The commands I used for the estimation of the area of my rectangle figure are,
a = imread('pic1.bmp');
BWpic1 = im2bw(a, 0 , 1);
[x,y] = follow(BWpic1);
size(x)
size(y)
x1(1) = x(1788);
y1(1) = y(1788);
x2(2:1788) = x(1:1787);
y2(2:1788) = y(1:1787);
A1 = x1(1)*y2(2:1788);
A2 = y1(1)*x2(2:1788);
A3 = A1-A2;
A4 = sum(A3);
Area = 0.5*A4
sum(BWpic1)
area= 196608*0.5
where my x and y sizes are both 1788. The value of the are I got from my program is 98304. But this value has a very high percentage error of 64% compared with the theoretical area which is 59712. The dimension of the rectangle is 311 by 192. I really don't know where the problem lies in my program, since I am quite sure that it is correct. So I'm giving myself a grade of 6 only. Benj, rica, lei and ayeen helped me with some of the problems that I have encountered.
Unfortunately I can't post my figure since I can't upload it now.
Thursday, June 19, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment