contour

getting error : contours is not defined for my hand-web-browser project

getting error : contours is not defined for my hand-web-browser project Question: I am trying to build a project "hand_web_browser", the primary objective of this project is to open web pages using hand-gestures. But, I am getting an error at line 55 which says cnt = max(contours, key=lambda x: cv2.contourArea(x)) NameError: name ‘contours’ is not …

Total answers: 1

How to draw a contour plot from a dataframe

How to draw a contour plot from a dataframe Question: I want to draw a contour plot using table data. I have 2 variables and response (3 columns). I dont understand how to build this plot using it. I tried code below. But I had a next mistake: Input z must be 2D, not 1D. …

Total answers: 2

How to find intersection points between lines and contours

How to find intersection points between lines and contours Question: Consider the below image where contours is shown in green and straight lines are shown in red how can we find point of intersections where straight lines cuts contours import cv2 from matplotlib import pyplot as plt import numpy as np # Read image img …

Total answers: 1

Thersholding using cv2.inRange() function

Thersholding using cv2.inRange() function Question: I am trying to seperate objects within certain color ranges in an image using opencv/python. I am using cv2.inRange() function for that and when I pass the following parameters to it cv2.inRange(hsv,(0,0,0),(170,255,255)) hsv being my image, it raises the error below: File "c:/Users/fazil/Desktop/Bilgisayar Bilimi/Python/Python Konuları/Opencv/Projeler/Object Tracking.pyw", line 59, in find_the_positions …

Total answers: 1

What does cv2.approxPolydp() return?

What does cv2.approxPolydp() return? Question: I am trying to resize an image according to the contour detected after applying cv2.approxPolyDP() . Afterwards, I have to custom crop it using cv2.resize() with dimensions for cropping according to the return values of the contour detected by the cv2.approxPolyDP(). I want to know which index is the height …

Total answers: 1

How to find contour of an image with missing part?

How to find contour of an image with missing part? Question: Grocery bill: As some of the top and bottom part of the image is missing the biggest contour i.e. the main bill cannot be cropped. The code works well in case of a complete bill image but fails to handle a missing-vertex image. Code: …

Total answers: 1

OpenCV Find a middle line of a contour [Python]

OpenCV Find a middle line of a contour [Python] Question: In my image processing project, I have already obtained a masked image (black-and-white image) and its contours using the cv.findContours function. My goal now is to create an algorithm that can draw a middle line for this contour. The masked image and its contour are …

Total answers: 4

OpenCV draw contours (Jupyter Notebook)

OpenCV draw contours (Jupyter Notebook) Question: I run the following code from Jupyter Notebook: import cv2 as cv contours, hierarchy = cv.findContours(im, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE) cnt = contours[4] cv.drawContours(im, contours, 2, (0, 230, 255), 6) # Show the image with contours cv.imshow(‘Contours’, im) cv.waitKey(0) (im is a binary image) After running this, the Jupyter Kernel dies. …

Total answers: 1