Questions tagged [opencv]

OpenCV (Open Source Computer Vision) is a library for real time computer vision. When using this tag, please mention the OpenCV release you're working with (e.g. 3.4.6), and add a language specific tag (python, c++, ...) if needed.

0
votes
0answers
9 views

Represent 3 values as 1 in numpy array

I am attempting to convert a 3 channel numpy array to a single channel numpy array. I want to combine all 3 element values into 1 number using: x << 16 + y << 8 + z My code below does ...
0
votes
0answers
7 views

How to process OpenCV C++ contours on a cloud?

I have OpenCV code in C++ with a list of contours that I want to have processed on a cloud and then have the cloud return data back. Can someone please tell me what I need to learn in order to ...
1
vote
0answers
12 views

Is there a way to use openCV-python to recognize multiple photos on a white background?

Basically, I have scanned in many old photos using our printer. About four photos fit on each page of the scan (around the four corners of the page), and the white space isn't always completely white. ...
0
votes
2answers
14 views

Plot values not updated in OpenCV's VideoCapture

I am trying to plot facial key points on the video frame using Open CV Video Capture. I am using a trained pytorch CNN model. Here is the code: cap = cv.VideoCapture(0) time.sleep(2.0) while cap....
1
vote
0answers
18 views

Apply VR lens distortion (barrel distortion) to live video feed

I am trying to create a custom VR headset that displays a live feed from a remote camera, and in order for the view to be clear from the vr headset, I need to duplicate the image from the camera for ...
0
votes
0answers
12 views

How to extract bounding box coordinates from an image with OpenCV?

I have been trying to extract a bounding box that has been drawn on an image (frames of a video in this case). I am stabilizing UAV videos that have bounding boxes on them, then need to extract those ...
-1
votes
0answers
17 views

Python OpenCV return black image form external camera

I'm trying to change the input source for OpenCV to an external camera. It opens a dialog asking me to select a capture source and when I select the external USB camera (C170) it only shows a black ...
0
votes
0answers
23 views

how to drawing boundary box for large data set of images with (display sequential images)?

i download many images to make my model put i faced a problem to make boundary box. the problem is when i run code all photos pop up at the same time i try many ways to make it display sequentially ...
-1
votes
1answer
37 views

How can I resize a directory full of images to desired width and height in python?

I am working on a python script to resize all of my images inside of a directory to a set width and height. my issue is that it doesn't properly read my image when using cv2.resize(). I know there ...
-2
votes
0answers
19 views

How to set up treshold level(value) in opencv(python)?

I'm trying to set up the value of treshold in opencv(see the code below) how I can set up this value to 0.5? import cv2 import numpy as np # import image image = cv2.imread('photo1.png') # ...
0
votes
0answers
11 views

How do we get rid of the duplicate box in Python?

I'd like to remove the overlapping boxes from Python. like this I want to get rid of the red box coordinates here and know only the black box coordinates. Now, I'm doing it by removing it if it's ...
-2
votes
1answer
24 views

i just get a big X on my image not on the road marking

before it would show me the lines but when I tried to make the lines blue and add them to the image I just get a massive blue X on my image? I've rewritten the code again and even found a tutorial ...
1
vote
0answers
12 views

Problem in testing my function with Catch2Farmework

I have written a function FindTopEnd which takes some arguments as shown. This function moves from bottom to up in a straight vertical line and checks for black pixel. If black pixel is found then it ...
0
votes
0answers
11 views

How to detect coordinates of each of the cells using binary image of the cell borders using OpenCV?

I have this image with some tables in it. The borders of the tables are white and the rest of the image is black. I want to find the coordinates(bottom right and top left) of each of the cell in that ...
-2
votes
0answers
16 views

What approaches can be used to identify employees loittering [on hold]

I need to find if two employees are idle or not. Like if they are whiling away their time by talking to each other. The base used is proximity. If a person is close to the other then there are chances ...
0
votes
0answers
26 views

OpenCV--How to detect video bad frame?

I have a homework to classify two kind of images, one is abnormal like pic 1,2,3 and another is normal like pic 4,5, is there any method or arithmetic to help me to solve this problem? It is like some ...
-5
votes
0answers
16 views

How to detect road edges without lane lines?

As you can see in the image below, the lane lines are not clear. So how can I detect the edges of the road using something else (like the green grasp on the sides)? Here's the image
0
votes
0answers
20 views

