Package io.scanbot.sdk.process
Class ImageProcessor
-
- All Implemented Interfaces:
-
io.scanbot.sdk.dispose.Disposable
public final class ImageProcessor implements Disposable
Class for applying chains of image processing operations.
-
-
Constructor Summary
Constructors Constructor Description ImageProcessor(Bitmap bitmap)
ImageProcessor(ByteArray nv21, Integer width, Integer height)
ImageProcessor(ByteArray jpeg)
ImageProcessor(String imagePath)
-
Method Summary
Modifier and Type Method Description Unit
dispose()
Calling this method will clear native buffer for ImageProcessor. final ImageProcessor
applyFilter(ParametricFilter filter)
Applies filter to the image. final ImageProcessor
crop(List<PointF> polygon)
Crops the image to the given polygon. final ImageProcessor
rotate(ImageProcessor.ImageRotation rotation)
Rotates the given image. final ImageProcessor
rotate(Integer degrees)
Rotates the given image clockwise. final ImageProcessor
resize(Integer maxSize)
Resizes image to the given size. final Bitmap
processedBitmap()
Returns processed image. final ByteArray
encodedProcessedImage(String extension)
Returns encoded processed image as ByteArray. final Boolean
saveProcessedImage(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
-
-
-
-