Refactor ID reader functions

Refactors include:

  • a more general "find largest box in image" helper function that could be used elsewhere (not just ID reader)
    • this means ID-box specific cropping and resizing is now a separate function
  • some changes to variable names and additional comments to facilitate easier maintenance
  • swapped image height and width. OpenCV has the confusing conventions of returning (height, width) from image.shape, but requiring an input of (width, height) when using cv2.resize(). This mix-up was corrected in several places.
  • removal of some magic numbers
  • closer crop of ID box region

TODO: why are some images upside down or sideways in the demo again?

Merge request reports

Loading