年齡和性別的view
年齡和性別的view應(yīng)該是根據(jù)臉的大小進(jìn)行縮放,而不是根據(jù)ImageView和圖片的大小進(jìn)行縮放吧?
int ageWidth = ageBitmap.getWidth();
int ageHeight = ageBitmap.getHeight();
Log.d("FacePlay", "ageWidth " + ageWidth + " ageHeight " + ageHeight);
if (bitmap.getWidth() < mPhoto.getWidth() && bitmap.getHeight() < mPhoto.getHeight() ) {
float ratio = Math.max(bitmap.getWidth() * 1.0f / mPhoto.getWidth() , bitmap.getHeight() * 1.0f / mPhoto.getHeight());
? ?ageBitmap = Bitmap.createScaledBitmap(ageBitmap, (int)( ageWidth * ratio), (int) (ageHeight * ratio), false);
? ?Log.d("FacePlay", "ageWidth " + ageBitmap.getWidth() + " ageHeight " + ageBitmap.getHeight());
}
canvas.drawBitmap(ageBitmap, x - ageBitmap.getWidth() / 2, y - h/2 - ageBitmap.getHeight(), null);
這樣寫得到的效果:
麻煩老師看看問題出在哪里?
2015-05-26
你好,是根據(jù)圖片和ImageView的尺寸進(jìn)行縮放,你這里檢查下你創(chuàng)建的bitmap的尺寸。
2015-07-03
哥們兒 解決了沒 ? 我的顯示也特別大 ? ?