Non profit film scanner

Hi
I am working on a film negative scanner for the national library of Norway.
This is a non profit project to try to get scanning of slides more automated.

What we want to achieve is to use the OpenMV-cam to see when a slide is in front of a DSLR camera.
We use a Arduino to drive a stepper motor witch in turn moves the film strips in front of the dslr/openmv.



The with of each image is constant, but the space between the images can vary.
So we need something that can detect rectangles or image content.
A row of slides looks like this:



First step was to use the find rect function with filtering on width and height. On high contrast images it worked fine, but on low contrast images it did not work.
Manual exposure was also set.
What the ompenmv is seeing:
example2.jpg
example3.jpg


Next was to boost the contrast, and defined a region of interest. The detection got better, but worked only about 60% of the time.
Then we thought what if we make the images binary. So that we did.
Now the rectangles are crisp, but the find rect does only recognize about 70-80% of the images.
How come the rectangles are not detected? It cant get better than this.


binary_inverted.JPG
binary register.JPG
binary_not register.JPG
I do not know what to do next.
Should we train a neural network, or can we do something simpler like templates?
We would need between a minimum of about 10-20 fps.

Any thoughts on what to try next?

Best Regards
Rune



This is a picture
example2.jpg
example4.jpg


This is not a valid picture
example8.jpg




This is the film base that the images are printed on.
example5.jpg


This is when no film is in the scanner
example6.jpg
binary.JPG

Hi, find_rectangles() is just the quad detector from an AprilTag detector. It’s rather good… but, was designed to find a black rectangle on a white background. It works the best when this is the case.

I would use find_line_segments(). This will give you line segments. Then, you can look to see if you have 4 segments where the rectangle box should be.

Thank you for the advice

I have implemented find line segments. I have filtered vertical and horisontal lines based on their theta values. Then i am filtering out just the lines arround the edges of where the image should be.
When the image is stationary it looks good. It detects almost all images. But when the images moves in front of the camera the vertical lines becomes difficult to detect.
I now run 50% speed on the stepper, but still only 1 in 6 images register. i get about 30fps so that should be plenty.
line_segments_frames.JPG
Any advice?

Best Regards
Rune

Um, try using lens_corr() first to improve the image lines so that they are more straight. Also, you can tell find_line_segments() where to look in the image. This lets you use a higher resolution without a speed loss using the ROI setting.