Given an image of circles (see Figure 1), we have to measure the area of a single circle by sampling different regions of the image. The images are converted to binary depending on the threshold which I determined manually from ImageJ.
Some circles are not perfect, others are cut during sampling. Hence erroneous values of area will occur upon computation. To resolve this problem, we have to dilate and erode the circles to approximately restore their original shape. I used an opening operator- erosion followed by dilation. I need to erode the image first to remove very small blobs and then dilate it afterwards to cancel the erosion.
The area is estimated by determining the area of a single circle. The method is statistical since there are numerous samples. For each sampled image, each blob is labeled and the number of pixels on that blob is the area for that circle. This is done for the rest of the samples and a plot of the histogram of the areas is obtained.
The average area obtained from the samples is 540 pixels with a standard deviation of 117 pixels. The histogram has a peak at 540, which means the mean and the mode coincides, enough to say that the result is valid. Another valid method to verify the result is to determine the same area by cropping a single almost perfect circle. Finding the average area and standard deviation from several samples will give a better approximate value.In my case, the resulting average area is 535.0 with a standard deviation of 3 pixels.
Rating: The activity is quite easy (except for the automation). So I'll give myself 10. points
Code: just change the corresponding threshold for each image (see the index)
im=imread('G:\AP 186\a9\c1.jpg');
//converting the image with their corresponding threshold
im1=im2bw(im,0.81);
subplot(121);
imshow(im1, []);
//im2=im2bw(im,0.85);
//im3=im2bw(im,0.78 );
//im4=im2bw(im, 0.81);
//im5=im2bw(im, 0.82);
//im6=im2bw(im, 0.83);
//im7=im2bw(im, 0.83);
//im8=im2bw(im, 0.82);
//im9=im2bw(im, 0.78);
//im10=im2bw(im, 0.82);
//im11=im2bw(im, 0.80);
//im12=im2bw(im, 0.82);
//im13=im2bw(im, 0.76);
//im14=im2bw(im, 0.77);
//im15=im2bw(im, 0.81);
imn1=dilate(erode(im1));
subplot(122);
imshow(imn1, []);
L1=bwlabel(imn1);
area=[max(L1)];
//using pixel counting
for i=1:1:max(L1);
[x,y]=find(L1==i);
area(i)=length(y);
end;
area
Subscribe to:
Post Comments (Atom)
1 comment:
Not bad. This is a 10.
Post a Comment