How can I draw a line on an image and count the pixels along the line?

4 次查看(过去 30 天)
I have a image of some rectangles and I want to draw a line across some of the rectangles. How can I count the pixels along the line and find out which part has the minimum intercepts?
Thanks, Gene

回答(2 个)

Image Analyst
Image Analyst 2012-8-29
Let's say you drew the line with improfile(). Then you'll have the endpoints of the line and you can use the Pythagorean theorem to get the distance.
I don't know what you mean by the part that has the minimum intercepts. Perhaps uploading an image and a better explanation would help.

Gene
Gene 2012-8-29
This is rephrase of my previous post.
If I have a image like the following: https://dl.dropbox.com/u/10571500/matlab2.jpg
and I want to find out which bar in it lined up. I want Matlab would allow me to select the area to do the operation (the red frame in the following image) and then find out the lined up bars simply by comparing the pixels along the two red lines. https://dl.dropbox.com/u/10571500/Picture1.jpg
But later I realize if the original bars are somehow rotated by some angle, which happens a lot, how should I do find out those lined up bars? https://dl.dropbox.com/u/10571500/Picture2.jpg

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by