image processing from webcam

Hi,I have something to ask you.I have an image with a large rectangle and inside that rectangle there are a red circle and a green circle.And I want to locate the center of red circle with the origin-coordinate is one of the corners of rectangle.Everything has been finished with an image I draw in power point.But when I draw that image on a real paper and using a webcam to capture that image,I cann't do the same things as I do with ppt image.When I convert the real image to binary,the rectangle,in some parts,is not separated with background and some areas of background dont't have the same color(black or white) with others.I try to reduce threshold but it is still bad.I just want to separate the rectangle with background to "label" it and then I do anything I do with ppt image.Can you tell me how can I do that.Sorry because my bad english.

1 commentaire

nghia nguyen
nghia nguyen le 25 Avr 2011
here are image links:
http://www.flickr.com/photos/48230201@N02/5653553606/in/photostream
http://www.flickr.com/photos/48230201@N02/5652986417/in/photostream/

Connectez-vous pour commenter.

 Réponse acceptée

Sean de Wolski
Sean de Wolski le 25 Avr 2011

0 votes

I would do this with:
I = imread('answers425.jpg'); %your_image
M = shrinkWrap(I(:,:,1),'objthresh',3000,'biggest'); %shrinkwrap it and keep only biggest object
subplot(121)
imshow(M); %show mask
subplot(122)
imshow(bsxfun(@times,uint8(M),I)); %show mask applied
The result I attain:

5 commentaires

nghia nguyen
nghia nguyen le 25 Avr 2011
Thanks a lot.But I also want to keep the rectangle from the original image.How can I do that
nghia nguyen
nghia nguyen le 25 Avr 2011
My main goal is just retain the rectangle and two circles and erase everything else.Like this:
http://www.flickr.com/photos/48230201@N02/5654383584/in/photostream
Sean de Wolski
Sean de Wolski le 25 Avr 2011
Perhaps use the edge function?
nghia nguyen
nghia nguyen le 26 Avr 2011
I try to use canny method but there are so many noise.I don't know what should I do to filter those noise and how can I determine where is the rectangle's edge or circle's edge.
nghia nguyen
nghia nguyen le 26 Avr 2011
Here is the image after using canny method:
http://www.flickr.com/photos/48230201@N02/5655801861/in/photostream
And can u tell me how can I post directly images instead of links

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by