Out of range error in delaunay-triangulation

asked 2017-12-24 07:32:10 -0500

Gina gravatar image

I'm trying to run the program which is compiled from the code here.

http://www.learnopencv.com/delaunay-t...

I'm using Visual studio 2015 and openCV 3.2. I encounter run error whose message is "OpenCV Error: One of arguments' values is out of range () in cv::Subdiv2D::locate, ..."

Can anyone help solve this problem?

edit retag flag offensive close merge delete

Comments

let me guess: you're using another (smaller) image, but the same pointslist ?

berak gravatar imageberak ( 2017-12-24 08:21:07 -0500 )edit

No.. I use the exact image and point list file

Gina gravatar imageGina ( 2017-12-24 08:55:45 -0500 )edit

well, i tried with the code, and points from a kazemi landmarks detector (in opencv3.4), and works flawless for me.

imho, the error is in your data somehow, not nessecarily in the code. (it complains, that one of the points is outside the rect)

(did you make sure, your image is loaded ? please add a check there !)

berak gravatar imageberak ( 2017-12-24 09:02:50 -0500 )edit

I checked before and I'm sure the image is successfully loaded in. The error occurs in line 111 which is subdiv.insert(*it) The error occurs in the first iteration when the insert method is called. I print out the point and the content is [207, 242] which is the same as the first line in obama.txt file describes. I also print out rect and the content is [512 * 697 from (0, 0)]. I really don't know why the first point is out of range..

Gina gravatar imageGina ( 2017-12-24 09:28:12 -0500 )edit

i think, the error comes from here

make a breakpoint in locate(), and debug it.

berak gravatar imageberak ( 2017-12-24 10:05:16 -0500 )edit
1

I discover the bottonRight in subdiv is {x=0.000000000 y=5.605e-45#DEN } subdiv is initialized using subdiv(rect), and I'm sure rect is correct still thinking how to solve it Do you have any idea?

Gina gravatar imageGina ( 2017-12-24 10:38:57 -0500 )edit

can you add the points file to your question ?

(now, how can x be 0 ? )

berak gravatar imageberak ( 2017-12-24 10:55:25 -0500 )edit
1

I think the problem is not about the point file, but initializing subdiv.

Gina gravatar imageGina ( 2017-12-24 11:23:17 -0500 )edit

i'm more and more inclined to think that, too. still, if i'd have the data, i'd try.

berak gravatar imageberak ( 2017-12-24 11:27:59 -0500 )edit
Gina gravatar imageGina ( 2017-12-24 11:33:21 -0500 )edit