Open floe opened 6 years ago
Thanks for your code, found it very helpful to understand the convoluted NDK camera API. In return, I may have a possible solution for your asset issue: I came across the same problem, i.e. how to properly load the haar cascade files on Android, and you can solve that at runtime (see also https://github.com/mmbuw/mis-2018-exercise-4-opencv/blob/master/app/src/main/java/com/example/mis/opencv/MainActivity.java#L129-L139):
public String initAssetFile(String filename) { File file = new File(getFilesDir(), filename); if (!file.exists()) try { InputStream is = getAssets().open(filename); OutputStream os = new FileOutputStream(file); byte[] data = new byte[is.available()]; is.read(data); os.write(data); is.close(); os.close(); } catch (IOException e) { e.printStackTrace(); } Log.d(TAG,"prepared local file: "+filename); return file.getAbsolutePath(); }
Still a hack, but oh well... ;-)
Regards, Florian
Glad it helped and I like this approach, it's still a hack, but a much more manageable hack, hopefully have time soon to implement it. Thanks for the idea!
Thanks for your code, found it very helpful to understand the convoluted NDK camera API. In return, I may have a possible solution for your asset issue: I came across the same problem, i.e. how to properly load the haar cascade files on Android, and you can solve that at runtime (see also https://github.com/mmbuw/mis-2018-exercise-4-opencv/blob/master/app/src/main/java/com/example/mis/opencv/MainActivity.java#L129-L139):
Still a hack, but oh well... ;-)
Regards, Florian