https://stackoverflow.com/questions/70537488/cannot-import-name-registermattype-from-cv2-cv2
The same thing occurred to me yesterday when I used Colab. A possible reason may be that the version of opencv-python(4.1.2.30) does not match opencv-python-headless(4.5.5.62).
Or the latest version 4.5.5 may have something wrong...
I uninstalled opencv-python-headless==4.5.5.62 and installed 4.1.2.30 and it fixed.