OpenCV

how to make work opencv with FFMPEG driver

点点圈 提交于 2021-01-28 04:06:09
问题 I have a camera on my linuxbox it is working well: # $ ls -al /dev/video* # crw-rw----+ 1 root video 81, 0 janv. 8 16:13 /dev/video0 # crw-rw----+ 1 root video 81, 1 janv. 8 16:13 /dev/video1 # $ groups # adm cdrom sudo dip video plugdev lpadmin lxd sambashare docker libvirt From python with cv2 it work well with the default driver CAP_V4L2 >>> from pathlib import Path >>> import cv2 >>> print(cv2.VideoCapture(0, apiPreference=cv2.cv2.CAP_V4L2).isOpened()) True >>> I would like to access it

OpenCV can't draw keypoints

落花浮王杯 提交于 2021-01-28 04:02:34
问题 I tried to run the example code shown for ORB in the openCV page. First I had to figure out the problem of cv2.ORB() (changed to cv2.ORB_create() , the after this error, appeared this: Traceback (most recent call last): File "orb.py", line 17, in <module> img2 =cv2.drawKeypoints(img,kp,color=(0,255,0), flags=0) TypeError: Required argument 'outImage' (pos 3) not found After doing a lot of things shown in blogs and manuals, I decided to add img to this function img2 =cv2.drawKeypoints(img,kp

Using SIFT (or an alternative) in Python OpenCV 4.2.0 (In 2020)

久未见 提交于 2021-01-28 04:00:49
问题 I am trying to use SIFT for feature detection with Python, but it is no longer part of OpenCV or OpenCV contrib. With OpenCV opencv-contrib-python (both versions 4.2.0.34, the latest as of this question), I get: >>> import cv2 >>> cv2.SIFT_create() Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: module 'cv2.cv2' has no attribute 'SIFT_create' >>> cv2.xfeatures2d.SIFT_create() Traceback (most recent call last): File "<stdin>", line 1, in <module> cv2

Using SIFT (or an alternative) in Python OpenCV 4.2.0 (In 2020)

徘徊边缘 提交于 2021-01-28 03:49:10
问题 I am trying to use SIFT for feature detection with Python, but it is no longer part of OpenCV or OpenCV contrib. With OpenCV opencv-contrib-python (both versions 4.2.0.34, the latest as of this question), I get: >>> import cv2 >>> cv2.SIFT_create() Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: module 'cv2.cv2' has no attribute 'SIFT_create' >>> cv2.xfeatures2d.SIFT_create() Traceback (most recent call last): File "<stdin>", line 1, in <module> cv2

Get a sub image using opencv Java

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-28 03:08:18
问题 I have already looked at how to get sub image by using OpenCV in java api, but this did not help I am curious how to create a sub image of a Mat image that I have loaded in from a file. When I run: crop = img.submat(405, 450, 280, 335); I get : OpenCV Error: Assertion failed (m.dims >= 2) in cv::Mat::Mat, file ..\..\..\..\opencv\modules\core\src\matrix.cpp, line 269 Exception in thread "main" CvException [org.opencv.core.CvException: cv::Exception: ..\..\..\..\opencv\modules\core\src\matrix

How to compile OpenCV with extra modules on OS X?

泪湿孤枕 提交于 2021-01-28 02:57:29
问题 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

How to merge contours in opencv?

六月ゝ 毕业季﹏ 提交于 2021-01-28 02:50:33
问题 Ok guys I have been working on this project for quite some time now. I am building this bot that plays the chrome dinosaur game. So I tried other methods to detect the characters like matchTemplate and even made my own algorithm to locate the objects, but I like this one (findcontours) the most. Here's what I have: Can anyone help me find out how I should merge the two rectangles of the cacti? img = screen_cap() roi = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) ret, thresh = cv2.threshold(roi,127,

How to segment similar looking areas (color wise) inside a image that belong to biosamples with opencv and python?

邮差的信 提交于 2021-01-28 02:03:50
问题 I'm trying to analyze images of bio-films of pseudomona, I'm doing this in order to find some kind of correlation between its grow and distribution with some independent variables. I've applied a segmentation to obtain a circular area of interest and now I was thinking in applying some color segmentation to the image with its HSV values to just leave the areas with bio-film. I've trying to think in a way to completely isolate all the areas that are important, I applied a bitwise_not to the

OpenVINO: How to build OpenCV with Inference Engine to enable loading models from Model Optimizer

爱⌒轻易说出口 提交于 2021-01-28 01:08:58
问题 I installed OpenVINO and want to run the following code on windows 10. import numpy as np import cv2 import sys from get_face_id import face_id_getter from check import check from win10toast import ToastNotifier FP = 32 targetId = 0 toaster = None if '-use_notifications' in sys.argv: toaster = ToastNotifier() if len(sys.argv) > 1 and '-m' in sys.argv: FP = 16 targetId = cv2.dnn.DNN_TARGET_MYRIAD cap = cv2.VideoCapture(0) getter = None if '-get_face_id' in sys.argv: getter = face_id_getter()

Get a sub image using opencv Java

时光总嘲笑我的痴心妄想 提交于 2021-01-28 01:08:46
问题 I have already looked at how to get sub image by using OpenCV in java api, but this did not help I am curious how to create a sub image of a Mat image that I have loaded in from a file. When I run: crop = img.submat(405, 450, 280, 335); I get : OpenCV Error: Assertion failed (m.dims >= 2) in cv::Mat::Mat, file ..\..\..\..\opencv\modules\core\src\matrix.cpp, line 269 Exception in thread "main" CvException [org.opencv.core.CvException: cv::Exception: ..\..\..\..\opencv\modules\core\src\matrix