Package io.scanbot.sdk.process
Class ImageProcessor
-
- All Implemented Interfaces:
-
io.scanbot.sdk.dispose.Disposable
public final class ImageProcessor implements DisposableClass for applying chains of image processing operations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classImageProcessor.Companion
-
Field Summary
Fields Modifier and Type Field Description public final static ImageProcessor.CompanionCompanion
-
Constructor Summary
Constructors Constructor Description ImageProcessor(Bitmap bitmap)ImageProcessor(ByteArray nv21, Integer width, Integer height)ImageProcessor(ByteArray jpeg)ImageProcessor(String imagePath)ImageProcessor(ImageProcessor imageProcessor)
-
Method Summary
Modifier and Type Method Description Unitdispose()Calling this method will clear native buffer for ImageProcessor. final ImageProcessorapplyFilter(ParametricFilter filter)Applies filter to the image. final ImageProcessorcrop(List<PointF> polygon)Crops the image to the given polygon. final ImageProcessorrotate(ImageProcessor.ImageRotation rotation)Rotates the given image. final ImageProcessorrotate(Integer degrees)Rotates the given image clockwise. final ImageProcessorresize(Integer maxSize)Resizes image to the given size. final BitmapprocessedBitmap()Returns processed image. final ByteArrayencodedProcessedImage(String extension)Returns encoded processed image as ByteArray. final BooleansaveProcessedImage(String path)Saves processed image to the given path. -
-
Method Detail
-
dispose
Unit dispose()
Calling this method will clear native buffer for ImageProcessor. It will be recreated if it will be called again
-
applyFilter
final ImageProcessor applyFilter(ParametricFilter filter)
Applies filter to the image.
- Parameters:
filter- filter to apply
-
crop
final ImageProcessor crop(List<PointF> polygon)
Crops the image to the given polygon.
- Parameters:
polygon- polygon to crop
-
rotate
final ImageProcessor rotate(ImageProcessor.ImageRotation rotation)
Rotates the given image.
- Parameters:
rotation- one of ImageProcessor.ImageRotation are supported
-
rotate
final ImageProcessor rotate(Integer degrees)
Rotates the given image clockwise.
- Parameters:
degrees- 0, 90, 180, 270 are supported
-
resize
final ImageProcessor resize(Integer maxSize)
Resizes image to the given size.
- Parameters:
maxSize- max size of the image
-
processedBitmap
final Bitmap processedBitmap()
Returns processed image.
-
encodedProcessedImage
final ByteArray encodedProcessedImage(String extension)
Returns encoded processed image as ByteArray.
- Parameters:
extension- file extension of the encoded image ".jpg", ".
-
saveProcessedImage
final Boolean saveProcessedImage(String path)
Saves processed image to the given path.
Warning: this method doesn't use SDK encryption!
- Parameters:
path- path to save image
-
-
-
-