Hi,
i want to use my android phone to process image, for example, make any
operation with de frame and show it with de change (show the image in
black/white, grayscale, sepia, etc).
This is my code:
public class CameraPreview extends SurfaceView implements
SurfaceHolder.Callback, PreviewCallback {
SurfaceHolder mHolder;
Camera mCamera;
/** The drawable to use as the background of the animation canvas */
private Bitmap mBackgroundImage;
// This variable is responsible for getting and setting the camera
settings
private Parameters parameters;
// this variable stores the camera preview size
private Size previewSize;
// this array stores the pixels as hexadecimal pairs
private int[] pixels;
public CameraPreview(Context context) {
super(context);
SurfaceHolder mHolder = getHolder();
mHolder.addCallback(this);
mHolder.setType(SurfaceHolder.SURFACE_TYPE_NORMAL);
this.setFocusable(true);
this.requestFocus();
}
public void surfaceCreated(SurfaceHolder holder) {
mCamera = Camera.open();
}
public void surfaceDestroyed(SurfaceHolder holder) {
mCamera.stopPreview();
mCamera.release();
mCamera = null;
}
public void surfaceChanged(SurfaceHolder holder, int format, int w,
int h) {
setImageSize();
mCamera.startPreview();
mCamera.setPreviewCallback(this);
}
public void onPreviewFrame(byte[] data, Camera camera) {
// transforms NV21 pixel data into RGB pixels
decodeYUV420SP(pixels, data, previewSize.width,
previewSize.height);
//here process the image
}
}
the problem is that i don't know how to show the new image processed.
In onPreviewFrame I convert yuv to rgb, I process the image i.e.
convert in grayscale, but what i do for show the new image?
I need help, thanks!!!!!!!!!!!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en