Edge detection with DIC pattern.

7 visualizaciones (últimos 30 días)
Tom Lancaster
Tom Lancaster el 19 de Ag. de 2024
Comentada: Tom Lancaster el 19 de Ag. de 2024
Need some help/advice with an edge detection method. I am looking at edge of cylinderical sample that contains a DIC pattern. I have tried some various basic stuff like the edge() and hough transformation, but I either have all of the DIC pattern showing in the edge image, or the edge of the sample is incomplete and no good.
anyone have any experience with this and could point me in the right direction please?

Respuesta aceptada

Umar
Umar el 19 de Ag. de 2024

Hi @Tom Lancaster ,

To effective detect edges on a cylindrical sample with a DIC pattern, I will consider employing a combination of preprocessing and advanced edge detection techniques.

First, start by applying a Gaussian filter to reduce noise, which can interfere with edge detection. You can use the following MATLAB code snippet:

% Read the image
img = imread('your_cylindrical_sample.jpg');
   % Convert to grayscale
    grayImg = rgb2gray(img);
   % Apply Gaussian filter
   filteredImg = imgaussfilt(grayImg, 2);

Note: For more information on this function, please refer to

https://www.mathworks.com/help/images/ref/imgaussfilt.html?s_tid=doc_ta

Next, utilize the edge() function with the 'Canny' method, which is particularly effective for detecting edges in images with varying intensity:

   % Perform edge detection
   edges = edge(filteredImg, 'Canny');

If the DIC pattern still overwhelms the edges, consider using morphological operations to refine the edge map. For instance, you can use imopen() to remove small objects:

% Morphological opening
se = strel('disk', 2);

Note: for more information on this function, please refer to

https://www.mathworks.com/help/images/ref/strel.html

cleanedEdges = imopen(edges, se);

Finally, visualize the results to ensure the edges of the cylindrical sample are clearly defined. Adjust the parameters as necessary to optimize the detection for your specific image. Let me know if you have any further questions.

  8 comentarios
Tom Lancaster
Tom Lancaster el 19 de Ag. de 2024
So yh its the white dogbone shape with the black speckles. DIC is digital image correlation, what happens is the cylinder is pulled to the left (right side is held fixed). This leads to the cylinder reducing in area and the length increase. until it necks (like when you pull chewing gum). I can crop the image before image processing but anything left of the dog bone needs to stay as the sample will eventually come in to view here.
So eventually what I want to be able to do is track how the thickness of the white dog bone (y direction). changes with each image, up and down the length of the white shape. Does this make sense?
Tom Lancaster
Tom Lancaster el 19 de Ag. de 2024
I should add that I have tried to use the bw area open function to filter out min length edges, but the issue is that sometimes the outline of the dogbone isn't continous, hence it filters out some of that edge.
%% Image Processing work
% Read the image
img = imread('Inconel600C10-2.chan 10000.tif');
% Convert to grayscale
grayImg = im2gray(img);
% Apply Gaussian filter
filteredImg = imgaussfilt(grayImg, 2);
% Perform edge detection
edges = edge(filteredImg, 'Canny');
[B, L] = bwboundaries(edges, 'noholes');
% Visualize the boundaries
figure();
imshow(grayImg); hold on;
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'r', 'LineWidth', 1);
end
hold off;
% Morphological opening
se = strel('disk', 2);
cleanedEdges = imopen(edges, se);
figure();
imshow(edges);
% Remove edges shorter than 50 pixels
minLength = 100;
BW_filtered = bwareaopen(edges, minLength);
figure();
imshow(BW_filtered);

Iniciar sesión para comentar.

Más respuestas (1)

Kaustab Pal
Kaustab Pal el 19 de Ag. de 2024
To effectively detect edges in noisy images, it's important to undertake several pre-processing steps before applying an edge-detection algorithm. If your image contains significant noise, you can mitigate this by smoothing the image with a Gaussian filter, followed by a histogram equalization operation. This will yield a more refined image. You can then apply an edge detection algorithm.
Here's a code example illustrating the process:
BW = rgb2gray(X); % converting the image X to grayscale
B = imgaussfilt(BW,5); % applying a gaussian filter with standard deviation of 5 to the image
BW = histeq(B); % performing histogram equilization
BW1 = edge(BW,'canny'); % applying edge detector
imshow(BW1)
Feel free to experiment with the Gaussian filter's standard deviation and the choice of edge detection algorithm to optimize your results.
You can expect the final output to resemble the image shown below:
Please refer to the links below for the official documentation on the different functions:
Hope this helps.
  2 comentarios
Tom Lancaster
Tom Lancaster el 19 de Ag. de 2024
Thank you! I am guessing the increasing the gaussian filter SD will errode the boundry of my cylinder right? As I am really interested in the dimensions I guess I shouldn't do this too strongly...
Umar
Umar el 19 de Ag. de 2024
Hi @Tom Lancaster,
As for your concern, increasing the Gaussian filter's standard deviation may indeed erode the boundaries of your cylinder, so it is advisable to use a moderate value to maintain the integrity of the dimensions you are interested in.

Iniciar sesión para comentar.

Productos


Versión

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by