OpenCV

Problems while taking screenshots of a window and displaying it with OpenCV

别说谁变了你拦得住时间么 提交于 2021-01-28 20:10:52
问题 When i run this code on my desktop pc it runs fine. but when i run it op my laptop something goes wrong when i set the bounding box for the image grab to the bounding box of the windows calculator and the screen recording of the window and places it self a little up and to the left. import cv2 import numpy as np from PIL import ImageGrab import win32gui def windowGrab(window_title=None): if window_title: global hwnd hwnd = win32gui.FindWindow(None, window_title) if hwnd: win32gui

“opencv2: no such file or directory” while trying to build Darknet?

不想你离开。 提交于 2021-01-28 19:58:39
问题 I am trying to use Darkent with OpenCV and CUDA. I installed darknet according to these instructions: https://pjreddie.com/darknet/install/ I installed CUDA according to these instructions: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html Finally, I installed OpenCV according to these instructions: http://www.linuxfromscratch.org/blfs/view/svn/general/opencv.html I then added the following lines to the end of my bashrc: export PATH=/usr/local/cuda-11.1/bin${PATH:+:${PATH}

OpenCV outputing odd pixel values

折月煮酒 提交于 2021-01-28 19:14:34
问题 I want to do processing on images with C++ and have been using OpenCV. I've gotten a bit stuck though when it comes to trying to access each pixel individually. I can output the whole gray scaled image just fine using: cout << image; and get the expected output of values like so: [143, 147, 164, 177, 177, 185, 196, 195, 185, 186, 178, 190, 178, 163, 183... But when I try to output one pixel at a time using: for (int y = 0; y < image.rows; ++y) { for (int x = 0;x < image.cols; ++x) { std::cout

OpenCV dnn exception SSD Mobilenetv2

╄→尐↘猪︶ㄣ 提交于 2021-01-28 19:05:54
问题 Using transfer learning, I trained SSD MobileNetV2 (ssd_mobilenet_v2_coco.config) model in TensorFlow (tensorflow-gpu==1.15.0). After freezing the graph (.pb) using TensorFlow API Python script (export_inference_graph.py), I created a text graph (.pbtxt) using the Python script provided in OpenCV wiki (tf_text_graph_ssd.py). I used the Python code snippet from the wiki to test inference, but I am getting the following error: cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules

camera to object distance calculation using opencv and python

為{幸葍}努か 提交于 2021-01-28 18:27:37
问题 I am using Microsoft Lifecam HD 3000 on my quadcopter for autonomous landing . I wish to calculate the distance between the onboard camera on the quadcopter and a landing pad which has a rectangle printed on it. The distance can then be fed as error to the PID controller. i am using python to code this. Could anyone suggest a simple way to find the distance. PS: I don't need the exact value of distance 回答1: If the landing rectangle size is known/constant then it is doable some data to prepare

Blending multiple images with OpenCV

柔情痞子 提交于 2021-01-28 18:16:27
问题 What is the way to blend multiple images with OpenCV using python? I came across the following snippet: img = cv2.addWeighted(mountain, 0.3, dog, 0.7, 0) on https://docs.opencv.org/3.4/d5/dc4/tutorial_adding_images.html that shows a way to blend 2 images mountain and dog . What if I want to blend more than 2 images? How could I do this? 回答1: Try This: blendedImage = weight_1 * image_1 + weight_2 * image_2 + ... + weight_n * image_n 回答2: You can blend all of your images by blending according

Extracting digits from image with python and OpenCV

独自空忆成欢 提交于 2021-01-28 18:10:36
问题 I am looking for some coding solution/help to extract the digits from the LCD display and then output the value from the image. Below is the code and example images and how I got so far, but I need some further help to actually extract the "digits" from the image and output the value. I have made digits lookup table from an earlier example, # import the necessary packages from imutils.perspective import four_point_transform from imutils import contours import imutils import cv2 # define the

Interpretation of projectPoints() function

大憨熊 提交于 2021-01-28 18:10:17
问题 I am working on converting 3D real-world points (X,Y,Z) meters to image coordinates (u, v) pixels. I have access to the Camera matrix K, camera orientation (in degrees) and translation vector. I use the code below to calculate the pixel coordinates. For (X,Y,Z) = (0.04379281, 0.15902013, 0.73328906) , I obtain (u, v) = (-184.52735432, -249.19158505) on an image of size 352x287 px . Is the origin of pixel coordinates in the image still top left corner? If yes, the obtained pixel location is

Interpretation of projectPoints() function

余生长醉 提交于 2021-01-28 18:03:39
问题 I am working on converting 3D real-world points (X,Y,Z) meters to image coordinates (u, v) pixels. I have access to the Camera matrix K, camera orientation (in degrees) and translation vector. I use the code below to calculate the pixel coordinates. For (X,Y,Z) = (0.04379281, 0.15902013, 0.73328906) , I obtain (u, v) = (-184.52735432, -249.19158505) on an image of size 352x287 px . Is the origin of pixel coordinates in the image still top left corner? If yes, the obtained pixel location is

opencv for java videowriter can't open

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-28 18:00:56
问题 I'm using opencv3.1.0 in java. I want to save video to file, but videowriter can't open. My code below: Size size = new Size(capture.get(Videoio.CAP_PROP_FRAME_WIDTH), capture.get(Videoio.CAP_PROP_FRAME_HEIGHT)); double fps = capture.get(Videoio.CAP_PROP_FPS); VideoWriter vw = new VideoWriter("/home/sify/1.mp4", VideoWriter.fourcc('X', '2', '6', '4'), fps, size, true); vw.isOpened() returns false. No file is created. I'm suspecting it's something wrong with fourcc. I tried to use H264/XVID