1 | initial version |
sad, but impossible with opencv means. all you can do is check for None
in python (or empty() in c++)
you can do additional (manual) checks, like f = open(imgpath)
for 2. or try to match the first bytes of the file against some 'file magic' list for 3. , but the real hard case is 1., since you'd need to know about the inner structure of the file format , you're trying to read.
the idea of try/catch won't work either, imho. you cannot "repair" a broken file on the fly.