简体   繁体   English

如何更改UWP的媒体捕获照片分辨率?

[英]How to change media capture photo resolution for UWP?

So I have some code that takes a photo in a UWP app (running on windows desktops and phones) using this code. 所以我有一些代码可以使用此代码在UWP应用程序(在Windows桌面和手机上运行)中拍照。

await _mediaCapture.CapturePhotoToStreamAsync(ImageEncodingProperties.CreateJpeg(), stream);

And it works great but it always takes the image at the full resolution of the device... (so 44 megapixels on a Lumia 1020) which is too big for me. 它的效果很好,但它总是以设备的全分辨率拍摄图像......(Lumia 1020上的44万像素)对我来说太大了。 I want to limit the resolution to a fixed size (say around 16 megapixel). 我想将分辨率限制在固定大小(比如大约1600万像素)。

So is there a way of setting the camera capture resolution or will I have to capture it at full resolution and downscale it myself? 那么有没有办法设置相机捕获分辨率,还是我必须以全分辨率捕获它并自己缩小尺寸?

You should be able to change resolution of MediaCapture element by setting MediaStreamProperties just after initialization: 您应该能够通过在初始化之后设置MediaStreamProperties来更改MediaCapture元素的分辨率:

// initialization here

// get available resolutions
var resolutions = captureManager.VideoDeviceController.GetAvailableMediaStreamProperties(MediaStreamType.Photo).ToList();
// set used resolution
await captureManager.VideoDeviceController.SetMediaStreamPropertiesAsync(MediaStreamType.Photo, resolutions[1]);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 UWP Media Capture无法通过WebCam录制视频 - UWP Media Capture Not Recording Video through WebCam UWP:后台任务中的音频媒体捕获 - UWP: Audio media capture in a background task 如何在Windows 8.1中捕获高分辨率视频并从中捕获照片。 尝试时出现UI跳跃效果 - How to capture high resolution video and capture photo from it in windows 8.1. I am having a UI jumping effect while tried it 如何在Windows Phone 8,8.1中更改默认视频捕获分辨率 - how to change the default video capture resolution in windows phone 8,8.1 如何在 C# 中捕获所有屏幕并更改位图的分辨率 - How to capture all screen in C# and change the resolution of the bitmap 如何在拍摄照片时缩放照片并使用wp8.1中的Media.Capture Api相应地设置Focus属性 - How to Zoom photo while capturing Photo and set Focus property accordingly using Media.Capture Api in wp8.1 拍摄多张照片,然后发送到服务器UWP C# - Capture more then one photo and send to the server UWP C# 如何在UWP中使用ListView捕获点击? - How to capture click with ListView in UWP? 如何从 UWP 上传照片到网络服务? - How to upload photo from UWP to web service? 如何根据 UWP 中的屏幕分辨率缩放 window? - How to scale window according to screen resolution in UWP?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM