0

I'm implementing a frame processor plugin (react-native-vision-camera). I would like to be able to load an image from a file and return it instead of the ImageProxy type frame so I can controll frames content.

For that, I have to load an image (no worries so far) and create an Image or an ImageProxy from the loaded image.

(I also tried to replace the bytes of the ImageProxy type image with those of the loaded image but I didn't succeed either. So I am also interested in this topic.)

@Override
public Object callback(@NotNull ImageProxy image, @NotNull Object[] params) {
    try {
        // Get path of image to load
        String param = params[0].toString();
        Bitmap bmImg = BitmapFactory.decodeFile(param);

        ImageView img = new ImageView(this);
        img.setImageBitmap(bmImg);


        return img;
        //return image;
    } catch (Exception e) {
        System.out.println("CRASHED");
        e.printStackTrace();
    }
    return null;
}

To do this I tried the code above but I am creating an ImageView and not an Image or an ImageProxy.

Any idea or sample code so I can control frame content?

Thanks in advance

  • `I am creating an ImageView and not an Image or an ImageProxy.` No. You are creating a Bitmap. And you display the bitmap in an ImageView. – blackapps Nov 07 '22 at 17:54
  • @blackapps thank you. I am a beginner sorry. I agree with you but I still need to get an Image or ImageProxy from "bmImage" (my bitmap). – Nicolas Romano Nov 07 '22 at 17:58
  • Yes, or directly from the file without using an intermediate bitmap. – blackapps Nov 07 '22 at 17:59
  • @blackapps Exactly. But I don't know how to do this at all (I also tried to modify the ImageProxy frame itself, to no avail). Do you have any ideas or example code? I did not find anything ... – Nicolas Romano Nov 07 '22 at 18:03

0 Answers0