imironica / liveness

Liveness detection experiments

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

opened this issue · comments

Looks like there is some kind of mistake in the code. When it comes to reading the next file in the NUAA dataset, it is passing an empty data inside.

So, after checking through all the steps, I've found out the issue.
I've changed the variable for my own implementation, so please do mind that 😅

Instead of this:

cv2.imwrite(newPath, cv2.cvtColor(crop, cv2.COLOR_RGB2BGR))

We can add this:

if crop.size==0:
    print("Ignored this - crop picture seems to be empty")
        else:
    cv2.imwrite(newPath, cv2.cvtColor(crop, cv2.COLOR_RGB2BGR))

So this will avoid all images with numpy array size less than zero. Not a perfect solution, but it should work well.

Since there has been no activity for a long time, I'll be closing this issue.