如何在Win8 metro应用程序VS2012中提高摄像头捕获质量

时间:2013-11-28 19:00:28

标签: visual-studio-2012 camera windows-8.1

我正在为Windows 8开发一个应用程序,它可以从webCamera中获取照片,目前的质量(.jpg或.png)是

  • 身高和宽度:640X480
  • 分辨率:96ppp
  • 深陷:24位

function takePhoto() {
    //if a file with the same name exist, creates another with a number at the end
    pics.createFileAsync("photo.jpg", Storage.CreationCollisionOption.generateUniqueName)
      .then(function (file) {   
          var photoProperties = Windows.Media.MediaProperties.ImageEncodingProperties.createJpeg();
          var photoProperties = Windows.Media.MediaProperties.ImageEncodingProperties.createPng();

          mediaCapture.capturePhotoToStorageFileAsync(photoProperties, file).then(function () {
              console.log("Image saved on disk. ");

              var thumbnailUrl = URL.createObjectURL(file, { oneTimeOnly: true });

              previewSlide(thumbnailUrl);
          });
      });
}

如果我将当前屏幕截图与原生相机的截图进行比较,原生相机的应用程序的质量是优越的,我希望得到与原生相机相同的结果,或者如果不可能,我想提高图像质量,如何实现?< / p>

提前致谢


编辑试图解析 MediaStreamType 的图片

enter image description here

enter image description here


初始化相机的功能:

function startCamera() {
        mediaCapture = new Capture.MediaCapture();

        mediaCapture.initializeAsync().then(function () {

            var iVectorView = mediaCapture.videoDeviceController.getAvailableMediaStreamProperties(Windows.Media.Capture.MediaStreamType.photo);

            for (var i = 0; i < iVectorView.length; i++) {
                console.log("elemento " + i + ":" + iVectorView[i]);
            }



            mediaCapture.VideoDeviceController.SetMediaStreamPropertiesAsync(iVectorView[], properties);
            mediaCapture.videoDeviceController.setm


            livePreview.src = URL.createObjectURL(mediaCapture);
            livePreview.play();
        });

        livePreview.addEventListener("pause", handlePause);
    }

1 个答案:

答案 0 :(得分:0)

这就是我在我的定格动画应用Zoetrope中的表现:

  1. 致电mediaCapture.VideoDeviceController.GetAvailableMediaStreamProperties(Windows.Media.Capture.MediaStreamType.Photo)以获取所有可用的照片资料并将结果投放至VideoEncodingProperties
  2. 返回的每个流属性都将具有宽度,高度和颜色深度等属性 - 选择一个适合您用例的属性。
  3. 致电mediaCapture.VideoDeviceController.SetMediaStreamPropertiesAsync(MediaStreamType.Photo, properties) with the VideoEncodingProperties that you want to use.