Different results of face detection for different sources of video

Example of code above should detect faces on videos. For detection i use open face detection DL model from caffe. The problem that face detection works just when source of video is web camera. When I ...
1
vote
0answers
13 views

how to get points mapping after opencv Stitching

I use OpenCV Stitcher class to stitch multiple images together and I can get the final image. But I was wondering how can I get points mapping between original images and stitched image. For example: ...
1
vote
0answers
44 views

OpenCV: How to find a coordinate in an image without overloading memory?

I want to find a coordinate in an image based on color. where the provisions of the coordinates are white. what I ask is how to check it without overloading memory (efficiently memory) and running ...
-3
votes
2answers
45 views

Python - Invalid literal for int() with base 10: 'x'

I'm working on a program to detect faces and lock computer if there exists some unknown face on the real-time. I'm collecting 21 images first and then training the model, but there exists an error ...
1
vote
0answers
28 views

crop random shaped polygon from an image and paste the cropped shape in a random place of another image

I'm a total beginner in python and opencv. Basically, I googled around and found 3 sets of code. Now, I'm just trying to put them together in order to achieve my target which is "crop random shaped ...
0
votes
1answer
28 views

Font matching using image moments in OpenCV

I am creating a code which will tell me how similar two letters are to each other. For this, I decided to go with HuMoments concept in OpenCV. Given are the images that I have Co.jpg C0.jpg A.jpg ...
0
votes
0answers
16 views

opencv cmake warning meanings: CMakeLists.txt:1066 (include)

I am now building from source the opencv4.1.0 with cmake3.13. The cmake configuration gives a warning message saying: CMake Warning at cmake/OpenCVGenSetupVars.cmake:54 (message): CONFIGURATION IS ...
0
votes
0answers
21 views

OpenCV Error: Incorrect size of input array () in cvGetSubRect

Following a tutorial on how to train you own cascade. When I run the OpenCV code below opencv_createsamples -img image1.jpg -bg bg.txt -info info/info.lst -pngoutput info -bgcolor 0 -bgthresh 0 -...
1
vote
3answers
42 views

Count number of unique colours in image [duplicate]

I am trying to count the number of unique colours in an image. I have some code that I think should work however when I run it on an image its saying a I have 252 different colours out of a possible ...
0
votes
0answers
18 views

How to rebuild opencv using the previously generated cmake files

I want to rebuild my opencv with one added configuration option, that is, with OPENCV_ENABLE_NONFREE checked. I don't want to delete all the previous cmake generated files and reconfigure everything. ...
0
votes
1answer
28 views

OpenCV: Contours hidden behind mask. How to detect when a contour is about to move near mask edge?

Summary of Question I am detecting object silhouettes in front of a light source. To simplify the background and remove noise, I require masking everything that isn't the light source. How can I ...
0
votes
0answers
19 views

What are some ways to extract tables without any grid from pdf files in python?

I'm working on a project which requires me to automate the task of data extraction from tables in a pdf file. I'm using python for this project. I'm wondering if there is any better way to approach ...
0
votes
0answers
30 views

Although opencv installed successfully I get the error “ModuleNotFoundError: No module named 'cv2'”

As far as I can tell I've successfully installed opencv (in two different ways) yet continue to get the error message ModuleNotFoundError: No module named 'cv2' First I tried using cmd (ran as ...
0
votes
0answers
6 views

how to improve dpi with preprocessing to be to made readable by tesseract -ocr

while True: _,gray=cap.read() #gray=cv2.pyrMeanShiftFiltering(gray,10,30) gray=cv2.blur(gray,ksize=(5,5)) gray=cv2.cvtColor(gray,cv2.COLOR_BGR2GRAY) gray=cv2.resize(gray,(300,200)) ...
1
vote
1answer
44 views

python error: tuples indices must be integers or slices not tuples

I am trying to display rectangles in an image using cv2. However due to the following error I cannot make them on the image. I have converted the image into numpy array and tried to write down the ...
2
votes
1answer
35 views

Python extract multiple objects from image opencv

I am trying to extract object from an image using the color using Opencv, i have tried by inverse thresholding and grayscale combined with findContours but I am unable to use it recursively. ...
1
vote
0answers
29 views

How to draw a fitting rectangle inside a irregular image area in python? [duplicate]

I have an image on which I applied segmentation task. Now I want to draw a largest fitting rectangle inside the irregular segmented area, how to acheive the same? My aim is to get coordinates of the ...
0
votes
1answer
32 views

Why is it giving me TypeError: Expected cv::UMat for argument 'src'?

I am finding trouble with some code that I am writing for homework. I think that mask = source[B-R].point(lambda i: i < -26) can't be assigned to the function cv2.dilate(mask, kernel,iterations=1) ...
0
votes
1answer
19 views

How can I convert Mat to Bitmap?(Run on linux ,not android) [duplicate]

I'm using OpenCV read image to Mat with Java, then put image pixels to JNI, however, the JNI required to use Bitmap format How can I convert Mat to Bitmap with Java? It should run on Ubuntu.
0
votes
1answer
19 views

add directories as object-libraries to interface-library

The official way to build opencv_contrib packages with opencv is to build them with additional flags. This works well, but is not what I'm looking for, since I wanted to test out - and eventually ...
1
vote
1answer
44 views

Image Rotation gives grayscale image

I got a problem with my Rotate image function in C++, Using OpenCV and Qt. It kinda does his job, but not as expected, apart of being in grayscale, a part of the image seems to be duplicated at the ...
0
votes
0answers
9 views

Haar Cascade training error - What does it mean when your trained cascade draws tons of boxes?

I am using Haar Cascade Trainer Gui [https://amin-ahmadi.com/cascade-trainer-gui/] . I have over 1000 negative images and positive images of dogs. The images of dogs I found online at [www.kaggle.com]....
0
votes
1answer
24 views

How to use emxArray_cell_wrap_0 in Visual Studio and C++?

The Matlab script I used for the coder is: function [B,N]=run_bwboundaries(im) if coder.target('MATLAB') else coder.rowMajor; [B,~,N]=bwboundaries(im); end I wanted run_bwboundaries to ...
0
votes
1answer
30 views

Video/image analysis to acquire distances between contours

I'm trying to quantify the distance between two contours in a video of a microvessel (see snapshot) Image analysis structure Right now I'm only able to select for one contour (which is outlined) and ...
0
votes
0answers
24 views

how can can I speed up new.forward() process in OpenCV having CUDA?

How can can I speed up new.forward() process in OpenCV in Python having CUDA? when I write net.setPreferableTarget(cv2.dnn.DNN_TARGET_OPENCL) I'm getting speed twice as slow And show up next ...
0
votes
0answers
10 views

Able to get pictures from video stream of an ip webcam in local but fails in cloud function , google compute engine VM instance

I have installed IP webcam in my android and video streaming. If I open the url, it's showing the live video in my web browser. I am able to successfully get pictures from a live video stream using ...
0
votes
0answers
15 views

How to reduce the thickness of the contours?

I am trying OCR using opencv and python. My sample images have really thick alphabets which leads to thick contours when extracted from the canny edge version of the image. Due to thick contours the ...
1
vote
1answer
18 views

Segmenting wedges from a Binary image with opencv

I have a B/W image, how do I go about identifying the wedges in the input image as shown in the marked image? Input image Wedges marked on image
0
votes
0answers
16 views

How can I fix this error on the compilation of OpenCV through mingw32-make?

I'm trying to compile the latest version of opencv 3 in windows for Mingw64, using cmake-gui and I've been encountering some errors in the compiling the source files. I have had a number of problems ...
0
votes
0answers
14 views

Take user input from mouse (ROI) for processing a particular region

I am currently hard coding the coordinates and processing the video file. I would like the user to select a particular region to process particular region instead of whole video file. This is a ...
0
votes
0answers
16 views

Assertion Error while calling openCV's dnn module's NMSBoxes function

I am trying to use non-maxima suppression for suppressing multiple bounding boxes in object detection. I tried using code with Felzenszwalb et al. proposed algorithm and Malisiewicz's algorithm, but ...
0
votes
0answers
15 views

Image filter kernel edge problems (Reflect values on edge)

I want to handle some edge problems that occur when using differently sized kernels on images. First of all: I know there are prebuilt options in opencv for handling these cases but since this is an ...
0
votes
0answers
15 views

Is there a generic way to detect lighters on opencv despite shadows or backgrounds' colors?

I'm new in openCV and I'm trying to find a generic way to detect lighters. I'm trying to code a solution that won't be perturbed by shadows, background's colors... I have tried a lot of methods on ...