How we can get the pixel values of an object in an image in matlab??
조회 수: 2 (최근 30일)
이전 댓글 표시
how we can get the pixel values of red line from starting to end point and return its pixel values.
댓글 수: 0
답변 (4개)
Image Analyst
2015년 8월 29일
Since you posted this as a brand new question, and left out any context, you've confused the other people that answered. That's why you should have asked this in your original question where I gave you the answer: http://www.mathworks.com/matlabcentral/answers/233509#answer_189277 The answer is "maxDistance" which is in the code that actually created that red line you're showing above. Go back to your original question to see.
댓글 수: 4
Walter Roberson
2015년 8월 31일
You run the code he showed you before, and the length of the rice grain is stored in maxDistance .
JangHo Cho
2015년 8월 24일
Let's say your picture has 300 x 150 pixels and RGB color. you can read the image by using imread() function
image = imread('your_pic.jpg'); and you can see the size of image by size(image). It will be 150 x 300 x 3 uint8 array. The array has 3 planes of colors RGB. You can find out what is the red color plane by imshow(image(:,:,1)) imshow(image(:,:,2)) imshow(image(:,:,3)) Now you know which plane is red color. Check the values of the pixels of the plane. if a pixel has values in red plane and there are zero values in other plane, the pixel is red. right? Maybe you should use for loop.
댓글 수: 3
Walter Roberson
2015년 8월 29일
You cannot draw a red line in a black and white binary image. You might draw a red line on top of a black and white binary image, using plot() or imline(), but that line does not form part of the resulting image. Possibly you snapshot or otherwise capture the result from the screen: if you do that then the result will be a color image, not a binary image.
Image Analyst
2015년 8월 29일
That's what I did. I drew the line in the overlay with plot(), AND I calculated the length of the line directly, so there is no reason at all to create some kind of image with a red line burned into it.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!