解決error: (-215:Assertion failed) VScn::contains(scn) && VDcn::contains(dcn) && VDepth::contains(depth) in function 'cv::CvtHelper的一種可能


 

錯誤發生於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

 

參考:

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

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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM