I was trying to make faster my frames in opencv, it was so slow using it normal, so I decided to ask it here Make faster videocapture opencv the answer was to use multi threading to make it faster, so I code it like this it give me no errors, but compared to my other code that is on the
Tag: opencv
Color is not responsive when Drawig a Circle function inside a loop
I would like to draw circles in a loop. I want each circle to have a different color, but when I do this, I only get one color. I tried the code on colab 4.1.2 Answer You need to create mat as uint8 type: matplotlib conversion is: NumPy arrays of type float applies pixel range [0, 1]. NumPy arrays of
create a rectangle around all the points returned from mediapipe hand landmark detection just like cv2.boundingrect does
I am using following code to detect hand landmarks using mediapipe I just want a rectangle around all the points returned by the detector Please tell if there is any way to do so built in mediapipe or using opencv Answer Before the while loop, determine the width and height each frame will be: For each landLM…
Converting Detectron2 instance segmentation to opencv Mat array
I am trying to get a binary image from the instance segmentation output performed using Detectron2. According to the official documentation the mask’s output format is the following: “pred_masks”: a Tensor of shape (N, H, W), masks for each detected instance. So i tried converting it to numpy: mask = ou…
Is there any possible way to get findout extreme points exactly on static image in python?
I need to findout extreme points of a image(cloth). I have tried with https://www.geeksforgeeks.org/find-co-ordinates-of-contours-using-opencv-python/ but i need to findout like this, But the current issue is for some images it is detecting currectly and for some images it is not. Can anyone help on this? the…
Saving an image as jpg gives me plain black
I am implementing gabor kernels, when I display the kernels while running the code (before saving them) they give me a picture like this But after saving the kernels as jpg images using cv2.imwrite, I get like that Any explanations? and how to save the kernels as in the first image? Answer There could be diff…
Line detection issue – OpenCV in Python
I have written the following script with which I aim to detect lines in Gazebo (a simulation environment): The code is integrated in ROS, so please focus your attention at the image_callback function. My issue is that the line that I want to detect is quite noisy and I cannot figure out how to detect it corre…
cv2.error (-215:Assertion failed) reader.ptr != NULL in function cvDrawContours
So I’m trying to create a license plate detection program and I have been following a guide for that, (https://github.com/nicknochnack/ANPRwithPython/blob/main/ANPR%20-%20Tutorial.ipynb) however I am currently running into a problem. I have also tried to change “location” to 0 or [0] but to …
Import “cv2” could not be resolved
I’ve installed python and opencv by using the correct commands in the cmd, but when I type in ‘import cv2’ in a python then I get the error in visual studio code and I can’t find any solution online how to fix this More of the error in the terminal Answer I noticed that Visual Studio d…
Display stream with FFmpeg, python and opencv
Situation : I have a basler camera connected to a raspberry pi, and I am trying to livestream it’s feed with FFmpg to a tcp port in my windows PC in order to monitor whats happening in front of the camera. Things that work : I manage to set up a python script on the raspberry pi which is responsible