本文整理汇总了Java中org.opencv.android.OpenCVLoader类的典型用法代码示例。如果您正苦于以下问题:Java OpenCVLoader类的具体用法?Java OpenCVLoader怎么用?Java OpenCVLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OpenCVLoader类属于org.opencv.android包,在下文中一共展示了OpenCVLoader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onResume
import org.opencv.android.OpenCVLoader; //导入依赖的package包/类
@Override
protected void onResume() {
super.onResume();
if (opMode == null)
return;
if (!OpenCVLoader.initDebug()) {
Log.d("OpenCV", "Internal OpenCV library not found. Using OpenCV Manager for initialization");
boolean success = OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, openCVLoaderCallback);
if (!success)
Log.e("OpenCV", "Asynchronous initialization failed!");
else
Log.d("OpenCV", "Asynchronous initialization succeeded!");
} else {
Log.d("OpenCV", "OpenCV library found inside package. Using it!");
openCVLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
}
}
示例2: onResume
import org.opencv.android.OpenCVLoader; //导入依赖的package包/类
@Override
public void onResume()
{
super.onResume();
if (!OpenCVLoader.initDebug()) {
Log.d("OpenCV", "Internal OpenCV library not found. Using OpenCV Manager for initialization");
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback);
} else {
Log.d("OpenCV", "OpenCV library found inside package. Using it!");
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
}
FaceConsumer consumer = new FaceConsumer(faceProcessQueue);
mProcessThread = new Thread(consumer);
mProcessThread.start();
System.out.println("faceConsumer has been started");
}
示例3: onCreate
import org.opencv.android.OpenCVLoader; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imageView = (ImageView)findViewById(R.id.image_view);
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_2_0, this, mOpenCVCallBack);
if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
Log.i("permission", "request READ_EXTERNAL_STORAGE");
ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
REQUEST_READ_EXTERNAL_STORAGE);
}else {
Log.i("permission", "READ_EXTERNAL_STORAGE already granted");
read_external_storage_granted = true;
}
}
示例4: startCamera
import org.opencv.android.OpenCVLoader; //导入依赖的package包/类
private void startCamera()
{
final String funcName = "startCamera";
if (cameraEnabled)
{
if (!OpenCVLoader.initDebug())
{
tracer.traceInfo(
funcName,
"Internal OpenCV library not found, using OpenCV Manager for initialization");
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, activity, loaderCallback);
}
else
{
tracer.traceInfo(funcName, "OpenCV library found inside package, use it!");
loaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
}
// setCameraDisplayOrientation(activity, Camera.CameraInfo.CAMERA_FACING_FRONT);
// cameraPreview.onResume();
}
}
示例5: onCreate
import org.opencv.android.OpenCVLoader; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mRobotConnection = new VisionRobotConnection(this);
mRobotConnection.start();
mPreferences = new VisionAlgorithmPreferences(this);
mRobotConnectionBroadcastReceiver = new RobotConnectionStatusBroadcastReceiver(this, this);
if (!OpenCVLoader.initDebug()) {
Log.e(this.getClass().getSimpleName(), " OpenCVLoader.initDebug(), not working.");
} else {
Log.d(this.getClass().getSimpleName(), " OpenCVLoader.initDebug(), working.");
}
setContentView(R.layout.activity_snobot_vision_gl);
openCamera();
}
示例6: configOpenCv
import org.opencv.android.OpenCVLoader; //导入依赖的package包/类
/**
* Config OpenCV (config callback and init OpenCV).
* When OpenCV is ready, it starts monitoring.
*/
private void configOpenCv() {
// OpenCV callback
BaseLoaderCallback loaderCallback = new BaseLoaderCallback(this) {
@Override
public void onManagerConnected(final int status) {
if (status == LoaderCallbackInterface.SUCCESS) {
openCvLoaded = true;
startMonitoring();
} else {
super.onManagerConnected(status);
}
}
};
// Init openCV
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_2_0, this, loaderCallback);
}
示例7: onCreate
import org.opencv.android.OpenCVLoader; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
incremented = 0;
facesNumber = 0;
eyesNumber = 0;
mouthNumber = 0;
faceDetect = false;
eyesDetect = false;
mouthDetect = false;
brightDetect = false;
lowerLimit1 = 0;
lowerLimit2 = 0;
upperLimit1 = 400;
upperLimit2 = 400;
brightness = 0;
setContentView(R.layout.main);
// mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_6, this, mLoaderCallback);
}
示例8: onResume
import org.opencv.android.OpenCVLoader; //导入依赖的package包/类
@Override
public void onResume()
{
super.onResume();
// Load default libopencv_java.so
if (OpenCVLoader.initDebug())
{
Toast.makeText(getApplicationContext(), "Libraries Loaded!", Toast.LENGTH_SHORT).show();
if (mLoaderCallback != null)
{
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
}
}
else
{
Toast.makeText(getApplicationContext(), "failed to load libraries", Toast.LENGTH_SHORT).show();
}
// Usual OpenCV Loader
// OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
}
示例9: onResume
import org.opencv.android.OpenCVLoader; //导入依赖的package包/类
@Override
public void onResume() {
super.onResume();
if (!OpenCVLoader.initDebug()) {
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_2_0,
this, mLoaderCallback);
} else {
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
}
}
示例10: onResume
import org.opencv.android.OpenCVLoader; //导入依赖的package包/类
@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 {
Log.d(TAG, "OpenCV library found inside package. Using it!");
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
}
}
示例11: onResume
import org.opencv.android.OpenCVLoader; //导入依赖的package包/类
public boolean onResume() {
if (!hasCamera(activity)) {
Toast.makeText(activity,
activity.getString(R.string.camera_unavailable_toast_message),
Toast.LENGTH_LONG).show();
return false;
}
if (camera == null) {
camera = Camera.open(findBackFacingCamera());
Picture = getPictureCallback();
cameraPreview.refreshCamera(camera);
}
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_5, activity, mLoaderCallback);
return true;
}
示例12: initializeOpenCVLibrary
import org.opencv.android.OpenCVLoader; //导入依赖的package包/类
private void initializeOpenCVLibrary() {
if (!OpenCVLoader.initDebug()) {
Log.e(this.getClass().getSimpleName(), " OpenCVLoader.initDebug(), not working.");
} else {
Log.d(this.getClass().getSimpleName(), " OpenCVLoader.initDebug(), working.");
}
}
示例13: onResume
import org.opencv.android.OpenCVLoader; //导入依赖的package包/类
@Override
protected void onResume() {
super.onResume();
Log.e(TAG, "onResume");
initPresenter();
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);
}
}
示例14: init
import org.opencv.android.OpenCVLoader; //导入依赖的package包/类
protected void init() {
addAccessibilityServiceDelegates();
registerActivityLifecycleCallbacks();
InputEventObserver.initGlobal(mContext);
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_13, mContext, new BaseLoaderCallback(mContext) {
});
}
示例15: onResume
import org.opencv.android.OpenCVLoader; //导入依赖的package包/类
@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 {
Log.d(TAG, "OpenCV library found inside package. Using it!");
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
}
init();
CameraProcessActivity.this.processState = false;
}