OpenCV

How to compile OpenCV with extra modules on OS X?

为君一笑 提交于 2021-01-28 00:14:00
问题 I've previously compiled OpenCV 3.0 successfully following this guide, which essentially consists of the following steps: Download all the prerequisites (XCode, Command Line Tools, CMake and OpenCV source) Build static libs by configuring CMake (via gui) with: Uncheck BUILD_SHARED_LIBS Uncheck BUILD_TESTS Add an SDK path to CMAKE_OSX_SYSROOT (if it matters, I used /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk ). Add x86_64 to CMAKE_OSX

Image quality improvement in Opencv

倖福魔咒の 提交于 2021-01-28 00:00:31
问题 I have two images. One has more green color and another one has better quality (it has right color). How can I improve the first one to have the similar color as the second one.I used the contrast enhancement as //Contrast enhancement for (int y = 0; y < rotated.rows; y++) { for (int x = 0; x < rotated.cols; x++) { for (int c = 0; c < 3; c++) { //"* Enter the alpha value [1.0-3.0]: " //"* Enter the beta value [0-100]: "; rotated.at<Vec3b>(y, x)[c] = saturate_cast<uchar>(2.5*(rotated.at<Vec3b>

how to detect all the rectangular boxes in the given image

断了今生、忘了曾经 提交于 2021-01-27 23:29:52
问题 I tried to detect all the rectangles in image using threshold, canny edge and applied contour detection but it was not able to detect all the rectangles. Finally, I thought of detect the same using hough transforms but when I tried to detect lines in image, I'm getting all the lines. I need to detect only rectangular boxes in the image. Can someone help me? I'm new to opencv. Input image Code: import cv2 import matplotlib.pyplot as plt import numpy as np img = cv2.imread("demo-hand-written

python detect yolov5 from screen as video source

感情迁移 提交于 2021-01-27 22:53:38
问题 I have a script that grabs an application's screenshot and displays it. it works quite nicely on my machine like a video with around 60FPS. import os os.getcwd() from PIL import ImageGrab import numpy as np import cv2 import pyautogui import win32gui import time from mss import mss from PIL import Image import tempfile os.system('calc') sct = mss() xx=1 tstart = time.time() while xx<10000: hwnd = win32gui.FindWindow(None, 'Calculator') left_x, top_y, right_x, bottom_y = win32gui.GetWindowRect

Gaussian Low-pass Filter in Android OpenCV.

大兔子大兔子 提交于 2021-01-27 21:22:58
问题 In order to make an image with better quality, I had do lots of research on filters. Filters are categorized into low, medium and high. After an analysis of these categories of filters, I conclude that Gaussian low-pass filter is the most suitable for me. And I had researched on how to code it in Android. Finally I found that OpenCV has this function. After a few days of headache, I still can't find any solution since I am new to OpenCV. Does anyone can help me? 回答1: Take a look at this

Absolute differences of images in OpenCV using a mask

╄→尐↘猪︶ㄣ 提交于 2021-01-27 21:12:01
问题 i need to compute some absolute differences on a set of images. Not all of the pixels should be taken into account. Unfortunately the opencv function cv::absdiff() doesnt provide a mask parameter. I also tried the cv::subtract() function which does provide a mask param, but this one doesnt compute absolute values and cuts the negative results to 0. So does anyone knows a fast way to compute absolute differences on a masked image/matrix with opencv? Thx! 来源: https://stackoverflow.com/questions

python detect yolov5 from screen as video source

冷暖自知 提交于 2021-01-27 21:10:37
问题 I have a script that grabs an application's screenshot and displays it. it works quite nicely on my machine like a video with around 60FPS. import os os.getcwd() from PIL import ImageGrab import numpy as np import cv2 import pyautogui import win32gui import time from mss import mss from PIL import Image import tempfile os.system('calc') sct = mss() xx=1 tstart = time.time() while xx<10000: hwnd = win32gui.FindWindow(None, 'Calculator') left_x, top_y, right_x, bottom_y = win32gui.GetWindowRect

How to change camera exposure on android?

旧巷老猫 提交于 2021-01-27 20:42:59
问题 I want to perform image processing with OpenCV and android. In the first step, I need to change the camera properties like resolution, exposure, etc. By using OpenCV I only can change the resolution( mOpenCvCameraView.setMaxFrameSize(320,240); ) and cannot change exposure. By using OpenCV and camera2 When I run it, it is crashing(this code: pastebin.com/3XgvKGQN ). How can I change camera exposure? package com.williams.drew.opencvtest; import android.graphics.Paint; import android.hardware

How to use `cv2.perspectiveTransform` to apply homography on a set of points in Python OpenCV?

我的梦境 提交于 2021-01-27 20:23:41
问题 I want to apply homography to the following points: array([[-7.4894, 1.8873], [-7.4973, 1.8543], [-7.5375, 1.6725], [-7.5681, 1.522 ], [-7.5961, 1.371 ], [-7.6252, 1.2013], [-7.6504, 1.031 ], [-7.667 , 0.8985], [-7.6817, 0.7657], [-7.6954, 0.613 ], [-7.7054, 0.4786], [-7.7124, 0.3452], [-7.7182, 0.1931], [-7.7215, 0.0866], [-7.7716, 0.0872], [-7.7715, 0.0929], [-7.7651, 0.2884], [-7.7587, 0.4269], [-7.7528, 0.5233], [-7.7418, 0.6616], [-7.7275, 0.8116], [-7.7048, 1.0032], [-7.6916, 1.0988], [

Calculate the Affine transformation matrix in image Feature based registration

孤街醉人 提交于 2021-01-27 20:01:24
问题 I have two images, one is the result of applying an affine transform to the other. I can register them using homography by extracting the points using the ORB_create function in OpenCV. However, I want to calculate the Affine matrix needed for this transformation. is there any way of doing it simply by having the two images? 回答1: Detect a rotated rectangle and use its corners to get your transformation matrix Use : getPerspectiveTransform or getAffineTransform Edit: regarding rotated