Ask Your Question

Revision history [back]

cv2.findContours error: (-215) step[dims-1] == (size_t)CV_ELEM_SIZE(flags) in function cv::Mat::create

i tried to find contours for image it make error

i using python 2.7 openCV 2.4.7,2.4.11

my code is

import cv2

import numpy as np

thresh = np.zeros((400,100),dtype=np.uint8)

contours,hierarchy,thresh = cv2.findContours(thresh, 1, 2)

error is

Traceback (most recent call last): File "C:\Python27\OpenCVContore.py", line 5, in <module> contours,hierarchy,thresh = cv2.findContours(thresh, 1, 2) error: ........\opencv\modules\core\src\matrix.cpp:236: error: (-215) step[dims-1] == (size_t)CV_ELEM_SIZE(flags) in function cv::Mat::create

please help me .. thank you opencv users

cv2.findContours error: (-215) step[dims-1] == (size_t)CV_ELEM_SIZE(flags) in function cv::Mat::create

i tried to find contours for image it make error

i using python 2.7 openCV 2.4.7,2.4.11

my code is

import cv2

cv2 import numpy as np

thresh img = np.zeros((400,100),dtype=np.uint8)cv2.imread('star.jpg',0)

contours,hierarchy,thresh ret,thresh = cv2.threshold(img,127,255,0)

contours,hierarchy = cv2.findContours(thresh, 1, 2)

error is

Traceback (most recent call last): File "C:\Python27\OpenCVContore.py", line 5, in <module> contours,hierarchy,thresh = cv2.findContours(thresh, 1, 2) error: ........\opencv\modules\core\src\matrix.cpp:236: error: (-215) step[dims-1] == (size_t)CV_ELEM_SIZE(flags) in function cv::Mat::create

please help me .. thank you opencv users