How to remove the pseudo-defects of the contour after differential images

4 views (last 30 days)
Hi, everyone ,I have an annoying promblem when I try to find the defections in the diff.bmp.
I got diff.bmp by diff original.bmp and compress.bmp
I tried to segment the defect by removing the contour artifacts with filtering methods and morphological manipulations, but it didn't work well, as shown in the myresult.bmp.
1.Is there any other good way to accurately delineate the defects in the red box in the defetection.bmp?
2.Or how to improve the effect of morphological manipulation?
3.Or how to avoid the pseudo-defects when I do differential operations?

Accepted Answer

Umar
Umar on 4 Jul 2024
Hi Zoumin,
I can help you to create a custom function that processes the edge image to identify and extract defects. Here's a simple example to get you started:
function defectsOnly = yourPostProcessingFunction(edgeImage) % Perform post-processing operations here to isolate defects % Example: Thresholding to extract defects threshold = 0.5; defectsOnly = edgeImage > threshold; end
Using this function, you can implement various post-processing techniques such as thresholding, morphological operations, or filtering based on the characteristics of the defects you aim to isolate. Customize the function according to your specific requirements for defect detection and isolation.

More Answers (2)

Umar
Umar on 4 Jul 2024
Hi ZP,
You can use morphological operations like dilation and erosion to enhance the defect boundaries. Additionally, you can apply techniques such as edge detection algorithms (e.g., Sobel, Canny) to highlight defect edges more effectively.
Let me know if you need further assistance.
  1 Comment
Zoumin
Zoumin on 4 Jul 2024
Hi UT,Thank you for your reply.
When using morphological manipulation and edge detection operators, the boundaries of pseudo-defects are also strengthened,
I don't know how to enhance merely the defects or find defects after pseudo-defects also highlighted

Sign in to comment.


Umar
Umar on 4 Jul 2024
Hi Zoumin,
To address your concerns, please see my answers below.
When using morphological manipulation and edge detection operators, the boundaries of pseudo-defects are also strengthened, I don't know how to enhance merely the defects or find defects after pseudo-defects also highlighted.
Yes and the root cause of this problem lies in the inherent nature of morphological operations and edge detection algorithms. These techniques are designed to highlight edges and shapes in an image, which can inadvertently include pseudo-defects that share similar characteristics with real defects. So, to address this issue and enhance only the genuine defects while excluding pseudo-defects, a post-processing step can be implemented. After applying morphological manipulation and edge detection, you can utilize additional filtering or segmentation techniques to refine the results and isolate the actual defects from the pseudo-defects. Here is an excellent example to guide you through the process. Convert the input image to a binary image using thresholding. Perform morphological operations to clean up the binary image. Apply the Sobel edge detection algorithm to identify edges. Use a post-processing function to isolate and enhance the defects.Display the final enhanced defects image.
>> % Perform morphological operations and edge detection bw = imbinarize(rgb2gray(yourImage)); bw = bwareaopen(bw, yourThreshold); edgeImage = edge(bw, 'Sobel');
% Apply post-processing to isolate defects defectsOnly = yourPostProcessingFunction(edgeImage);
% Display the enhanced defects imshow(defectsOnly);
This will help resolve your problems.
  1 Comment
Zoumin
Zoumin on 4 Jul 2024
Hi UT,
Thanks for your reply,it deeply helps me,I think I have got your idea.
But I am still not very clear abot how to do post-processing ,would you mind show me some tips?

Sign in to comment.

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!