Lexicographic image processing

I want to process the array of an image lexicographically (meaning reading as you write, so from left to right). Normal arithmatic functions (division, multiplication etcetera) multiply the entire array, but I want to push the top-left pixel through my algorithm, and then the one to the right of that, and after that one the one to the right of that, up until the last pixel, and then it starts with the pixel one row beneath the first one all the way on the left.
 To illustrate, imagine an image of 12 X 16 pixels:
I want to calculate what value each pixel is supposed to have. I do this by comparing the actual value with the value I want. I calculate the value it needs to be at a certain pixel by looking at how far it is from the origin. The origin is in the center:
The distance then from the origin to the actual pixel is this:
The length of this 'vector' is then calculated by splitting it into a horizontal and vertical part:
The length is then the the x-coordinate squared and the y-coordinate squared added together and then the root of that number is taken. So that's basically the theorem of Pythagoras. I know that in this case, the length found is not the real length, because you use x=1 and y=1. So first off I subtract 8.5 from the x value and 6.5 from the y-value before going any further.
But I want to process the pixels in the order of y=1 x = 1, 2, 3, 4, 5, 6, 7, 8 etcetera and then y=2 x=1, 2, 3, 4, 5, 6, 7 etcetera. That is exactly what lexicographical processing is. But how can I get this to work? In my VI you can see how I am currently exporting just the numbers of the total size of the image (or frame of a video), but I want to process them one by one. I looked up some helpful Labview files that do something similar, like the 'Check Pixel Value' VI but there you have to manually scroll through the data. I want it to happen automatically.
So how can I process pixels of an image lexicographically?
Solved!
Go to Solution.
Attachments:
USB Webcam n-bit to corrected 1 bit.vi ‏59 KB
Check Pixel Value-2013.vi ‏31 KB
Advertisement
Reply

Yes, I do have a 2D array. I use the IMAQ Vision VI's to get my webcam to run. The solution is rather simple in that sense, yes.
But here is the deal though: the comparing with the Lorentzian function returns me a value. That is rounded to either a 0 or a 1, because it will be the pattern used for a Digital Micromirror Device (DMD). This induces an error. In order to make up for that, I need to correct it using neighbouring pictures (if a pixel is surrounded by 8 pixels, then the diagonal pixels are primarily used for this). I tried something similar in which I split it into 'rows' and process that, but that ofcourse removes the option to resolve the induced error.
The 'easiest' way is to split it into 1024 times 728 pixels and hook all of these up to the formula and connect each of them to their corresponding pixels, but that would take several months, so that's not an option.
Could you be more concrete in how you would do this? I tried something similar but thought, because of that error resolving, it would remove the option to work in this way, because it doesn't allow 'inter-row interaction'.
To give you some background:
I want to use a DMD to create a laser with a top-hat wavefront, meaning it's intensity distribution is equal everywhere on every point of the wavefront. For this we hook a CCD camera up to our computer which measures the intensity distribution. This image is then sent to our Labview program, which processes this image and turns it into a pattern for the DMD. The DMD or Digital Micromirror Device is a device that is made up of thousands of tiny mirrors, all of which can stand in either + 12 degrees or -12 degrees.
We look at the profile and compare that to a profile as simulted by a Super Lorentzian function
A Super Lorentzian function looks like this:
A / (B + ( (X-C)/X0) ^n)) + D
A/B is the top value
C is the horizontal transliteration
X0 is a value referring to the width of the function
n is a power
D is vertical transliteration
For even numbers of n the function produces a top hat function. In our case, we want to simulate an eigth order Super Lorentzian, so n=8
The image of the CCD Camera is a 12 bit image. Labview saves this as 16 bit, meaning it has 2^16 different grayscale values.
I don't have the CCD camera yet so for now I use the webcam of my laptop and turn that into a 16-bit image.
Here a some screenshots of my program so far:
And a SL function looks like this:
Our error inducement comes from an algorith developed by Dorrer and Zuegel, two german physicists.
A screenshot of their paper concerning binary spatial light modulation:
But the main issue I am concerned with is thus the error inducing. Doesn't normal array processing remove the possibility to do so? And if not, how can I do it?