Hello,
I am a bit new to matlab, so probably my question is not even correctly formulated 😅
I want to detect the fiber angles in the attached microscopy image, but the image is made of SEM microgrpahs, so it does not have a good contrast between the fibers and their surrounding. I have tried to first threshold the image to emphasize the lines that delimit the fibers in order to use the Hough Transform to detect the lines. However, I do not seem to succeed in detecting all the lines or length segments.
Other things that I have tried: bwpropfil to try to remove the unwanted shapes (i.e. non linear shapes), edge to detect the edges of the image and perhaps highlight the lines; bwskel, etc.
I´m sure there are better ways to process the image to achieve this, so I would like to ask you what can I do to improve the line detection.
Thanks a lot in advance!!
img = imread('Stitched end indent.png');
imgBright = imlocalbrighten(img);
imgHaze = imreducehaze(imgBright);
imgContrast = imadjust(imgHaze);
maxDiff = max(max(imgContrast))
imgThresh = imgContrast < thresholdValue;
imgThresh2 = imcomplement(imgThresh);
imgRemoved=bwareaopen(imgThresh2,30);
[H,theta,rho] = hough(imgRemoved);
peaks = houghpeaks(H,1000,'threshold',ceil(0.5*max(H(:))));
lines = houghlines(imgRemoved,theta,rho,peaks,'FillGap',5,'MinLength',30);
figure,imshow(imgRemoved),hold on
xy=[lines(k).point1;lines(k).point2];
plot(xy(:,1),xy(:,2),'Linewidth',1,'Color','green');
len=norm(lines(k).point1-lines(k).point2);