Using the sip toolbox in the scilab program, we have can view images.
We open the scilab program then we open the sip toolbox but we encounter error in the imagemagick path so we type command so that we can use sip toolbox.
The commands used are:
chdir(ImageMAgickPath); link(CORE_RL_Magick_.dll);
after entering this command, we can use the sip toolbox.
I first studied how to insert images in the sip toolbox. I first changed the directory using the command
chdir ('C:\Documents and Settings\AP186user13\My Documents\My Pictures').
After changing the directory, I can now read the image using sip tool box.
To read the image, I used the commands
-->image = imread('square.bmp');
-->xbasc(); imshow(image);
Then, the image is shown in the sip graphic window. This image(which is binary) will appearNow, i am ready to use "follow" and find the area of the image using scilab.
I enter the following commands to find the area of the square.
--> [x,y] = follow(image);
--> size(x);(the size of x is 584)
--> size(y); (the size of y is 584)
--> x2(1) = x(584) ;
--> x2(2:584) = x(1:583);
-->y2(1) = y(584) ;
-->y2(2:584) = y(1:583);
--> area=0.5*sum(x.*y2-y.*x2);
area = 21316.
The dimensions of the square is 148x148. Therefore the theoretical value of the square is 21904.
The error from the value at the scilab to the value of the theoretical is 2.69%.
For the second, rectangleUsing the same commands as the square,
-->image = imread('rectangle.bmp');
-->xbasc(); imshow(image);
--> [x,y] = follow(image);
--> size(x);(the size of x is 510)
--> size(y); (the size of y is 510)
--> x2(1) = x(510) ;
--> x2(2:510) = x(1:509);
-->y2(1) = y(510) ;
-->y2(2:510) = y(1:509);
--> area=0.5*sum(x.*y2-y.*x2);
area = 14534.
we find the scilab value of area to be 14534 and the theoretical to be 14960. Therefore the error is 2.84%.
For the third image,Using the same commands.
-->image = imread('circle.bmp');
-->xbasc(); imshow(image);
--> [x,y] = follow(image);
--> size(x);(the size of x is 548)
--> size(y); (the size of y is 548)
--> x2(1) = x(548) ;
--> x2(2:548) = x(1:547);
-->y2(1) = y(548) ;
-->y2(2:548) = y(1:547);
--> area=0.5*sum(x.*y2-y.*x2);
area = 29477
The scilab value of area is 29477. While the theoretical(having a radius of 97) is 29599. The error is 0.02%.
Acknowledgements...
Beth, for answering all my questions...
Lei, for helping me with the commands...
I will give myself a grade of 10/10.
Good day.
Thursday, June 19, 2008
A2 = Area estimation of images
Posted by
anarica
at
10:58 AM
Subscribe to:
Post Comments (Atom)
2 comments:
Yep, a perfect 10!
what does follow function do?
Post a Comment