Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

Saving image back to sdcard after processing in Android+OpenCV

$
0
0
I want to save the image after processing it, into the same location in sdcard. Initially I converted the image into 'Mat' for processing and now if I'm writing it directly into the same location but it's saving as a file containing some random values. I'm using the following code for writing. private void write(String fpath, String fname, Mat image, boolean mode) { // TODO Auto-generated method stub try { File savefile = new File(fpath, "/"+fname); FileOutputStream fout = null; try { fout = new FileOutputStream(savefile,mode); } catch (FileNotFoundException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } PrintWriter pr = new PrintWriter(fout); for (int i = 0; i < image.width(); i++){ for(int j = 0; j < image.height(); j++) { pr.print(image+"," ); //pr.print("\n"); } } pr.close(); } catch (Exception e) { e.printStackTrace(); } }

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>