I want to use the Y, U and V channel of the image. How can I target those channels? need help for the conversion. please give me some example code. Here is my code.
public void YUVImage(View view) {
Bitmap bitmap = ((BitmapDrawable)OrignalImg.getDrawable()).getBitmap();//reading image from imageView
int bwidth = bitmap.getWidth();
int bheight = bitmap.getHeight();
Bitmap mutableBitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
Canvas c = new Canvas(mutableBitmap);
Toast.makeText(this, "Done 1 ok ",
Toast.LENGTH_LONG).show();
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setFilterBitmap(true);
Toast.makeText(this, "Done 2 ok ",
Toast.LENGTH_LONG).show();
ColorMatrix yuvMatrix = new ColorMatrix();
yuvMatrix.setRGB2YUV();
Toast.makeText(this, "Now Yuv ok ",
Toast.LENGTH_LONG).show();
ColorFilter filter = new ColorMatrixColorFilter(yuvMatrix);
paint.setColorFilter(filter);
Matrix matrix = new Matrix();
matrix.setTranslate(2*bwidth, 2*bheight);
c.drawBitmap(mutableBitmap, 0, 0, paint);
Toast.makeText(this, "Canvas ok ",
Toast.LENGTH_LONG).show();
ImageView mImg=null;
mImg = (ImageView) findViewById(R.id.imageView1);
mImg.setImageDrawable(new BitmapDrawable(getResources(), mutableBitmap));
//mImg.setImageBitmap(newBitmap);
Toast.makeText(this, "YUV Image converted",
Toast.LENGTH_LONG).show();
}