how to calculate normal to all points of a contour line?

4 views (last 30 days)
Hi all,
I did several calculation to a figure and got a "heat map" (an examlple is represented below). Now Im trying to calculate how this "heat map" change as function of the distance from its bounderies, so called as function of r.
the right handside plot is made by: pcolor(Xmat,Ymat,T1); all of those are double matrices.
So far I have managed to find the contour to T1 by a code I saw here:
binaryImage = T1 > 0; % Threshold/binarize the image.
binaryImage = imfill(T1, 'holes'); % Fill holes.
boundaries = bwboundaries(binaryImage); % Get list of (x,y) coordinates of outer perimeter.
and smoode it to by applyng 30 times smooth function to get a nice curve:
I will be grateful if someone could help me to calculate the normal vectors to all the point of the contour.
Alternatively, if someone has a better solution to my problem, it will be great.
wourth mention that not all the figures are of circular shapes, some are only half or quater circles.
Thank you very much.

Answers (0)


Find more on Contour Plots 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!