Camera Using custom Camera Preview Renderer is not clear

别来无恙 提交于 2019-12-24 11:56:09

问题


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,


回答1:


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.



来源:https://stackoverflow.com/questions/44136669/camera-using-custom-camera-preview-renderer-is-not-clear

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!