java - Android App using opencv: how to save an image without overwriting? -


i'm using following code save image folder when select option:

file path = environment.getexternalstoragepublicdirectory(environment.directory_pictures); string filename = "teste.png"; file file = new file(path, filename); filename = file.tostring(); highgui.imwrite(filename, mrgba); 

but i'd saved image not overwrite image that's in folder. how that? using kind of index each image or that, think, how?

thanks.

maybe this?

file mediastoragedir = new file(environment.getexternalstoragepublicdirectory(environment.directory_pictures), "myappdir");  if (!mediastoragedir.exists()) {     if (!mediastoragedir.mkdirs()) {         log.e(tag, "failed create directory");         return null;     } }  string timestamp = new simpledateformat("yyyymmdd_hhmmss").format(new date()); file mediafile; mediafile = new file(mediastoragedir.getpath() + file.separator + "testimage_" + timestamp + ".png"); 

Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -