CameraX と FirebaseVision を使用して、画像からテキストを読み取ります。画像を分析しているときに、バーコード スキャナーを使用するときのように、画像全体ではなく、画像の一部を選択したいと考えています。
class Analyzer : ImageAnalysis.Analyzer {
override fun analyze(imageProxy: ImageProxy?, rotationDegrees: Int) {
// how to crop the image in here?
val image = imageProxy.image
val imageRotation = degreesToFirebaseRotation(degrees)
if (image != null) {
val visionImage = FirebaseVisionImage.fromMediaImage(image, imageRotation)
val textRecognizer = FirebaseVision.getInstance().onDeviceTextRecognizer
textRecognizer.processImage(visionImage)
}
}
知りたいのですが、画像をトリミングする方法はありますか?