Issue
I am trying to do a basic colour conversion in python however I can't seem to get past the below error. I have re-installed python, opencv and tried on both python 3.4.3 (latest) and python 2.7 (which is on my Mac).
I installed opencv using python's package manager opencv-python.
Here is the code that fails:
frame = cv2.imread('frames/frame%d.tiff' % count)
frame_HSV= cv2.cvtColor(frame,cv2.COLOR_RGB2HSV)
This is the error message:
cv2.error: OpenCV(3.4.3) /Users/travis/build/skvark/opencv-python/opencv/modules/imgproc/src/color.cpp:181: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'
Solution
This error happened because the image didn't load properly. So you have a problem with the previous line cv2.imread
. My suggestion is :
check if the image exists in the path you give
check if the count variable has a valid number
Answered By - shaked litbak
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.