Skip to content
Advertisement

Tag: opencv

OpenCV(4.1.2) error: (-215:Assertion failed) !ssize.empty() in function ‘cv::resize’

I am recieving this error when running this line of code: OpenCV(4.1.2) C:projectsopencv-pythonopencvmodulesimgprocsrcresize.cpp:3720: error: (-215:Assertion failed) !ssize.empty() in function ‘cv::resize’ Answer Your img variable is empty, you probably didn’t load the image correctly. Try printing your img.shape after you load your image. Then have a look at the path you specified, there is probably something wrong with it. (Either you

Python loadarff fails for string attributes

I am trying to load an arff file using Python’s ‘loadarff’ function from scipy.io.arff. The file has string attributes and it is giving the following error. How to read the arff successfully? Answer Since SciPy’s loadarff converts containings of arff file into NumPy array, it does not support strings as attributes. In 2020, you can use liac-arff package. However, make

How to decode a video (memory file / byte string) and step through it frame by frame in python?

I am using python to do some basic image processing, and want to extend it to process a video frame by frame. I get the video as a blob from a server – .webm encoded – and have it in python as a byte string (b’x1aExdfxa3xa3Bx86x81x01Bxf7x81x01Bxf2x81x04Bxf3x81x08Bx82x88matroskaBx87x81x04Bx85x81x02x18Sx80gx01xffxffxffxffxffxffxffx15Ixa9fx99*xd7xb1x83x0fB@Mx80x86ChromeWAx86Chromex16Txaekxadxaexabxd7x81x01sxc5x87x04xe8xfcx16t^x8cx83x81x01x86x8fV_MPEG4/ISO/AVCxe0x88xb0x82x02x80xbax82x01xe0x1fCxb6ux01xffxffxffxffxffxff …). I know that there is cv.VideoCapture, which can do almost what I need.

Understanding contour hierarchies: How to distinguish filled circle/contour and unfilled circle/contour in OpenCV?

I am unable to differentiate between the below two contours. cv2.contourArea() is giving the same value for both. Is there any function to distinguish them in Python? How do I use contour hierarchies to determine the difference? Answer To distinguish between a filled contour and unfilled contour, you can use contour hierarchy when finding contours with cv2.findContours(). Specifically, you can

Advertisement