Ask Your Question
0

detect object only at the center of the screen

asked 2012-12-23 03:31:19 -0600

steven gravatar image

Hi people, i am new to image processing, and here i am asking a novice question. can we detect object only when it is at the center of the camera view? meaning i only want to detect it if is at the center of the camera view.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
2

answered 2012-12-23 05:26:28 -0600

In each process you can use the ROI(region of interest).The ROI rectangle indicates which part of image must be process. The another solution You can process entire of image then find your object.In the final by a rule check position & dimension of object.

edit flag offensive delete link more

Comments

thanks man for replying, could you give me more ideas of how to do it?

steven gravatar imagesteven ( 2012-12-23 07:23:38 -0600 )edit
IplImage* img;
CvPoint center = cvPoint(img->width/2,img->height/2);
CvSize size = cvSize(50,50);
CvRect rct = cvRect(center.x - size.width/2,center.y - size.height/2, size.width ,size.height);
cvSetImageROI(img,rct);

// process ...

cvResetImageROI(img);
Mostafa Sataki gravatar imageMostafa Sataki ( 2012-12-23 07:45:05 -0600 )edit
1

answered 2012-12-23 07:47:34 -0600

rics gravatar image

Extending Mostafa's answer here you can find some ROI usage examples using the C interface of OpenCV. For example Listing 1. shows how to use cvSetImageROI on one image and then use cvCopy to copy only the selected part to another image.

edit flag offensive delete link more

Comments

thanks man ! but this method only works with image? meaning picture?

steven gravatar imagesteven ( 2012-12-23 23:42:28 -0600 )edit

Yes, the region of interest is set in the header of the image, so you need an image instead of a matrix or array: http://docs.opencv.org/modules/core/doc/old_basic_structures.html?highlight=iplimage#IplImage

rics gravatar imagerics ( 2012-12-24 02:42:10 -0600 )edit

Thanks guys for the reply ! i am sorry for replying late, got sick for the past few days after the Christmas feast :X.

I am actually currently trying detect center of a circle, the object is black colour. Thru a wireless web camera. But however, i still cant find any solution to it . i tried detecting circle, but i couldnt get the center of the circle. :/

steven gravatar imagesteven ( 2012-12-29 01:01:00 -0600 )edit

Question Tools

Stats

Asked: 2012-12-23 03:31:19 -0600

Seen: 3,226 times

Last updated: Dec 23 '12