cv2

ModuleNotFoundError: No module named 'cv2'

我只是一个虾纸丫 提交于 2019-12-19 07:22:25
问题 I have been working on this error for a long time now. I have Python 3.6 and Python 2.7. I have tried to install opencv 2 and 3 in Python 2.7 and Python 3.6 respectively. I know the python interpreter I am using and I can interchange between them when I want. When I run Python interpreter and write import cv2 it does import it. When I run the code from command prompt it says ModuleNotFoundError: No module named 'cv2' . The module is installed. The cv2.pyd file is in C:\Python27\Lib\site

import cv2 dll load failed

耗尽温柔 提交于 2019-12-13 03:55:51
问题 When I passed on win7 (python3) pip install opencv-python pip install opecncv-contrib-python Can be correct import CV2 But when I installed opencv on window server 2008 R2 enterprise, this was the following error: In [2]: import cv2 --------------------------------------------------------------------------- ImportError Traceback (most recent call last) <ipython-input-2-c8ec22b3e787> in <module>() ----> 1 import cv2 c:\python36\lib\site-packages\cv2\__init__.py in <module>() 1 import importlib

How to play sound from a video (cv2) in Python

血红的双手。 提交于 2019-12-13 03:53:05
问题 I'm playing a mp4 file in python, but the sound of the video doesn't comes out, I searched for a while if it's anyway to play the sound, but I could not find anything. Does anyone knows how to play the sound? I post the code that displays de video : import cv2 import numpy as np # Create a VideoCapture object and read from input file # If the input is the camera, pass 0 instead of the video file name cap = cv2.VideoCapture('video.mp4') # Check if camera opened successfully #if (cap.isOpened()

How to use warp_matrix (from cv2.findTransformECC) with cv2.transform

夙愿已清 提交于 2019-12-13 03:39:27
问题 I've got an shape defined by an array of points [[x1,y1],[x2,y2],...,[xn,yn]] and an image (img1) with (almost) by I need to find where is this shape, by that I mean if a draw this shape at an arbitrary place on an image (img2) I find the affine transformation to go from an img1 to img2. I managed to do this cv2.findTransformECC. I get a warp_matrix. [img1] https://i.imgur.com/097V8YM.png [img2] https://i.imgur.com/dNUrgE8.png The code : def get_gradient(im) : # Calculate the x and y

Need help in understanding error for cv2.undistortPoints()

橙三吉。 提交于 2019-12-12 23:39:05
问题 I am trying to triangulate points from a projector and a camera using Structured Light in OpenCV Python. In this process I have a list of tuples that match one to one between the camera and the projector. I am passing this to cv2.undistortedPoints() as below: camera_normalizedPoints = cv2.undistortPoints(camera_points, camera_K, camera_d) However, python is throwing the following error and I am unable to understand what the error means. camera_normalizedPoints = cv2.undistortPoints(camera

Error while installing cv2 in pycharm - python 3.5.3

旧城冷巷雨未停 提交于 2019-12-12 18:19:24
问题 I am getting error while installing cv2 package from project interpreter. Error occured: Non zero exit code(1) When I execute command, pip install cv2..it gives error as, Could not find a version that satisfies the requirement cv2(from versions: )No matching distribution found for cv2 Please help me solve this error. 回答1: The package name is actually opencv-python . So you should do: pip install opencv-python However, the package is only available on pypi for version 3, not for version 2. I

CV2 Cannot connect to X server:

ⅰ亾dé卋堺 提交于 2019-12-12 14:01:47
问题 When I try to use cv2.imshow(), I get an error saying that it can't conect to X server. I'm running this locally, using bash in Windows Command Prompt. No servers, no VPNS, etc. Python 3.4, CV2 3.4 img = cv2.imread(fileName) cv2.imshow("Image", img) cv2.waitKey(0) 回答1: Encountered the same issue with bash on windows. had to install OpenCV using conda install instead. everything worked fine after the install. check out the anaconda page for details here. if you do have anaconda already you can

Unable to run Tracking on Open CV 3.4.1 on Python 3.6.6

…衆ロ難τιáo~ 提交于 2019-12-12 13:51:01
问题 I tried running tracking using open CV on python 3.6.6, but it shows: AttributeError: module 'cv2' has no attribute 'TrackerKCF_create' I also tried the python 2.7 API, but the same result: AttributeError: module 'cv2' has no attribute 'Tracker_create' The Open CV version is 3.4.1. Any idea how to resolve this? Thanks in advance. Edit: The problem is different to the one asked here. I tried this but it wasn't working for me. However, I solved it and I have given a solution below. 回答1: The

OpenCv, Python3: No icons in the toolbar

跟風遠走 提交于 2019-12-12 09:47:56
问题 I am using Python 3.5 on Linux along with OpenCV 3.4.0 (installed by pip install opencv-python ) to display the images from my webcam and I want to use the toolbar at the top of my frame. But the icons of this toolbar aren't shown. (I could use the Buttons without the icons, but where are the Icons) Is there any way to get the usual icons or write Text instead of icons on these buttons. Here is my code: import cv2 cv2.CascadeClassifier(cv2.data.haarcascades + "haarcascade_frontalface_default

Reading image file (file storage object) using CV2

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 08:06:16
问题 I am sending an image by curl to flask server, i am using this curl command curl -F "file=@image.jpg" http://localhost:8000/home and I am trying to read the file using CV2 on the server side. On the server side I handle the image by this code @app.route('/home', methods=['POST']) def home(): data =request.files['file'] img = cv2.imread(data) fact_resp= model.predict(img) return jsonify(fact_resp) I am getting this error- img = cv2.imread(data) TypeError: expected string or Unicode object,