在使用Visual C ++的Windows应用商店应用中使用OpenCV [英] Using OpenCV in a Windows Store app with Visual C++

查看:258
本文介绍了在使用Visual C ++的Windows应用商店应用中使用OpenCV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用 OpenCV 库在Windows 8商店应用程序中使用C ++ / CX进行某些图像处理。我可以使用Visual C ++ 2012构建OpenCV库,但当我打包我的应用程序,并运行 Windows应用程序认证包,我得到几个错误说,OpenCV DLL使用一些不受支持的Windows API。如何修复这些错误?

解决方案

OpenCV使用CMake构建其源。下载OpenCV源后,在根文件夹中编辑文件CMakeLists.txt以包含以下两行:



add_definitions(-DWINAPI_FAMILY = WINAPI_FAMILY_APP)$ b $



if(WIN32 AND NOT MINGW)在以下#if块中添加b_definitions(-D_UNICODE)



通过这样做,您的库将只能访问Windows应用商店应用支持的API。这可能意味着你将必须修复一些生成错误(当我上星期尝试没有太多),但最终你的二进制文件将是WACK干净。



但是上述步骤将仅对OpenCV的x86和x64版本构建成功。 OpenCV使用的CMake工具尚不支持ARM体系结构的Visual C ++ 2012项目。该问题正由此错误跟踪。



更新



现在有一个CMake的端口支持构建Windows应用商店和手机应用程序(8.0和8.1)。详情请参阅:
http://cmakems.codeplex.com/



第二次更新



下面的视频显示了OpenCV在使用C ++编写的Windows 10 Universal应用程序中的工作:
http://channel9.msdn.com/Events/Build/2015/3-82


I am trying to use the OpenCV library for some image processing inside my Windows 8 Store app using C++/CX. I am able to build the OpenCV library using Visual C++ 2012 but when I package my app and run the Windows App Certification Kit, I get several errors saying that the OpenCV DLLs use some unsupported Windows API. How do I fix these errors?

解决方案

OpenCV uses CMake to build its sources. After you have downloaded the OpenCV sources, in the root folder edit the file CMakeLists.txt to contain the following two lines:

add_definitions(-DWINAPI_FAMILY=WINAPI_FAMILY_APP) add_definitions(-D_UNICODE)

in the following #if block:

if(WIN32 AND NOT MINGW)

By doing this your library will only have access to the API that are supported for Windows Store apps. This might mean that you will have to fix some build errors (there weren't too many when I tried last week) but eventually your binaries would be WACK clean.

But the above steps will succeed only for x86 and x64 builds of OpenCV. The CMake tool which is used by OpenCV, doesn't yet support Visual C++ 2012 projects for ARM architecture. That issue is being tracked by this bug.

Update

There is now a port of CMake that support building Windows Store and Phone apps (both 8.0 and 8.1). See details here: http://cmakems.codeplex.com/

Second Update

The below video shows OpenCV working in a Windows 10 Universal app written using C++: http://channel9.msdn.com/Events/Build/2015/3-82

这篇关于在使用Visual C ++的Windows应用商店应用中使用OpenCV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