Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: ‘CV_IMWRITE_PNG_COMPRESSION’ was not declared in this scope #5

Open
SalvaTure98 opened this issue Jan 12, 2023 · 8 comments

Comments

@SalvaTure98
Copy link

SalvaTure98 commented Jan 12, 2023

Hi, I'm trying to install the package and I followed all the instructions. I'm using Ros Noetic, ./bin/Protonect and NiViewer2 work fine and the current version of OpenCv is 4.2.0, but then when I use:

cd ~/catkin_ws/src/
git clone https://github.com/code-iai/iai_kinect2.git
cd iai_kinect2
rosdep install -r --from-paths .
cd ~/catkin_ws
catkin_make -DCMAKE_BUILD_TYPE="Release" -Dfreenect2_DIR=/home/salvo/libfreenect2/lib/cmake/freenect2
Base path: /home/salvo/catkin_ws

This happens:
atkin_make -DCMAKE_BUILD_TYPE="Release" -Dfreenect2_DIR=/home/salvo/libfreenect2/lib/cmake/freenect2
Base path: /home/salvo/catkin_ws
Source space: /home/salvo/catkin_ws/src
Build space: /home/salvo/catkin_ws/build
Devel space: /home/salvo/catkin_ws/devel
Install space: /home/salvo/catkin_ws/install

Running command: "cmake /home/salvo/catkin_ws/src -DCMAKE_BUILD_TYPE=Release -Dfreenect2_DIR=/home/salvo/libfreenect2/lib/cmake/freenect2 -DCATKIN_DEVEL_PREFIX=/home/salvo/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/salvo/catkin_ws/install -G Unix Makefiles" in "/home/salvo/catkin_ws/build"

-- Using CATKIN_DEVEL_PREFIX: /home/salvo/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/salvo/catkin_ws/devel;/opt/ros/noetic
-- This workspace overlays: /home/salvo/catkin_ws/devel;/opt/ros/noetic
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.10", minimum required is "3")
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Using Debian Python package layout
-- Using empy: /usr/lib/python3/dist-packages/em.py
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/salvo/catkin_ws/build/test_results
-- Forcing gtest/gmock from source, though one was otherwise available.
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /usr/bin/python3 (found version "3.8.10")
-- Using Python nosetests: /usr/bin/nosetests3
-- catkin 0.8.10
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~ traversing 5 packages in topological order:
-- ~~ - iai_kinect2 (metapackage)
-- ~~ - kinect2_registration
-- ~~ - kinect2_bridge
-- ~~ - kinect2_calibration
-- ~~ - kinect2_viewer
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin metapackage: 'iai_kinect2'
-- ==> add_subdirectory(iai_kinect2/iai_kinect2)
-- +++ processing catkin package: 'kinect2_registration'
-- ==> add_subdirectory(iai_kinect2/kinect2_registration)
-- CPU based depth registration enabled
-- OpenCL based depth registration enabled
CMake Warning at iai_kinect2/kinect2_registration/CMakeLists.txt:60 (message):
Your libOpenCL.so is incompatible with CL/cl.h. Install ocl-icd-opencl-dev
to update libOpenCL.so?

-- +++ processing catkin package: 'kinect2_bridge'
-- ==> add_subdirectory(iai_kinect2/kinect2_bridge)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- +++ processing catkin package: 'kinect2_calibration'
-- ==> add_subdirectory(iai_kinect2/kinect2_calibration)
-- +++ processing catkin package: 'kinect2_viewer'
-- ==> add_subdirectory(iai_kinect2/kinect2_viewer)
-- Eigen found (include: /usr/include/eigen3, version: 3.3.7)
-- The imported target "vtkParseOGLExt" references the file
"/usr/bin/vtkParseOGLExt-7.1"
but this file does not exist. Possible reasons include:

  • The file was deleted, renamed, or moved to another location.
  • An install or uninstall procedure did not complete successfully.
  • The installation package was faulty and contained
    "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
    but not all the files it references.

