Package io.scanbot.sdk.ui.camera.util
Object CameraImageUtils
-
- All Implemented Interfaces:
public class CameraImageUtils
Util methods to process Camera images
-
-
Field Summary
Fields Modifier and Type Field Description public final static CameraImageUtils
INSTANCE
-
Method Summary
Modifier and Type Method Description final static ByteArray
)>imageToJpegByteArray(<Error class: unknown class> image)
android.media.Image to JPEG byte array. final static ByteArray
cropByteArray(ByteArray data, Rect cropRect)
Crops byte array with given android.graphics.Rect. final Boolean
isAspectRatioValid(Rational aspectRatio)
True if the given aspect ratio is meaningful. final Boolean
isAspectRatioValid(Size sourceSize, Rational aspectRatio)
True if the given aspect ratio is meaningful and has effect on the given size. final static Rect
computeCropRectFromAspectRatio(Size sourceSize, Rational aspectRatio)
Calculates crop rect with the specified aspect ratio on the given size. final static Rational
rotate(Rational rational, Integer rotation)
Rotate rational by rotation value, which inverse it if the degree is 90 or 270. final static ByteArray
nv21ToJpeg(ByteArray nv21, Integer width, Integer height, Rect cropRect)
final static ByteArray
bitmapToNv21(Bitmap src, Integer width, Integer height)
Converts Android Bitmap image to NV21 format final static ByteArray
)>yuv420888toNv21(<Error class: unknown class> image)
final static ByteArray
nv21ToYuv420888(ByteArray nv21, Integer width, Integer height)
-
-
Method Detail
-
imageToJpegByteArray
final static ByteArray )>imageToJpegByteArray(<Error class: unknown class> image)
android.media.Image to JPEG byte array.
-
cropByteArray
final static ByteArray cropByteArray(ByteArray data, Rect cropRect)
Crops byte array with given android.graphics.Rect.
-
isAspectRatioValid
final Boolean isAspectRatioValid(Rational aspectRatio)
True if the given aspect ratio is meaningful.
-
isAspectRatioValid
final Boolean isAspectRatioValid(Size sourceSize, Rational aspectRatio)
True if the given aspect ratio is meaningful and has effect on the given size.
-
computeCropRectFromAspectRatio
final static Rect computeCropRectFromAspectRatio(Size sourceSize, Rational aspectRatio)
Calculates crop rect with the specified aspect ratio on the given size. Assuming the rect is at the center of the source.
-
rotate
final static Rational rotate(Rational rational, Integer rotation)
Rotate rational by rotation value, which inverse it if the degree is 90 or 270.
- Parameters:
rational
- Rational to be rotated.rotation
- Rotation value being applied.
-
nv21ToJpeg
final static ByteArray nv21ToJpeg(ByteArray nv21, Integer width, Integer height, Rect cropRect)
-
bitmapToNv21
final static ByteArray bitmapToNv21(Bitmap src, Integer width, Integer height)
Converts Android Bitmap image to NV21 format
-
yuv420888toNv21
final static ByteArray )>yuv420888toNv21(<Error class: unknown class> image)
-
nv21ToYuv420888
final static ByteArray nv21ToYuv420888(ByteArray nv21, Integer width, Integer height)
-
-
-
-