How to plot the intensity profile at 45 degree angle at certin coordinate?

17 views (last 30 days)
The maximal intensity is located at coordiante (1064; 662).
I can plot the line profile vertically and horiontally.
My problem is finding the start and end coordinate from the maxima point in the image and plotting this hoizontal line at 45 degree angle instead. i want to measure the size of the rectangle, rotated 45 degree. Any idea how to find those coordiantes?
Edit: correcting spelling.

Accepted Answer

darova on 30 Aug 2019
Simple example
I = imread('image.png');
x = 900:1150; % x coordinate ( columns )
y = round( tand(45)*x )-400; % y coordinate ( rows )
hold on
hold off
axis on
ind = sub2ind(size(I),y,x); % indices of pixels

More Answers (1)

Image Analyst
Image Analyst on 30 Aug 2019
You can use improfile(), however that will get you the profile along one line only. What I'd actually recommend is to use the Radon Transform which will get you a projection along any angle or set of angles you want, and then you can just get the width by looking at the FWHM of the projection.
Attached is a similar application (not exact) using radon(). Once you see what it's doing I think you'll be able to modify it. Not including any fancy graphing stuff it should only be 3 lines of code - one to radon, and two to find() to find the FWHM.


Find more on Labels and Annotations 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!

Translated by