MATLAB: How to find slope of many line on this picture with noise

average slopeImage Processing Toolboxlinearmanylineransacslopeslope many line

i need to find average slope of many line ? (sorry for my English)

Best Answer

A pure imaging approach, though probably not as good as RANSAC, would be to try to join the lines with imclose(), then label and call regionprops asking for the orientation:
binaryImage = grayImage < someThreshold; % or however.....
[labeledImage, numBlobs] = bwlabel(binaryImage);
props = regionprops(labeledImage, 'Orientation');
allAngles = [props.Orientation];
Some of the short lines that are on the same "line" but far away would be detected as their own independent line rather than being two distant, well separated parts of the same line.
Related Question