Classifying Printed vs Handwritten Paper Images

Hi there, I am building an application for automating the scanning of answer sheets. For that, I am trying to classify the images between 5 classes ( i.e, Printed, Handwritten, Printed with Object, Handwritten with object, Blurred). The project requires Clear images whether Printed or Handwritten, anything else is rejected.
After a set of images are collected they will be stored in a folder or converted into a pdf.
So far, I have collected approx 60 images per class and trained the model and am able to classify the images in real time using the openMV Camera. Now I wish to do a couple of things

  1. I am using the following settings but the images are not turning out to be much clear
    to interpret the text. Is there any advance setting I can do?

                       sensor.set_pixformat(sensor.RGB565)   
                       sensor.set_framesize(sensor.QVGA)     
                       sensor.set_windowing((240, 240))   
                       sensor.skip_frames(time=2000) 
    
  2. If the image captured fulfills all the requirements then a folder should be created for
    each answer sheet and the photos should be stored in that. All the rejected images
    goes into trash.(User can decide for each image whether the image is accepted or
    rejected).

This is the whole scenario, any suggestions or ideas are welcome.
Thanks!

Hi, so, to see text in the image the camera needs to have sufficient resolution for this. This is an optics problem and depends on the height of the sensor from the document.

As for your application to scan the image… do you want to do that on the OpenMV Cam? Because, if you are using the H7 regular it doesn’t have enough resolution to accomplish this.

Scanning documents in general requires extremely high resolution cameras… Like 8MP or more.

I am using the OpenMV Cam H7 Plus and I am also adjusting the height and focus according to the page.
It works fine if I take a segment of the page but when I try to capture the whole page, the image turns out to be blurry.
Can you suggest something please?
Also can you show me a way to create different folders for different answer sheets as mentioned in my previous message!
Thanks!!

Have you tried to set the resolution to WXQVA2? This is the full 5MP.

As for making folders you just use the MicroPython os calls. It’s the same as in regular Python.

I tried setting the resolution to WXQVA2 but it is showing Attribute Error. The camera is supporting WQXGA2.
I am attaching the screenshot for reference, please tell me what changes do I need to make.

Sorry, I meant sensor.WQXGA2: sensor — camera sensor — MicroPython 1.15 documentation

That’s the full res. If it’s blurry after that you need to adjust the sensor lens focus.

Thank you so much, now each word is clearly visible and readable!! :slight_smile: