This is the code for the "How to do Object Detection with OpenCV" live session by Siraj Raval on Youtube
103
stars
80
forks
source link
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. #8
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.
image = image.astype('uint8')
Check this Kaggle Kernal
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.
image = image.astype('uint8')
Check this Kaggle Kernal_Originally posted by @shravankumar9892 in https://github.com/llSourcell/Object_Detection_demo_LIVE/issues/6#issuecomment-428078042_
thxx My issue got solved by this method