Ask Your Question

kpyopvision's profile - activity

2020-05-22 01:55:42 -0600 received badge  Famous Question (source)
2020-04-08 21:28:20 -0600 received badge  Notable Question (source)
2020-04-04 13:45:25 -0600 received badge  Popular Question (source)
2020-01-02 18:33:37 -0600 commented answer error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

Thank you, that was very kind of you. spotted. And I feel like the very thing that I should have typed in the first plac

2020-01-02 18:25:21 -0600 received badge  Supporter (source)
2020-01-02 18:25:11 -0600 marked best answer error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

Following an OpenCV tutorial. Followed instructions on https://pypi.org/project/opencv-contr.... The package works great until the tutorial asks to include the following in the script

gray = cv2.cvtColor(color, cv2.COLOR_RGB2GRAY)

Write here how did you expect the library to function. The tutorial asks to create a script to transform different layers Following the video it is supposed to split the channels and convert them to grayscale. I'm not 100% sure since I'm new.

Actual behaviour The following error occurs when running the command:

python3 02_05.py

with pwd showing that I am in the required folder

File "02_05.py", line 6, in <module> gray = cv2.cvtColor(color, cv2.COLOR_RGB2GRAY) cv2.error: OpenCV(4.1.2) /Users/travis/build/skvark/opencv-python/opencv/modules/imgproc/src/color.cpp:182:

error: (-215:Assertion failed) !_src.empty() in function 'cvtColor' I don't have a user called Travis on my computer in case that is not obvious Steps to reproduce example code:: This is the full script::

   import numpy as np

   import cv2
   color = cv2.imread("butterfly,jpg",1 )

gray = cv2.cvtColor(color, cv2.COLOR_RGB2GRAY)
cv2.imwrite("gray.jpg", gray)

b = color [:,:, 0]
g = color [:,:, 1]
r = color [:,:, 2]

rgba = cv2.merge((b,g,r, g))
cv2.imwrite("rgba.png", rgba)

` That was the full script

operating system : Mac OSX Mojave 10.14.4 architecture (e.g. x86) : Mac OSX Mojave 10.14.4 (Apple?) opencv-python version : opencv-contrib-python 4.1.2.30 Thank you.

2020-01-02 18:25:11 -0600 received badge  Scholar (source)
2020-01-02 11:14:55 -0600 asked a question error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

error: (-215:Assertion failed) !_src.empty() in function 'cvtColor' Following an OpenCV tutorial. Followed instructions