How to draw a line perpendicular to the medial axis in each point and save the intensity values?
1 Ansicht (letzte 30 Tage)
Bruno Pop-Stefanov am 24 Okt. 2014
Take a look at the file overlayLines.m that I have attached. This function draws red lines over an RGB image. You can certainly modify it for a one-channel image. Also, if you examine the loop you'll see how to find the pixel values that the line crosses.
I = imread('autumn.tif');
x = [10,200;50,60];
y = [140,160;20,200];
J = overlayLines(I,x,y);
Radek am 28 Okt. 2014
Hi, i have solved same issue. my propasal is this (not the best and quickest solution ever but it works):
1. Calculate angle of the line
Where Gpoint and Gpoint2 are two points on the line and GpointX is point G X coord
to make PERPENDICULAR line
function [Line LineIndexes]=ComputeLineCoords(angle,GpointX,GpointY, shift,L)
Line(1:X)=round(StepElevation*(1:X)- GpointX*StepElevation +GpointY+shift);
To get indexes of pixels in which the line is going (Line) and its bounding box in LineIndexes .
intputs are angle GpointX - Since i wrote it for XY you have to use Y coord of the point where the line should be placed GpointY - Since i wrote it for XY you have to use X coord of the point where the line should be placed shift - 0 should be fine but you hav eto experiment with it a little L - image to get sizes
you might play around a little with the dimensions but this worked for me