Ask Your Question

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

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

snavas gravatar image

I was making use of convexityDefects for hand detection/recognition in my project using opencv-contrib-python version cv2 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 it still works but from version 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:


edit retag flag offensive close merge delete


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

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

1 answer

Sort by ยป oldest newest most voted

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

berak gravatar image

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

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

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

edit flag offensive delete link more



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 -0500 )edit

@snavas see the update on berak's answer.

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

Thanks for the suggestion, I will try that out!

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

Python only not c++

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

Question Tools

1 follower


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

Seen: 107 times

Last updated: Dec 02 '20