Browse Source

Fix a few warning in the Android demo compilation.

EMGUCV_3_4_3
Canming Huang 7 years ago
parent
commit
c87236ab14
  1. 7
      Emgu.CV.Example/Android/ButtonMessageImageActivity.cs
  2. 27
      Emgu.CV.Example/Android/Camera2Activity.cs
  3. 2
      Emgu.CV.Example/LicensePlateRecognition/LicensePlateDetector.cs
  4. 2
      Emgu.CV.Example/XamarinForms/Core/ButtonTextImagePage.xaml.cs

7
Emgu.CV.Example/Android/ButtonMessageImageActivity.cs

@ -43,8 +43,7 @@ namespace AndroidExamples
//dummy code to load the opencv libraries
bool loaded = CvInvoke.CheckLibraryLoaded();
//CvInvoke.CV_FOURCC('m', 'j', 'p', 'g');
}
/*
@ -75,7 +74,7 @@ namespace AndroidExamples
String action;
if (haveCameraOption & havePickImgOption)
{
int result = GetUserResponse(this, "Use Image from", "Default", "Photo Library", "Camera");
int result = GetUserResponse(this, pickImgString, "Default", "Photo Library", "Camera");
if (result == 1)
action = "Default";
else if (result == 0)
@ -88,7 +87,7 @@ namespace AndroidExamples
}
else if (havePickImgOption)
{
int result = GetUserResponse(this, "Use Image from", "Default", "Photo Library", "Cancel");
int result = GetUserResponse(this, pickImgString, "Default", "Photo Library", "Cancel");
if (result == 1)
action = "Default";

27
Emgu.CV.Example/Android/Camera2Activity.cs

@ -530,27 +530,28 @@ namespace AndroidExamples
/// <summary>
/// {@link CameraDevice.StateCallback} is called when the currently active {@link CameraDevice}
/// CameraStateListener is called when the currently active {@link CameraDevice}
/// changes its state.
/// </summary>
CameraDevice.StateCallback mStateCallback;
class StateCallback : CameraDevice.StateCallback
public class CameraStateListener : CameraDevice.StateCallback
{
Camera2Activity Activity { get; set; }
public StateCallback(Camera2Activity activity)
public CameraStateListener(Camera2Activity activity)
{
Activity = activity;
}
public override void OnOpened(CameraDevice camera)
{
// This method is called when the camera is opened. We start camera preview here if
// the TextureView displaying this has been set up.
lock (mCameraStateLock)
{
mState = STATE_OPENED;
mCameraOpenCloseLock.Release();
mCameraDevice = camera;
@ -560,28 +561,28 @@ namespace AndroidExamples
{
CreateCameraPreviewSessionLocked();
}*/
}
}
public override void OnDisconnected(CameraDevice camera)
{
lock (mCameraStateLock)
{
mState = STATE_CLOSED;
mCameraOpenCloseLock.Release();
camera.Close();
mCameraDevice = null;
}
}
public override void OnError(CameraDevice camera, Android.Hardware.Camera2.CameraError error)
{
Log.Error(TAG, "Received camera device error: " + error);
lock (mCameraStateLock)
{
@ -595,7 +596,7 @@ namespace AndroidExamples
{
activity.Finish();
}
}
}
}
/// <summary>
@ -748,7 +749,7 @@ namespace AndroidExamples
var activity = this;
CameraManager manager = (CameraManager)activity.GetSystemService(Context.CameraService);
mStateCallback = new StateCallback(this);
mStateCallback = new CameraStateListener(this);
try
{

2
Emgu.CV.Example/LicensePlateRecognition/LicensePlateDetector.cs

@ -266,7 +266,7 @@ namespace LicensePlateRecognition
UMat filteredPlate = FilterPlate(plate);
Tesseract.Character[] words;
//Tesseract.Character[] words;
StringBuilder strBuilder = new StringBuilder();
using (UMat tmp = filteredPlate.Clone())
{

2
Emgu.CV.Example/XamarinForms/Core/ButtonTextImagePage.xaml.cs

@ -64,7 +64,7 @@ namespace Emgu.CV.XamarinForms
if (action.Equals("Default"))
{
#if __ANDROID__
mats[i] = new Mat(Forms.Context.Assets, imageNames[i]);
mats[i] = new Mat( Android.App.Application.Context.Assets, imageNames[i]);
#else
mats[i] = CvInvoke.Imread(imageNames[i], ImreadModes.AnyColor);

Loading…
Cancel
Save