Google
 
Web basic-eng.blogspot.com
basic-programming.blogspot.com basic-control.blogspot.com

Saturday, November 05, 2005

Drawing Circles Around Round Object

Drawing shapes to highlight certain objects could be done in several ways. Previous examples illustrate few ways of drawing object by overwriting pixel value as well as by adding a "patch" on top of an image. This example shows how to draw circles around a round object just simply using "plot" command

1. Original image

S = imread('pic13.jpg');
S = im2bw(S);
S2 = ~S;
imshow(S2);


2. Extracting required objects' properties. Required properties are centroid and the area of the round objects. The area property is used to compute the radius of the object.

S3 = bwlabel(S2);
S4 = regionprops(S3,'Centroid','area');
R = sqrt(S4(1).Area/pi);
h = S4(1).Centroid(1);
k = S4(1).Centroid(2);

3. Drawing circles around 1st object with different radius by refering to the radius of the object.

ratio = [2 1.5 1];
nR = round(R*ratio);
t = 0:pi/20:2*pi;
x1 = (h+nR'*cos(t))';
y1 = (k+nR'*sin(t))';
hold on;
plot(x1,y1);





Contents and Information:
Contents by Date
All the posts are arranged by date, newest on top
http://basic-eng.blogspot.com/2005/09/contents-by-date.html
Contents by Categories
All the posts are arranged by categories
http://basic-eng.blogspot.com/2006/05/contents-by-categories-updated-on.html



Leave your message and suggestion here:



2 Comments:

Blogger Doniette said...

How would you like to know about a Life Time Fitness resource, that displays all the Life Time Fitness information on one website? Check out
Life Time Fitness today. Not only do they have a good fitness book section, but they also have great articles on fitness. I was really impressed with the resources their webmster put together.

4:35 AM  
Blogger MovieDude said...

Hey! Most Excellent Blog!
If your bored out of your mind, then you may want a very 'STRANGE'
movie download !

8:03 PM  

Post a Comment

<< Home