Hello. I have the image below that contains multiple cross cutting lines and I want to i) measure the length of each individual line and ii) the angle of each individual line. The lines are not perfectly linear, so task iii) would be to try and figure out a way to approximate a linearity from the lines.
I have tried using regionprops (see below - sorry for any novice-based coding inelegance) but it only gives me one angle at the centre of the image. I assume it has something to do with the thickness of the lines, or the fact that the lines are cutting each other.
Any guidance on the issues with regionprops, or any alternative ways of doing this would be greatly valued!
[grayImage,map] = imread([fname01, '.png']);
[rows, columns, numberOfColorChannels] = size(grayImage);
if numberOfColorChannels > 1
grayImage = grayImage(:, :, 1);
if grayImage(i,j) == 255;
props = regionprops(grayImage, 'Orientation','Centroid');
allOrientations = [props.Orientation]
for k = 1 : length(props)
x = props(k).Centroid(1);
y = props(k).Centroid(2);
plot(x, y, 'r+', 'MarkerSize', 30, 'LineWidth', 2);
caption = sprintf(' Angle = %.3f', props(k).Orientation);
text(x, y, caption, 'Color', 'r', 'FontSize', 18, 'FontWeight', 'bold');