Sorry, this content is no longer available

Ask Your Question
0

detect object only at the center of the screen

asked Dec 23 '12

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.

Preview: (hide)

2 answers

Sort by » oldest newest most voted
2

answered Dec 23 '12

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.

Preview: (hide)

Comments

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

steven gravatar imagesteven (Dec 23 '12)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 (Dec 23 '12)edit
1

answered Dec 23 '12

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.

Preview: (hide)

Comments

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

steven gravatar imagesteven (Dec 24 '12)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 (Dec 24 '12)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 (Dec 29 '12)edit

Question Tools

Stats

Asked: Dec 23 '12

Seen: 3,279 times

Last updated: Dec 23 '12