Hi, How to tell Engine to delete white, blank spaces on scanned page? Or create image for objects located in center of scanned page?
Auto margins delete
- 557 Views
- Last Post 05 October 2017
There is “CropImage” Method of ImageDocument Object that finds the edges of a document on the image and then crops the image. For more detailed information see “Help → API Reference → Image-Related Objects → ImageDocument”.
Pay attention, that this method works more correct when all four edges of document can be found i.e. the document is completely surrounded by background. In other cases you can crop it manually with “Modify” Method of the ImageDocument Object. This method modifies ImageDocument according to transmitted ImageModification Object. You should add the region that should be clipped into ImageModification through “AddClipRegion” Method.
Hi, tell me what in what step of processing document, this should be done? I mean, it should be working like this?:
1. frDocument.AddImageFile('page', nil, nil );
If yes, how can i check what goes wrong if my image is not auto-crop?
Image cropping is useful when the image has already been loaded but hasn’t been processed. This code is technically correct (except missed brackets at the end of the second line) but it is doing quite a strange thing.
1) It adds an image, for instance ‘test.png’, to existing FRDocument object.
2) Then it crops the image inside of FRDocument object.
3) After that it processes the FRDocument object.
4) And finally it saves FRDocument object with a name of image (in our case ‘test.png’). But the file is saved in the internal format of FineReader Engine, which can’t be read by any image viewer.
As I mentioned before autocrop works better when all 4 edges of document can be clearly seen. If application doesn’t crop your image, try another image with perfectly shaped edges. If the latter image is processed correctly, then the issue is in borders of the first document. Otherwise most probably the cause is in Autocrop function application.
I'm also trying to use CropImage method to ensure the same area position across several document of the same type.
i mean: given an area position i'd like to read its content on several documents. These documents can be skewed so i try to normalize and remove borders. Shoud i use some kind of markers on four corners? Can this ensure that crop method will works as expected? Can i have an example of how the page should be to make all "4 edges of document can be clearly seen"?
First of all please note that CropImage method is intended to be used only on photos.
The “4 edges should be seen” rule means, that the page has to be seen on photo as whole. It also helps if the page contrasts with the background, so that edges of the page are easily distinguishable.
To improve skew correction, you can manually call CorrectSkew method with specific CorrectSkewMode parameter set. More about that method you can read in Help → API Reference → Image-Related Objects → ImageDocument.
Also instead of manually choosing the area of interest, you can try using the text block with the data you are interested in. You can iterate through blocks and choose the one you need, checking the blocks text for key information. You can read more about text blocks in Help → API Reference → Layout-Related Objects → TextBlock.
We also recommend you to check out the FlexiCapture Engine at ABBYY website. It might be more convenient to implement your scenario, using FlexibleLayouts. And the FlexiCapture Engine provides you capabilities and interfaces for that.
1720 questions, 5579 answers.