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

I want to transform my image to grayscale but when i traid to use TransformToGrayscaleOp class i got this error in the ide: Unresolved reference: TransformToGrayscaleOp

Here's my code until now:

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'

Why i dont have that class?



Solution 1:[1]

You have to update your tensorflow-lite-support library

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dominik Ter