1 | initial version |
your img is most likely invalid.
some things to check:
did the capture open ? is 1
the correct id ? (i doubt so, rather try 0
). please check:
cap.isOpened() #should return True
did you get a valid frame from your capture ? please check if ret==True
(older webcams might need some "warmup", and you might need to continue, until you receive a valid image)
2 | No.2 Revision |
your img is most likely invalid.
some things to check:
did the capture open ? is 1
the correct id ? (i doubt so, rather try 0
). please check:
cap.isOpened() #should return True
did you get a valid frame from your capture ? please check if ret==True
(older webcams might need some "warmup", and you might need to continue, until you receive a valid image)
in general, please make it a habit , to always check, if resources got read/loaded, like from imread(), and also you need to check, if the cascade xml files get ead properly with cascade.empty()