java - NDK and OpenCV setup in Android Studio -
i imported module "opencv android" android studio , tried implement image processing features in java code.
most of opencv methods core.multiply , core.add work fine, however, found opencv methods mat.put() , mat.get() not quite efficient, , program run slow in device.
so, questions are,
if set ndk in android studio, make program run faster? (i think program more efficient if use pointer in c++, not sure if correct)
i use opencv methods mat.get() , mat.put() in way,
bitmap bitmap = bitmapfactory.decoderesource(this.getresources(), r.drawable.testphoto); mat m1 = new mat(bitmap.getheight(), bitmap.getwidth(), cvtype.cv_8uc4); mat m2 = m1.clone(); utils.bitmaptomat(bitmap, m1); byte[] arr = new byte[(int)(m1.total() * m1.channels())]; m1.get(0,0,arr); //some processing here... m2.put(0,0,arr);
so, there more efficient way use mat.get() , mat.put()?
- if using ndk better way, how can set both opencv , ndk in android project? tried follow tutorial set ndk in android studio, once set ndk, not import opencv project.
to setup opencv , ndk, first import opencv library module in android project , add dependencies. can research how setup android ndk.
after getting image input through bitmapfactory , conveting mat, can process image in ndk, makes program run faster , efficient.
Comments
Post a Comment