Ask Your Question
1

Build OpenCV and PCL with Cmake

asked 2017-05-15 08:21:27 -0600

danieltak gravatar image

Hello, I am new to Computer Vision and am having trouble to build OpenCV with PCL, i could build PCL alone. Since PCL is developed to be complementary to OpenCV, it is good to call both libraries.

I am using Windows 7 x64, OpenCV 3.2.0, Visual Studio 2017 (MSVC15) and PCL 1.8.0.

The OpenCV installed is the Win Pack, VS is working fine and PCL was installed with the all-in-one pack (http://unanancyowen.com/en/pcl18/#Dow...). The Enviromental variable used for OpenCV are: "Path" "%OPENCV_DIR%\bin;C:\Program Files\opencv\build\x64\vc14"& "OPENCV_DIR" "C:\Program Files\opencv\build" & "OPENCV_VER" "320" and also OpenCV_DIR, changing to lowercase.

The CmakeLists.txt code is and is a code from the same site as the all-in-one package:

cmake_minimum_required( VERSION 2.8 )
# Create Project
project( solution )
add_executable( project main.cpp )

# Set StartUp Project (Option)
# (This setting is able to enable by using CMake 3.6.0 RC1 or later.)
set_property( DIRECTORY PROPERTY VS_STARTUP_PROJECT "project" )

# Find Packages
# Find PCL
find_package( PCL 1.8 REQUIRED )

# Find OpenCV
set( "OpenCV_DIR" "C:/Program Files/opencv/build" )
find_package( OpenCV REQUIRED )


if( PCL_FOUND AND OpenCV_FOUND )
  # [C/C++]>[General]>[Additional Include Directories]
  include_directories( ${PCL_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} )

  # [C/C++]>[Preprocessor]>[Preprocessor Definitions]
  add_definitions( ${PCL_DEFINITIONS} )

  # For Use Not PreCompiled Features 
  #add_definitions( -DPCL_NO_PRECOMPILE )

  # [Linker]>[General]>[Additional Library Directories]
  link_directories( ${PCL_LIBRARY_DIRS} ${OpenCV_LIB_DIR})

  # [Linker]>[Input]>[Additional Dependencies]
  target_link_libraries( project ${PCL_LIBRARIES}  ${OpenCV_LIBS} )
endif()

And the log given by the Cmake-gui is:

Boost version: 1.61.0
Found the following Boost libraries:
  system
  filesystem
  thread
  date_time
  iostreams
  serialization
  chrono
  atomic
  regex
Could NOT find openni (missing:  OPENNI_LIBRARY OPENNI_INCLUDE_DIRS) 
** WARNING ** io features related to openni will be disabled
Could NOT find ensenso (missing:  ENSENSO_LIBRARY ENSENSO_INCLUDE_DIR) 
** WARNING ** io features related to ensenso will be disabled
Could NOT find DAVIDSDK (missing:  DAVIDSDK_LIBRARY DAVIDSDK_INCLUDE_DIR) 
** WARNING ** io features related to davidSDK will be disabled
Could NOT find DSSDK (missing:  _DSSDK_LIBRARIES) 
** WARNING ** io features related to dssdk will be disabled
Could NOT find RSSDK (missing:  _RSSDK_LIBRARIES) 
** WARNING ** io features related to rssdk will be disabled
** WARNING ** io features related to pcap will be disabled
** WARNING ** io features related to png will be disabled
Could NOT find openni (missing:  OPENNI_LIBRARY OPENNI_INCLUDE_DIRS) 
** WARNING ** visualization features related to openni will be disabled
Could NOT find ensenso (missing:  ENSENSO_LIBRARY ENSENSO_INCLUDE_DIR) 
** WARNING ** visualization features related to ensenso will be disabled
Could NOT find DAVIDSDK (missing:  DAVIDSDK_LIBRARY DAVIDSDK_INCLUDE_DIR) 
** WARNING ** visualization features related to davidSDK will be disabled
Could NOT find DSSDK (missing:  _DSSDK_LIBRARIES) 
** WARNING ** visualization features related to dssdk will be disabled
Could NOT find RSSDK (missing:  _RSSDK_LIBRARIES) 
** WARNING ** visualization features related to rssdk will be disabled
looking for PCL_COMMON
looking for PCL_OCTREE
looking for PCL_IO
looking for PCL_KDTREE
looking for PCL_SEARCH
looking for PCL_SAMPLE_CONSENSUS
looking for PCL_FILTERS
looking for PCL_2D
looking for PCL_GEOMETRY
looking for PCL_FEATURES
looking for PCL_ML
looking for PCL_SEGMENTATION
looking for PCL_VISUALIZATION
looking for PCL_SURFACE
looking for PCL_REGISTRATION
looking for PCL_KEYPOINTS
looking for PCL_TRACKING
looking for PCL_RECOGNITION
looking for PCL_STEREO
looking for PCL_OUTOFCORE
looking for PCL_PEOPLE
OpenCV ARCH: x86
OpenCV RUNTIME: vc15 ...
(more)
edit retag flag offensive close merge delete

Comments

did you actually build the opencv libs for vs2017 ?

(you can't use the prebuilt libs, they're for vs2015)

berak gravatar imageberak ( 2017-05-15 08:25:11 -0600 )edit

I think i will reinstall the vs, however vs2017 is msvc 15.2, just some changes that i didn't look what was.

danieltak gravatar imagedanieltak ( 2017-05-15 08:50:30 -0600 )edit

"Opencv ARCH : x86" do you use a 32bits system?

LBerger gravatar imageLBerger ( 2017-05-15 08:59:33 -0600 )edit

It is x64 =P I tried to compile with Visual Studio 15 2017 Win64, but PCL was configured to win32, i ll try to remake PCL build. However, it didn't even get to OpenCV part.

danieltak gravatar imagedanieltak ( 2017-05-15 09:01:33 -0600 )edit

Do you need eigen with pcl?

LBerger gravatar imageLBerger ( 2017-05-15 09:14:00 -0600 )edit

I am not really sure, i am trying some 2D Lidar applications (Newbie of Computer Vision here). However, some examples with 2D Lidar that i saw didn't use Eigen. ps.: I am installing the x64 version of PCL and 3rd party. Will give the feedback soon

danieltak gravatar imagedanieltak ( 2017-05-15 09:26:21 -0600 )edit

if you solve install pcl with eigen and vs 2017 please let me know

LBerger gravatar imageLBerger ( 2017-05-15 09:32:22 -0600 )edit

Try to take a look at this: https://gist.github.com/UnaNancyOwen/...

And https://gist.github.com/UnaNancyOwen/... ps.: I can't understand japanese, but could have some ideia with the steps.

danieltak gravatar imagedanieltak ( 2017-05-15 09:44:01 -0600 )edit

Thanks but i can build eigen with vs 2015-vs 2013 but not with vs 2017 : there is a bug in vs 2017...

LBerger gravatar imageLBerger ( 2017-05-15 10:15:16 -0600 )edit

I am checking the new Version of Eigen, where they made some MSVC bug fixes. Here is the changelog However, if it really is a bug, you could File a Bug

I am trying to install this new version with Cmake on Windows and it is not working, don't have LINUX to try it, because they have the INTALL file for unix systems. Either it is a Visual Studio bug or the CmakeLists.txt of the beta version is wrong for VS2017, it isn't installing Blas files and many others. I don't know how to fix it, since i am new to Cmake. Sorry

And i solved my problem, will post it tomorrow

danieltak gravatar imagedanieltak ( 2017-05-15 11:50:22 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-09-04 09:07:00 -0600

danieltak gravatar image

updated 2018-09-04 09:11:41 -0600

Found the answer asking on the website that i got those files: http://unanancyowen.com/en/pcl18/#comment-1221

This is the code to build OpenCV and PCL with CMAKE:

cmake_minimum_required( VERSION 2.8 )
# Create Project
project( solution )
add_executable( project main.cpp )

# Set StartUp Project (Option)
# (This setting is able to enable by using CMake 3.6.0 RC1 or later.)
set_property( DIRECTORY PROPERTY VS_STARTUP_PROJECT "project" )

# Find Packages
# Find PCL
find_package( PCL 1.8 REQUIRED )

# Find OpenCV
set( OpenCV_DIR "C:/Program Files/opencv/build" )
find_package( OpenCV REQUIRED )

if( PCL_FOUND AND OpenCV_FOUND )
  # [C/C++]>[General]>[Additional Include Directories]
  include_directories( ${PCL_INCLUDE_DIRS} )
  include_directories( ${OpenCV_INCLUDE_DIRS} )

  # [C/C++]>[Preprocessor]>[Preprocessor Definitions]
  add_definitions( ${PCL_DEFINITIONS} )

  # For Use Not PreCompiled Features 
  #add_definitions( -DPCL_NO_PRECOMPILE )

  # [Linker]>[General]>[Additional Library Directories]
  link_directories( ${PCL_LIBRARY_DIRS} )
  link_directories( ${OpenCV_LIB_DIR} )

  # [Linker]>[Input]>[Additional Dependencies]
  target_link_libraries( project ${PCL_LIBRARIES} )
  target_link_libraries( project ${OpenCV_LIBS} )
endif()

And on this link there is an old explanation.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-05-15 08:11:45 -0600

Seen: 3,920 times

Last updated: Sep 04 '18