Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upcv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor' #933
Comments
|
i have the same problem |
|
This a secondary error that basically just means the image you are trying to process didn't load and was empty. If you grabbed the image dara from the camera, it means the camera connection failed or isn't configured correctly. If you loaded an image file, it means the loading failed. |
|
I was facing this issue and by removing special characters from the image_file_name the issue was resolved. Example: Renaming "48172454-thymianblätter.jpg" to "48172454-thymian.jpg". |
|
I am using hik vision's camera and i am getting same error...i think my laptop's processor is not able to load the frames due to very high resolution and frame rate |
|
I am having the same issue. Is image resolution causing the problem? |
|
I have same problem. My old code is : cap = cv2.VideoCapture(1) Then I change my code, and problem has solved. Probably, opencv accepts my finger print input as a camera. Thus, I change VideoCapture parameter as follows: |
|
how to solve this error. anyone has answer for this error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor' |
|
this problem occcurs when you dont declare what 'im' is or the image has not been loaded to the variable 'im'/. |
|
Now I guess we can close this issue. @ageitgey @rezabrg @rafaelpsimoes |
|
@rezabrg download the required haarcascades it will work |
|
In my case, I found that in the settings of windows 10, permission to access camera has been disabled to any applications |
Did you find a solution? |
|
cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor' how to solve this |
|
gray = cv2.cvtColor(image_frame, cv2.COLOR_BGR2GRAY) error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'mn biết lỗi này là sao k ạ |
|
The same is happening with me |
|
I realized I wasn't in the same dir as the image.I was trying to load an image from Desktop using just the image name.jpg. I changed dir into Desktop and everything worked fine. |
|
I am facing the same issue? what is causing the problem? |
|
I have the same problem the reason was the image name in the folder was different from the one i was calling from cv2.imread function. properly load the images. hope it helps |
|
If you use a camera: |
|
Same error Traceback (most recent call last): |
|
complete image path helps me to resolve error |
|
ret, frame = cv2.VideoCapture('PATH').read() |
|
cv2.error: OpenCV(4.2.0) /io/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor' Same here, the suggestions under this topic didnt work for me. |
chuyển \ thành / thử xem bạn |
How to solve? |
|
error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\objdetect\src\cascadedetect.cpp:1689: error: (-215:Assertion failed) !empty() in function 'cv::CascadeClassifier::detectMultiScale' Please help! |
|
The problem is your image location. Just check carefully if you make a mistake on the location. For example if your image stored under a folder and rather in the same folder of your source code then dont use color = cv2.imread("butterfly.jpg", 1 ) instead color = cv2.imread("images/your-folder/butterfly.jpg", 1 ) |
Description
I'm having problem to run this program, the error under below

gray = cv2.cvtColor(im,cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'
What I Did