Droplet size calculation of a spray image
Hi predecessors,
I have this kind of spray image and I want to calculate the droplet size and distribution of the particles, and wondering if there is a way to do that on MATLAB so that I can learn from it. Thanks!
Here are what I do now, I really appreciate you can help to point out the errors or mistakes,and if you are me, what code will you use to realize this function.
clc
clear all;
image=imread(‘E:picture_testheitu.tiff’);
jqimage=image(2000:2500,2000:2500);
imshow(jqimage,[0 4000]);title(‘jiequ’);
[gradthresh,numofiter]=imdiffuseest(jqimage);
diffusedImage=double(imdiffusefilt(jqimage,’GradientThresh’,gradthresh,’NumberOfIterations’,numofiter));
imshow(diffusedImage,[0 4000]);
[testx,testy]=size(diffusedImage);
array_x=zeros(501,501);
blank_x=zeros(501,501);
y=zeros(1,501);
for i=1:testx
testx_temp=diffusedImage(i,:);
for i1=2:testy-1
y(i1)=abs((testx_temp(i1+1)-testx_temp(i1-1))/2);
end
array_x(i,:)=y;
[pks,locs]=findpeaks(array_x(i,:),"MinPeakHeight",40);
blank_x_i=blank_x(i,:);
for i2=1:length(locs);
blank_x_i(locs(i2))=1;
end
blank_x(i,:)= blank_x_i;
end
array_y=zeros(501,501);
blank_y=zeros(501,501);
x=zeros(501,1);
for i=1:testy
testx_temp=diffusedImage(:,i);
for i1=2:testx-1
x(i1)=abs((testx_temp(i1+1)-testx_temp(i1-1))/2);
end
array_y(:,i)=x;
[pks,locs]=findpeaks(array_y(:,i),"MinPeakHeight",40);
blank_y_i=blank_y(:,i);
for i2=1:length(locs);
blank_y_i(locs(i2))=1;
end
blank_y(:,i)= blank_y_i;
end
figure;
imagesc(blank_x);
hold on;
imagesc(blank_y);
add_ab=blank_x+blank_y;
imagesc(add_ab);
figure;
binaryimage=im2bw(add_ab);
imshow(binaryimage);
binaryimage=imfill(binaryimage,’holes’);
imshow(binaryimage);title(‘binaryimage’);
figure
labeledimage=bwlabel(binaryimage,8);
imshow(labeledimage);
coloredlabels=label2rgb(labeledimage,’hsv’,’k’,’shuffle’);
hold on;
imshow(coloredlabels);
blobmeasurements=regionprops(labeledimage,add_ab,’all’);
numberofblobs=size(blobmeasurements,1);
boundaries=bwboundaries(binaryimage);
numberofboundaries=size(boundaries,1);
for k1=1:numberofboundaries
thisboundary=boundaries{k1};
plot(thisboundary(:,2),thisboundary(:,1),’g’,’LineWidth’,2);
end
for k2=1:numberofblobs
blobarea=blobmeasurements(k2).Area;
blobecd(k2)=sqrt(4*blobarea/pi);
fprintf(‘%dn’,blobecd(k2))
endHi predecessors,
I have this kind of spray image and I want to calculate the droplet size and distribution of the particles, and wondering if there is a way to do that on MATLAB so that I can learn from it. Thanks!
Here are what I do now, I really appreciate you can help to point out the errors or mistakes,and if you are me, what code will you use to realize this function.
clc
clear all;
image=imread(‘E:picture_testheitu.tiff’);
jqimage=image(2000:2500,2000:2500);
imshow(jqimage,[0 4000]);title(‘jiequ’);
[gradthresh,numofiter]=imdiffuseest(jqimage);
diffusedImage=double(imdiffusefilt(jqimage,’GradientThresh’,gradthresh,’NumberOfIterations’,numofiter));
imshow(diffusedImage,[0 4000]);
[testx,testy]=size(diffusedImage);
array_x=zeros(501,501);
blank_x=zeros(501,501);
y=zeros(1,501);
for i=1:testx
testx_temp=diffusedImage(i,:);
for i1=2:testy-1
y(i1)=abs((testx_temp(i1+1)-testx_temp(i1-1))/2);
end
array_x(i,:)=y;
[pks,locs]=findpeaks(array_x(i,:),"MinPeakHeight",40);
blank_x_i=blank_x(i,:);
for i2=1:length(locs);
blank_x_i(locs(i2))=1;
end
blank_x(i,:)= blank_x_i;
end
array_y=zeros(501,501);
blank_y=zeros(501,501);
x=zeros(501,1);
for i=1:testy
testx_temp=diffusedImage(:,i);
for i1=2:testx-1
x(i1)=abs((testx_temp(i1+1)-testx_temp(i1-1))/2);
end
array_y(:,i)=x;
[pks,locs]=findpeaks(array_y(:,i),"MinPeakHeight",40);
blank_y_i=blank_y(:,i);
for i2=1:length(locs);
blank_y_i(locs(i2))=1;
end
blank_y(:,i)= blank_y_i;
end
figure;
imagesc(blank_x);
hold on;
imagesc(blank_y);
add_ab=blank_x+blank_y;
imagesc(add_ab);
figure;
binaryimage=im2bw(add_ab);
imshow(binaryimage);
binaryimage=imfill(binaryimage,’holes’);
imshow(binaryimage);title(‘binaryimage’);
figure
labeledimage=bwlabel(binaryimage,8);
imshow(labeledimage);
coloredlabels=label2rgb(labeledimage,’hsv’,’k’,’shuffle’);
hold on;
imshow(coloredlabels);
blobmeasurements=regionprops(labeledimage,add_ab,’all’);
numberofblobs=size(blobmeasurements,1);
boundaries=bwboundaries(binaryimage);
numberofboundaries=size(boundaries,1);
for k1=1:numberofboundaries
thisboundary=boundaries{k1};
plot(thisboundary(:,2),thisboundary(:,1),’g’,’LineWidth’,2);
end
for k2=1:numberofblobs
blobarea=blobmeasurements(k2).Area;
blobecd(k2)=sqrt(4*blobarea/pi);
fprintf(‘%dn’,blobecd(k2))
end Hi predecessors,
I have this kind of spray image and I want to calculate the droplet size and distribution of the particles, and wondering if there is a way to do that on MATLAB so that I can learn from it. Thanks!
Here are what I do now, I really appreciate you can help to point out the errors or mistakes,and if you are me, what code will you use to realize this function.
clc
clear all;
image=imread(‘E:picture_testheitu.tiff’);
jqimage=image(2000:2500,2000:2500);
imshow(jqimage,[0 4000]);title(‘jiequ’);
[gradthresh,numofiter]=imdiffuseest(jqimage);
diffusedImage=double(imdiffusefilt(jqimage,’GradientThresh’,gradthresh,’NumberOfIterations’,numofiter));
imshow(diffusedImage,[0 4000]);
[testx,testy]=size(diffusedImage);
array_x=zeros(501,501);
blank_x=zeros(501,501);
y=zeros(1,501);
for i=1:testx
testx_temp=diffusedImage(i,:);
for i1=2:testy-1
y(i1)=abs((testx_temp(i1+1)-testx_temp(i1-1))/2);
end
array_x(i,:)=y;
[pks,locs]=findpeaks(array_x(i,:),"MinPeakHeight",40);
blank_x_i=blank_x(i,:);
for i2=1:length(locs);
blank_x_i(locs(i2))=1;
end
blank_x(i,:)= blank_x_i;
end
array_y=zeros(501,501);
blank_y=zeros(501,501);
x=zeros(501,1);
for i=1:testy
testx_temp=diffusedImage(:,i);
for i1=2:testx-1
x(i1)=abs((testx_temp(i1+1)-testx_temp(i1-1))/2);
end
array_y(:,i)=x;
[pks,locs]=findpeaks(array_y(:,i),"MinPeakHeight",40);
blank_y_i=blank_y(:,i);
for i2=1:length(locs);
blank_y_i(locs(i2))=1;
end
blank_y(:,i)= blank_y_i;
end
figure;
imagesc(blank_x);
hold on;
imagesc(blank_y);
add_ab=blank_x+blank_y;
imagesc(add_ab);
figure;
binaryimage=im2bw(add_ab);
imshow(binaryimage);
binaryimage=imfill(binaryimage,’holes’);
imshow(binaryimage);title(‘binaryimage’);
figure
labeledimage=bwlabel(binaryimage,8);
imshow(labeledimage);
coloredlabels=label2rgb(labeledimage,’hsv’,’k’,’shuffle’);
hold on;
imshow(coloredlabels);
blobmeasurements=regionprops(labeledimage,add_ab,’all’);
numberofblobs=size(blobmeasurements,1);
boundaries=bwboundaries(binaryimage);
numberofboundaries=size(boundaries,1);
for k1=1:numberofboundaries
thisboundary=boundaries{k1};
plot(thisboundary(:,2),thisboundary(:,1),’g’,’LineWidth’,2);
end
for k2=1:numberofblobs
blobarea=blobmeasurements(k2).Area;
blobecd(k2)=sqrt(4*blobarea/pi);
fprintf(‘%dn’,blobecd(k2))
end droplet size distribution, particle, image segmentation MATLAB Answers — New Questions