简体   繁体   English

为Windows 10 Universal App构建OpenCV

[英]Building OpenCV for Windows 10 Universal App

Firstly, when I use CMake with this command to generate the solution for OpenCV 3.1: 首先,当我通过此命令使用CMake生成OpenCV 3.1的解决方案时:

set VLD_DIR=vld_dir
mkdir %VLD_DIR%
set OPENCV_TEST_DATA_PATH=..\..\opencv_extra
set OPENCV_PERF_VALIDATION_DIR=%VLD_DIR%
cmake .. -G "Visual Studio 14 2015" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0

Then build it with Visual Studio 2015 and I have a bunch of errors, one of them is: 然后使用Visual Studio 2015进行构建,我有很多错误,其中一个是:

 Error  C2653   'CameraOptionsUI': is not a class or namespace name opencv_videoio  G:\opencv\modules\videoio\src\cap_winrt\CaptureFrameGrabber.cpp 100 

And then when I try to make a blank universal app for Windows 10 using visual studio 2015 again, then type this on a random function: 然后,当我尝试再次使用Visual Studio 2015为Windows 10创建空白的通用应用程序时,然后在随机函数上键入以下内容:

 Windows::Media::Capture::

the intellisense never guides me to the CameraOptiosUI. 智慧永远不会引导我使用CameraOptiosUI。 The strange thing is that when I go to the MSN site: https://msdn.microsoft.com/en-us/library/windows/apps/windows.media.capture.cameraoptionsui.aspx , it looks like the class does exist. 奇怪的是,当我转到MSN站点时: https : //msdn.microsoft.com/en-us/library/windows/apps/windows.media.capture.cameraoptionsui.aspx ,看起来该类确实存在。 Where is the class in Windows 10 platform? Windows 10平台上的课程在哪里?

Another Info: I built OpenCV the same but for UWP version 8.1, I succeeded. 另一个信息:我以相同的方式构建了OpenCV,但对于UWP版本8.1,我成功了。 Then I come to the same line as the error above (CaptureFrameGrabber.cpp line 100), it points me to the class ref class Windows::Media::Capture::CameraOptionsUI. 然后,我进入与上面的错误相同的行(CaptureFrameGrabber.cpp第100行),它将我指向类ref类Windows :: Media :: Capture :: CameraOptionsUI。 Why in version 10, I cannot point to that class anymore? 为什么在版本10中,我不能再指向该类? Does it changed the API? 是否更改了API?

Sorry for my bad English. 对不起,我的英语不好。

From Lucian Wischik blog 来自Lucian Wischik博客

How to build OpenCV native dlls for UWP OpenCV is on GitHub. 如何为UWP构建OpenCV本机dll OpenCV在GitHub上。 There are three relevant forks/branches, as of writing on November 2015: 截至2015年11月,共有三个相关的分支/分支:

1 https://github.com/itseez/opencv 1 https://github.com/itseez/opencv

 +- [2] fork https://github.com/Microsoft/opencv

      +- [3] branch https://github.com/Microsoft/opencv/tree/vs2015-samples

Repository 1 is the master. 存储库1是主存储库。 In it, the native OpenCV binaries are built for all different platforms using CMake. 在其中,本机OpenCV二进制文件使用CMake为所有不同的平台构建。 As far as I can tell, this repository only has support via CMake for building Windows Store and Windows Phone 8.0 and 8.1 apps. 据我所知,此存储库仅通过CMake支持构建Windows Store和Windows Phone 8.0和8.1应用程序。 It doesn't seem to have UWP. 它似乎没有UWP。 And it also requires you to install some particular old versions of VS, as per its readme.txt. 并且还需要您根据VS的readme.txt安装一些特定的旧版本的VS。

Fork [2] doesn't seem to bring anything new. 前叉[2]似乎并没有带来什么新的东西。

Branch [3] contains Visual Studio .sln files from which you can build UWP versions of all the native OpenCV binaries: x86, x64 and ARM, Debug and Release. 分支[3]包含Visual Studio .sln文件,您可以从中构建所有本机OpenCV二进制文件的UWP版本:x86,x64和ARM,调试和发行版。 The Release builds actually were a bit wonky, but I submitted PR #69 to make them build right. 发布版本实际上有点古怪,但是我提交了PR#69以使其正确构建。 So: if you clone this repository, select this branch, set an environment variable, and open up vs2015/WS/10.0/ARM/OpenCV.sln, or x86/OpenCV.sln, or x64/OpenCV.sln, then you can successfully build UWP binaries for OpenCV. 因此:如果克隆此存储库,选择此分支,设置环境变量,然后打开vs2015 / WS / 10.0 / ARM / OpenCV.sln或x86 / OpenCV.sln或x64 / OpenCV.sln,则可以成功为OpenCV构建UWP二进制文件。 This will produce 15 binaries for each architecture+build combination. 这将为每种架构+构建组合生成15个二进制文件。

http://blogs.msdn.com/b/lucian/archive/2015/11/28/opencv-building-uwp-binaries.aspx http://blogs.msdn.com/b/lucian/archive/2015/11/28/opencv-building-uwp-binaries.aspx

If you want to use the CameraOptionsUI-Class, you can add the needed Reference for it in your Solution Explorer. 如果要使用CameraOptionsUI类,则可以在解决方案资源管理器中为其添加所需的参考。 Under the "Reference"-menu. 在“参考”菜单下。 Rightclick and "add Reference" should offer you a menu for adding Extensions. 右键单击和“添加参考”应为您提供添加扩展的菜单。 Somewhere there you're going to find the extensions for Desktop-UWP-Apps or something similar. 您将在某个地方找到Desktop-UWP-Apps的扩展名或类似的扩展名。 Just add them and your Visual Studio should find the CameraOptionsUI-Class. 只需添加它们,Visual Studio就会找到CameraOptionsUI-Class。 This Class is for Desktop-Apps ;) 此类适用于桌面应用程序;)

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM