Hey Manojkumar,
It seems that you are trying to find the droplet size distribution and density of the droplets per frame. Before performing any such computations, you need to segment the image such that the droplets are clearly distinguishable from the background.
You can begin with loading the image using "imread" function then convert the image to grayscale using "rgb2gray" function. Convert the grayscale image to binary (black and white) so that the droplets are clearly distinguishable from the background using the "imbinarize" function: https://www.mathworks.com/help/images/ref/imbinarize.html You can play around with these functions to get the desired result. For example:
img = imread('drops.jpeg');
img2 = imcomplement(img);
binaryImg = imbinarize(img,0.1);
binaryImg2 = imcomplement(binaryImg);
imshowpair(img2,binaryImg2,'montage');
You can improve upon the thresholding by using positional arguments in the "imbinarize" function, for example:
binaryImg = imbinarize(img, 'adaptive', 'ForegroundPolarity','dark','Sensitivity',0.1);
binaryImg2 = imcomplement(binaryImg);
imshowpair(img2,binaryImg2,'montage');
I have generated the following function:
function [BW,maskedImage] = segmentImage(RGB)
[centers,radii,~] = imfindcircles(RGB,[1 75],'ObjectPolarity','dark','Sensitivity',0.98);
if max_num_circles < length(radii)
centers = centers(1:max_num_circles,:);
radii = radii(1:max_num_circles);
BW = circles2mask(centers,radii,size(RGB,1:2));
maskedImage(repmat(~BW,[1 1 3])) = 0;
The above function produced an image similar to binaryimage using adaptive thresholding as shown.
Once you have segmented the image, you can use the "regionprops" function to derive all the statistics. For example:
regionprops('table', maskedImage, 'Area', 'Centroid');
The above function call produced the following output:
Area Centroid
____ __________________________
336 816.12 525.04 2
372 858.41 567.7 2
318 842.12 578.87 2
330 830.43 589.3 2
222 821.78 549.97 2
: :
15 507 471 2
12 506 400.25 2
30 526.4 420.4 2
36 529.58 292.92 2
102 463.82 414.97 2
Using the above statistics you can easily derive the size distribution and number density for each frames.