Ask Your Question

Imread in Android OpenCV shows an image with too much blue colour

asked 2013-01-11 11:17:29 -0600

KristoF124 gravatar image

I'm making a modification of image-manipulations sample. I have created an option to load an image from the internal memory of the device. I use the imread function. It shows me pictures with too much blue colour all the time. Here's the code:

case ImageManipulationsActivity.VIEW_MODE_READIMG:
        mRgba = Highgui.imread("/mnt/sdcard/download/02.jpg");

For example an object on the image should be red, but appears blue. When I add the flag "CV_LOAD_IMAGE_COLOR", the image appears in grayscale. The same problem appears in OpenCV 2.4.2 and in the version. The image, which I'm loading is in full color. How can I display it properly?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-01-11 12:50:17 -0600

  1. Highgui.imread in Java like cv::imread in C++ load image as RGB (3 channels) by default. So, if you will try to use image data directly as RGBA image (low level data operations) you can get problems.

  2. Can you, please create ticket on OpenCV issue tracker. Please attach your project or piece of code for problem reproduction and images.

edit flag offensive delete link more


Thank you for you answer. Now it works but only with few pictures. What sort of images can imread load? Before converting the color space to RGB, the imread function opened more images than now. Does it depend on image size?

KristoF124 gravatar imageKristoF124 ( 2013-01-11 14:44:49 -0600 )edit

Question Tools


Asked: 2013-01-11 11:17:29 -0600

Seen: 2,770 times

Last updated: Jan 11 '13