无法在 android 中找到转换灰度 class 以在 android 中转换为灰度

Uneable to find TransformToGrayscaleOp class in android for transform to greyscale in android

我想将图像转换为灰度,但是当我尝试使用 TransformToGrayscaleOp class 时,我在 ide 中遇到了这个错误:Unresolved reference: TransformToGrayscaleOp

到目前为止,这是我的代码:

val model = Modelo.newInstance(applicationContext)
        val imageProcessor: ImageProcessor = ImageProcessor.Builder()
            .add(ResizeOp(150, 150, ResizeOp.ResizeMethod.NEAREST_NEIGHBOR))
            .add( TransformToGrayscaleOp()) //<-----
            .build()
        imageProcessor.process(tensorImage)
        model.process(tensorImage.tensorBuffer)

build.gradle

implementation 'org.tensorflow:tensorflow-lite:2.8.0'
implementation 'org.tensorflow:tensorflow-lite-support:0.1.0'
implementation 'org.tensorflow:tensorflow-lite-metadata:0.1.0'

为什么我没有 class?

您必须更新您的 tensorflow-lite-support 库

implementation 'org.tensorflow:tensorflow-lite-support:0.3.1'