如何在OpenCV中使用/安装VIZ [英] How do I use/install VIZ in OpenCV

查看:721
本文介绍了如何在OpenCV中使用/安装VIZ的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试遵循本教程这里.当我运行代码时,我得到

I'm trying to follow this tutorial here. When I run the code I get

"g++ -std=c++11 d.cpp -o d `pkg-config --cflags --libs opencv`
d.cpp:20:27: fatal error: opencv2/viz.hpp: No such file or directory
 #include <opencv2/viz.hpp>
                           ^
compilation terminated.

Compilation exited abnormally with code 1 at Fri May  9 01:22:57
"

怎么回事?如何使用/安装viz? viz文件夹位于<OpenCV-Source-Directory>/modules文件夹中,而viz.hpp在其中,我构建了OpenCV的Itseez版本.

Whats going on? How do I use/install viz? The viz folder is in the <OpenCV-Source-Directory>/modules folder and viz.hpp is there, I build the Itseez version of OpenCV.

可以使用一些建议,tututials/google什么也没说.

Could use a little advice, the tutotials/google say nothing.

推荐答案

要在opencv中使用viz模块,您需要:

To use the viz module in opencv you need:

1)构建,编译和安装VTK库. 下载最新的VTK版本: http://www.vtk.org/download/
转到VTK文件夹:

1) Build, compile and install VTK library. Download the last VTK version: http://www.vtk.org/download/
Go to VTK folder:

cd /Users/myUser/Documents/VTK

创建构建文件夹:

mkdir build

cd build

设置cmake参数以将viz模块与opencv一起使用.为此,我们将在控制台中编写:

Set the cmake parameters to use viz module with opencv. To do this We will write in console:

ccmake .

这将显示来自cmake的配置窗口(我无法放置图像).然后,您需要使用向下键盘越过窗口并尝试查找下一个参数来对其进行更改.最后,参数应如下所示:

And it's going to show a configuration window from cmake (I can't put the image). Then you need to cross the window with down keyboard and try to find the next parameters to change it. Finally the parameters should be like this:

BUILD_SHARED_LIBS = ON

BUILD_TESTING = ON

CMAKE_BUILD_TYPE = Release

CMAKE_INSTALL_PREFIX = /Users/myUser/Documents/VTK/build

QT_QMAKE_EXECUTABLE = /usr/local/bin/qmake

然后按"t",然后在此窗口中:

Then push 't' and in this window:

使用向下键盘跨文件(现在您需要保留更多时间)以查找nexts参数并对其进行更改:

Cross the file with down-keyboard (now you need to keep the key much more time) to find the nexts parameters and to change it:

CMAKE_OSX_ARCHITECTURES: i386;x86_64

CMAKE_OSX_SYSROOT: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk

按"c"保存配置并退出. 现在我们可以编译安装VTK库了:

Push 'c' to save the configuration and exit. Now we can compile an install the VTK library:

cmake .

make

sudo make install

2)再次构建,编译和安装opencv,但是当我们要使用时,我们需要使用WITH_VTK = ON(如morynicz所说). ->转到opencv文件夹

2) Build, compile and install opencv again, but when we are going we need to use WITH_VTK=ON (like morynicz says). ->Go to the opencv folder

cd /User/myUser/Documents/Opencv

mkdir build

cd build

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON -D BUILD_EXAMPLES=ON –D WITH_VTK=ON ../

make

sudo make install

这篇关于如何在OpenCV中使用/安装VIZ的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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