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

angleImage Processing Toolboxintensityintensity profileplotradon

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.

Best Answer

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))
Related Question