Ask Your Question
1

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

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

Paramesh Reddy gravatar image

updated 2015-09-30 13:07:33 -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?.

thanks

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

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 http://docs.opencv.org/modules/core/doc/basic_structures.html#mat-locateroi.

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 http://docs.opencv.org/modules/imgproc/doc/object_detection.html?highlight=matchtemplate#matchtemplate) and applying minMaxLoc() onto its output (see http://docs.opencv.org/modules/core/doc/operations_on_arrays.html#minmaxloc).

edit flag offensive delete link more
0

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
Login/Signup to Answer

Question Tools

1 follower

Stats

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

Seen: 973 times

Last updated: Jul 15 '15