I'm using google vision to read QR tags. everything has be going fine on the phone that I was developing for. recently I was given an Galaxy Tab A as the target device. I cannot get the Tab A to auto focus close enough to read the qr tags.
I noticed in the camera app that it has a Macro setting. when I turn it on, it focuses up close and reads the tag just fine.
So... in Xamarin how do I access the camera object's parameters when I am using the google vision cameraSource?
I've tried the examples I've found here, and I guess I'm missing something, cause I can't make them work.
Thanks for any help.
update
Here's the only way I have been able to get this java code to convert, and it doesn't work. Obviously I'm doing something wrong...
private static bool cameraFocus(CameraSource cameraSource, String focusMode)
{
Java.Lang.Reflect.Field[] declaredFields = cameraSource.Class.GetDeclaredFields();
foreach (Java.Lang.Reflect.Field field in declaredFields) {
if (field.GetType() == typeof(Android.Hardware.Camera)) {
field.Accessible = true;
try {
Android.Hardware.Camera camera = (Android.Hardware.Camera)field.Get(cameraSource);
if (camera != null) {
Android.Hardware.Camera.Parameters parameters = camera.GetParameters();
parameters.FocusMode = Android.Hardware.Camera.Parameters.FocusModeMacro;
camera.SetParameters(parameters);
return true;
}
return false;
} catch {
}
break;
}
}
return false;
}