相机使用自定义相机预览渲染器不清楚 [英] Camera Using custom Camera Preview Renderer is not clear

查看:24
本文介绍了相机使用自定义相机预览渲染器不清楚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下链接使用自定义渲染器显示相机预览

如何使相机预览更清晰,因为我希望稍后将其用于 OCR.

谢谢,

解决方案

我想您已经明白了这一点,但我将在此处发布解决方案以供参考.

您需要在相机属性中设置对焦模式".

Camera Preview = Camera.Open(1);//设置参数.如果(预览!= null){Camera.Parameters cameraParameters = Preview.GetParameters();//自动对焦cameraParameters.FocusMode = Camera.Parameters.FocusModeContinuousPicture;//放cameraPreview.Preview.SetParameters(cameraParameters);}

对于您提到的示例(https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/custom-renderer/view/) 您应该将此代码放在您的 Android Cutom Renderer 中(CameraPreviewRenderer 方法 OnElementChanged).>

它对我有用.希望这会有所帮助.

I am using the following link to display the camera preview using Custom renderers https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/custom-renderer/view/

I was able to bring up the camera preview. But the preview is not at all clear. There is no Auto focus as well. Screenshot for reference

How can I make the camera preview clearer, because I wish to use the same later on for OCR.

Thanks,

解决方案

I think you already figured this out but I'm going to post the solution here for reference.

You need to setup the "Focus Mode" in the Camera properties.

Camera Preview = Camera.Open(1);
// Set the parameters.
if (Preview != null)
{
    Camera.Parameters cameraParameters = Preview.GetParameters();
    // Autofocus
    cameraParameters.FocusMode = Camera.Parameters.FocusModeContinuousPicture;
    // Set
    cameraPreview.Preview.SetParameters(cameraParameters);
}

For the example you mentioned (the one in https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/custom-renderer/view/) you should place this code in you Android Cutom Renderer (CameraPreviewRenderer method OnElementChanged).

It worked for me. Hope this helps.

这篇关于相机使用自定义相机预览渲染器不清楚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