-- The imported target "vtkRenderingPythonTkWidgets" references the file
"/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
but this file does not exist. Possible reasons include:

  • The file was deleted, renamed, or moved to another location.
  • An install or uninstall procedure did not complete successfully.
  • The installation package was faulty and contained
    "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
    but not all the files it references.

-- The imported target "vtk" references the file
"/usr/bin/vtk"
but this file does not exist. Possible reasons include:

  • The file was deleted, renamed, or moved to another location.
  • An install or uninstall procedure did not complete successfully.
  • The installation package was faulty and contained
    "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
    but not all the files it references.

-- The imported target "pvtk" references the file
"/usr/bin/pvtk"
but this file does not exist. Possible reasons include:

  • The file was deleted, renamed, or moved to another location.
  • An install or uninstall procedure did not complete successfully.
  • The installation package was faulty and contained
    "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
    but not all the files it references.

-- OpenNI found (include: /usr/include/ni, lib: /usr/lib/libOpenNI.so)
-- OpenNI2 found (include: /usr/include/openni2, lib: /usr/lib/libOpenNI2.so)
** WARNING ** io features related to pcap will be disabled
** WARNING ** io features related to png will be disabled
** WARNING ** io features related to libusb-1.0 will be disabled
-- OpenNI found (include: /usr/include/ni, lib: /usr/lib/libOpenNI.so)
-- OpenNI2 found (include: /usr/include/openni2, lib: /usr/lib/libOpenNI2.so)
-- QHULL found (include: /usr/include, lib: optimized;/usr/lib/x86_64-linux-gnu/libqhull.so;debug;/usr/lib/x86_64-linux-gnu/libqhull.so)
-- OpenNI found (include: /usr/include/ni, lib: /usr/lib/libOpenNI.so)
-- looking for PCL_COMMON
-- looking for PCL_KDTREE
-- looking for PCL_OCTREE
-- looking for PCL_SEARCH
-- looking for PCL_SAMPLE_CONSENSUS
-- looking for PCL_FILTERS
-- looking for PCL_2D
-- looking for PCL_GEOMETRY
-- looking for PCL_IO
-- 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_APPS
-- looking for PCL_IN_HAND_SCANNER
-- looking for PCL_POINT_CLOUD_EDITOR
-- looking for PCL_OUTOFCORE
-- looking for PCL_PEOPLE
-- Configuring done
-- Generating done
-- Build files have been written to: /home/salvo/catkin_ws/build

Running command: "make -j12 -l12" in "/home/salvo/catkin_ws/build"

[ 33%] Built target kinect2_registration
[ 41%] Building CXX object iai_kinect2/kinect2_calibration/CMakeFiles/kinect2_calibration.dir/src/kinect2_calibration.cpp.o
[ 50%] Building CXX object iai_kinect2/kinect2_bridge/CMakeFiles/kinect2_bridge_nodelet.dir/src/kinect2_bridge.cpp.o
[ 58%] Building CXX object iai_kinect2/kinect2_bridge/CMakeFiles/kinect2_bridge.dir/src/kinect2_bridge.cpp.o
[ 66%] Building CXX object iai_kinect2/kinect2_viewer/CMakeFiles/kinect2_viewer.dir/src/viewer.cpp.o
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_calibration/src/kinect2_calibration.cpp: In constructor ‘Recorder::Recorder(const string&, const string&, const string&, const string&, Source, bool, bool, const Size&, float)’:
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_calibration/src/kinect2_calibration.cpp:113:22: error: ‘CV_IMWRITE_PNG_COMPRESSION’ was not declared in this scope
113 | params.push_back(CV_IMWRITE_PNG_COMPRESSION);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp: In member function ‘void Kinect2Bridge::initCompression(int32_t, int32_t, bool)’:
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:464:28: error: ‘CV_IMWRITE_JPEG_QUALITY’ was not declared in this scope
464 | compressionParams[0] = CV_IMWRITE_JPEG_QUALITY;
| ^~~~~~~~~~~~~~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:466:28: error: ‘CV_IMWRITE_PNG_COMPRESSION’ was not declared in this scope
466 | compressionParams[2] = CV_IMWRITE_PNG_COMPRESSION;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp: In member function ‘void Kinect2Bridge::initCompression(int32_t, int32_t, bool)’:
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:464:28: error: ‘CV_IMWRITE_JPEG_QUALITY’ was not declared in this scope
464 | compressionParams[0] = CV_IMWRITE_JPEG_QUALITY;
| ^~~~~~~~~~~~~~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:468:28: error: ‘CV_IMWRITE_PNG_STRATEGY’ was not declared in this scope
468 | compressionParams[4] = CV_IMWRITE_PNG_STRATEGY;
| ^~~~~~~~~~~~~~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:466:28: error: ‘CV_IMWRITE_PNG_COMPRESSION’ was not declared in this scope
466 | compressionParams[2] = CV_IMWRITE_PNG_COMPRESSION;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:469:28: error: ‘CV_IMWRITE_PNG_STRATEGY_RLE’ was not declared in this scope
469 | compressionParams[5] = CV_IMWRITE_PNG_STRATEGY_RLE;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:468:28: error: ‘CV_IMWRITE_PNG_STRATEGY’ was not declared in this scope
468 | compressionParams[4] = CV_IMWRITE_PNG_STRATEGY;
| ^~~~~~~~~~~~~~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:469:28: error: ‘CV_IMWRITE_PNG_STRATEGY_RLE’ was not declared in this scope
469 | compressionParams[5] = CV_IMWRITE_PNG_STRATEGY_RLE;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp: In member function ‘void Kinect2Bridge::receiveColor()’:
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:1103:45: error: ‘CV_BGRA2BGR’ was not declared in this scope
1103 | cv::cvtColor(tmp, images[COLOR_HD], CV_BGRA2BGR);
| ^~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:1107:45: error: ‘CV_RGBA2BGR’ was not declared in this scope
1107 | cv::cvtColor(tmp, images[COLOR_HD], CV_RGBA2BGR);
| ^~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp: In member function ‘void Kinect2Bridge::processIrDepth(const cv::Mat&, std::vectorcv::Mat&, const std::vectorKinect2Bridge::Status&)’:
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:1183:50: error: ‘CV_BGRA2BGR’ was not declared in this scope
1183 | cv::cvtColor(tmp, images[COLOR_SD_RECT], CV_BGRA2BGR);
| ^~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:1187:50: error: ‘CV_RGBA2BGR’ was not declared in this scope
1187 | cv::cvtColor(tmp, images[COLOR_SD_RECT], CV_RGBA2BGR);
| ^~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp: In member function ‘void Kinect2Bridge::processColor(std::vectorcv::Mat&, const std::vectorKinect2Bridge::Status&)’:
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:1250:55: error: ‘CV_BGR2GRAY’ was not declared in this scope
1250 | cv::cvtColor(images[COLOR_HD], images[MONO_HD], CV_BGR2GRAY);
| ^~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:1254:65: error: ‘CV_BGR2GRAY’ was not declared in this scope
1254 | cv::cvtColor(images[COLOR_HD_RECT], images[MONO_HD_RECT], CV_BGR2GRAY);
| ^~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:1258:57: error: ‘CV_BGR2GRAY’ was not declared in this scope
1258 | cv::cvtColor(images[COLOR_QHD], images[MONO_QHD], CV_BGR2GRAY);
| ^~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp: In member function ‘void Kinect2Bridge::receiveColor()’:
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:1103:45: error: ‘CV_BGRA2BGR’ was not declared in this scope
1103 | cv::cvtColor(tmp, images[COLOR_HD], CV_BGRA2BGR);
| ^~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:1262:67: error: ‘CV_BGR2GRAY’ was not declared in this scope
1262 | cv::cvtColor(images[COLOR_QHD_RECT], images[MONO_QHD_RECT], CV_BGR2GRAY);
| ^~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:1107:45: error: ‘CV_RGBA2BGR’ was not declared in this scope
1107 | cv::cvtColor(tmp, images[COLOR_HD], CV_RGBA2BGR);
| ^~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp: In member function ‘void Kinect2Bridge::processIrDepth(const cv::Mat&, std::vectorcv::Mat&, const std::vectorKinect2Bridge::Status&)’:
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:1183:50: error: ‘CV_BGRA2BGR’ was not declared in this scope
1183 | cv::cvtColor(tmp, images[COLOR_SD_RECT], CV_BGRA2BGR);
| ^~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:1187:50: error: ‘CV_RGBA2BGR’ was not declared in this scope
1187 | cv::cvtColor(tmp, images[COLOR_SD_RECT], CV_RGBA2BGR);
| ^~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp: In member function ‘void Kinect2Bridge::processColor(std::vectorcv::Mat&, const std::vectorKinect2Bridge::Status&)’:
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:1250:55: error: ‘CV_BGR2GRAY’ was not declared in this scope
1250 | cv::cvtColor(images[COLOR_HD], images[MONO_HD], CV_BGR2GRAY);
| ^~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:1254:65: error: ‘CV_BGR2GRAY’ was not declared in this scope
1254 | cv::cvtColor(images[COLOR_HD_RECT], images[MONO_HD_RECT], CV_BGR2GRAY);
| ^~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:1258:57: error: ‘CV_BGR2GRAY’ was not declared in this scope
1258 | cv::cvtColor(images[COLOR_QHD], images[MONO_QHD], CV_BGR2GRAY);
| ^~~~~~~~~~~
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:1262:67: error: ‘CV_BGR2GRAY’ was not declared in this scope
1262 | cv::cvtColor(images[COLOR_QHD_RECT], images[MONO_QHD_RECT], CV_BGR2GRAY);
| ^~~~~~~~~~~
make[2]: *** [iai_kinect2/kinect2_calibration/CMakeFiles/kinect2_calibration.dir/build.make:63: iai_kinect2/kinect2_calibration/CMakeFiles/kinect2_calibration.dir/src/kinect2_calibration.cpp.o] Errore 1
make[1]: *** [CMakeFiles/Makefile2:2392: iai_kinect2/kinect2_calibration/CMakeFiles/kinect2_calibration.dir/all] Errore 2
make[1]: *** Attesa per i processi non terminati....
make[2]: *** [iai_kinect2/kinect2_bridge/CMakeFiles/kinect2_bridge.dir/build.make:63: iai_kinect2/kinect2_bridge/CMakeFiles/kinect2_bridge.dir/src/kinect2_bridge.cpp.o] Errore 1
make[1]: *** [CMakeFiles/Makefile2:1042: iai_kinect2/kinect2_bridge/CMakeFiles/kinect2_bridge.dir/all] Errore 2
make[2]: *** [iai_kinect2/kinect2_bridge/CMakeFiles/kinect2_bridge_nodelet.dir/build.make:63: iai_kinect2/kinect2_bridge/CMakeFiles/kinect2_bridge_nodelet.dir/src/kinect2_bridge.cpp.o] Errore 1
make[1]: *** [CMakeFiles/Makefile2:1069: iai_kinect2/kinect2_bridge/CMakeFiles/kinect2_bridge_nodelet.dir/all] Errore 2
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_viewer/src/viewer.cpp: In member function ‘void Receiver::imageViewer()’:
/home/salvo/catkin_ws/src/iai_kinect2/kinect2_viewer/src/viewer.cpp:279:84: error: ‘CV_AA’ was not declared in this scope
279 | cv::putText(combined, oss.str(), pos, font, sizeText, colorText, lineText, CV_AA);
| ^~~~~
make[2]: *** [iai_kinect2/kinect2_viewer/CMakeFiles/kinect2_viewer.dir/build.make:63: iai_kinect2/kinect2_viewer/CMakeFiles/kinect2_viewer.dir/src/viewer.cpp.o] Errore 1
make[1]: *** [CMakeFiles/Makefile2:2473: iai_kinect2/kinect2_viewer/CMakeFiles/kinect2_viewer.dir/all] Errore 2
make: *** [Makefile:141: all] Errore 2
Invoking "make -j12 -l12" failed

