Hi,
Loic has asked him to help you with this.
Ok, to start, there are layers in the process of making OMR recognition apps:
1. The Form set up (which is what you are wondering about)
2. The matching of the form (alignment due to translation in scanning)
3. The recognition
Now steps 2 and 3 are handled by our sdk through the OMRDetect functions, and the FindAnchor.
The anchoring mechanism will determine how much translation the filled test has gone under in scanning, then you apply that translation to the rectangles that correspond to the OMR fields and then you run your OMRDetect function. (If you need more on this please do ask)
Now your question, what do I do with the rectangles, and how do I make a form that i can reuse over and over again?
Yes there are some sdks that will make you make a form, but here in GdPicture, we realized that our customers prefer more control over their forms. And since it is an app level design we could not disagree and force our Form template format.
That being said, we will provide a demo app that will include all of this integrated together in the next couple of months.
Here are some hints on how to do it:
You need to create a class called FormTemplate, in that class, you shall have an array of Rectangles, that you can initialize per form in the contructor, for example, if you have 20 questions, each having 4 possible answers, you will need 80 fields.
You will also need a string to recognize the form (this could be done a million other ways, id, handles, etc).
Your constructor call should look like this:
Code: Select all
FormTemplate( "Chemsitry A101, SPR13", 80)
Where the first parameter is the string to identify the form, and the second is to specify the number of fields.
Then you can populate the fields by passing an array of Rects to a SetRects function in the form.
Finally, you have a ready form to use over any scanned document of that form.
Now finally, how to draw the rectangles on a GdViewer, and make their values populate the form automatically.
Say you load your form onto GdViewer, there are a set of functions in the GdViewer called Highlighted Regions:
https://www.gdpicture.com/guides/gdpicture/v9/html/con ... gions.html
And there is the Rectangle Of Selection:
https://www.gdpicture.com/guides/gdpicture/v9/html/con ... ction.html
You need to use those two together.
Basically, on mouse up, you get the area of the rectangle of selection on the document using GetRectCoordinatesOnDocument, and you add a region using AddRegion.
You do this for every form field. When you are done, you save, call SetRects in your FormTemplate instance.
Now when you scan filled tests, you use the anchor mechanism to measure the offset, and just offset the rectangles in your FormTemplate by adding the offset. Then you call the OMRDetect function over the scanned image.
I know all this information could be overwhelming, but it is aimed at describing a whole application at once
.
Again, we will implement all the above and more in an easy to understand manner in a demo app that you could probably adopt or use as is in the next couple of months.
Best Regards,
Sami Kharma
GdPicture Support