Detect Edge in picture with low contrast
Show older comments
Hi, i need to detect a specific edge in a variaty of pictures which follow the same pattern.
i have tried using an averaging and then a sobel and laplacian filter but didnt get satisfying results. please use attached file as example. The edge that i am looking for is the dark one from the top more or less in the middle of the picture. Thanks for answers in advance

1 Comment
Oliver Stilz
on 27 Sep 2017
Accepted Answer
More Answers (2)
Image Analyst
on 22 Sep 2017
2 votes
Rather than do a crummy job fixing the image and then trying to find the edge in software, I suggest you improve your image capture environment, like with better lighting, perhaps polarizers, etc.
3 Comments
Oliver Stilz
on 25 Sep 2017
Image Analyst
on 25 Sep 2017
You'd need to tell me what this is - I have few ideas. Like is this a photo of a brake rotor from a car on a black background?
Have you tried broad illumination? Point source Illumination?
Try calling a machine vision illumination company like Advanced Illumination or SmartVisionLights and discuss your setup with an engineer.
Oliver Stilz
on 26 Sep 2017
Ramnarayan Krishnamurthy
on 22 Sep 2017
The image would need pre-processing before passing it to one of the edge detectors. I would suggest trying to enhance the contrast by histogram equalization using the histeq function https://www.mathworks.com/help/images/ref/histeq.html
The region above the edge to the center seems to have a lot of noise as visible in the contrast stretched image. Consider using the gaussian filter before finally passing it to an edge detector.
I = imread('WHL_20mm.PNG');
I2 = histeq(imread('WHL_20mm.PNG'));
I3 = imgaussfilt(I2, 5);
I4 = edge(I3,'sobel');
imshow(I4)
Another slightly involved approach would be to use Flat-Field correction ( https://en.wikipedia.org/wiki/Flat-field_correction )
Iin = im2double(imread('WHL_20mm.PNG'));
shading = imgaussfilt(Iin,5);
I2 = Iin.*mean2(shading)./Iin;
I3 = Iin-I2;
I4 = stdfilt(I3,ones(21,21));
I5 = imgaussfilt(I4,15);
I6 = imclose(imdilate(edge(I5,'canny'),strel('disk',3)),strel('line',55,0));
% Using regionprops find the longest lines, remove the others, then
% grow/dilate as required.
figure
imagesc(I5)
figure
imshow(I6)
3 Comments
Oliver Stilz
on 25 Sep 2017
Image Analyst
on 26 Sep 2017
Can you attach a worst case example? Also, what do you want to know about the edge? Like how perfect and burr-free it is, or it's radius of curvature?
Oliver Stilz
on 27 Sep 2017
Categories
Find more on Object Analysis in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


