MATLAB Code for Area Fit

%% Cloud area and Volume

% Imaging parameters
Magn=1; %magnification of the imaging system
px_sizew=3.75*10^(-3); %width of CCD pixel-in mm
px_sizeh=3.75*10^(-3); %height of CCD pixel-in mm
px_area=px_sizew*px_sizeh; %area for each pixel in mm^2

%% load image
C1=imread(‘C:\Users\Anarisil\Desktop\MOTPhase2\20120502\7-4\50ms.jpg’);

CAvrg=double(C1);

%% Dimension of the picture

[px_height,px_width]=size(CAvrg);
x=1:px_width;
y=1:px_height;

%% finding the maximum value of that point and the 1/e value
MaxInt=max(max(CAvrg));
threshold=MaxInt/exp(1);

%% %% counting
px_count=0;

for i=1:px_height
for j=1:px_width
if CAvrg(i,j)>=threshold
px_count=px_count+1;
else
end
end
end

%px_count will give the number of pixels with values above the threshold

%% determining the volume
%assumption: x=y=z
V(1,1)=px_count*px_area;
V(2,1)=4/(3*sqrt(pi))*(V(1,1))^(3/2); %in mm^3

Advertisements

Tags: , ,

About vekin

I'm mostly a scientist, but occasionally a writer and an artist, and most definitely a dreamer.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: