0

I recently used this sample of great TensorFlow lite in android.

I can use this project correctly, but I want to estimate poses on single images too (not just in real time mode). so I tried to reach my goal! but unfortunately I couldn't! and those disappointing codes are here:

private fun runOnSimpleImage() {
    val detector = MoveNet.create(this, device, ModelType.Lightning)
    detector.let { detector ->
        simpleDetector = detector
    }
    simpleDetector?.estimatePoses(templateBitmap)?.let {persons->
        VisualizationUtils.drawBodyKeypoints(
            templateBitmap,
            persons, false
        )
    }

    showOutputBitmap(templateBitmap)
}

Also I search it and found this. but I couldn't solve my problem yet. and my result is something like this:

enter image description here

SadeQ digitALLife
  • 1,403
  • 4
  • 16
  • 22

1 Answers1

0

Fortunately my code is not wrong! and it works correctly. and you can use it!

The problem was in method that I used to convert my drawable image to Bitmap.

I used to use these codes:

val drawable = ResourcesCompat.getDrawable(resources, R.drawable.resized,theme)

templateBitmap = (drawable as BitmapDrawable).bitmap

But when I changed those to something like this:

 templateBitmap = BitmapFactory.decodeResource(resources,R.drawable.resized)

my problem solved.

SadeQ digitALLife
  • 1,403
  • 4
  • 16
  • 22