
// First, create a CoordinateTransform that represents the transformation matrix
val transform = CoordinateTransform(previewView.getOutputTransform(), mImageProxyTransform)
// Then transform. The "rectF" is the rectangle in the UI.
transform.mapRect(rectF)
--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion on the web visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/ed671457-84ad-4ca1-a44b-1d9430eaabd2n%40android.com.
Thanks I followed the instructions but now how to save the "rectF" as a cropped image?
my current code is this Analyzer :
mImageProxyTransform=mImageProxyTransformFactory.getOutputTransform(imageProxy)
val rectf = RectF(rectangle.left.toFloat(), rectangle.top.toFloat(), rectangle.right.toFloat(), rectangle.bottom.toFloat())
runOnUiThread( Runnable() {
val transform = CoordinateTransform(previewView.getOutputTransform(), mImageProxyTransform)
transform.mapRect(rectf)
})
imageProxy.close()
var bitmap = Bitmap.createBitmap(imageProxy.width, imageProxy.height, Bitmap.Config.ARGB_8888)
bitmap.copyPixelsFromBuffer(imageProxy.planes[0])
// Crop!
bitmap = Bitmap.createBitmap(bitmap, rect.left, rect.top, rect.width(), rect.height())