0

I am trying to load an image into a bitmap so I can make some processing on tha cameraframe, but I keep getting bmp == null when I try to use the static image. Here is my code:

public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
        String path = Environment.getExternalStorageDirectory().getAbsolutePath();
        File file = new File(path,"/myopencv/myimage.bmp");
    if (file.exists()) {
        objectbmp = BitmapFactory.decodeFile(path);
        object = new Mat();
        Log.e("Get frame","next line generates the error: bmp == null");
        Utils.bitmapToMat(objectbmp, object);
       }
  }

So I used Eclipse to open my DDMS towards my physical device. I created a new folder myopencv inside /storage/sdcard0/. Then I placed the myimage.bmp file there using Eclipses tool (Push a file onto the device). So the file clearly exists. Also I test for it, to see if the file exists, and it seems to exist. So why is it null? How can I make this work properly?

4

1 に答える 1