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

Posted 2 years ago
5069 Views
|
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.
9 Replies
Sort By:
Posted 2 years ago
 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...
Posted 2 years ago
 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: http://stackoverflow.com/questions/687261/converting-rgb-to-grayscale-intensityMaybe 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.
Posted 2 years ago
 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?
Posted 2 years ago
 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.
Posted 2 years ago
 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:
Posted 2 years ago
 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?