Just want to share that I was able to resolve this problem yesterday. Found the culprit DLL: it’s the HDF5 which I installed last Jan 1. My first source compilation was Dec 29 that’s why it worked the first time. So basically, the fix was:
After installation, edit cv2/config.py and add the path to my hdf5.dll. Again, I’m using OpenCV 4.5.1 source.
Thanks for this tip, it helped me a lot. But in OpenCV 4.5.1, I think it’s best to add the directories in cv2/config.py so that other codes will just include import cv2 only.
When I use python, I also get an error “C:\DevHome\Program\OpenCV450\build\python_loader\cv2_init_.py”. Just use “pip uninstall opencv-python” and reinstall it.
Record it.As a non-native English speaker, it is too difficult to find information and solve problems