user3338092
user3338092

Reputation: 45

OpenCV 3 with Python 3 on Windows separate HD

I want openCV and Python to be installed to and run on a second HD (E: in this case). Things seemed OK after following the instructions provided in https://www.solarianprogrammer.com/2016/09/17/install-opencv-3-with-python-3-on-windows

import cv2
print(cv2.__version__)
image = cv2.imread("clouds.jpg")
function OK, but
image = cv2.imread("clouds.jpg")

results in this:

"Traceback (most recent call last):   File "<pyshell#3>", line 1, in <module>
    cv2.imshow("Over the Clouds", image) 
    cv2.error: C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp:304:
    error: (-215) size.width>0 && size.height>0 in function cv::imshow"

Any idea of how to get cv2 to look for projects\opencv.... on E:?

Upvotes: 0

Views: 62

Answers (1)

thewaywewere
thewaywewere

Reputation: 8626

The traceback tells the image is empty or the path is incorrect. Double check the image name and it's path, if any, is correct in imread().

Example:

  • cv2.imread('E:/path/to/image.jpg') or
  • cv2.imread('E:\\path\\to\\image.jpg')

Hope this help.

Upvotes: 1

Related Questions