battle programmers alliance
Would you like to react to this message? Create an account in a few clicks or log in to continue.

battle programmers allianceLog in

battle programming a forum for elite programmers with extreme will power to sharpen their skills

descriptionstarting openCV on android studio thread Emptystarting openCV on android studio thread

more_horiz
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:

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);

annoying

_________________
MB over and out emp it up

descriptionstarting openCV on android studio thread EmptyRe: starting openCV on android studio thread

more_horiz
OpenCV is garbage it does not work, and if it does work they sure did a terrible job
documenting it
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum