Auto cropping and processing photos in a scan of multiple photos

I’ve been using cv2 with object detection/classification applications. I need to find a way to separate images (photos) contained in a scan image into separate cropped photos. For example this scan of images:


This would be separated into separate images, cropped and rotated correctly. These won’t just be cats or anything I would use object recognition for - I just need a way to detect a probable rectangular box for each. The background would be uniform approximately white (as the scans are color and the background is actually color as well). Any pointers/projects to where I should look using OpenCV?

  1. segmentation. brightness threshold might be good enough, maybe you need to use inRange (or numpy equivalent), maybe you need to work in HSV or similar color space

  2. findContours

  3. minAreaRect

  4. maybe an affine transform to turn each rectangle upright

  5. profit