# User:TheLarry/Notebook/Larrys Notebook/2009/11/17/Lower (More Realistic) Image

< User:TheLarry‎ | Notebook‎ | Larrys Notebook‎ | 2009‎ | 11‎ | 17

## Lower Resolution Image

I don't understand why they chose to use 11 high res pixels to equal 1 lower res pixel. I can't picture how that worked. they say, "the factor of eleven was chosen so that the peak intensity of a small object would be centered on a CCD matrix cell rather than a cell boundary." I thought that each higher res image would have to be a square to equal the lower res pixel. Like something like 9 high res would equal 1 lower res so that the higher res could be 3x3. Well that's the way i'm going about it.

And since i am working on doing it that way i can't say each high res pixel is a nm since that means 184.5 pixels equals 1 lower res pixel. And that doesn't work out plus the matrix would be gigantic. So i'll probably go with 9 higher res pixels equals 1 lower res. Which makes the high res array 9 times as large. Plus it makes the high res pixel/nm = 20.5. I'll work with it right now but i'll probably make it a user control later on. Alright let's make some low res image.

In case you were wondering this was done in the paper so allow for sub pixel movement. Hmmm...if i go about this to put on flurophores then the best thing is to have something like 13 higher res pixels = 1 lower res so that each dye could be in the middle of a pixel. but 13 doesn't work in the square thing like 11 didn't. I can make it 169 high res pixels = 1 lower res, but then the array is gigantic...it might not be that large. If i only have to do this once for a single dot. then i can just choose 100 low res pixels from around the dye to simulate. that makes it 169,000 element array for the high res image. that isn't enormous because i was doing 326,368 pixels before (326,368 = 658 x 496).

Note to self: The square thing i was thinking about above wasn't a problem in the end when i found the resample.vi which changes the resolution. See picture below if you don't believe me.

i can think about this after i implement it. I'll just leave it as a user control right now.

It is extremely annoying to be working with these complex images while trying to do this

I got it! It was a pain in the ass but i switch a complex image to an 8 bit...hoorah. And it also lowers the resolution. OK that are two steps down.

The trick for converting an IMAQ Complex Image to 16 (or 8 bit) is to flip the frequencies. There is a sub.vi called IMAQ ComplexFlipFrequency.vi. And it made it possible to convert it. I did it dynamically so i scaled all the pixels down to 8 bit. Here take a look at it. (I am going into detail because i couldn't' find this information online when i looked.)

Here you go. It takes in a complex image and flips the frequency. Then it goes through some code to rescale the pixel intensities. So first I need to find the max and minimum value of the pixel intensities. With that found I subtract them and take 255 divided by that number. This gives a factor to rescale all of the pixel intensities. So first I use the complex subtract to make the lowest value 0. Then multiply all pixels by the factor found above. Recast the image as an 8 bit and it is done. After that i resample to lower the resolution but i did that for my own project. See All of Above.

### Filling in the rest of the image

For speed i only calculate pixels close to the point i want. So now i can fill in the rest of the image. I did this before so hopefully i can just steal those sub.vis i made.

Sweet and that worked. The sub.vis i made before kicked ass and i can control of where to put that 1 dot in the larger image. I still don't have the ratios right. I mean it doesn't correspond to the correct nm/pixel yet but that can be changed easily as long as i do the math correctly.