contour

Get the contour (outline) from a png image with the correct edges

Get the contour (outline) from a png image with the correct edges Question: I have multiple png files and I’m trying to get the polygon contour coordinates. That is the simplified coordinates, only each outer corner (not a convex hull polygon). The program that will do this at the moment is python and opencv. But …

Total answers: 1

How to filter contours based on their approximate shape in a Binary video frames

How to filter contours based on their approximate shape in a Binary video frames Question: I’m working on a project where i have to detect a red vehicle (please see image below). As i believe that this can be achieved with out using Deep learning (overkill in this case), i used histogram Back projection depending …

Total answers: 2

Sorting contours based on precedence in Python, OpenCV

Sorting contours based on precedence in Python, OpenCV Question: I am trying to sort contours based on their arrivals, left-to-right and top-to-bottom just like how you write anything. From, top and left and then whichever comes accordingly. This is what and how I have achieved up to now: def get_contour_precedence(contour, cols): tolerance_factor = 61 origin …

Total answers: 4

Shape Openness detection in OpenCV

Shape Openness detection in OpenCV Question: I’m building a shape analysis algorithm and one of the attributes we would like to add is whether the shape is open or closed. For example, the left circle is closed, the middle circle is open and the right circle is more open. I tried to do it via …

Total answers: 2

OpenCV findContours() detects contours only if the image is saved and read beforehand

OpenCV findContours() detects contours only if the image is saved and read beforehand Question: Providing some context: I am trying to get the number of boxes in this image, I have the above image stored in an ndarray blank_img. If I run the following: v = np.median(blank_img) sigma = 0.33 lower = int(max(0, (1.0 – …

Total answers: 1

How to read the result of cv2.findContours?

How to read the result of cv2.findContours? Question: I have a binary 2D-matrix b with shape (340,490) and apply cv2.findContours(b,1,2) on it. The result is a 3D array with shape (6, 2, 1) like [[90,3],[5,60],[90, 110],[5,135],[3,200],[3,3]]. I can’t read it. I applied cv2.drawContours(b,contours, -1, (0,0,255), 3) It worked prefected. Since I have bunch of noisy …

Total answers: 1

How do i separate overlapping cards from each other using python opencv?

How do i separate overlapping cards from each other using python opencv? Question: I am trying to detect playing cards and transform them to get a bird’s eye view of the card using python opencv. My code works fine for simple cases but I didn’t stop at the simple cases and want to try out …

Total answers: 3

4 corners of a playingcard with contours

4 corners of a playingcard with contours Question: Im trying to find coordinates of 4 corners of a playingcard so i can use it to warpPerspective of the card and later use for recognition. I have tried using cv.boundingRect, but as im using a live videofeed, i only need the card and not the closest …

Total answers: 1

How to detect a contour or spot on the edge?

How to detect a contour or spot on the edge? Question: I’m trying to detect the black spots on the following image. I use adaptive thresholding and use find contours in opencv. This method is successful for detecting most of the black spots inside the gray background. However, it’s not able to detect the spots …

Total answers: 1

Detect colorful dots in image in python?

Detect colorful dots in image in python? Question: I’m trying to detect colorful dots on a white/gray background. The dots are 3 different colors (yellow, purple, blue) of different sizes. Here is the original image: I converted the image to HSV and found lower and upper bounds for each image then applied contour detection to …

Total answers: 1