How to plot grey level variation along horizontal cross-section of any image according to position of the mouse?

3 views (last 30 days)
How to plot grey level variation along horizontal cross-section of any image according to position of the mouse?

Accepted Answer

Dishant Arora
Dishant Arora on 5 Dec 2014
I = imread('cameraman.tif');
[row , column] = size(I);
imshow(I)
[x , ~] = ginput(1);
plot(1:column , I(x , :))

More Answers (1)

Image Analyst
Image Analyst on 5 Dec 2014
There is a function specifically built for that. It's called improfile(). It can handle profiles at any angle, though if you know that you want exactly a perfect row or column, the code Dishant gave is the way to go.

Products

Community Treasure Hunt

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

Start Hunting!