Ask Your Question
0

perspectiveTransform Error handler

asked 2017-05-26 18:35:26 -0600

Fynjy8 gravatar image

updated 2017-05-26 18:36:57 -0600

I use http://docs.opencv.org/trunk/d7/dff/t... , but i changed SURF to SIFT, but it doesn't matter. Everything works good, but there are one problem: it hasn't error handler when img_object didn't find in img_scene. For example when images are really different - it's error in this:

perspectiveTransform(obj_corners, scene_corners, H);

So i need some error handler like:

if (**something**) { 
printf("Didn't find!"); }


else { ...    
perspectiveTransform(obj_corners, scene_corners, H);
...}

My questin is: What something ?? min_dist > 20 ? Or what condition i need?

P.S. Thank you for your answers, and sorry for my english :D

edit retag flag offensive close merge delete

Comments

What is error message? Have you check obj-corners size?

if (obj_corners.size()==0) { 
printf("Didn't find!"); }


else { ...
LBerger gravatar imageLBerger ( 2017-05-27 01:07:33 -0600 )edit

obj_corners.size(): 4

obj_corners: [0, 0; 500, 0; 500, 200; 0, 200]

obj_corners is about template left in img_matches - not about template on scene image. So, if I have template image 500x200 it has this corners

error in cv.perspectiveTransform(_InputArray , _OutputArray* , _InputArray* )* System.Runtime.InteropServices.SEHException

Fynjy8 gravatar imageFynjy8 ( 2017-05-27 03:33:54 -0600 )edit

It is not an opencv error message. Is it an egmu message ?

LBerger gravatar imageLBerger ( 2017-05-27 05:24:37 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-06-03 07:15:00 -0600

Fynjy8 gravatar image

My answer is:

if (obj.size() == 0 || scene.size() == 0) {
                        printf("Didn't find!");
                    }

                    cv::Mat H = findHomography(obj, scene, cv::RANSAC); 

if (H.empty()) {
                        printf("Didn't find!");
                    }
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-05-26 18:35:26 -0600

Seen: 446 times

Last updated: Jun 03 '17