opencv3.0

ImportError: dynamic module does not define module export function (PyInit_cv2)

心已入冬 提交于 2019-12-19 07:35:07
问题 When I try to import cv2 in IPython , I am getting this error- ImportError: dynamic module does not define module export function (PyInit_cv2) I have opencv 3.0, ubuntu 14.04, python 3.4. I searched online but couldn't get any answer. 回答1: Python3 libraries usually can be found in: /usr/lib/python3/dist-packages I found out that the library cv2.cpython-34m.so is needed for Python3.4. But this file wasn't be contained in my default library directory. In my environment, this library was stored

Speed up live plotting of a footage (cv2)

佐手、 提交于 2019-12-19 04:50:32
问题 I am attempting to use the cv2 module to create a live scatter plot for each frame of a video. The code below does exactly that. However with more than 8 minute of footage containing more than 60000 frames to process, the code is not efficient and does take much longer than necessary to get the desired output. vidcap = cv2.VideoCapture(filepath) fig, ax = plt.subplots(1) plt.ion() x=df["time"][7:100] y=df["force"][7:100] for i in range(len(x)): vidcap.set(1,590) ret, image = vidcap.read()

Using OpenCL accelerated functions with OpenCV3 in Python

不问归期 提交于 2019-12-18 16:53:40
问题 OpenCV3 introduced its T-API (Transparent API) which gives the user the possibility to use functions which are GPU (or other OpenCL enabled device) accelerated, I'm struggling to find how to tap into that with Python. With C++ there are calls like ocl::setUseOpenCL(true); that enable OpenCL acceleration when you use UMat instead of Mat objects. However I found no documentation whatsoever for Python. Does anybody have any sample code, links or guides on how to achieve OpenCL acceleration with

input arguments of python's cv2.calibrateCamera

廉价感情. 提交于 2019-12-18 13:31:52
问题 I get the following error when I try to calibrate camera using cv2.calibrateCamera: rms, camera_matrix, dist_coefs, rvecs, tvecs = cv2.calibrateCamera(pts3d, pts2d, self.imgsize, None, None) cv2.error: /home/sarkar/opencv/opencv/modules/calib3d/src/calibration.cpp:2976: error: (-210) objectPoints should contain vector of vectors of points of type Point3f in function collectCalibrationData I initially had nx3 and nx2 array for pts3d and pts2d. I then tried to reshape pts3d and pts2d in the

How do I use SIFT in OpenCV 3.0 with c++?

夙愿已清 提交于 2019-12-18 11:02:39
问题 I have OpenCV 3.0, and I have compiled & installed it with the opencv_contrib module so that's not a problem. Unfortunately the examples from previous versions do not work with the current one, and so although this question has already been asked more than once I would like a more current example that I can actually work with. Even the official examples don't work in this version (feature detection works but not other feature examples) and they use SURF anyway. So, how do I use OpenCV SIFT on

OPENCV Desktop Capture

老子叫甜甜 提交于 2019-12-18 09:17:25
问题 How to capture the desktop in OpenCV (ie. turn a bitmap into a Mat)? Hello, Can anyone explain to me how I would use this code in OpenCV to capture the desktop screen? I've been trying to get it to work for about 30-45 minutes but my screen doesn't capture anything when I run it. In my application from main I have the follow three statements HWND hwndDesktop = GetDesktopWindow(); hwnd2mat(hwndDesktop); imshow("output", src); i'm calling the function hwnd2mat that is found in the link above. i

compatibility issue with contourArea in openCV 3

て烟熏妆下的殇ゞ 提交于 2019-12-18 04:32:16
问题 I am trying to do a simple area calculation of contours I get from findContours. My openCv version is 3.1.0 My code is: cc = cv2.findContours(im_bw.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) cv2.contourArea(cc[0]) error: 'C:\\builds\\master_PackSlaveAddon-win32-vc12-static\\opencv\\modules\\imgproc\\src\\shapedescr.cp...: error: (-215) npoints >= 0 && (depth == CV_32F || depth == CV_32S) in function cv::contourArea\n' Cant seem to solve it, I have a feeling its just typecasting altough I

AttributeError: 'module' object has no attribute 'ORB'

对着背影说爱祢 提交于 2019-12-17 23:17:15
问题 when I run my python code import numpy as np import cv2 import matplotlib.pyplot as plt img1 = cv2.imread('/home/shar/home.jpg',0) # queryImage img2 = cv2.imread('/home/shar/home2.jpg',0) # trainImage # Initiate SIFT detector orb = cv2.ORB() # find the keypoints and descriptors with SIFT kp1, des1 = orb.detectAndCompute(img1,None) kp2, des2 = orb.detectAndCompute(img2,None) # create BFMatcher object bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True) # Match descriptors. matches = bf.match

What is the cv2.cv replacement in OpenCV3?

て烟熏妆下的殇ゞ 提交于 2019-12-17 22:37:09
问题 I'm using OpenCV3, and with the python bindings there is no cv2.cv module: In [1]: import cv2 In [2]: from cv2 import cv --------------------------------------------------------------------------- ImportError Traceback (most recent call last) <ipython-input-2-15a6578c139c> in <module>() ----> 1 from cv2 import cv ImportError: cannot import name cv However, I have some legacy code of the form: hsv_im = cv2.cvtColor(image, cv2.cv.CV_BGR2HSV) When running this, I get the error: In [7]: hsv_im =

How to get color palette from image using opencv? [closed]

允我心安 提交于 2019-12-17 07:42:40
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . I'd like to extract the color palette of an image, similar to this (from here): I need it to extract specific colors like yellow, green, and brown and display the percentage of the area covered by that color. Also, I can add more colors to extract. How can I reduce the number of