Image processing on irregular shaped water droplets

조회 수: 6 (최근 30일)
James Sung
James Sung 2015년 5월 27일
편집: Vidhi Agarwal 2024년 9월 18일
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
Ashish Uthama
Ashish Uthama 2015년 5월 27일
Do you have control on how the images are captured? (I am thinking if alternate means of lighting the surface would yield better results)

댓글을 달려면 로그인하십시오.

답변 (1개)

Vidhi Agarwal
Vidhi Agarwal 2024년 9월 18일
편집: Vidhi Agarwal 2024년 9월 18일
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:
Hope that Helps!

카테고리

Help CenterFile Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by