@SalvaTure98 SalvaTure98 changed the title CV erroe CV error Jan 12, 2023
@SalvaTure98 SalvaTure98 changed the title CV error Error :catkin_make -DCMAKE_BUILD_TYPE="Release" Jan 12, 2023
@SalvaTure98 SalvaTure98 changed the title Error :catkin_make -DCMAKE_BUILD_TYPE="Release" error: ‘CV_IMWRITE_PNG_COMPRESSION’ was not declared in this scope Jan 12, 2023
@paul-shuvo
Copy link
Owner

Could you use OpenCV 4.0.0 and let me know if that works. Also did you complete the following steps?

image

@stevensu1838
Copy link

stevensu1838 commented Apr 11, 2023

Hi @paul-shuvo I am setting up Kinect v2 with ROS Noetic by following post. However, I have no problem using libfreenect2 but got errors with paul-shuvo/iai_kinect2_opencv4. May I please ask if this post is correct?

https://www.reddit.com/r/ROS/comments/uj1auq/set_up_kinect_v2_with_ros_noetic/
You have to install those packages: https://github.com/OpenKinect/libfreenect2#linux https://github.com/paul-shuvo/iai_kinect2_opencv4#install <- There's an error in the instructions, replace git clone https://github.com/code-iai/iai_kinect2.git with git clone https://github.com/paul-shuvo/iai_kinect2_opencv4.git!

