a)I was wondering what is the difference between YUV and YUV420? b)I want to use the raw frames from Camera and convert them into YUV420 in real time. What is the fastest way to do this? I used bitmap factory to convert from yuv to jpg and I used onDraw() method to draw the bitmap. However, this takes some time to process. What is the best alternative to do the conversion if I want converting from YUV to YUV420?
I found a very straight forward way to convert from NV12 to YV12/YUV 420. Two lines of code did the job for me:
public void surfaceCreated(SurfaceHolder holder) {
try {
// set view of surface in cameraview
Camera.Parameters p = mCamera.getParameters();
p.setPreviewFormat(ImageFormat.YV12);
mCamera.setParameters(p);
mCamera.setPreviewDisplay(holder);
mCamera.startPreview();
}
}