How to detect all the pixel intensity values in a grayscale image and store them?
86 views (last 30 days)
Show older comments
Victoria Austin
on 7 Jan 2020
Commented: Victoria Austin
on 10 Jan 2020
I have a grayscale image wich has a very low contrast. I want to obtain the pixel intensity values of the entire image so that i can compare the background pixel intensity value to that of the object in the image. Can you please tell me how to obtain these pixel values and store them for my analysis?
5 Comments
Accepted Answer
Image Analyst
on 9 Jan 2020
Edited: Image Analyst
on 9 Jan 2020
You can call impixelinfo() to let you see the gray levels as you mouse around over the image.
To get the gray level of the image at a particular location, just index it:
grayLevel = grayImage(row, column); % For a gray scale image.
rgbValues = rgbImage(row, column, :); % For a color image or gray scale image.
or you could use impixel()
pixelValue = impixel(yourImage); % where your image can be gray scale or color.
Also I'm attaching a script that converts an image into a CSV file where each column is [x, y, grayLevel] or [x, y, r, g, b]
2 Comments
Image Analyst
on 9 Jan 2020
It's not easy. It would be a project to do this robustly - not some 5 minute job I can do for you. I'd look into perhaps using the radon transform to determine the angle. You might also look into anisotropic diffusion to smooth/smear the image along the blobs to reduce noise and help distinguish the blobs better. Demos attached. You might also have to look at watershed segmentation to split apart touching blobs. See Steve's Image Processing Blog
Depending on how many images you have it might be better to just use human assisted analysis, like with imdistline() or ginput() or drawpoint() or something. It could be faster to do that than to program up some complicated algorithm that takes weeks. It just depneds on what is your goal. Is your goal to make measurements from your image, regardless of the method? Or is your goal the development of a new algorithm for these types of images? If you can make measurements for your sponsoring organization this week and get them their answers, is that preferable than telling them you'll need 6 months to develop a new robust algorithm? Would they want to wait, or just get it done even if it's maybe somewhat subjective?
More Answers (1)
Victoria Austin
on 9 Jan 2020
2 Comments
Image Analyst
on 9 Jan 2020
Just ry putting roipoly in a loop where, at the end of the loop, you call questdlg() to ask them if they want to draw any more.
See Also
Categories
Find more on Image Segmentation and Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!