From an image we must be able to obtain the a value of the cell area. Getting that means that we must be able to properly threshold the image before we can convert it to black and white and be able to separate as many cells as we can from the cluster.
First I crop a 256x256 patch from Figure 1 and called it co1. Converted it to graycale, then got the histogram to obtain a threshold so I can separate the cell from the background and turn co1 to a bw image. This is in Figure 2.
Afterwards, with no erosion nor dilation, I used paint to crop 5 distinct well separated cells and got its area using sum(im1).I used the mean area ai=540 as reference area before getting the areas from different regions of the image.
In order to removed the holes and other irregularity in cells and reduce some distinct cells from the clusters, I used a double erosion to remove holes and separate some cells and double dilation to reconstruct some separate cells.
However not all cells were completely separated and they remained in clusters. No matter, the areas of these cells or clusters are then computed as follows,
Finally, the average area obtained with this method is af= 531.38889 or 531 and the standard deviation of the values from this mean is 14.034155. Furthermore, the reference area mean is ai= 540, and the percent difference of the computed area from the reference is only 1.6%. This suggest that the values are very close and the calculation was indeed correct.
References:
[1]Activity 9 AP 186 Manual
[2]http://groups.google.com/group/face-rec/browse_thread/thread/0d29fb3a357a530a?pli=1
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
stacksize(50000000);
apat=4;
nito=1;//areas nito
for i=1:apat
cut=imread('C:\Users\USA\Desktop\co'+string(i)+'.png');
cut=im2gray(cut);
cut=im2bw(cut, 0.80);
//imwrite(cut,'C:\Users\USA\Desktop\cobw'+string(i)+'.bmp');
x= [-2.0:.5:2];
[X,Y] =ndgrid(x,x);
[sx,sy]= size(X);
r= sqrt(X.^2 + Y.^2);
c=zeros(sx,sy);
f=find(r<=2);
c(f)=1;
im=cut;
se=c;
//h=scf(i+1);
//1.erodeerode. to close holes
im=erode(im, se); im=erode(im, se);
im=dilate(im, se);im=dilate(im, se);
//h=scf(i+3);
//imshow(im);
//imwrite(im,'C:\Users\USA\Desktop\cobwdilate erode use tabul'+string(i+sho)+'.bmp');
[L,n]=bwlabel(im);
//find the area
mm=tabul(L,'i');// frequecny ng values na eun(0,1,2..n n cell)=area ng cell
xx=mm(:,2)//area
make it easy remove area na higher than 600 na
fi=find(xx<=600 & xx>=500);
xx=xx(fi)
end
-->Size: 258 rows X 258 columns
Truecolor Image
xx =
529.
554.
514.
523.
524.
533.
526.
Size: 258 rows X 258 columns
Truecolor Image
xx =
530.
521.
542.
522.
560.
559.
Size: 258 rows X 258 columns
Truecolor Image
xx =
533.
536.
523.
531.
526.
524.
521.
518.
529.
Size: 258 rows X 258 columns
Truecolor Image
xx =
528.
518.
515.
530.
areas=read('areas.txt',-1,1);
f=tabul(areas,'i');
x=f(:,1);
y=f(:,2);
bar(x,y);
areas=read('tabul areas.txt',-1,1);
f=tabul(areas,'i');
x=f(:,1);
fi=find(xx<=600)
fi=find(xx>=500);
x=x(fi);
y=f(:,2);
y=y(fi);
bar(x,y);
No comments:
Post a Comment