Ask Your Question

Opencv 2.4.9 Viz module not there.

asked 2014-04-29 04:12:31 -0500

MRDaniel gravatar image


I downloaded opencv-2.4.9.exe and linked with Visual Studio 2012.

In the source, i cannot find the viz module.

I followed this tutorial, changing values to 249 for OpenCV.

Any clues?

edit retag flag offensive close merge delete


did you include the correct header file (opencv2/viz/...)? Because the standard opencv.hpp doesn't include it yet as you can see here

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-29 04:42:02 -0500 )edit

it's a 3.0 feature only.

berak gravatar imageberak ( 2014-04-29 04:43:39 -0500 )edit

euhm viz is added as 2.4.9 looking at the changelog which clearly states that "New VTK-based 3D visualization module viz stabilized and back-ported to 2.4 branch." So this is actually a bug and this should be fixed!

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-29 04:59:17 -0500 )edit

ehum, right.sorry.

berak gravatar imageberak ( 2014-04-29 05:02:27 -0500 )edit

Intellisense cannot find the include that we want. I am working from the tutorial sample with that include line.

MRDaniel gravatar imageMRDaniel ( 2014-04-29 05:03:49 -0500 )edit

@StevenPuttemans Is it QT related?

MRDaniel gravatar imageMRDaniel ( 2014-04-29 06:15:07 -0500 )edit

no it is not :) the viz interface is based on the VTK package for 3D modelling. Problem is that with the integration of viz module inside the 2.4 branch, errors were solved BUT they didn't think of fixing all headers to be properly included. Saw you opened a bug report. Link it to this topic and wait until someone starts fixing those headers or do so yourself. The files are there, the correct references in other files not! A dumb way could be to include all the source and header files of the viz module in your project, but don't think this will work .. worth a try tough.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-29 06:18:34 -0500 )edit

@berak : its just a matter of checking first then replying :P I almost made the same mistake ^_^

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-29 06:19:50 -0500 )edit

I'll post the link. I'm building trunk from source, hopefully that'll work out. :)

MRDaniel gravatar imageMRDaniel ( 2014-04-29 06:20:22 -0500 )edit

Won't solve it, just looked at the 2.4 branch, it seems that headers are not included at the correct places. However I haven't got the knowledge where it should all be added :D

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-29 06:21:44 -0500 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2014-05-05 08:57:36 -0500

Anatoly gravatar image

updated 2014-05-05 09:05:48 -0500

How to build 'opencv_viz' module.

For Ubuntu

  1. sudo apt-get isntall libvtk5-dev
  2. cmake -DWITH_VTK=On <path-to-opencv-sources> //cmake will find vtk automatically
  3. make.

For windows

  1. Download VTK sources from
  2. Open CMake-Gui and configure VTK for Visual Studio.
  3. Enable compilation as static library option & reconfigure
  4. open generated Visual studio project and compile it for Release & Debug

Note: it's recommended to compile VTK statically, because in this case 'opencv_viz.dll' will be ~15 Mb in size and fully self-contained (i.e. no external dependencies at all).

Build OpenCV with VTK.

  • set WITH_VTK= On in CMake-Gui
  • set VTK_DIR = path-to-build-directory-of-VTK
  • compile OpenCV

Note: it is recommended to point build directory, not install directory.

Note: if you have several VTKs in your system and wrong version is found, you may force concrete version via setting VTK_DIR environment variable to proper path.

For Macos

It's possible, I made it! And I tested it for OS X 10.9 with VTK 6.2 from vtk development repository. I don't remember my steps that's why don't publish them here.

edit flag offensive delete link more


Guru gravatar imageGuru ( 2014-07-05 11:50:51 -0500 )edit

how do i enable compilation as static library ? I cannot find that optin

Nbb gravatar imageNbb ( 2016-08-30 07:36:55 -0500 )edit

Sorry, this doesn't help me on windows, with vtk and successfull cmake for it, there still no opencv_viz.dll after building ALL_BUILD.

stiv-yakovenko gravatar imagestiv-yakovenko ( 2017-09-17 13:57:11 -0500 )edit

@stiv-yakovenko post a new question if you don't use opencv 2.4.9

LBerger gravatar imageLBerger ( 2017-09-17 14:09:51 -0500 )edit

for opencv 3 it should be not path-to-build-directory-of-VTK, but vtk cmake file folder

stiv-yakovenko gravatar imagestiv-yakovenko ( 2017-09-17 15:09:20 -0500 )edit

this post is too old path on windows now should be -DVTK_DIR:PATH=......./install/vtk/lib/cmake/vtk-8.1

LBerger gravatar imageLBerger ( 2017-09-17 15:12:13 -0500 )edit

answered 2014-05-05 07:50:33 -0500

Andrey Pavlenko gravatar image

The new viz module exists in OpenCV-2.4.9 sources but was not included into pre-built libraries since it depends on VTK that assumes redistribution of pre-built VTK with the package.

For those who needs the viz module we suggest building OpenCV-2.4.9 from sources with -DWITH_VTK=ON CMake option. (Use -DVTK_DIR=/your/vtk/build/path to help CMake finding VTK).

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-04-29 04:12:31 -0500

Seen: 17,827 times

Last updated: May 05 '14