Reputation: 89
I am attempting to load jpegs into Android using BitmapFactory, however, the images are in a different Bayer Pattern format then Android wants. Specifically, I have images in a BGGR and RGGB format. The RGGB formats seem okay, however, BGGR seems to have issues.
Does Android have a method to convert the BGGR Bayer Pattern to RGGB? Do I need to create a function to convert both to RGB? Is there such one already out there?
Upvotes: 1
Views: 615
Reputation: 304
Would it be too much to ask for a smaple of the file format that you are trying to display? Because on my end I have no problems displaying different BGGR Bayer Pattern filtered files using the following code. The code loads and displays the file in an image view.
try {
ImageView imageView1 = (ImageView) findViewById(R.id.imageView1);
Resources resources = getApplicationContext().getResources();
InputStream is = resources.openRawResource(R.raw.test_bggr_bayer_file); // this is a bggr bayer pattern filtered jpeg file.
Bitmap bm = BitmapFactory.decodeStream(is);
is.close();
imageView1.setImageBitmap(bm);
}
catch (IOException e) {}
Upvotes: 1