其他分享
首页 > 其他分享> > 解决error: (-215:Assertion failed) VScn::contains(scn) && VDcn::contains(dcn) && VDepth::contains(dept

解决error: (-215:Assertion failed) VScn::contains(scn) && VDcn::contains(dcn) && VDepth::contains(dept

作者:互联网

参考:

https://github.com/llSourcell/Object_Detection_demo_LIVE/issues/6

https://stackoverflow.com/questions/52739143/opencv-error-215assertion-failed-vscncontainsscn-vdcncontainsdcn

错误发生于opencv颜色空间转换时:

 im_lab = cv2.cvtColor(im_bgr, cv2.COLOR_BGR2LAB)

根据上面第二个链接里的回答,数据不能是浮点型,只能是整型。但根据我的实验,float64会报如题的错误,但只要改成float32就可以运行。

im_bgr = im_bgr.astype(np.float64) # throws an error in the title
im_bgr = im_bgr.astype(np.float32) # runs without error

 

标签:dcn,contains,astype,opencv,bgr,im,&&,error
来源: https://www.cnblogs.com/mrlonely2018/p/13939731.html