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


battle programming a forum for elite programmers with extreme will power to sharpen theire skills
 
HomeSearchRegisterLog in
 

 starting openCV on android studio thread

Go down 
AuthorMessage
Moti Barski
super
super
Moti Barski

Posts : 450
Join date : 2011-08-02

starting openCV on android studio thread Empty
PostSubject: starting openCV on android studio thread   starting openCV on android studio thread EmptyWed Apr 08, 2020 3:19 pm

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
Back to top Go down
kurosen
codding
codding
kurosen

Posts : 228
Join date : 2012-04-17

starting openCV on android studio thread Empty
PostSubject: Re: starting openCV on android studio thread   starting openCV on android studio thread EmptyWed Apr 08, 2020 3:57 pm

OpenCV is garbage it does not work, and if it does work they sure did a terrible job
documenting it
Back to top Go down
 
starting openCV on android studio thread
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
battle programmers alliance :: battle programming alliance :: chit chat-
Jump to: