Ask Your Question

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

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


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);

// process ...

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

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


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:

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


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

Seen: 3,158 times

Last updated: Dec 23 '12