I would like to filter out cnts with small area. But I got the an error. What is the proper way to use filter? code error Answer The filter function returns a generator but the drawContours function expects a list. To fix this, use the list command. Another solution is to use a list comprehension to build the list, like
Tag: opencv
how do I (filter and) save many ROIs taken from a larger picture individually to picture files?
I followed this discussion: How extract pictures from an big image in python made mine, this is the output link https://imgur.com/a/GK8747f and .py script below I did frame them up, then how to save each one/qr code Answer I did frame them up, then how to save each one/qr code If you want to save the contents of each rectangle,
numpy slicing using multiple conditions where one of the conditions searches the neighborhood of an element
the problem is to take a black-white image, detect all the places where white borders on black, keep that white, and turn all other white pixels black. I know how to do this using normal for-loops and lists, but I want to do it w/ numpy, which I am not that familiar with. Here is what I have so far:
error: (-215:Assertion failed) !empty() in function CV2 Error
I am making a program in python that just draws a rectangle around a car. I am currently stuck on getting the coordinates of the car, here is the code: I am running in on an error with the function “cv2.detectMultiScale”. error: I have tried googling, it says to use cv2.CascadeClassifier(cv2.data.haarcascades + “cars.xml”) instead of cv2.CascadeClassifier(“cars.xml”). It didn’t work :(,
How to make kornia HomographyWarper behave like OpenCV warpPerspective?
As the title says, I want to use HomographyWarper from kornia so that it gives the same output as OpenCV warpPerspective. With the code above, I get the following output: With normalized_coordinates=False, I get the following output: Apparently the homography transformation is applied differently. I would love to know the difference. Answer You need to make two changes: Use the
how to mark the labels on image using watershed opencv
As this is the output from the watershed and I want to mark the labels like 1,2,3 etc on the regions identified. I have tried to use cv2.puttext as well by using cv2.boudingrect but the labels are not coming in the center of the region identified Through the above code the generated labels are as follows What i want is
How to use cv2.fillpoly function properly [closed]
Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 6 months ago. Improve this question I am trying to use the fillpoly function to fill two polygons at
Luminance Correction (Prospective Correction)
When I was searching internet for an algorithm to correct luminance I came across this article about prospective correction and retrospective correction. I’m mostly interested in the prospective correction. Basically we take pictures of the scene with image in it(original one), and two other ,one bright and one dark, pictures where we only see the background of the original picture.
How to create a video out of frames without saving it to disk using python?
I have a function that returns a frame as result. I wanted to know how to make a video out of a for-loop with this function without saving every frame and then creating the video. What I have from now is something similar to: Then the video will be created as video.mp4 and I can access it on memory. I’m
Repeated drawings of bounding box
I would like to simply make a bounding box that uses points(any amount) to follow my mouse around. Error being when I draw the bounding box currently it repeats all the previous drawings and have repeated bounding boxes Answer You had already the right idea creating a clone from the original image, but just forgot to set the clone back