I have an array of size 600 by 600 pixels. In a circle of given radius (say 50 pixels) and given origin (given ith row and jth column), I want to plot gaussian distribution, i.e., give the pixels
the value of a 2-D gaussian distribution with peak at the origin. How do I do this in labview ?
Solved! Go to Solution.
You would run your x and y values through the 2D Gaussian function but making the origin 300,300 (for your given 600x600 pixel array). Here's what I get on an intensity chart given an amplitude of 10 and sigma = 100 pixels:
Here's the example (quick and dirty) code:
Thanks for your reply.
How do I convert this intensity distribution into a greyscale (uint8) image (a matrix with all elements between 0 and 255) ?
I used "To Unsigned Byte Integer" function but it doesn't seem to solve the problem ?
Just change the amplitude on the output of the exponential to 255 (instead of the 10 in my code example) and then convert to U8. Like this (after changing the marker colors in the intensity chart):
I tried to follow your hints but didn't succeed. May be I'm missing something silly.
Attached is my program. Please change it to obtain the desired pattern.
Here's a one-loop version. It is sufficient to calculate a singe 1D gaussan once, then use the outer product to generate the 2D array.
This means we only need to evaluate only 600 exponential functions instead of 360000! 😄 (You could reduce it again by 50% taking advantage of symmetry. Try it!)