opencv-python

expand a selection of pixels in opencv 2

expand a selection of pixels in opencv 2 Question: I have a selection mask on an image in cv2 and I want to expand the selection of pixels such that every pixel within a radius R of an already selected pixel can be added to the selection. I would like for it to work identical …

Total answers: 2

Get confidence of template matching for object with multiple instances by using cv2.TM_CCOEFF_NORMED

Get confidence of template matching for object with multiple instances by using cv2.TM_CCOEFF_NORMED Question: I’m using template matching for searching for an object with multiple instances. I’m referring to the tutorial in https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_template_matching/py_template_matching.html#template-matching-with-multiple-objects This is the code which I use currently import cv2 import numpy as np from matplotlib import pyplot as plt img_rgb = …

Total answers: 1

cv2 contourArea returned value

cv2 contourArea returned value Question: I went through the opencv-python documentation for the method cv2.contourArea() in order to understand the context of the returned value. But i need some clarification. For instance, if the area of a contour is 32.0, how does it translate to the number of pixels in the image (width or height)? …

Total answers: 1

Find If Image Is Bright Or Dark

Find If Image Is Bright Or Dark Question: I would like to know how to write a function in Python 3 using OpenCV which takes in an image and a threshold and returns either ‘dark’ or ‘light’ after heavily blurring it and reducing quality (faster the better). This might sound vague , but anything that …

Total answers: 4

Cannot import cv2 on PyCharm

Cannot import cv2 on PyCharm Question: I am trying to import cv2 module in PyCharm, but it shows error. I tried in terminal as well pip install opencv-python pip3 install cv2 pip install opencv-python pip3 install cv2 and whatnot. Trying to install opencv-python from terminal shows this Requirement already satisfied: opencv-python in ./anaconda3/lib/python3.6/site-packages (3.4.1.15) and …

Total answers: 4