It is working now. I am using your first post code. Check ur filename, misspelled or extension. The error you posted…shape[0] meaning filename is not in your currently, misspelled, etc.
Go back to your first code. Is the filename in current folder?
Here is an images:
Can you try test this an image? This should be no white background.