Created
July 13, 2022 08:01
-
-
Save muhwyndhamhp/95635d1cd3f7fbc35f157fe845461b7d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private val imgSize = | |
// Set this image size according to our choice of DNN Model (160 for FaceNet, 112 for MobileFaceNet) | |
private val imageTensorProcessor = ImageProcessor.Builder() | |
.add(ResizeOp(imgSize, imgSize, ResizeOp.ResizeMethod.BILINEAR)) | |
.add(CastOp( DataType.FLOAT32 )) | |
.build() | |
private fun convertBitmapToBuffer(image: Bitmap): ByteBuffer { | |
return imageTensorProcessor.process(TensorImage.fromBitmap(image)).buffer | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment