List of usage examples for org.opencv.android OpenCVLoader OPENCV_VERSION_3_0_0
String OPENCV_VERSION_3_0_0
To view the source code for org.opencv.android OpenCVLoader OPENCV_VERSION_3_0_0.
Click Source Link
From source file:alicrow.opencvtour.FollowTourActivity.java
License:Open Source License
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getIntent().getData() != null) { /// FollowTourActivity was launched directly, with a Tour archive. Must initialize OpenCV and load the Tour before we can set up the Activity. /// This happens when another app calls our app to open a tour archive. OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, new BaseLoaderCallback(this) { @Override/*from w w w . j a va2s . c om*/ public void onManagerConnected(int status) { switch (status) { case LoaderCallbackInterface.SUCCESS: { Log.i(TAG, "OpenCV loaded successfully"); /// Load the tour file Uri data = getIntent().getData(); String scheme = data.getScheme(); File extracted_folder = null; if (ContentResolver.SCHEME_CONTENT.equals(scheme)) { /// content uri try { /// Try to retrieve the filename so we know what to name our extracted folder. String folder_name; Cursor cursor = getContentResolver().query(data, new String[] { "_display_name" }, null, null, null); cursor.moveToFirst(); int nameIndex = cursor.getColumnIndex("_display_name"); if (nameIndex >= 0) { folder_name = cursor.getString(nameIndex); } else { folder_name = "imported-folder.zip.tour"; } cursor.close(); folder_name = folder_name.substring(0, folder_name.length() - ".zip.tour".length()); extracted_folder = new File(Tour.getImportedToursDirectory(FollowTourActivity.this), folder_name); Utilities.extractFolder(getContentResolver().openInputStream(data), extracted_folder.getPath()); } catch (FileNotFoundException ex) { Log.e(TAG, ex.getMessage()); /// Import failed. Exit the activity. FollowTourActivity.this.finish(); } } else { /// regular file uri String filepath = data.getPath(); String folder_name = data.getLastPathSegment(); folder_name = folder_name.substring(0, folder_name.length() - ".zip.tour".length()); extracted_folder = new File(Tour.getImportedToursDirectory(FollowTourActivity.this), folder_name); Utilities.extractFolder(filepath, extracted_folder.getPath()); } Tour.setSelectedTour(new Tour(new File(extracted_folder, "tour.yaml"))); load(savedInstanceState); break; } default: { super.onManagerConnected(status); break; } } } }); } else load(savedInstanceState); }
From source file:alicrow.opencvtour.TourListFragment.java
License:Open Source License
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); /// Must wait until OpenCV is initialized before loading the tours (since we load image descriptors). BaseLoaderCallback _loader_callback = new BaseLoaderCallback(getActivity()) { @Override//from ww w . j a v a 2s . c om public void onManagerConnected(int status) { switch (status) { case LoaderCallbackInterface.SUCCESS: { Log.i(TAG, "OpenCV loaded successfully"); /// Add footer so the floating action button doesn't cover up the list. _adapter = new TourAdapter(Tour.getTours(getActivity())); WrapAdapter wrap_adapter = new WrapAdapter(_adapter); wrap_adapter.addFooter(getActivity().getLayoutInflater().inflate(R.layout.empty_list_footer, _recycler_view, false)); _recycler_view.setAdapter(wrap_adapter); } break; default: { super.onManagerConnected(status); } break; } } }; _recycler_view = (RecyclerView) getActivity().findViewById(R.id.recycler_view); OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, getActivity(), _loader_callback); _recycler_view.setLayoutManager(new LinearLayoutManager(getActivity())); getActivity().findViewById(R.id.fab).setOnClickListener(this); getActivity().findViewById(R.id.help_button).setOnClickListener(this); }
From source file:android.google.com.basiccamera.UIActivity.java
License:BSD License
protected void onFinishedSurfaceChanged() { if (INIT_OPENCV) { // Load OpenCV if (!OpenCVLoader.initDebug()) { Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization"); OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback); } else {//from ww w .j a v a 2 s. c o m Log.d(TAG, "OpenCV library found inside package. Using it!"); mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS); } } }
From source file:com.android.cts.verifier.sensors.helpers.OpenCVLibrary.java
License:Apache License
/** * Load OpenCV Library in async mode//from w ww . ja v a 2 s . c o m * * @param context Activity context. * @param allowStatic Allow trying load from local package. * @param allowInstall Allow installing package from play store. * * @return if load succeed return true. Return false otherwise. */ public static boolean load(Context context, boolean allowLocal, boolean allowPackage, boolean allowInstall) { // only need to load once if (!sLoaded) { // Try static load first if (allowLocal && OpenCVLoader.initDebug()) { sLoaded = true; } else if (allowPackage) { if (allowInstall || probePackage(context)) { final CountDownLatch done = new CountDownLatch(1); // Load the library through async loader OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, context, new BaseLoaderCallback(context) { @Override public void onManagerConnected(int status) { Log.v(TAG, "New Loading status: " + status); switch (status) { case LoaderCallbackInterface.SUCCESS: { sLoaded = true; } break; default: { Log.e(TAG, "Connecting OpenCV Manager failed"); } break; } done.countDown(); } }); try { if (!done.await(ASYNC_LOAD_TIMEOUT_SEC, TimeUnit.SECONDS)) { Log.e(TAG, "Time out when attempt async load"); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } } return sLoaded; }
From source file:com.example.thibautg.libreaudioview.MainActivity.java
License:Open Source License
/** * * @param savedInstanceState/*from w w w .j av a 2s. c o m*/ * open cv is loaded */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (openCvStatic) { System.loadLibrary("opencv_java3"); AudioOutput audioOutput = startSoundStreaming(); startCamera(audioOutput); } else if (!openCvStatic) { if (!OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mOpenCVCallBack)) { Log.e(TAG, "Cannot connect to OpenCV Manager"); } } }
From source file:com.louislepper.waveform.CameraActivity.java
License:Apache License
@Override public void onResume() { super.onResume(); if (!OpenCVLoader.initDebug()) { Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization"); OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback); } else {/*w ww . j a v a 2 s. c om*/ Log.d(TAG, "OpenCV library found inside package. Using it!"); mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS); } }
From source file:com.minio.io.alice.MainActivity.java
License:Open Source License
@Override public void onResume() { super.onResume(); if (webSocket == null) { webSocket = new ClientWebSocket(); webSocket.connect(context);/*from w w w. ja v a 2s. c o m*/ } if (!OpenCVLoader.initDebug()) { if (XDebug.LOG) Log.d(MainActivity.TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization"); OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback); } else { if (XDebug.LOG) Log.d(MainActivity.TAG, "OpenCV library found inside package. Using it!"); mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS); } }
From source file:com.projectcs2103t.openglestest.OpenGLES20Activity.java
License:Apache License
@Override protected void onResume() { super.onResume(); if (!OpenCVLoader.initDebug()) { Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization"); OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback); } else {// ww w.j a v a2s . co m Log.d(TAG, "OpenCV library found inside package. Using it!"); mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS); } // The following call resumes a paused rendering thread. // If you de-allocated graphic objects for onPause() // this is a good place to re-allocate them. mGLView.onResume(); }
From source file:com.raulh82vlc.face_detection_sample.opencv.ui.FDOpenCVActivity.java
License:Apache License
@Override protected void onResume() { super.onResume(); Log.e(TAG, "onResume"); initPresenter();//w ww . j a v a 2s. co m if (!OpenCVLoader.initDebug()) { Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization"); OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, presenter.getLoader(getApplicationContext(), openCvCameraView)); } else { Log.d(TAG, "OpenCV library found inside package. Using it!"); presenter.getLoader(getApplicationContext(), openCvCameraView) .onManagerConnected(LoaderCallbackInterface.SUCCESS); } }
From source file:it.baywaylabs.jumpersumo.MainActivity.java
License:Open Source License
@Override public void onResume() { super.onResume(); OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback); Log.d(TAG, "onResume ..."); onServicesDevicesListUpdated();/*from w ww . j a va 2 s. com*/ registerReceivers(); initServices(); }