I am trying to make a color detection from the default camera using python, to do this I am using OpenCV and NumPy. My program suddenly closes the camera. This is code I’m trying to run: Answer There are three stages to do this task: Firstly you need to make a color boundries Color detection Stack them …
Tag: opencv
How to compare first frame to other frame of video opencv python
I want the first frame of video to compare with other frames of video and calculate ssim (similarity) based on the first frame. How to do this search a lot but not getting the desired result. Answer @Ceopee is right and there is no error in that tutorial. The idea is simple: Code:
Opencv-Overlay a Video on Webcam
Guys I am having problem on overlaying my video to webcam. I can open webcam without any issues or errors but my video is not being showed. I am trying to play my video in specific x-y coordinates.I take most of my code from an other stackoverflow question but I cannot find it know so that I cannot mention it
Turning an Open CV frame into a Base64 encoded JPEG
I want to take a frame from an Open CV webcam stream, produce a JPEG thumbnail and then encode it as Base64 (It will then be sent as an MQTT message, but this is not the problem). My Python “sendimage” function is: It seems to work as far as the cv2.imencode, but the base64.b64encode fails with. E…
OPENCV – !ssize.empty()
THIS IS MY CODE: Guys, this is the part of my code. I am trying to resize my image but ıt gives the following error: error: OpenCV(4.0.1) C:ciopencv-suite_1573470242804workmodulesimgprocsrcresize.cpp:3784: error: (-215:Assertion failed) !ssize.empty() in function ‘cv::resize’ Do you have any sugge…
OpenCV – Detect points along a curve
I need to detect the points along these curves, in particular I need the position on the image of one of the two points starting from the left: I tried to detect Hough Points like that: But it doesn’t get the right points and I suppose that this is because the points are positioned along the two curves.…
How to find the principal axis of a blob which goes through the centroid of the blob?
I want to find the principal axis of a blob which goes through the centroid of the blob. I was able to find the centroid of the blob, but how can I find the principal axis? Here’s what I have tried: These are the images that I used: I’m expecting something like this. It should connect with the con…
Bounding box detection for characters / digits
I have images, which look like the following: I want to find the bounding boxes for the 8 digits. My first try was to use cv2 with the following code: Unfortunately that doesn’t work. Does anyone have an idea? Answer The problem in your solution is likely the input image, which is very poor in quality. …
Adaptive Threshold error: (-215:Assertion failed) src.type() == CV_8UC1 in function ‘adaptiveThreshold’
I am working on pre-trained vgg16 model, for that I need to have input size of image file to be (224,224,3). The code I am working on is: Help me in resolving the issue. Answer The error says the solution: src.type() == CV_8UC1 meaning you need to set your image type to the uint8 source So if you redefine you…
How to apply an operation to every PIXEL (not every rgb component!) of a python image (either using numpy, opencv or PIL)?
I’m trying to apply a function over all pixels of an image (in my specific case I want to do some colour approximation per pixel, but I don’t think this is relevant for the problem) in an efficient way. The thing is that I’ve found different approaches to do so, but all of them apply a funct…