How to detect all the pixel intensity values in a grayscale image and store them?

86 次查看(过去 30 天)
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 个评论
Victoria Austin
Victoria Austin 2020-1-8
I have attached the grayscale image. @ Image Analyst I did watch your Image Segmentation tutorial and it was really helpful. As you can see the image quality isn't very good in terms of contrast.
I also have another question. Is it possible for me to be get the pixel intensity value at a point?
My main issue is to be able to detect very line individually so that i can count them. Grayscale.jpg

请先登录,再进行评论。

采纳的回答

Image Analyst
Image Analyst 2020-1-9
编辑:Image Analyst 2020-1-9
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 个评论
Victoria Austin
Victoria Austin 2020-1-9
This really helped me. Thank you so much.
Can you also help me with the quantization?
I had converted the grayscale image to a binary one using the imbinarize function. And then I used bnconncom to count them. But my image has a low contrast so it didnt get segmented very well, so the no of particles it counted was incorrect.
Is there a good way for me to get the no of lines in this image as accurately as possible?
Image Analyst
Image Analyst 2020-1-9
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?

请先登录,再进行评论。

更多回答(1 个)

Victoria Austin
Victoria Austin 2020-1-9
The goal was initially the development of a new algorithm, but as I'm on a time crunch now, I really just need to be able to make measurements from the image, regardless of the method.
And yes it is more preferable to just make the measurements than building a more robust algorithm. Although its not the best option, I dont really have the time anymore to build the program. I have been trying to do this from my end for atleast 2 months now. I was introduced to MATLAB through Image processing just 2 months back so I am just a beginner.
If there is any way you can help me out, I'd really appreciate it.
  2 个评论
Image Analyst
Image Analyst 2020-1-9
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.
Victoria Austin
Victoria Austin 2020-1-10
Oh this wont work for me because this image has a countable number of lines wheras in all the images before this one the lines are not as clear or segmented. I cant manually draw every region in every image.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Image Segmentation and Analysis 的更多信息

产品


版本

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by