PreprocessImage

PreprocessImage(string, PreprocessingFilter)

Use image preprocessing to improve the accuracy of OCR. Create a list of filters that will be applied to the input image in the order you specify. example to create filters: PreprocessingFilter filters = new PreprocessingFilter { PreprocessingFilter.Invert(), PreprocessingFilter.Threshold(150), PreprocessingFilter.Binarize(), PreprocessingFilter.Rotate(180), PreprocessingFilter.Resize(3000,3000, Aspose.OCR.Filters.InterpolationFilterType.Box), PreprocessingFilter.Scale(6f), PreprocessingFilter.Dilate() }; You don’t need all of them. Set only what you need.

public MemoryStream PreprocessImage(string fullPath, PreprocessingFilter filters)
Parameter Type Description
fullPath String Full path to the image.
filters PreprocessingFilter Image optimization filtersPreprocessingFilter.

Return Value

Stream with modified image so you can save or recognize it.

See Also


PreprocessImage(MemoryStream, PreprocessingFilter)

Use image preprocessing to improve the accuracy of OCR. Create a list of filters that will be applied to the input image in the order you specify. example to create filters: PreprocessingFilter filters = new PreprocessingFilter { PreprocessingFilter.Invert(), PreprocessingFilter.Threshold(150), PreprocessingFilter.Binarize(), PreprocessingFilter.Rotate(180), PreprocessingFilter.Resize(3000,3000, Aspose.OCR.Filters.InterpolationFilterType.Box), PreprocessingFilter.Scale(6f), PreprocessingFilter.Dilate() }; You don’t need all of them. Set only what you need.

public MemoryStream PreprocessImage(MemoryStream stream, PreprocessingFilter filters)
Parameter Type Description
stream MemoryStream Memory stream containing the image.
filters PreprocessingFilter Image optimization filtersPreprocessingFilter.

Return Value

Stream with modified image so you can save or recognize it.

See Also