Visual Studio 2017 Viz.hpp not working [closed]

asked 2018-09-04 13:17:47 -0600

Ron88 gravatar image

updated 2018-09-04 13:31:43 -0600

LBerger gravatar image

Dear all,

I try to compile the following example Code (Source 1), but I Always get the LNK2019 error (Source 2). I used the OpenCV Version 3.4.3 and the Viz.hpp and Viz Folder is originally not in the include Folder of build/include/ opencv2. I added it from the source Folder in Sources/modules/viz/include/opencv2. Has anybody a hint, what I can do?

Thanks in Advance and Kind Regards

Ron

**Source 1**
// OpenCV_Test.cpp : Diese Datei enthält die Funktion "main". Hier beginnt und endet die Ausführung des Programms.
//

#include "pch.h"
#include <opencv2/viz.hpp>
#include <opencv2/calib3d.hpp>
#include <iostream>

using namespace cv;
using namespace std;

/**
 * @function help
 * @brief Display instructions to use this tutorial program
 */
static void help()
{
    cout
        << "--------------------------------------------------------------------------" << endl
        << "This program shows how to visualize a cube rotated around (1,1,1) and shifted "
        << "using Rodrigues vector." << endl
        << "Usage:" << endl
        << "./widget_pose" << endl
        << endl;
}

/**
 * @function main
 */
int main()
{
    help();

    /// Create a window
    viz::Viz3d myWindow("Coordinate Frame");

    /// Add coordinate axes
    myWindow.showWidget("Coordinate Widget", viz::WCoordinateSystem());

    /// Add line to represent (1,1,1) axis
    viz::WLine axis(Point3f(-1.0f, -1.0f, -1.0f), Point3f(1.0f, 1.0f, 1.0f));
    axis.setRenderingProperty(viz::LINE_WIDTH, 4.0);
    myWindow.showWidget("Line Widget", axis);

    /// Construct a cube widget
    viz::WCube cube_widget(Point3f(0.5, 0.5, 0.0), Point3f(0.0, 0.0, -0.5), true, viz::Color::blue());
    cube_widget.setRenderingProperty(viz::LINE_WIDTH, 4.0);
    myWindow.showWidget("Cube Widget", cube_widget);

    /// Rodrigues vector
    Mat rot_vec = Mat::zeros(1, 3, CV_32F);
    float translation_phase = 0.0, translation = 0.0;
    while (!myWindow.wasStopped())
    {
        /* Rotation using rodrigues */
        /// Rotate around (1,1,1)
        rot_vec.at<float>(0, 0) += (float)CV_PI * 0.01f;
        rot_vec.at<float>(0, 1) += (float)CV_PI * 0.01f;
        rot_vec.at<float>(0, 2) += (float)CV_PI * 0.01f;

        /// Shift on (1,1,1)
        translation_phase += (float)CV_PI * 0.01f;
        translation = sin(translation_phase);

        Mat rot_mat;
        Rodrigues(rot_vec, rot_mat);

        /// Construct pose
        Affine3f pose(rot_mat, Vec3f(translation, translation, translation));

        myWindow.setWidgetPose("Cube Widget", pose);

        myWindow.spinOnce(1, true);
    }

    return 0;
}

Source 2

1>------ Erstellen gestartet: Projekt: OpenCV_Test, Konfiguration: Debug x64 ------ 1>OpenCV_Test.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __cdecl cv::viz::Widget::~Widget(void)" (??1Widget@viz@cv@@QEAA@XZ)" in Funktion ""public: __cdecl cv::viz::Widget3D::~Widget3D(void)" (??1Widget3D@viz@cv@@QEAA@XZ)". 1>OpenCV_Test.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: void __cdecl cv::viz::Widget::setRenderingProperty(int,double)" (?setRenderingProperty@Widget@viz@cv@@QEAAXHN@Z)" in Funktion "main". 1>OpenCV_Test.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __cdecl cv::viz::WLine::WLine(class cv::Point3_<double> const &,class cv::Point3_<double> const &,class cv::viz::Color const &)" (??0WLine@viz@cv@@QEAA@AEBV?$Point3_@N@2@0AEBVColor@12@@Z)" in Funktion "main". 1>OpenCV_Test.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __cdecl cv::viz::WCube::WCube(class cv::Point3_<double> const &,class cv::Point3_<double> const &,bool,class cv::viz::Color const &)" (??0WCube@viz@cv ... (more)

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-12-06 10:10:22.619219

Comments

" I used the OpenCV Version 3.4.3 and the Viz.hpp and Viz Folder is originally not in the include Folder" Have you got vtk installed?

LBerger gravatar imageLBerger ( 2018-09-04 13:34:31 -0600 )edit

Hello LBerger,

I installed it. Is there any Setting or path that Needs to be adjusted?

Kind Regards

Ron

Ron88 gravatar imageRon88 ( 2018-09-05 05:09:54 -0600 )edit

delete cmakecache.txt an run cmakegui after configure check VTK_DIR variables if it is set to NOT_FOUND then set it to something as .../vtk/lib/cmake/vtk-8.1 rerun configure and BUILD_opencv_viz must be set to true. Press generate and rebuild opencv

LBerger gravatar imageLBerger ( 2018-09-05 06:00:23 -0600 )edit

In CMAKE there is no possibility to choose the BUILD_opencv_viz, although it is in the modules Folder. I added the VTK path to VTK_DIR.

Ron88 gravatar imageRon88 ( 2018-09-05 08:39:30 -0600 )edit

can you post cmakeoutput?

can you check this in your vtk installed?

LBerger gravatar imageLBerger ( 2018-09-05 08:41:33 -0600 )edit

