How to auto crop full DSLR scanned scrapbook pages?

Dear community members,

I come to you as a complete novice in Python programming, aware of the time it will take me to solve my problem.
Today, I’m asking for your help and expertise.

For several years now, my project has been to digitize my family’s old photo albums using the “DSLR scanning” technique. This method consists in re-photographing them page by page to gain in speed on a reproduction bench that I designed myself.

To speed up the image post-processing process, I would need to write Python/OpenCV script that automatically performs a slight straightening and cropping of each image, removing the background.

Here’s a visual example:

Given that the dimensions of the album page are known beforehand (e.g. 280 x 295 mm), and that my resulting image files measure 3744 x 5616 pixels, I wonder whether it would be possible for OpenCV to detect the outline of a slightly slanted rectangle, whose length and width exceed 3000 pixels and which has a ratio of 0.95, and perform the image cropping.

If the contrast conditions of the images are not sufficient, I may have to resort to inserting a colored contrast sheet under each page before each shot, which would degrade the speed and relevance of the chosen technique.

Thank you in advance for your attention and support.

Best regards,