Skip to content

Instantly share code, notes, and snippets.

@neonankiti
Created December 4, 2019 00:16
Show Gist options
  • Save neonankiti/daeb7b24dd9c21164bc9be00ebe5d0ae to your computer and use it in GitHub Desktop.
Save neonankiti/daeb7b24dd9c21164bc9be00ebe5d0ae to your computer and use it in GitHub Desktop.
Pose Estimation with TensorFlow Lite in Android Sample
/** Writes Image data into a `ByteBuffer`. */
private fun convertBitmapToByteBuffer(bitmap: Bitmap) {
imgData!!.rewind()
// intValues are input image size memory like IntArray(bitmap.width * bitmap.height)
bitmap.getPixels(intValues, 0, bitmap.width, 0, 0, bitmap.width, bitmap.height)
// Convert the image to floating point.
var pixel = 0
for (i in 0 until imageSizeX) {
for (j in 0 until imageSizeY) {
val v = intValues[pixel++]
addPixelValue(v)
}
}
}
@neonankiti
Copy link
Author

This is copy of https://github.com/edvardHua/PoseEstimationForMobile/ projects.
This software includes the work that is distributed in the Apache License 2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment