使用Win RT从相机捕获快照
Capturing Snap from Camera using Win RT
我正在编写从相机捕获图像的代码。下面是我写的代码。这里方法CapturePhotoToStorageFileAsync没有返回。
auto MediaCap = ref new Windows::Media::Capture::MediaCapture();
auto ImageProp = ref new Windows::Media::Capture::ImageEncodingProperties ();
ImageProp->Height = 240;
ImageProp->Width = 320;
ImageProp->Subtype = "JPEG";
Windows::Storage::StorageFile^ strFile;
auto res = MediaCap->CapturePhotoToStorageFileAsync(ImageProp,strFile);
res->Completed = ref new AsyncActionCompletedHandler([](IAsyncAction ^action)
{
//action->GetResults();
//action->Start();
///action->Close();
});
res->Start();
我在这里错过了什么吗?
您是想向用户显示UI还是只是默默地捕获?我发现的唯一的c++相机示例使用CameraCaptureUI和CaptureFileAsync -然后操作是获得一个StorageFile^ back。
如果你故意使用CapturePhotoToStorageFileAsync,检查你的功能。
问题已解决
添加了 的代码- InitializeAsync ()
- 创建用于存储图像的文件使用
Windows::Storage::StorageFileRetrievalOperation^ CreateFileOp = Windows::Storage::KnownFolders::图片库->CreateFileAsync("Test.jpg");
我找到了Java脚本文章,并在c++中实现。http://code.msdn.microsoft.com/windowsdesktop/Media-Capture-Sample-adf87622/sourcecode?fileId=43837& pathId = 1754477665
相关文章:
- 了解 GLM- openGL 中的相机转换
- OpenGL相机和相机空间转型的困惑
- 如何使用按钮更新GTK3图像以使用C++从相机捕获图片
- 通过 API 控制 DJI 相机
- 将相机数据从服务器实时流式传输到客户端
- 来自逆 vp 矩阵和相机位置的光线方向不正确
- OpenCV - Python 断言错误:SAD 算法 - 立体相机视差图计算
- Qt 和 Android - 如何使用 Qandroidjniobject 启动相机
- 在Windows(C++)中使用USB相机拍摄高分辨率照片
- 如何在相机类中添加胶卷
- 强制Qt相机视频格式
- 操纵安卓相机的深度图导致应用程序崩溃
- 深度值没有意义 R200 相机
- Qt QML相机在部署后显示白屏
- Opencv 如何从相机读取单帧
- OpenCV - 来自相机的实时馈送不流畅
- 佳能SDK无法从相机下载图片
- 如何处理来自MIPI相机的12位图像?
- 如何设置vtk相机的正确变焦系数?
- 使用Win RT从相机捕获快照