05-06-2014 09:29 AM
Hey there!
I want to program the so called error diffusion algorithm for my Spatial Light Modulator. What the algorithm does is it calculates the value a pixel is supposed to have and divides this by the value the pixel actually has. This gives us a reflection per pixel, which must then be rounded to either a 0 or a 1. This rounding induces an error that is diffused to surrounding unprocessed pixels. It therefore has the name 'error diffusion algorithm', since it diffuses the error over several pixels.
This algorithm was applied by Dorrer and Zuegel on binary spatial light modulators such as Digital Micromirror Devices and Deformable Mirrors.
A nice view of a block diagram of it is this:
The reflection t(m,n with m,n being the coordinates of the system) is rounded to either a 0 or a 1. The value that is actually assigned is called s(m,n). The difference between these two is the error e(m,n). The unprocessed pixels are these:
I am having trouble with the diffusion of the error to the neighbouring pixels, so the most important part. I tried adding this to my algorithm but failed.
My attempt included separating the coordinates from the image and adding numbers to them.
I did this as following:
I seperated the coordinates and splitted these into the X and Y values. I then copied this data four times for four neighbouring pixels. These were x+1,y and x,y+1 and x+1,y+1 and x-1,y+1.
I however had trouble combining the error with the calculated value when I actually get to those pixels. I can't get to add the error to the pixel that is for an example underneath it. Has anyone any idea who I can add the error to these neighbouring pixels?
Solved! Go to Solution.
06-10-2014 10:04 AM
Hi Choisai,
It's a very late repl, but do you still need help with this aplication? I can look into it if you want!
Best regards,
Jos
06-10-2014 05:22 PM
Dear Jos,
I have already succeeded. I used case structures and logical operators to determine whether or not a pixel was at the edges. Then I filled an empty array with these errors and later on retrieved the error per pixel. But thank you for the offer!