Ask Your Question
1

Did convexityDefects function behaviour changed between cv2 versions 4.2.0 and 4.3.0?

asked 2020-12-02 05:51:08 -0600

snavas gravatar image

I was making use of convexityDefects for hand detection/recognition in my project using opencv-contrib-python version cv2 4.2.0.32. I recently updated my cv2 version to the latest one, but my functionality broke.

error: (-5:Bad argument) The convex hull indices are not monotonous, which can be in the case when the input contour contains self-intersections in function 'cv::convexityDefects'

I was able to backtrack and find the version where convexityDefects stopped behaving as I was expecting (as it behaved before). In 4.2.0.34 it still works but from version 4.3.0.36 and on I get the hull indices are not monotonous error.

Do someone knows if the implementation of the convexityDefects function changed across versions and what did it change?

Aditional information:

Thanks!

edit retag flag offensive close merge delete

Comments

can you share the code you used so we can try to reproduce the problem.

sturkmen gravatar imagesturkmen ( 2020-12-02 06:08:31 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2020-12-02 06:00:16 -0600

berak gravatar image

updated 2020-12-02 21:10:57 -0600

yes, there were changes, have a look at the resp. pr:

https://github.com/opencv/opencv/pull...

you need to read this part carefully to solve your problem.

edit flag offensive delete link more

Comments

1

So, as I understand, opencv did not check before if the convex hull indices were monotonous or not. However, the hull indices not being monotonous was not a problem for me before, is there a way I can bypass this check or maybe making my indices monotonous somehow?

snavas gravatar imagesnavas ( 2020-12-02 07:07:17 -0600 )edit

@snavas see the update on berak's answer.

sturkmen gravatar imagesturkmen ( 2020-12-02 21:12:33 -0600 )edit

Thanks for the suggestion, I will try that out!

snavas gravatar imagesnavas ( 2020-12-03 05:28:48 -0600 )edit

Python only not c++

supra56 gravatar imagesupra56 ( 2020-12-03 07:55:01 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-12-02 05:51:08 -0600

Seen: 1,318 times

Last updated: Dec 02 '20