Finding radii of a droplet for each y

6 ビュー (過去 30 日間)
Nijat Azimzade
Nijat Azimzade 2022 年 5 月 16 日
コメント済み: Nijat Azimzade 2022 年 5 月 17 日
Imagine that a droplet is a stack of discs, each one having it's own radius, which you have to find. I have the contour of the droplet, that is array C and I have tip position (position of min y), that is i. Is it possible to write a code with the following meaning: for each y, subsctract x values of C's opposite parts?
  2 件のコメント
Image Analyst
Image Analyst 2022 年 5 月 16 日
Yes. So is each disc a different z? Like this is a confocal microscope image or some other kind of volumetric image? And x and y are with respect to each 2-D image from the "stack"? What exactly is a "tip"? What exactly is (the badly-named) "i"? Is it
i = min(y); % Get tip position.
Are your images binary or gray scale? If gray scale, can you binarize them to produce a good binary image?
Can you provide a few images at different z levels, after reading this of course:
Nijat Azimzade
Nijat Azimzade 2022 年 5 月 17 日
Sorry for lack of details. Here you can see my code. I use online MATLAB. In attachment I give the original image of the droplet (I am not sure how to download post-processed image, but if you run this code you'll get exactly same result as me). In short, I want to get the volume of the droplet but I do not have 3D image. Idea is to imagine this droplet as a stack of discs (one on another), each with own diameter, find these discs' areas and then add them to get volume. So basically to approach ice droplet as just a sliced potato. On image these dics diameters are straight lines connecting right side and left side of a contour.
clc; clear all;
I = imread('Droplet 10m40s.png');
x=im2gray(I);
%binarization
v=im2bw(x,0.2);
v1=imfill(v,'holes'); % to fill the holes
imshow(v1)
bw= bwareaopen(v1,3000);% threshold in order to remove the undesired parts
imshow(bw);
[L n]=bwlabel(bw);
r=regionprops(L, "BoundingBox");
% rectangle('Position',r.BoundingBox, 'EdgeColor','g');
% height = r.BoundingBox(4)
% width=r.BoundingBox(3)
B=bwboundaries(bw)
C=B{1}; %first contur in the file B
hold on
plot(C(:,2),C(:,1),'b')
%this plot function must be memorized. For some reason y is first position
%and x is second. 1 and 2 always stay like this
A=min(C(:,1)) %is to take the minimum y value of contur
i=find(C(:,1)==min(C(:,1))); %it is to determine the position of minimum y in the list
Cc=C(i-10:i+10,:); %to define tip angle with n values
hold on
plot(Cc(:,2),Cc(:,1),'r')
%we divide our angle into two lines and get equation of each line with
%polyfit. Then we find angle 1, 2 between line 1, 2 and imginary vertical under
%the tip (dividing line). Then we add angles 1 and 2
Ccc1=C(i-15:i,:);
yy1=Ccc1(:,2)
xx1=Ccc1(:,1);
p = polyfit(xx1,yy1,1)
angle1=atan(p(1))
% pp= poly2sym(p)
Ccc2=C(i:i+15,:)
yy2=Ccc2(:,2)
xx2=Ccc2(:,1)
o = polyfit(xx2,yy2,1)
angle2=atan(o(1))
oo=poly2sym(o)
angle=-angle1+angle2
teta=rad2deg(angle)
x=max(C)-min(C)
sum(bw(:) == 0) %black
sum(bw(:) == 1) %white %to get number of white and black pixels

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by