【发布时间】:2022-11-16 05:49:58
【问题描述】:
我正在开发一个 Android 应用程序。 我正在使用 Google ML Kit 进行交易。但是我需要在使用 Imageproxy 渲染时反转颜色。 我可以用 OpenCV 反转图像。但我无法将其转换为 Imageproxy。如何反转图像颜色?
我需要你的帮助
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();
}
【问题讨论】:
标签: android google-mlkit