Process the image of the text document Version 2 (python)
Action group: Robin OCR
Description
The action performs automatic image processing of a text document to improve its quality.
Action icon
Parameters and their settings
Property | Description | Type | Filling example | Mandatory field |
---|---|---|---|---|
Parameters | ||||
Image | The path to the image file of the document to be processed. | Robin.FilePath | Yes | |
Page number | The page number of the file to be processed. If the field is not filled in, the processing will be applied to all pages of the file. If the image is not in tiff or tif format, the field will not be taken into account. | Robin.Numeric | No | |
Brightness and contrast preprocessing | The page number of the file to be processedIf the value is «true», then the brightness and contrast of the image will be corrected at the beginning of processing. If the value of «Brightness and Contrast Postprocessing» is also «true», then postprocessing will be used by default. | Robin.Boolean | true | No |
Correct distortions | If the value is «true», then all distortions in the plane will be corrected in the image. | Robin.Boolean | true | No |
Align horizontally | If the value is «true», then the image will be aligned horizontally. | Robin.Boolean | true | No |
Brightness and contrast post- processing | If the value is «true», then the brightness and contrast of the image will be corrected at the end of processing. If the value «Brightness and Contrast Preprocessing» is also true, then postprocessing will be used by default. | Robin.Boolean | true | No |
Folder path | The path to the folder where the processed image file will be saved. If the field remains empty, the file will be saved in the source folder. | Robin.FolderPath | C:\doc\img | No |
File name | The name of the processed image file. If the field remains empty, the original file name will be saved. | Robin.String | No | |
Format | The format in which the processed image file will be saved. If the field remains empty, the file is saved in the same format as the original image. | Robin.String | No | |
Overwrite | If the value is «true» and an image file with the same name and extension exists in the specified folder, then the new file will overwrite it. If «false», the file will not be overwritten and the action will return an error. | Robin.Boolean | true | No |
Results | ||||
Result | The path to the processed image file. | Robin.FilePath |
Special conditions of use
- The action works correctly with document images.
- Valid image extensions: jpg, jpeg, jpe, ppm, bmp, dib, png, tif , tiff. If a different extension is selected, the action will generate an error. Error description: "An invalid extension is specified".
- If the image is multi-page, the user can specify the page to be processed. If no page is specified, the processing will be applied to the whole file. If the submitted image is not multi-page, the "Page number" parameter is ignored.
- If an invalid file page number is specified, the action will generate an error. Error description: "A nonexistent document page is specified.".
- The user can change the name and path to save the processed image.
- If the user does not specify a file name, the original file name will be saved.
- If the user does not specify a folder path, the file will be saved in the original folder.
- If the user specifies a file name but does not specify a folder path, the file will be saved with the specified name in the source folder.
- If the user specifies a folder path but does not specify a file name, the file will be saved with the original name in the specified folder.
- If the user does not specify a file name and folder path, "Overwrite" = true must be filled in to overwrite the existing file, otherwise the action will generate an error (prescribed in step 12).
The user can specify a new image extension by selecting it from the "Format" parameter. If the parameter is not filled in, the image will be saved in the original extension. - The user can overwrite a file: if the overwrite parameter is "true" and a file with the same name and extension exists in the specified folder, the new file will overwrite it. If "false", the file will not be overwritten and the action will generate an error. Error description: "A file with the specified name and extension already exists."
- Options for image processing: Brightness and contrast preprocessing, Correct distortions, Align horizontally, Brightness and contrast post-processing.
- Preprocessing changes brightness and contrast more gently than postprocessing. But pre-processing can illuminate image boundaries that are necessary for other image processing parameters. Therefore, it is necessary to understand which specific processing parameters to apply to the image. If the user selects post-processing and brightness and contrast pre-processing, post-processing will be used by default.
Example of use
Task
There is an image of a check on the desktop, you need to change the brightness and contrast of the image to the values: brightness - 50, contrast 20.
Solution
Use the "Change brightness and contrast" action.
Implementation
- Move the ""Change brightness and contrast" action to the workspace and set its parameters.
- Click on the "Start" button in the top panel.
Result
The program robot completed successfully. The brightness and contrast of the image has been changed.
Image after changing the brightness and contrast.
Обзор
Инструменты контента