skeleton app for getting image from gallery or phone camera :
https://www.yotamarker.com/t155p50-android-mobile-app-development-grimoire?highlight=gallery#407
*********************************************************************
1 dl openCV SDK : http://sourceforge.net/projects/opencvlibrary/files/opencv-android/
2 create project, file, import, select the openCV SDK location (extracted openCV files location)
3 rebuild project
4 file, project, structure
5 module : select app, dependencies tab, select openCV module
MainActivity is the activity that we will be using to perform our OpenCV specific tasks,
OpenCV. Add this as a global member of MainActivity.java:
Bitmap to mat object :
Mat src = new Mat(selectedImage.getHeight(), selectedImage.getWidth(), CvType.CV_8UC4);
Utils.bitmapToMat(selectedImage, src);
Blur image :
Imgproc.blur(src, src, new Size(3,3));
break;
Convert processed mat back to bitmap and display on image view :
Bitmap processedImage = Bitmap.createBitmap(src.cols(), src.rows(), Bitmap.Config.ARGB_8888);
Utils.matToBitmap(src, processedImage);
ivImage.setImageBitmap(selectedImage);
ivImageProcessed.setImageBitmap(processedImage);
:XX:
https://www.yotamarker.com/t155p50-android-mobile-app-development-grimoire?highlight=gallery#407
*********************************************************************
1 dl openCV SDK : http://sourceforge.net/projects/opencvlibrary/files/opencv-android/
2 create project, file, import, select the openCV SDK location (extracted openCV files location)
3 rebuild project
4 file, project, structure
5 module : select app, dependencies tab, select openCV module
MainActivity is the activity that we will be using to perform our OpenCV specific tasks,
OpenCV. Add this as a global member of MainActivity.java:
Code:
private BaseLoaderCallback mOpenCVCallBack = new BaseLoaderCallback(this) {
@Override
public void onManagerConnected(int status) {
switch (status) {
case LoaderCallbackInterface.SUCCESS:
LoaderCallbackInterface.SUCCESS:
//DO YOUR WORK/STUFF HERE
break;
default:
super.onManagerConnected(status);
break;
}
}
};
@Override
protected void onResume() {
super.onResume();
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_10, this,
mOpenCVCallBack);
}
Bitmap to mat object :
Mat src = new Mat(selectedImage.getHeight(), selectedImage.getWidth(), CvType.CV_8UC4);
Utils.bitmapToMat(selectedImage, src);
Blur image :
Imgproc.blur(src, src, new Size(3,3));
break;
Convert processed mat back to bitmap and display on image view :
Bitmap processedImage = Bitmap.createBitmap(src.cols(), src.rows(), Bitmap.Config.ARGB_8888);
Utils.matToBitmap(src, processedImage);
ivImage.setImageBitmap(selectedImage);
ivImageProcessed.setImageBitmap(processedImage);
:XX: