|Random Dot Stereograms
||[Mar. 8th, 2007|02:32 pm]
I've made a RDS creator on our server, using a bit of C#. Below is what it creates so far. I can throw variable sized images at it, and it'll make a nice RDS, but I have to change the code to change the picture. =(|
I'm hoping to be able to add a nice page for people to upload an image, or provide a URL to one so they can make their own, just as soon as I work out what commands are needed. o.O
It -can- use a covering image... but I'll be adding that on last.
It also features my own line of code to create the RDS... the fastest I've come up with so far. (That's right... one line! These things are easy if you simplify the theory.)
Here's the original...
And here's the source for it so far... the RDC creation algorithm is emphasized.
<% @Page Language="C#" Debug="true" %>
<% @Import Namespace="System.Drawing" %>
<% @Import Namespace="System.Drawing.Imaging" %>
<script language="c#" runat="server">
void RDS(Bitmap bitmap,int stripWidth)
Random rnd = new Random();
scaling=((float)stripWidth/(float)5)/(float)255; // This makes sure full white (high points are white and have a value of 255) are always 1/5th the width of the image strip.
//Draw the random strip
randomDotColour=rnd.Next(0,2)*255; // Random number,either 0 or 255
//Create the RDS
//Send the picture back to the browser
Response.ContentType = "image/gif";
//Start here :p
void Page_Load(Object senter, EventArgs e)
Bitmap bitmap = new Bitmap("f:/Inetpub/wwwroot/RDCLive/rds/shark.png"); // http://rdc.untamed.co.uk/rds/shark.png
I love these 3d pictures,I have a book somewhere from when they
were very popular in the 90s :-)
Yes! I remember people were buying hard-back books with them in!
I like it!!!
It's given me some slightly strange images... I thought at one point I was seeing multiple sharks - and then I'm sure I saw some artifacts along the side of the shark! But my eyesights daft anyway!
"You dumb bastard, it's not a scooner, it's a sailboat!"
I think you'll find it's a duck with horns.
I added your other journal; just letting you know. ^_^
Heh, brill! I was wondering if you would.
Not bad at all. I haven't written one of those since I was 10.
I remember getting a pen out and trying to work out how the ones in "The People" newspaper were created. I didn't have the internet back then, so I don't think I ever got a properly working one. I remember that sometime after that I got a working program on an Acorn Arch in highschool, but I can't remember if I'd worked it out, or read how it was done. Fascinating things though, dispite their age.
Wow, scary trig stuff.
I lack the brain power to look at something like that and see what's wrong, perhaps lots of coffee and hands-on experiments would work. =)
That was an interesting program for high school, was it from a class you took, or was it your own private work?
Using your huge brain to comprehend a big trigonometric problem doesn't always get the best possible answer.
Take me for example... Once I learned that : pixel brightness = offset
I then just threw all the maths shit out the window and never look back (*after* the depth image was made ^-^ ). That's why my generator programs about ... 1 line long. ^-^
Original magic eye pictures start with the original strip on the left, then get offset through the whole image, so by the time the strips used on the right, it's pritty mangled.
If you use a recognisable image in the strip (like M & M's) instead of random dots, the effects worse.
While I was looking at the Magic Eye images, I noticed an interesting technique they used to reduce this... they started the magic eye offsetting in the middle, so the middle strip had NO offset in it, and the strips to the left and to the right were offset left and right instead.
My reconstruction of this always left a strip in the middle that was flat, I never did work out what was wrong.
Your icons cool. =)
Are there any freeware pascal JIT compilers I could use to run them?