Ask Your Question
0

Error with Contour functions in OpenCV 2.4.3

asked 2012-11-28 01:08:10 -0600

Abid Rahman K gravatar image

updated 2012-11-28 09:57:24 -0600

Almost all the functions related to contours returns an error :

TypeError: points data type = 5 is not supported

This is the code I tried :

first = cv2.inRange(hsv,obj1_min,obj2_max)
contours,hierarchy = cv2.findContours(first,cv2.RETR_LIST,cv2.CHAIN_APPROX_SIMPLE)
cnt = contours[0]
rect = cv2.boundingRect(cnt)

Or try contours.py in /samples/python2 folder.

What is the problem? Is it a bug?

UPDATE :

This error occurs when I am using OpenCV 2.4.3.

Same code run fine in OpenCV 2.4.2. So I am using 2.4.2 now.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2012-11-28 01:54:07 -0600

Siegfried gravatar image

Hi, I'm not an expert in opencv for python. But it looks for me that you are using a unsupported image type (tpye 5 == CV_32F). findContours only support 8bit single channel images (type 8uC1 == 0) (see findContours online documentation).

edit flag offensive delete link more

Comments

updated the question. Same code works fine in version 2.4.2, but shows error in 2.4.3

Abid Rahman K gravatar imageAbid Rahman K ( 2012-11-28 09:59:39 -0600 )edit
0

answered 2012-11-28 03:18:24 -0600

venky gravatar image

If it supports only 8bit channel, you can use "convertTo" command to do it. Check for "convertTo" command in OpenCV. Hope it helps you a bit. Thanks Venky

edit flag offensive delete link more

Comments

updated the question. Same code works fine in version 2.4.2, but shows error in 2.4.3

Abid Rahman K gravatar imageAbid Rahman K ( 2012-11-28 09:59:25 -0600 )edit

Might be there is a bug in the newer version. I also faced problem while using CascadeCalssifier::setimage() results in segmentation fault. The documentation and the implementation does not match (after I checked objdetect.hpp). I suggest for you to have a look in the internal working of the function/class. Hope it helps.

venky gravatar imagevenky ( 2012-11-28 11:28:52 -0600 )edit

Question Tools

Stats

Asked: 2012-11-28 01:08:10 -0600

Seen: 2,271 times

Last updated: Nov 28 '12