CameraImageUtils

Util methods to process Camera images

Functions

Link copied to clipboard
fun bitmapToNv21(src: Bitmap, width: Int, height: Int): ByteArray

Converts Android Bitmap image to NV21 format.

Link copied to clipboard
fun calculateFinderRectWithPadding(width: Int, height: Int, changeOrientation: Boolean, origRect: Rect, padding: Int): Rect

Calculates Rect based on given origRect:

Link copied to clipboard
fun calculateModifiedRect(frameCroppingMode: FrameHandler.FrameCroppingMode, finderRect: Rect, imageWidth: Int, imageHeight: Int, imageOrientation: Int): Rect?

Calculates modified Rect based on given finderRect and frameCroppingMode.

Link copied to clipboard
fun calculateSquareRect(width: Int, height: Int, changeOrientation: Boolean, origRect: Rect): Rect

Calculates Rect based on given origRect:

Link copied to clipboard
fun imageToJpegByteArray(image: <Error class: unknown class>): ByteArray?

android.media.Image to JPEG byte array.

Link copied to clipboard
Link copied to clipboard
fun nv21ToJpeg(nv21: ByteArray, width: Int, height: Int, cropRect: Rect?): ByteArray
Link copied to clipboard
fun nv21ToYuv420888(nv21: ByteArray, width: Int, height: Int): ByteArray
Link copied to clipboard
fun rotate(rational: Rational, rotation: Int): Rational

Rotate rational by rotation value, which inverse it if the degree is 90 or 270.

Link copied to clipboard
fun saveFramesSequence(frame: ImageRef, frameHandlerName: String)

With each call saves frame to a file as a sequence of images.

Link copied to clipboard
fun yuv420888toNv21(image: <Error class: unknown class>): ByteArray