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

7 vues (au cours des 30 derniers jours)
Happy PhD
Happy PhD le 30 Août 2019
Modifié(e) : Happy PhD le 30 Août 2019
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.

Réponse acceptée

darova
darova le 30 Août 2019
Simple example
clc,clear
I = imread('image.png');
x = 900:1150; % x coordinate ( columns )
y = round( tand(45)*x )-400; % y coordinate ( rows )
subplot(2,1,1)
imshow(I)
hold on
plot(x,y,'-r')
hold off
axis on
subplot(2,1,2)
ind = sub2ind(size(I),y,x); % indices of pixels
plot(I(ind))

Plus de réponses (1)

Image Analyst
Image Analyst le 30 Août 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.

Community Treasure Hunt

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

Start Hunting!

Translated by