Open
Description
Issue: Color Conversion Codes Not Working in Android
Description
When trying to use color conversion codes with cvtColor
in Android, none of the conversion codes seem to work. The function fails with an assertion error indicating that the source image is empty (!_src.empty()
).
Steps to Reproduce
- Create a Mat object from a base64 image:
const source = OpenCV.base64ToMat(imageUriData);
- Try to convert the image using any color conversion code:
const dst = OpenCV.createObject(ObjectType.Mat, 0, 0, DataTypes.CV_8UC3);
OpenCV.invoke("cvtColor", source, dst, ColorConversionCodes.COLOR_RGB2BGR);
Expected Behavior
The color conversion should work as expected, converting the image from one color space to another.
Actual Behavior
The conversion fails with an assertion error, suggesting that the source image is empty, even though the image is valid and can be processed in other ways.
Environment
- React Native Fast OpenCV version: ^0.4.5
- Platform: Android
- React Native version: 0.79.1
- Device:TECNO CH6IS
Additional Context
- The same code works on iOS
- The image is being loaded correctly from base64
- The issue occurs with all color conversion codes, including:
- COLOR_RGB2BGR
- COLOR_BGR2RGB
- COLOR_RGBA2BGR
- COLOR_BGRA2BGR
- COLOR_BGR2RGBA
- COLOR_RGB2RGBA
- COLOR_BGR2GRAY
- COLOR_RGB2GRAY
Possible Workaround
Currently, we're using COLOR_RGBA2BGR
as a workaround, but this might not be the correct conversion for all cases.
Questions
- Is there a specific way to handle color conversions in Android?
- Are there any known limitations with color conversions in the Android implementation?
- Should we be using a different approach for color space conversions in Android?
Thank you for your help in resolving this issue.
Metadata
Metadata
Assignees
Labels
No labels