i am using the native
approach but i want the image as input rather than frames , when i run this code its not running the camera as well
this is my java code
public class CvNativeActivity extends Activity implements CvCameraViewListener2
{
private CameraBridgeViewBase mOpenCvCameraView;
public native int convertNativeGray(int n);
private final static String TAG = "CvNativeActivity";
public native int convertNativeGray(long matAddrRgba, long matAddrGray);
private Mat mRgba;
private Mat mGray;
// other part
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this)
{
@Override
public void onManagerConnected(int status) {
switch (status) {
case LoaderCallbackInterface.SUCCESS:
{
System.loadLibrary("native_activity");// Load Native module
Log.i(TAG, "OpenCV loaded successfully");
mOpenCvCameraView.enableView();
} break;
default:
{
super.onManagerConnected(status);
} break;
}
}
};
// some more stuff
public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
mRgba = inputFrame.rgba();
convertNativeGray(mRgba.getNativeObjAddr(),
mGray.getNativeObjAddr());
return mGray;
}
@Override
public void onCameraViewStarted(int width, int height) {
// TODO Auto-generated method stub
}
@Override
public void onCameraViewStopped() {
// TODO Auto-generated method stub
}
}
Have you tried this:
File file= new File(android.os.Environment.getExternalStorageDirectory(),"Your folder");
Bitmap bitmap = BitmapFactory.decodeFile(file.getAbsolutePath())
Source: Raghunandan
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With