I'm developing an Android Application. I am trading with Google ML Kit. But I need to invert the colors when rendering with Imageproxy. I am able to invert the image with OpenCV. But I can't convert it to Imageproxy. How can I invert image colors?
i need your help
InputImage image = InputImage.fromMediaImage(mediaImage, imageProxy.getImageInfo().getRotationDegrees());
try {
Bitmap bitmap = ImageConvertUtils.getInstance().getUpRightBitmap(image);
Mat tmp = new Mat (bitmap.getWidth(), bitmap.getHeight(), CvType.CV_8UC1);
Utils.bitmapToMat(bitmap, tmp);
Core.bitwise_not(tmp, tmp);
Utils.matToBitmap(tmp, bitmap);
} catch (MlKitException e) {
e.printStackTrace();
}
If you just need to run inverted image with ML Kit. You don't need to convert it back to ImageProxy, just create another InputImage and feed it to ML Kit
InputImage invertedImage = InputImage.fromBitmap(yourBitmap, 0);