开发者

Image transformation in C#

开发者 https://www.devze.com 2023-04-11 13:10 出处:网络
I am working on a document processing application that generates and reads forms. The sample form attached is generated as a printed document, filled out by people, scanned and fed back to the applica

I am working on a document processing application that generates and reads forms. The sample form attached is generated as a printed document, filled out by people, scanned and fed back to the application to detect filled values including Optical Marks (Bubbles), Text (OCR), etc. Click here for Sample Form.

Since scanning distorts the image in terms of rotation, scale and translation, I use the three markers to detect orientation and correct the image in a rather primitive way that is VERY expensive on computation and memory. Here is the gist of it:

  1. Read in the image from disk.
  2. Detect bolbs using AForge.net.
  3. Filter out the markers using shape, relative size and other properties.
  4. Calculate rotation and rotate image.
  5. Detect bolbs from the rotated image using AForge.net.
  6. Calculate scale and scale rotated image.
  7. Detect bolbs from the scaled image using AForge.net.
  8. Calculate translation and translate rotated, scaled image.
  9. Detect bolbs from the translated image using AForge.net.
  10. Filter out answer marks (bubbles) since I already have the positions of the original form.
  11. Extract mean color and compare to threshold to determine if the option is filled.

The above being an extremely accurate but inefficient way to process, I am looking to take a geometric approach to extracting blobs only ONCE, filtering out markers/bubbles and using simple math to figure out expected positions of bubbles relative to the markers. This should cut down开发者_运维百科 the processing time by 80% and memory usage by 60%.

Alternately, there HAS to be a way to apply all three transformations on a single image without one affecting the next. That would also reduce the need for blob detection thrice.


I would model the image and do the transformations on that model in memory instead of the actual image. Then once you have calculated the transformation matrix you can apply it to the actual image to do the OCR.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号