Ask Your Question

How to get co-ordinates of a point in original image?

asked 2013-05-30 05:46:52 -0500

Paramesh Reddy gravatar image

updated 2020-11-15 02:07:36 -0500

Hai, I am working with ear detection in frontal face with opencv and c++.I am taking ROI to detect ear point as shown bellow.

image description

Yes i detected point of ear as p(x,y),But my problem is that i need a co-ordinate of that point corresponding to original image as shown bellow.

image description

is there any method in opencv to do this one if no please guide me about how to do this one?.


edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2013-05-30 06:56:27 -0500

Guanta gravatar image

Yes there is a builtin-function if your small image is a real ROI of your larger image matrix, i.e. it was created via cv::Rect(), cv::Range(), cv::rowRange(), cv::colRange(), cv::row(), cv::col(): it is called locateROI(), see

Example usage:

cv::Size orig_img_size;
cv::Point offset;
roi_matrix.locateROI(orig_img_size, offset);
// offset will now contain the offset of the ROI to your image 
// this you need to add to your locale point-coordinate p.

If you haven't created it by one of the mentioned functions (hope I haven't forgotten one), e.g. if you have saved the small image to your harddrive before without saving the offset parameter, then you can get the shift using matchTemplate() (see and applying minMaxLoc() onto its output (see

edit flag offensive delete link more

answered 2015-07-15 13:43:04 -0500

tiagoaleks gravatar image

Hello, Paramesh.

I am now also working on frontal face ear detection to find the extremities. I am having a lot of difficulties with this. I have already trained the cascade with 1000 ears, multiple times and with different parameters, but still it fails a lot. Can you help me with some input? How did you get to find the point?

Thank you.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-05-30 05:46:52 -0500

Seen: 1,520 times

Last updated: Jul 15 '15