CameraCaptureUI 控制弹出窗口的大小? [英] CameraCaptureUI control size of popup?

查看:23
本文介绍了CameraCaptureUI 控制弹出窗口的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于 CameraCaptureUI 的几个问题.

A couple of questions about CameraCaptureUI.

1) 我可以控制弹出窗口的大小/位置吗?它在我的 Win10 平板电脑上弹出的很小,每次应用需要拍照时都放大它真的很烦人!

1) Can I control the size/placement of the popup? It pops up very small on my Win10 tablet and it's really annoying to enlarge it each time the app needs to take a photo!

2) 我正在尝试创建质量与内置相机应用程序相当的照片,但我遇到了很多麻烦.只有通过使用croppedSizeInPixels,我才能获得更大的质量看起来不错的东西.有人可以解释为什么这有帮助,以及是否有更好的方法来提高照片的质量?默认情况下,内置应用程序创建约 1MB 大的 2592x1944 像素图像.如果这是正确的方法,我应该以某种方式计算这些尺寸吗?

2) I am trying to create photos that are equivalent in quality to the built-in camera app, but I had a lot of trouble with this. Only by playing around with the croppedSizeInPixels could I get anything larger that seemed decent quality. Can someone explain why this helped and if there's a better way to increase the quality of the photo? The builtin app creates 2592x1944 pixel images approx 1MB large by default. IF this is the right way should I be calculating these dimensions somehow?

captureUI = new CameraCaptureUI();
captureUI.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg;
captureUI.PhotoSettings.AllowCropping = true;
captureUI.PhotoSettings.MaxResolution = CameraCaptureUIMaxPhotoResolution.HighestAvailable;

// photo created is approx 576KB
captureUI.PhotoSettings.CroppedSizeInPixels = new Size(3840, 2160);    

推荐答案

1) 我可以控制弹出窗口的大小/位置吗?

1) Can I control the size/placement of the popup?

如您所见,CameraCaptureUI 类 可以控制相机捕捉 UI 的大小/位置.对于 Windows 8.1,此类提供了一个完整的窗口 UI,用于从相机捕获音频、视频和照片.但是,在 Windows 10 中,它是一个弹出窗口.实际上,该类启动了用于捕获的内置相机应用程序,您可以在任务管理器中找到它.

As you can see, there is no API in CameraCaptureUI class can control the size/placement of the camera capture UI. For Windows 8.1, this class provides a full window UI for capturing audio, video, and photos from a camera. However, in Windows 10, it's a popup windows. Actually, this class launches the built-in Camera app for capturing, you can find this in Task Manager.

如果 CameraCaptureUI 无法满足您的要求,并且您希望对捕获操作进行更强大的低级别控制,则应使用 MediaCapture 对象并实现您自己的捕获体验.有关详细信息,请参阅捕获照片和视频与 MediaCapture.

If CameraCaptureUI can't meet your requirement and you want more robust, low-level control of the capture operation, you should use the MediaCapture object and implement your own capture experience. For more information, see Capture photos and video with MediaCapture.

2) 我正在尝试制作质量与内置相机应用相当的照片.

2) I am trying to create photos that are equivalent in quality to the built-in camera app.

CameraCaptureUI 类实际上启动了用于捕获的内置相机应用程序,它没有提供很多方法来为返回的照片指定属性.我们只能使用 CroppedSizeInPixels 来指定分辨率拍摄的照片.我们可以将此属性设置为足够大的值.如果指定的尺寸大于任何可用分辨率,则拍摄的照片将首先缩放到足够大的尺寸.如果您想控制捕获图片的分辨率,我还建议将 MediaCapture 与 GetMediaStreamPropertiesSetMediaStreamPropertiesAsync 方法.有关详细信息,请参阅相机分辨率示例.

CameraCaptureUI class actually launches the built-in Camera app for capturing and it doesn't provide much ways to specify properties for the returned photo. We can only use CroppedSizeInPixels to specify the resolution of the captured photo. We can set this property to a large enough value. If a size is specified that is larger than any available resolution, then the captured photo will be scaled to a large enough size first. If you want to control the resolution of the captured picture, I'd also recommend using MediaCapture with GetMediaStreamProperties and SetMediaStreamPropertiesAsync methods. For more info, please see Camera resolution sample.

这篇关于CameraCaptureUI 控制弹出窗口的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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