Message Boards Message Boards


Determine intensity for each pixel in an image by digitizing/binning it?

Posted 4 years ago
9 Replies
0 Total Likes

So I have .bmp file that displays a circular fringe pattern like a target. I guess my question is does anyone know the process that will allow me to determine intensity for each pixel in the image on a scale from 1-9( in terms of lightness and darkness). I'm confused about what I even need to do first. Do I need to digitize the image first, or can I pull that pixel information from the image in its original form? Any help or advice would greatly appreciated. Thank you.The image is the fringe pattern produced by a Michelson Interferometer

9 Replies

Look at ImageData to get the intensity of the pixels. This will be on a scale 0-1 normally. So multiplying it by 8 and adding 1 should give you values from 1 to 9...

You can use ImageData to get a 2 dimensions list of pixels. Each pixel will be a list of RGB values.

You can then calculate intensity in anyway that you want. There appear to be many ways of doing that:

Maybe you want to use the built-in tools to convert the image to grayscale?

grayImage = ColorConvert[yourImage, "Grayscale"];

You can then use ImageData to get a 2d list of intensity values and use Flatten to turn it into a simple 1d list of intensity values:

intensVals = Flatten@ImageData[grayImage]

From there you can run whatever statistic you would like on the intensity values.

Thank you for your response. My questions is for the image part of the code your wrote. Can I simply drag and drop? which I have tried but the image never appears. Just a box where the image should be. Or do I specify the path and so on?

Try dragging and dropping an image. Does it work?

If you can't drag and drop an image, you can import it into Mathematica with the Import command. See the documentation for Import for more information.

Sean it did end up working. Let me ask you one last question. Lets say I have a mathematica simulation that produces fringes, and I want to compare them to real world fringes( the green rings above) produced with the same variables( wavelength, pathlength, etc). Do you think a simple intensity comparison of the pixels would be accurate?

You can be interested in the following threads dealing with extraction of intensity profiles:

And about obtaining physically reasonable intensity values from usual RGB images:

Sean now that I have the pixels. How can I arrange them so that they are in the same order as the picture. Or in other words lets say I wanted to plot a horizontal strip of intensities across the center of the picture. How do I know which pixels correspond to that horizontal strip?

You probably want to start a new question. You can't expect people to always be available after a month.

ImageData provides the data in the same shape as the original image. You can see this by running ImageDimensions on the image and Dimensions on the data given by ImageData

Also @Maurice Stancil, bluntly soliciting help is against policy of this forum. You should show your own effort in terms of Wolfram Language code. Mathematica has detailed documentation and there are plenty materials around to learn basic concepts.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract