Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

Android screenshot using Opencv

$
0
0
How do I make a screenshot using Opencv (android) and convert it to an Image. I myself have made a code for screenshot see [link here](http://stackoverflow.com/questions/39200942/black-screenshot-android-opencv). The output of this image is black which is not I wanted. Is there also a possibility of using a mat here? public void camera_b(View v) { String path = Environment.getExternalStorageDirectory().toString() + "/" + "hellp.jpg"; v = getWindow().getDecorView().getRootView(); v.setDrawingCacheEnabled(true); Bitmap bitmap = Bitmap.createBitmap(v.getDrawingCache()); v.setDrawingCacheEnabled(false); OutputStream out = null; File imageFile = new File(path); try { out = new FileOutputStream(imageFile); // choose JPEG format bitmap.compress(Bitmap.CompressFormat.JPEG, 90, out); out.flush(); } catch (FileNotFoundException e) { // manage exception } catch (IOException e) { // manage exception } finally { try { if (out != null) { out.close(); } } catch (Exception exc) { } } }

Viewing all articles
Browse latest Browse all 19555

Trending Articles



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