-
Notifications
You must be signed in to change notification settings - Fork 81
-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(-215:Assertion failed) VScn::contains(scn) && VDcn::contains(dcn) && VDepth::contains(depth) in function 'CvtHelper' #6
Comments
Hi, did you solve it? I am having the same issue here :( |
I'm pretty sure it just means the image doesn't exist. I fixed the path when opening the image and it worked for me. |
I have the same issue, but fixing the path does not work for me. |
Due to the cause of the error in my case, you might want to double check that the image isn't None, or in an otherwise invalid state I suppose (though about that I wouldn't know) |
The image isn't None. I can show it. It occurs when I'm trying to convert image from RGBA to GRAY. |
I'm getting the same error, even when using the full path to the image. Someone else I know had the same problem and fixed it by moving the pictures, but I can't get it to work no matter what I try. (FYI working on a Mac, not sure if that changes anything) |
When I next got this error (or a very similar one at least) it was because I was trying to make my own image with a numpy array. It probably doesn't help in your cases, but I realized each pixel has to be on its own sublist, like so: [[[a,b,c]], [[a,b,c]], [[a,b,c]]] Try printing your image to the console to see if it makes sense |
I also had the same issue. Actually I had mistakenly typed wrong name of image file in my code that I was trying to import. But when I typed the right name of file then this issue was solved. |
Even I had the same problem, and the solution was quiet easy. Remember 1 thing, if the RGB values of your image lie in the range of 0-255, make sure the values are not of data type 'float'. As OpenCV considers float only when values range from 0-1. If it finds a float value larger than 1 it clips off the value thinking floats only exsist between 0-1. Hence such errors generated. So convert the data type to uint8 if values are from 0-255. |
I met the same problem and found that this occurred to me simply because I commented out 2 lines:
Getting them back made it work. |
I solved this problem by use x = np.asarray(x, dtype=np.uint8) before do the conversion |
for this code, i used your instruction : cap = cv2.VideoCapture(0) while(True):
When everything done, release the capturecap.release() i am getting error : int() argument must be a string, a bytes-like object or a number, not 'NoneType' |
error: (-215:Assertion failed) VScn::contains(scn) && VDcn::contains(dcn) && VDepth::contains(depth) in function 'CvtHelper' |
Try this once, |
I get this error because of a stupid bug. I use LSP dataset to train some nets recently and this bug that you discuss comes. What something wrong. I find it for two days. And I find "im00001.jpg" was changed into "img00001.jpg" by myself. |
Yeeees... thank you ! I am working on a code that wrote on labtop and I am running it on my PC... I use 1 and it works !!!! thanks a lot |
get the same error while using trackbar in opencv but after this method it resolved |
I had exactly the same error. |
error: (-215:Assertion failed) VScn::contains(scn) && VDcn::contains(dcn) && VDepth::contains(depth) in function 'cv::CvtHelper<struct cv::Set<3,4,-1>,struct cv::Set<1,-1,-1>,struct cv::Set<0,2,5>,2>::CvtHelper' |
Yes, only change the path work |
Non of the above solved my problem. What I noticed is, when I use pyCharm or Code I get those errors.
in Code: I tested: I have everywhere the same env and same python version. Solution for me: When I run the code in the standalone terminal, it works fine. I tried also to run Code as admin (with sudo on the terminal, but got same errors). |
I've got the same error. I fixed it by using two '\' in the file path instead of one ''. |
I had the same problem, I was sure the path was right. My problem was in the cv2.imread I had before the color conversion. Since I am getting the image from a file instead of cv2.VideoCapture. My code was as follows:
The solution was to put the cv2.IMREAD_UNCHANGED (or -1) inside the cv2.imread method as follows:
Hope it helps! |
Traceback (most recent call last):
File "demo.py", line 132, in
result = find_strawberry(image)
File "demo.py", line 63, in find_strawberry
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
cv2.error: OpenCV(3.4.2) /Users/travis/build/skvark/opencv-python/opencv/modules/imgproc/src/color.hpp:253: error: (-215:Assertion failed) VScn::contains(scn) && VDcn::contains(dcn) && VDepth::contains(depth) in function 'CvtHelper'
The text was updated successfully, but these errors were encountered: