OpenCV作为依赖项安装在我的Android代码中,但在运行应用程序时,它仍要求进行打包安装。但是该程序包在playstore中不可用(最初将其作为依赖项安装的原因)
我从该网站(https://medium.com/@rdeep/android-opencv-integration-without-opencv-manager-c259ef14e73b)运行了所有步骤,以安装适用于Android的opencv 343。 但是,当我在手机上(通过android studio)运行应用程序时,我收到安装软件包“找不到OpenCV管理器软件包”的消息。 我该怎么办?
我尝试运行以下代码:
public class MainActivity extends AppCompatActivity implements CameraBridgeViewBase.CvCameraViewListener2 {
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
@Override
public void onManagerConnected(int status) {
switch (status) {
case LoaderCallbackInterface.SUCCESS:
{
//Log.i(TAG, "OpenCV loaded successfully");
mOpenCvCameraView.enableView();
} break;
default:
{
super.onManagerConnected(status);
} break;
}
}
};
@Override
public void onResume()
{
super.onResume();
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION, this, mLoaderCallback);
//OpenCVLoader.initDebug();
}
private CameraBridgeViewBase mOpenCvCameraView;
@Override
public void onCreate(Bundle savedInstanceState) {
//Log.i(TAG, "called onCreate");
Log.d("verify",String.valueOf(OpenCVLoader.initDebug()));
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.activity_main);
mOpenCvCameraView = findViewById(R.id.HelloOpenCvView);
mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE);
mOpenCvCameraView.setCvCameraViewListener(this);
}
@Override
public void onPause()
{
super.onPause();
if (mOpenCvCameraView != null)
mOpenCvCameraView.disableView();
}
public void onDestroy() {
super.onDestroy();
if (mOpenCvCameraView != null)
mOpenCvCameraView.disableView();
}
public void onCameraViewStarted(int width, int height) {
}
public void onCameraViewStopped() {
}
public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {
return inputFrame.rgba();
}
}
我希望能运行相机 相反,当应用程序启动时,我收到错误消息,必须退出该应用程序。