Btw, my current opencv version is 4.2.0. Do I need to switch it to 4.0.0? Thanks a lot.

And when you say
image

in your post above, do you mean this as shown below? If not, at which step shall I run cmake .. -DENABLE_CXX11=ON, please

Build (if you have run cd depends previously, cd .. back to the libfreenect2 root directory first.)

mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/freenect2
cmake .. -DENABLE_CXX11=ON
make
make install

@paul-shuvo
Copy link
Owner

You are right on both counts. It should be fine on OpenCV 4.2.0, but this was only tested for 4.0.0; if it doesn't, comment here, I'll take a look.

@paul-shuvo
Copy link
Owner

@SalvaTure98, I guess the error was here git clone https://github.com/code-iai/iai_kinect2.git, it should be git clone https://github.com/paul-shuvo/iai_kinect2.git, pointed out by @stevensu1838 and was addressed here

@stevensu1838
Copy link

stevensu1838 commented Apr 11, 2023

@paul-shuvo Thank you so much for your great help. I still get errors. Could you please take a look at the steps I used? Did I do anything wrong?
Ubuntu 20.04 ROS noetic

First of all, my I've got dual graphics cards installed and nvidia was made the default one for higher performance.
image

Install libfreenect2:

Download libfreenect2 source
git clone https://github.com/OpenKinect/libfreenect2.git
cd libfreenect2

Install build tools
sudo apt-get install build-essential cmake pkg-config
Install libusb. The version must be >= 1.0.20.

sudo apt-get install libusb-1.0-0-dev

Install TurboJPEG
(Debian/Ubuntu 17.10 and newer) sudo apt-get install libturbojpeg0-dev

Install OpenGL

(Other) sudo apt-get install libglfw3-dev

Install OpenCL (optional)

Intel GPU
    (Other) sudo apt-get install beignet-dev

Install CUDA (optional, Nvidia only):

I didn't install CUDA. Because I don't know if I need it. Is it required?

Install VAAPI (optional, Intel only)
(Other) sudo apt-get install libva-dev libjpeg-dev
Install OpenNI2 (optional)
(Other) sudo apt-get install libopenni2-dev

Build
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/freenect2 -Dfreenect2_DIR=$HOME/freenect2/lib/cmake/freenect2 -DENABLE_CXX11=ON
make
make install

Set up udev rules for device access: sudo cp ../platform/linux/udev/90-kinect2.rules /etc/udev/rules.d/, then replug the Kinect.
Run the test program: ./bin/Protonect. It works well.

