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

the LivinGrimoire Artificial General Intelligence software design pattern forum

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

skeleton app for getting image from gallery or phone camera :

1 dl openCV SDK :

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


private BaseLoaderCallback mOpenCVCallBack = new BaseLoaderCallback(this) {
        public void onManagerConnected(int status) {
            switch (status) {
                case LoaderCallbackInterface.SUCCESS:
                    //DO YOUR WORK/STUFF HERE
    protected void onResume() {
        OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_10, this,

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

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


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

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
power_settings_newLogin to reply