Image transformation in C#

白昼怎懂夜的黑 提交于 2019-12-22 08:27:37

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/7701448/image-transformation-in-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!