Search code examples
javaandroidjavacv

How to use JavaCv's cvSaveImage in android


I have created an app using javaCv and I'm trying to save an image in android using

cvSaveImage("/storage/sdcard0/watermarked/test.jpg", yCrCb);
cvSaveImage("/storage/extSdCard/test.jpg",yCrCb);

where yCrCb is an IplImage.

There is no exception error and the program runs smoothly but the files are not saved into the path as mentioned above. I would like to ask what might be the possible problems ? is it the naming convention of the file name ?

If it helps, I have a java application counterpart of this app and the java version works fine when i use the line

cvSaveImage("C:\\testing123.jpg", yCrCb);

Solution

  • Hi I have used same thing for storing the image.

    For getting the path to sdcard, I have used the Environment.getExternalStorageDirectory().toString();

    append the folder name to this path where you want to store the image

    try this and also make sure that you have written permission in the xml file.