Image transparency darkened by cvtColor on Android native layer? (Bug #1987)


Added by Jona Meson almost 13 years ago. Updated over 12 years ago.


Status:Done Start date:2012-05-25
Priority:Normal Due date:
Assignee:Andrey Pavlenko % Done:

0%

Category:android
Target version:2.4.2
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

I'm working with OpenCv 2.4.0 Android prebuilt libs to build my own library on the native side to work with Bitmap data on the java layer.

I'm having an issue where cvtColor(rgba, image, COLOR_RGBA2BGRA) is not properly converting the image. The image produced contains darkened transparency.

To better explain I have posted images and some code here:
http://stackoverflow.com/questions/10746358/image-transparency-darkened-when-saved-using-opencv#comment13979542_10746358

Essentially the issue is not seen when I pass to the native side an int array with the pixels. Since this method doesn't require the color conversion, because the bytes are swapped by the native code automatically, I'm thinking it must be a bug with cvtColor function?


Associated revisions

Revision a72f4474
Added by Andrey Pavlenko over 12 years ago

fixing bug #1987(android keeps RGBA in alpha pre-multiplied form, Mat <-> Bitmap should handle this correctly)

Revision 5d5527d0
Added by Roman Donchenko about 11 years ago

Merge pull request #1987 from pentschev:cv_completesymm_template_2.4

History

Updated by Jona Meson almost 13 years ago

It seems that the pixels read from a Bitmap at the native layer are alpha premultiplied and need to be unmultiplied. This is actually not a bug... However I'm not sure why this code doesn't do it?
http://code.opencv.org/svn/opencv/trunk/opencv/modules/java/src/cpp/utils.cpp

Updated by Andrey Kamaev almost 13 years ago

  • Target version set to 2.4.2

Updated by Andrey Pavlenko over 12 years ago

  • Status changed from Open to Done

Also available in: Atom PDF