简体   繁体   中英

Building OpenCV for Windows 10 Universal App

Firstly, when I use CMake with this command to generate the solution for 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:

 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:

 Windows::Media::Capture::

the intellisense never guides me to the 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. Where is the class in Windows 10 platform?

Another Info: I built OpenCV the same but for UWP version 8.1, I succeeded. 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. Why in version 10, I cannot point to that class anymore? Does it changed the API?

Sorry for my bad English.

From Lucian Wischik blog

How to build OpenCV native dlls for UWP OpenCV is on GitHub. There are three relevant forks/branches, as of writing on November 2015:

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. In it, the native OpenCV binaries are built for all different platforms using 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. It doesn't seem to have UWP. And it also requires you to install some particular old versions of VS, as per its readme.txt.

Fork [2] doesn't seem to bring anything new.

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. The Release builds actually were a bit wonky, but I submitted PR #69 to make them build right. 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. This will produce 15 binaries for each architecture+build combination.

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. 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. Just add them and your Visual Studio should find the CameraOptionsUI-Class. This Class is for Desktop-Apps ;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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