正面からのカメラで写真を撮りました。画像の中心をトリミングしたいのですが、コード xwidth > xheight をPictureCallback
関数内に配置すると、カメラがフリーズします。バースト モードのように、カメラから 4 枚の写真を撮っています。私の目的は、次のように各画像を中央から切り取ることです。
カメラをフリーズすることなく。
PictureCallback myPictureCallback_JPG = new PictureCallback(){
@Override
public void onPictureTaken(byte[] arg0, Camera arg1) {
// TODO Auto-generated method stub
try {
BitmapFactory.Options options=new BitmapFactory.Options();
options.inSampleSize = 8;
bitmapPicture = BitmapFactory.decodeByteArray(arg0, 0, arg0.length,options);
int xxWidth = bitmapPicture.getWidth();
int xHeight = bitmapPicture.getHeight();
if (xxWidth >=xHeight){
bitmapPicture = Bitmap.createBitmap(
bitmapPicture,
xxWidth/2 - xHeight/2,
0,
bitmapPicture.getHeight(),
bitmapPicture.getHeight()
);
}