I'm trying to draw a text on a face using android face detection API.
Right now, I did this
for(Landmark landmark : face.getLandmarks()){
if(landmark.getType() == Landmark.NOSE_BASE){
Bitmap moustache = BitmapFactory.decodeResource(resources, R.drawable.moustache);
canvas.drawText("=====", landmark.getPosition().x, landmark.getPosition().y, mIdPaint);
}
}
but turns out the text =====
is draw on top of the head, and I don't know why.
If someone need more code, just let me know
If you are drawing graphics over a live camera preview, you need to take a few things into account:
The sample code for the face tracker demo has utility methods (translateX, translateY, scaleX, scaleY) to help with this: