org.opencv.core.CvException Java Examples
The following examples show how to use
org.opencv.core.CvException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Utils.java From OpenCvFaceDetect with Apache License 2.0 | 7 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #2
Source File: Utils.java From marvel with MIT License | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #3
Source File: Utils.java From MOAAP with MIT License | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #4
Source File: Utils.java From MOAAP with MIT License | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #5
Source File: Utils.java From MOAAP with MIT License | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #6
Source File: Utils.java From FtcSamples with MIT License | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #7
Source File: Utils.java From android-object-distance with Apache License 2.0 | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #8
Source File: Utils.java From OpenCV-Android-Object-Detection with MIT License | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #9
Source File: Utils.java From Document-Scanner with GNU General Public License v3.0 | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #10
Source File: Utils.java From ml-authentication with Apache License 2.0 | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #11
Source File: Utils.java From FaceT with Mozilla Public License 2.0 | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #12
Source File: Utils.java From PixaToon with GNU General Public License v3.0 | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #13
Source File: Utils.java From Form-N-Fun with MIT License | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #14
Source File: Utils.java From MOAAP with MIT License | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #15
Source File: Utils.java From faceswap with Apache License 2.0 | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #16
Source File: Utils.java From SimpleDocumentScanner-Android with MIT License | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #17
Source File: Utils.java From FTCVision with MIT License | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #18
Source File: Utils.java From Android-Car-duino with GNU General Public License v2.0 | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #19
Source File: Utils.java From ml-authentication with Apache License 2.0 | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #20
Source File: Utils.java From ResistorScanner with MIT License | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #21
Source File: Utils.java From OpenCV-AndroidSamples with MIT License | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #22
Source File: Utils.java From Camdroid with Apache License 2.0 | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #23
Source File: Utils.java From effective_android_sample with Apache License 2.0 | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #24
Source File: Utils.java From sudokufx with Apache License 2.0 | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #25
Source File: Utils.java From Image-Detection-Samples with Apache License 2.0 | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #26
Source File: Utils.java From SoftwarePilot with MIT License | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #27
Source File: Utils.java From LPR with Apache License 2.0 | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #28
Source File: Utils.java From LicensePlateDiscern with MIT License | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #29
Source File: Utils.java From AndroidDocumentScanner with MIT License | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }
Example #30
Source File: Utils.java From pasm-yolov3-Android with GNU General Public License v3.0 | 6 votes |
public static String exportResource(Context context, int resourceId, String dirname) { String fullname = context.getResources().getString(resourceId); String resName = fullname.substring(fullname.lastIndexOf("/") + 1); try { InputStream is = context.getResources().openRawResource(resourceId); File resDir = context.getDir(dirname, Context.MODE_PRIVATE); File resFile = new File(resDir, resName); FileOutputStream os = new FileOutputStream(resFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } is.close(); os.close(); return resFile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new CvException("Failed to export resource " + resName + ". Exception thrown: " + e); } }