안녕하세요?
안드로이드 O/S 를 사용해서 영상처리를 하고 있습니다.
NDK 단으로 카메라 데이터를 보내고 처리 후 bitmap으로 만들어서 이미지뷰에 뿌리고 있습니다.
그런데 속도가 생각보다 너무 낮게 나오네요. 한 10프레임 정도.
imageview.setimagebitmap(); 함수를 빼면 20~23프레임이 처리 되는데...
imageview 가 아닌 surfaceview 로 바꿔보려했는데 카메라 프리뷰를 surfaceview 로 처리를 해놔서 어떻게 바꿔야 하는지도 모르겠구요..ㅠㅠ 고수님의 답변 기다립니다.ㅠ
코드는 아래~
C코드도 포함 시키고 싶은데ㅠ 길이 제한때문에 못올리네요.ㅠ
private native void HISTOGRAMCOMPRESS(Bitmap _outBitmap, byte[] _in, int flag, int width, int heigth, int Avg_NumOfPix);
public void surfaceCreated(SurfaceHolder holder){
try {
mCamera = Camera.open();
mCamera.setPreviewDisplay(holder);
mCamera.setPreviewCallback(new Camera.PreviewCallback() {
@Override
public void onPreviewFrame(byte[] data, Camera camera) {
// TODO Auto-generated method stub
if(a == 0)
{
Camera.Parameters params = camera.getParameters();
width = params.getPreviewSize().width;
height = params.getPreviewSize().height;
Avg_NumOfPix = width*height/256;
prBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
}
HISTOGRAMCOMPRESS(prBitmap, data, flag, width, height, Avg_NumOfPix);
mImageview.setImageBitmap(prBitmap);
a = 1;
}
});
} catch (IOException exception) {
mCamera.release();
mCamera = null;
mImageview = null;
// TODO: add more exception handling logic here
}
}