The CXX compiler identification is MSVC 19.15.26726.0 The C compiler identification is MSVC 19.15.26726.0 Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x86/cl.exe Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x86/cl.exe -- works Detecting CXX compiler ABI info Detecting CXX compiler ABI info - done Detecting CXX compile features Detecting CXX compile features - done Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x86/cl.exe Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.15.26726/

Ron88 gravatar imageRon88 ( 2018-09-05 08:44:20 -0600 )edit
Ron88 gravatar imageRon88 ( 2018-09-05 08:47:19 -0600 )edit

Where to build binaries c:/build/opencv Ok but not inside opencv github folder. Are you in 32 bits ? cmake genrator for 64 bits is Visual Studio 15 2017 Win64 and post cmake output in your post

you can use this too

LBerger gravatar imageLBerger ( 2018-09-05 08:51:09 -0600 )edit

I'm on a 64bit operating System and I try to compile it for Visual Studio 2017. The path where I try to build the binaries is: C:\Users\Ron\Documents\A_Working_Directory\Studium\Software\Bildverarbeitung\opencv-3.4.3

Ron88 gravatar imageRon88 ( 2018-09-05 09:00:33 -0600 )edit

Visual Studio 15 2017 is for a 32 bits system

LBerger gravatar imageLBerger ( 2018-09-05 09:03:00 -0600 )edit

What does that mean? Should I change the Visual Studio Version?

Ron88 gravatar imageRon88 ( 2018-09-05 09:06:19 -0600 )edit

Can you recommend a combination of VTK Version, OpenCV Version and Visual Studio Version for a Windows 10 64bit System

Ron88 gravatar imageRon88 ( 2018-09-05 09:09:20 -0600 )edit

No you must change cmake generator in cmakegui. delete cmakecache.txt and choose this one

image description

LBerger gravatar imageLBerger ( 2018-09-05 09:14:32 -0600 )edit

I did all of this, but still no BUILD_opencv_viz. :(

Ron88 gravatar imageRon88 ( 2018-09-05 11:34:32 -0600 )edit

where is cmakeoutput ?

LBerger gravatar imageLBerger ( 2018-09-05 12:27:27 -0600 )edit

Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) (Required is at least version "2.7") Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) (Required is at least version "2.6") AVX_512F is not supported by C++ compiler AVX512_SKX is not supported by C++ compiler Dispatch optimization AVX512_SKX is not available, skipped libjpeg-turbo: VERSION = 1.5.3, BUILD = opencv-3.4.3-libjpeg-turbo Looking for Mfapi.h Looking for Mfapi.h - found found Intel IPP (ICV version): 2017.0.3 [2017.0.3] at: C:/Users/Ron/Documents/A_Working_Directory/Studium/Software/Bildverarbeitung/opencv-3.4.3/bin/3rdparty/ippicv/ippicv_win found Intel IPP IW sources: 2017.0.3 at: C:/Users/Ron/Documents/A_Working_Directory/Studium/Software/Bildverarbeitung/opencv-3.4.3/bin/3rdparty/ippicv/ippiw_win

Ron88 gravatar imageRon88 ( 2018-09-05 12:46:46 -0600 )edit

Could not find OpenBLAS include. Turning OpenBLAS_FOUND off Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off Could NOT find BLAS (missing: BLAS_LIBRARIES) LAPACK requires BLAS A library with LAPACK API not found. Please specify library location. Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) Could NOT find Matlab (missing: MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN) VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file Processing WORLD modules... module opencv_core... module opencv_flann... module opencv_imgproc... module opencv_ml.

Ron88 gravatar imageRon88 ( 2018-09-05 12:50:19 -0600 )edit

Could not find OpenBLAS include. Turning OpenBLAS_FOUND off Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off Could NOT find BLAS (missing: BLAS_LIBRARIES) LAPACK requires BLAS A library with LAPACK API not found. Please specify library location. Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) Could NOT find Matlab (missing: MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN) VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file Processing WORLD modules... module opencv_core... module opencv_flann... module opencv_imgproc... module opencv_ml.

Ron88 gravatar imageRon88 ( 2018-09-05 12:51:00 -0600 )edit

GUI: Win32 UI: YES VTK support: NO

Media I/O: ZLib: build (ver 1.2.11) JPEG: build-libjpeg-turbo (ver 1.5.3-62) WEBP: build (ver encoder: 0x020e) PNG: build (ver 1.6.34) TIFF: build (ver 42 - 4.0.9) JPEG 2000: build (ver 1.900.1) OpenEXR: build (ver 1.7.1) HDR: YES SUNRASTER: YES PXM: YES

Video I/O: Video for Windows: YES DC1394: NO FFMPEG: YES (prebuilt binaries) avcodec: YES (ver 57.107.100)

Ron88 gravatar imageRon88 ( 2018-09-05 12:52:04 -0600 )edit

avformat: YES (ver 57.83.100) avutil: YES (ver 55.78.100) swscale: YES (ver 4.8.100) avresample: YES (ver 3.7.0) GStreamer: NO DirectShow: YES Media Foundation: YES

Parallel framework: Concurrency

Ron88 gravatar imageRon88 ( 2018-09-05 12:53:28 -0600 )edit

Trace: YES (with Intel ITT)

Other third-party libraries: Intel IPP: 2017.0.3 [2017.0.3] at: C:/Users/Ron/Documents/A_Working_Directory/Studium/Software/Bildverarbeitung/opencv-3.4.3/bin/3rdparty/ippicv/ippicv_win Intel IPP IW: sources (2017.0.3) at: C:/Users/Ron/Documents/A_Working_Directory/Studium/Software/Bildverarbeitung/opencv-3.4.3/bin/3rdparty/ippicv/ippiw_win

Ron88 gravatar imageRon88 ( 2018-09-05 12:54:04 -0600 )edit