Image processing on irregular shaped water droplets
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Currently, I am working on a project about condensation of droplets on flat surfaces. What I need to do is detecting all the droplets occurring on surfaces in series of pictures using MATLAB. For example, one of the pictures will look like this:
I was able to detect all the small droplets (which are more likely to be complete circles) using imfindcircles . However, the problem is detecting irregular shaped droplets (like 3 biggest circles in the picture). I am planning to used regionprops on these droplets; however, I was not able to clearly extract the binary image on this picture.
The code that I am using to process image is:
I=imread('test003.jpg');
im = mean(I,3);
im = (im-min(im(:))) / (max(im(:))-min(im(:)));
bw=im2bw(im,0.28);
imshow(bw)
[~, threshold] = edge(im,'canny');
fudgefactor = .92;
bws = edge(im, 'canny', threshold * fudgefactor);
figure, imshow(bws)
se90 = strel('line', 3, 80);
se0 = strel('line', 3, 0);
BWsdil = imdilate(bws, [se90 se0]);
figure, imshow(BWsdil)
BWdfill = imfill(BWsdil, 'holes');
figure, imshow(BWdfill);
so far I was able to get these images:
So droplets I have a problem with are 1, 2 and 3. I am planning to combine the regionprops and imfindcircles once I am able to extract the regions of irregular shaped droplets. Could you please suggest to me what I can do to improve this image processing?
Thank you!
1 comentario
Ashish Uthama
el 27 de Mayo de 2015
Do you have control on how the images are captured? (I am thinking if alternate means of lighting the surface would yield better results)
Respuestas (1)
Vidhi Agarwal
el 18 de Sept. de 2024
Editada: Vidhi Agarwal
el 18 de Sept. de 2024
I am aware of the difficulties you are having identifying more irregularly shaped droplets in your pictures. It can be quite beneficial to refine your image processing strategy by using morphological operations, using adaptive thresholding, and improving contrast. Here are various procedures and bits of code that you can utilize to enhance the binary image extraction process and then use “regionprops” to analyze it.
- Use contrast adjustment techniques like histogram equalization to improve the visibility of droplets
imAdjusted = imadjust(Image); %imAdjusted consist of enhanced contrast of original image
- Use adaptive thresholding to handle varying lighting conditions across the image.
bw = imbinarize(imAdjusted, 'adaptive', 'Sensitivity', 0.4);
- Apply a median or Gaussian filter to reduce noise before edge detection.
imFiltered = medfilt2(imAdjusted, [3 3]);
- Adjust the Canny edge detection parameters for better edge sensitivity.
[~, threshold] = edge(imFiltered, 'canny');
fudgefactor = 0.9; % Adjust as needed
bws = edge(imFiltered, 'canny', threshold * fudgefactor);
- Use morphological operations to clean up the binary image. For example, “imclose” can help close gaps in the edges, and “imopen” can remove small noise.
se = strel('disk', 3);
bwCleaned = imclose(bws, se);
bwCleaned = imopen(bwCleaned, se);
- Use “imfill” to fill holes in the binary image.
BWdfill = imfill(bwCleaned, 'holes');
- Analyze the connected components using “regionprops” to filter and identify irregular droplets.
stats = regionprops(BWdfill, 'Area', 'Eccentricity', 'Solidity', 'BoundingBox', 'Centroid');
Following the above steps, we are getting following output:
For better understanding of “imadjust”, “imbinarize”, “medfilt2” and various Morphological Operations refer to the following documentation:
- “Imadjust” = https://www.mathworks.com/help/images/ref/imadjust.html
- "imbinarize" = https://www.mathworks.com/help/images/ref/imbinarize.html
- "medfilt2" = https://www.mathworks.com/help/images/ref/medfilt2.html
- Morphological Operations = https://www.mathworks.com/help/images/morphological-filtering.html
Hope that Helps!
0 comentarios
Ver también
Categorías
Más información sobre Image Segmentation and Analysis en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!