Install libfreenect2:

To summarize, I did follow the instructions and enable C++11 by using cmake .. -DENABLE_CXX11=ON instead of cmake ... but I did run cmake .. -DENABLE_CXX11=ON -DCUDA_PROPAGATE_HOST_FLAGS=off. because I am not sure if I am compiling libfreenect2 with CUDA.

Clone this repository into your catkin workspace, install the dependencies and build it:
cd ~/catkin_ws/src/
git clone https://github.com/paul-shuvo/iai_kinect2.git
cd iai_kinect2
rosdep install -r --from-paths .
cd ~/catkin_ws
catkin_make -DCMAKE_BUILD_TYPE="Release"

Then it throws the following errors. Could you please tell me what I did wrong? Thanks a lot.

image
image
image
image
image

@paul-shuvo paul-shuvo reopened this Apr 13, 2023
@paul-shuvo
Copy link
Owner

@stevensu1838 did you do the following?

Note: If you installed libfreenect2 somewhere else than in $HOME/freenect2 or a standard location like /usr/local you have to specify the path to it by adding -Dfreenect2_DIR=path_to_freenect2/lib/cmake/freenect2 to catkin_make.

@stevensu1838
Copy link

@paul-shuvo Hi, thanks a lot. Yes, I did it with catkin_make -DCMAKE_BUILD_TYPE="Release" -Dfreenect2_DIR=/home/ysu66/freenect2/lib/cmake/freenect2 .Same error:
image

And after deleting the freenect2 and libfreenect2 a couple of times and re-installation, I couldn't even run ./bin/Protonect

It throws these errors but it worked for me before. Any chance you know how to fix it first? Thanks in advance.
ysu66@mech1936:~/libfreenect2/build$ ./bin/Protonect
Version: 0.2.0
Environment variables: LOGFILE=<protonect.log>
Usage: ./bin/Protonect [-gpu=] [gl | cl | clkde | cuda | cudakde | cpu] []
[-noviewer] [-norgb | -nodepth] [-help] [-version]
[-frames ]
To pause and unpause: pkill -USR1 Protonect
[Info] [Freenect2Impl] enumerating devices...
[Info] [Freenect2Impl] 7 usb devices connected
[Info] [Freenect2Impl] found valid Kinect v2 @2:11 with serial 105087734847
[Info] [Freenect2Impl] found 1 devices
libva info: VA-API version 1.7.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva info: va_openDriver() returns 0
[Info] [VaapiRgbPacketProcessorImpl] driver: Intel iHD driver for Intel(R) Gen Graphics - 20.1.1 ()
[Info] [Freenect2DeviceImpl] opening...
[Info] [Freenect2DeviceImpl] transfer pool sizes rgb: 2016384 ir: 608*33792
[Info] [Freenect2DeviceImpl] opened
[Info] [Freenect2DeviceImpl] starting...
[Debug] [Freenect2DeviceImpl] status 0x090000: 9763
[Debug] [Freenect2DeviceImpl] status 0x090000: 9763
[Info] [Freenect2DeviceImpl] submitting rgb transfers...
[Info] [Freenect2DeviceImpl] submitting depth transfers...
[Info] [Freenect2DeviceImpl] started
device serial: 105087734847
device firmware: 4.0.3917.0
[Debug] [DepthPacketStreamParser] not all subsequences received 0
[Error] [VaapiFrame] vaGetImage(display, surface, 0, 0, image.width, image.height, image.image_id): unknown libva error
Segmentation fault (core dumped)

image

@paul-shuvo
Copy link
Owner

@stevensu1838 this is the most frustrating thing about working with anything ROS. I used to spend countless hours to make different libraries/modules work (together) and the whole thing is a dependency hell, and thus finding the root cause is very difficult.

That's why me and my colleagues would use a separate machine, as for us it was easier to reinstall everything from scratch than trying to find the needle in the hay stack. I know this is not a solution, but that's what I can offer right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants