diff --git a/.github/workflows/macos-dep-brew.yml b/.github/workflows/macos-dep-brew.yml index a9fd51e..508748c 100644 --- a/.github/workflows/macos-dep-brew.yml +++ b/.github/workflows/macos-dep-brew.yml @@ -41,4 +41,4 @@ jobs: run: | mkdir build && cd build cmake .. -DCMAKE_BUILD_TYPE=Release - make -j2 + make -j$(sysctl -n hw.logicalcpu) diff --git a/.github/workflows/macos-dep-src.yml b/.github/workflows/macos-dep-src.yml index 4cb18d2..435596a 100644 --- a/.github/workflows/macos-dep-src.yml +++ b/.github/workflows/macos-dep-src.yml @@ -51,7 +51,7 @@ jobs: - name: Build and install ViSP run: | cd ${HOME}/visp/build - make -j2 install + make -j$(sysctl -n hw.logicalcpu) install echo "VISP_DIR=$(pwd)/install" >> $GITHUB_ENV echo $VISP_DIR @@ -59,4 +59,4 @@ jobs: run: | mkdir build && cd build cmake .. -DCMAKE_BUILD_TYPE=Release - make -j2 + make -j$(sysctl -n hw.logicalcpu) diff --git a/.github/workflows/ubuntu-dep-src.yml b/.github/workflows/ubuntu-dep-src.yml index d3dd3e4..a867ad0 100644 --- a/.github/workflows/ubuntu-dep-src.yml +++ b/.github/workflows/ubuntu-dep-src.yml @@ -54,7 +54,7 @@ jobs: mkdir build && cd build && mkdir install cmake .. -DBUILD_DEMOS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF -DBUILD_TUTORIALS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(pwd)/install cat ViSP-third-party.txt - make -j2 install + make -j$(nproc) install echo "VISP_DIR=$(pwd)/install" >> $GITHUB_ENV echo $VISP_DIR @@ -62,4 +62,4 @@ jobs: run: | mkdir build && cd build cmake .. -DCMAKE_BUILD_TYPE=Release - make -j2 + make -j($nproc) diff --git a/.github/workflows/ubuntu-extra.yml b/.github/workflows/ubuntu-extra.yml index a7a81a8..571925f 100644 --- a/.github/workflows/ubuntu-extra.yml +++ b/.github/workflows/ubuntu-extra.yml @@ -43,7 +43,7 @@ jobs: cd ${HOME}/librealsense mkdir build && cd build && mkdir install cmake .. -DBUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(pwd)/install - make -j2 install + make -j$(nproc) install echo "REALSENSE2_DIR=$(pwd)/install" >> $GITHUB_ENV echo $REALSENSE2_DIR @@ -54,7 +54,7 @@ jobs: mkdir build && cd build && mkdir install cmake .. -DBUILD_DEMOS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF -DBUILD_TUTORIALS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(pwd)/install cat ViSP-third-party.txt - make -j2 install + make -j$(nproc) install echo "ViSP_WS=${HOME}" >> $GITHUB_ENV echo $ViSP_WS @@ -62,27 +62,27 @@ jobs: run: | mkdir visp_sample-build && cd visp_sample-build cmake .. -DCMAKE_BUILD_TYPE=Release -DVISP_DIR=$ViSP_WS/visp/build - make -j2 + make -j$(nproc) - name: Build visp_sample using visp-config from build tree run: | make -f Makefile.visp-config VISP_INSTALL_PREFIX=$ViSP_WS/visp/build - make -f Makefile.visp-config clean + make -j$(nproc) -f Makefile.visp-config clean - name: Build visp_sample with ViSP from install tree run: | mkdir visp_sample-build_2 && cd visp_sample-build_2 cmake .. -DCMAKE_BUILD_TYPE=Release -DVISP_DIR=$ViSP_WS/visp/build/install/lib/cmake/visp - make -j2 + make -j$(nproc) - name: Build visp_sample using visp.pc from install tree run: | export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$ViSP_WS/visp/build/install/lib/pkgconfig - make -f Makefile.visp.pc - make -f Makefile.visp.pc clean + make -j$(nproc) -f Makefile.visp.pc + make -j$(nproc) -f Makefile.visp.pc clean - name: Build visp_sample using visp-config from install tree run: | export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$ViSP_WS/visp/build/install/lib/pkgconfig - make -f Makefile.visp-config VISP_INSTALL_PREFIX=$ViSP_WS/visp/build/install - make -f Makefile.visp-config clean + make -j$(nproc) -f Makefile.visp-config VISP_INSTALL_PREFIX=$ViSP_WS/visp/build/install + make -j$(nproc) -f Makefile.visp-config clean diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a7b0237 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,84 @@ +{ + "editor.tabSize": 2, + "C_Cpp.vcFormat.indent.braces": false, + "C_Cpp.vcFormat.newLine.beforeOpenBrace.block": "sameLine", + "C_Cpp.vcFormat.newLine.beforeOpenBrace.namespace": "newLine", + "C_Cpp.vcFormat.newLine.beforeOpenBrace.type": "newLine", + "C_Cpp.vcFormat.newLine.closeBraceSameLine.emptyFunction": true, + "C_Cpp.vcFormat.newLine.closeBraceSameLine.emptyType": true, + "C_Cpp.vcFormat.space.beforeInitializerListOpenBrace": true, + "C_Cpp.vcFormat.space.betweenEmptyBraces": true, + "C_Cpp.clang_format_style": "Visual Studio", + "C_Cpp.vcFormat.newLine.beforeOpenBrace.function": "newLine", + "C_Cpp.vcFormat.space.pointerReferenceAlignment": "right", + "C_Cpp.vcFormat.space.beforeEmptySquareBrackets": true, + "C_Cpp.vcFormat.space.beforeOpenSquareBracket": false, + "files.associations": { + "bitset": "cpp", + "optional": "cpp", + "iosfwd": "cpp", + "__bit_reference": "cpp", + "__bits": "cpp", + "__config": "cpp", + "__debug": "cpp", + "__errc": "cpp", + "__hash_table": "cpp", + "__locale": "cpp", + "__mutex_base": "cpp", + "__node_handle": "cpp", + "__split_buffer": "cpp", + "__threading_support": "cpp", + "__tuple": "cpp", + "__verbose_abort": "cpp", + "array": "cpp", + "atomic": "cpp", + "bit": "cpp", + "cctype": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "complex": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "exception": "cpp", + "fstream": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "ios": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "locale": "cpp", + "memory": "cpp", + "mutex": "cpp", + "new": "cpp", + "ostream": "cpp", + "ratio": "cpp", + "sstream": "cpp", + "stack": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "string": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "typeinfo": "cpp", + "unordered_map": "cpp", + "variant": "cpp", + "vector": "cpp", + "__nullptr": "cpp", + "__string": "cpp", + "chrono": "cpp", + "compare": "cpp", + "concepts": "cpp", + "algorithm": "cpp" + } +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 74a537f..52ae660 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ -project(visp-sample) - cmake_minimum_required(VERSION 3.0) +project(visp-sample) + #-------------------------------------------------------------------- # By default set release configuration #-------------------------------------------------------------------- @@ -14,7 +14,6 @@ endif() #-------------------------------------------------------------------- find_package(VISP REQUIRED) - #-------------------------------------------------------------------- # Propagate in subdirs #-------------------------------------------------------------------- @@ -24,6 +23,7 @@ add_subdirectory(core) add_subdirectory(detection) add_subdirectory(gui) add_subdirectory(io) +add_subdirectory(json) add_subdirectory(klt) add_subdirectory(mbt) add_subdirectory(me) diff --git a/Makefile.visp.pc b/Makefile.visp.pc index 3be42cc..792d457 100644 --- a/Makefile.visp.pc +++ b/Makefile.visp.pc @@ -1,4 +1,4 @@ -CXX = g++ +#CXX = g++ VISP_CFLAGS = `pkg-config --cflags visp` VISP_LDFLAGS = `pkg-config --libs visp` diff --git a/README.md b/README.md index cf9c2ec..3b7e38d 100644 --- a/README.md +++ b/README.md @@ -54,14 +54,15 @@ $ git clone https://github.com/lagadic/visp_sample $ mkdir visp_sample-build $ cd visp_sample-build $ cmake ../visp_sample -DVISP_DIR=$ViSP_WS/visp-build +$ make -j4 ``` ### 2.2. Build visp_sample using `visp-config` from build tree ``` $ cd $ViSP_WS/visp_sample -$ make -f Makefile.visp-config VISP_INSTALL_PREFIX=$ViSP_WS/visp-build -$ make -f Makefile.visp-config clean +$ make -j4 -f Makefile.visp-config VISP_INSTALL_PREFIX=$ViSP_WS/visp-build +$ make -j4 -f Makefile.visp-config clean ``` ### 2.3. Build visp_sample with ViSP from install tree @@ -72,6 +73,7 @@ $ git clone https://github.com/lagadic/visp_sample $ mkdir visp_sample-build $ cd visp_sample-build $ cmake ../visp_sample -DVISP_DIR=/tmp/usr/local/lib/cmake/visp +$ make -j4 ``` ### 2.4. Build visp_sample using `visp.pc` from install tree @@ -79,8 +81,8 @@ $ cmake ../visp_sample -DVISP_DIR=/tmp/usr/local/lib/cmake/visp ``` $ cd $ViSP_WS/visp_sample $ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/tmp/usr/local/lib/pkgconfig -$ make -f Makefile.visp.pc -$ make -f Makefile.visp.pc clean +$ make -j4 -f Makefile.visp.pc +$ make -j4 -f Makefile.visp.pc clean ``` ### 2.5. Build visp_sample using `visp-config` from install tree @@ -88,6 +90,6 @@ $ make -f Makefile.visp.pc clean ``` $ cd $ViSP_WS/visp_sample $ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/tmp/usr/local/lib/pkgconfig -$ make -f Makefile.visp-config VISP_INSTALL_PREFIX=/tmp/usr/local -$ make -f Makefile.visp-config clean +$ make -j4 -f Makefile.visp-config VISP_INSTALL_PREFIX=/tmp/usr/local +$ make -j4 -f Makefile.visp-config clean ``` diff --git a/ar/CMakeLists.txt b/ar/CMakeLists.txt index a7e184b..549fce8 100644 --- a/ar/CMakeLists.txt +++ b/ar/CMakeLists.txt @@ -1,7 +1,7 @@ -project(sample-core) - cmake_minimum_required(VERSION 3.0) +project(sample-core) + file(GLOB src_cpp RELATIVE ${CMAKE_CURRENT_LIST_DIR} "*.cpp") foreach(src ${src_cpp}) diff --git a/blob/CMakeLists.txt b/blob/CMakeLists.txt index a7e184b..549fce8 100644 --- a/blob/CMakeLists.txt +++ b/blob/CMakeLists.txt @@ -1,7 +1,7 @@ -project(sample-core) - cmake_minimum_required(VERSION 3.0) +project(sample-core) + file(GLOB src_cpp RELATIVE ${CMAKE_CURRENT_LIST_DIR} "*.cpp") foreach(src ${src_cpp}) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 2c723ea..549fce8 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -1,10 +1,6 @@ -project(sample-core) - cmake_minimum_required(VERSION 3.0) -# C++11 is needed for brace-enclosed initializer list in sample-vpVelocityTwistMatrix-3.cpp:9:37 -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) +project(sample-core) file(GLOB src_cpp RELATIVE ${CMAKE_CURRENT_LIST_DIR} "*.cpp") diff --git a/core/sample-vpForceTwistMatrix-3.cpp b/core/sample-vpForceTwistMatrix-3.cpp index f742c91..de7e6de 100644 --- a/core/sample-vpForceTwistMatrix-3.cpp +++ b/core/sample-vpForceTwistMatrix-3.cpp @@ -6,7 +6,7 @@ int main() { #ifdef VISP_HAVE_VIPER850 vpRobotViper850 robot; - vpColVector sH = robot.getForceTorque(sH); // Get the force/torque measures + vpColVector sH = robot.getForceTorque(); // Get the force/torque measures // Set the transformation from sensor frame to the probe frame vpHomogeneousMatrix pMs; diff --git a/core/sample-vpForceTwistMatrix-4.cpp b/core/sample-vpForceTwistMatrix-4.cpp index e6cc42d..669ff2d 100644 --- a/core/sample-vpForceTwistMatrix-4.cpp +++ b/core/sample-vpForceTwistMatrix-4.cpp @@ -2,6 +2,7 @@ int main() { +#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) { vpTranslationVector stp(0.1, 0.2, 0.3); vpRotationMatrix sRp( {0, 0, -1, @@ -17,5 +18,5 @@ int main() vpForceTwistMatrix sFp(sRp); std::cout << "sFp:\n" << sFp << std::endl; } - +#endif } diff --git a/core/sample-vpImagePoint-4.cpp b/core/sample-vpImagePoint-4.cpp new file mode 100644 index 0000000..24d0839 --- /dev/null +++ b/core/sample-vpImagePoint-4.cpp @@ -0,0 +1,20 @@ +#include +#include + +int main() +{ + vpImagePoint start_pixel(10, 12); + vpImagePoint end_pixel(20, 16); + //vpImagePoint start_pixel(10.5, 12.2); + //vpImagePoint end_pixel(20, 12); + //vpImagePoint end_pixel(20.5, 16.2); + //vpImagePoint end_pixel(21, 16.4); + + for (auto curr_pixel = start_pixel; curr_pixel.inSegment(start_pixel, end_pixel); + curr_pixel = curr_pixel.nextInSegment(start_pixel, end_pixel)) { + std::cout << "pixel: " << curr_pixel << std::endl; + if (curr_pixel == end_pixel) break; + } + + return EXIT_SUCCESS; +} diff --git a/core/sample-vpIoTools-4.cpp b/core/sample-vpIoTools-4.cpp new file mode 100644 index 0000000..90ebf74 --- /dev/null +++ b/core/sample-vpIoTools-4.cpp @@ -0,0 +1,10 @@ +#include + +int main() +{ + std::cout << vpIoTools::getIndex("file-1.txt", "file-%d.txt") << std::endl; + std::cout << vpIoTools::getIndex("/tmp/file0040.txt", "/tmp/file%04d.txt") << std::endl; + std::cout << vpIoTools::getIndex("file.txt", "file%d.txt") << std::endl; + std::cout << vpIoTools::getIndex("file03.txt", "file%02d.txt") << std::endl; + std::cout << vpIoTools::getIndex("file-03.txt", "file%02d.txt") << std::endl; +} diff --git a/core/sample-vpIoTools-5.cpp b/core/sample-vpIoTools-5.cpp new file mode 100644 index 0000000..e21cc1a --- /dev/null +++ b/core/sample-vpIoTools-5.cpp @@ -0,0 +1,21 @@ +#include + +int main() +{ + std::string tmp_path = vpIoTools::getTempPath(); + std::cout << "Temp path: " << tmp_path << std::endl; + + std::string tmp_dir1 = vpIoTools::makeTempDirectory(tmp_path); + std::cout << "Created unique temp dir1: " << tmp_dir1 << std::endl; + + std::string tmp_dir2_template = tmp_path + vpIoTools::path("/") + "dir_XXXXXX"; + std::string tmp_dir2 = vpIoTools::makeTempDirectory(tmp_dir2_template); + std::cout << "Created unique temp dir2: " << tmp_dir2 << std::endl; + + if (vpIoTools::remove(tmp_dir1)) { + std::cout << "Temp dir1 was deleted" << std::endl; + } + if (vpIoTools::remove(tmp_dir2)) { + std::cout << "Temp dir2 was deleted" << std::endl; + } +} diff --git a/core/sample-vpMatrix-19.cpp b/core/sample-vpMatrix-19.cpp new file mode 100644 index 0000000..158286a --- /dev/null +++ b/core/sample-vpMatrix-19.cpp @@ -0,0 +1,30 @@ +#include + +int main() +{ + std::string filename("matrix.yaml"); + { + vpMatrix M(2, 3); + M[0][0] = -1; M[0][1] = -2; M[0][2] = -3; + M[1][0] = 4; M[1][1] = 5.5; M[1][2] = 6.0f; + + std::string header("My header"); + + if (vpMatrix::saveMatrixYAML(filename, M, header.c_str())) { + std::cout << "Matrix saved in " << filename << std::endl; + M.print(std::cout, 10, header); + } else { + std::cout << "Cannot save matrix in " << filename << std::endl; + } + } + { + vpMatrix N; + char header[FILENAME_MAX]; + if (vpMatrix::loadMatrixYAML(filename, N, header)) { + std::cout << "Matrix loaded from " << filename << std::endl; + N.print(std::cout, 10, header); + } else { + std::cout << "Cannot load matrix from " << filename << std::endl; + } + } +} diff --git a/core/sample-vpMatrix-20.cpp b/core/sample-vpMatrix-20.cpp new file mode 100644 index 0000000..d139633 --- /dev/null +++ b/core/sample-vpMatrix-20.cpp @@ -0,0 +1,31 @@ +#include + +int main() +{ + std::string filename("matrix.bin"); + bool binary_data = true; + { + vpMatrix M(2, 3); + M[0][0] = -1; M[0][1] = -2; M[0][2] = -3; + M[1][0] = 4; M[1][1] = 5.5; M[1][2] = 6.0f; + + std::string header("My header"); + + if (vpMatrix::saveMatrix(filename, M, binary_data, header.c_str())) { + std::cout << "Matrix saved in " << filename << std::endl; + M.print(std::cout, 10, header); + } else { + std::cout << "Cannot save matrix in " << filename << std::endl; + } + } + { + vpMatrix N; + char header[FILENAME_MAX]; + if (vpMatrix::loadMatrix(filename, N, binary_data, header)) { + std::cout << "Matrix loaded from " << filename << std::endl; + N.print(std::cout, 10, header); + } else { + std::cout << "Cannot load matrix from " << filename << std::endl; + } + } +} diff --git a/core/sample-vpVelocityTwistMatrix-3.cpp b/core/sample-vpVelocityTwistMatrix-3.cpp index 28325c2..f59c9bb 100644 --- a/core/sample-vpVelocityTwistMatrix-3.cpp +++ b/core/sample-vpVelocityTwistMatrix-3.cpp @@ -2,6 +2,7 @@ int main() { +#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) { vpTranslationVector cte(0.1, 0.2, 0.3); vpRotationMatrix cRe( {0, 0, -1, @@ -18,4 +19,5 @@ int main() vpVelocityTwistMatrix cVe(cRe); std::cout << "cVe:\n" << cVe << std::endl; } +#endif } diff --git a/detection/CMakeLists.txt b/detection/CMakeLists.txt index a7e184b..549fce8 100644 --- a/detection/CMakeLists.txt +++ b/detection/CMakeLists.txt @@ -1,7 +1,7 @@ -project(sample-core) - cmake_minimum_required(VERSION 3.0) +project(sample-core) + file(GLOB src_cpp RELATIVE ${CMAKE_CURRENT_LIST_DIR} "*.cpp") foreach(src ${src_cpp}) diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt index a7e184b..549fce8 100644 --- a/gui/CMakeLists.txt +++ b/gui/CMakeLists.txt @@ -1,7 +1,7 @@ -project(sample-core) - cmake_minimum_required(VERSION 3.0) +project(sample-core) + file(GLOB src_cpp RELATIVE ${CMAKE_CURRENT_LIST_DIR} "*.cpp") foreach(src ${src_cpp}) diff --git a/gui/sample-vpDisplayGTK-3.cpp b/gui/sample-vpDisplayGTK-3.cpp index c0f3f6d..0239812 100644 --- a/gui/sample-vpDisplayGTK-3.cpp +++ b/gui/sample-vpDisplayGTK-3.cpp @@ -14,66 +14,66 @@ int main() display.init(I, 20, 20, "Track ball..."); vpDisplay::display(I); - char text[200]; + std::string text; bool motion_allowed = false; - center.set_u( I.getWidth()/2 ); - center.set_v( I.getHeight()/2 ); + center.set_u(I.getWidth() / 2); + center.set_v(I.getHeight() / 2); - for ( ; ; ) { + for (; ; ) { vpDisplay::display(I); //vpDisplay::setBackground(I, vpColor::black); pos_text.set_u(30); pos_text.set_v(30); if (motion_allowed) - sprintf(text, "A left click to stop target motion..."); + text = "A left click to stop target motion..."; else - sprintf(text, "A left click to start target motion..."); - vpDisplay::displayCharString(I, pos_text, text, vpColor::red); + text = "A left click to start target motion..."; + vpDisplay::displayText(I, pos_text, text, vpColor::red); pos_text.set_u(30); pos_text.set_v(45); - sprintf(text, "A right click to quit..."); - vpDisplay::displayCharString(I, pos_text, text, vpColor::red); + text = "A right click to quit..."; + vpDisplay::displayText(I, pos_text, text, vpColor::red); - if (vpDisplay::getPointerMotionEvent (I, pointer ) ) { + if (vpDisplay::getPointerMotionEvent(I, pointer)) { if (motion_allowed) { - center = pointer; - //std::cout << "focus: " << pointer << std::endl; + center = pointer; + //std::cout << "focus: " << pointer << std::endl; } } - ip1.set_u( center.get_u() ); - ip1.set_v( center.get_v() - 6*radius ); - ip2.set_u( center.get_u() ); - ip2.set_v( center.get_v() - 4*radius ); + ip1.set_u(center.get_u()); + ip1.set_v(center.get_v() - 6 * radius); + ip2.set_u(center.get_u()); + ip2.set_v(center.get_v() - 4 * radius); vpDisplay::displayLine(I, ip1, ip2, vpColor::white, true); - ip1.set_u( center.get_u() - 6*radius ); - ip1.set_v( center.get_v()); - ip2.set_u( center.get_u() - 4*radius ); - ip2.set_v( center.get_v() ); + ip1.set_u(center.get_u() - 6 * radius); + ip1.set_v(center.get_v()); + ip2.set_u(center.get_u() - 4 * radius); + ip2.set_v(center.get_v()); vpDisplay::displayLine(I, ip1, ip2, vpColor::white, true); - ip1.set_u( center.get_u() ); - ip1.set_v( center.get_v() + 6*radius ); - ip2.set_u( center.get_u() ); - ip2.set_v( center.get_v() + 4*radius ); + ip1.set_u(center.get_u()); + ip1.set_v(center.get_v() + 6 * radius); + ip2.set_u(center.get_u()); + ip2.set_v(center.get_v() + 4 * radius); vpDisplay::displayLine(I, ip1, ip2, vpColor::white, true); - ip1.set_u( center.get_u() + 6*radius ); - ip1.set_v( center.get_v()); - ip2.set_u( center.get_u() + 4*radius ); - ip2.set_v( center.get_v() ); + ip1.set_u(center.get_u() + 6 * radius); + ip1.set_v(center.get_v()); + ip2.set_u(center.get_u() + 4 * radius); + ip2.set_v(center.get_v()); vpDisplay::displayLine(I, ip1, ip2, vpColor::white, true); - vpDisplay::displayCircle(I, center, 2*radius, vpColor::white, true); -// vpDisplay::displayCircle(I, center, 1.5*radius, vpColor::black, true); -// vpDisplay::displayCircle(I, center, radius, vpColor::white, true); - // vpDisplay::displayCircle(I, center, 5*radius, vpColor::white, false); + vpDisplay::displayCircle(I, center, 2 * radius, vpColor::white, true); + // vpDisplay::displayCircle(I, center, 1.5 * radius, vpColor::black, true); + // vpDisplay::displayCircle(I, center, radius, vpColor::white, true); + // vpDisplay::displayCircle(I, center, 5 * radius, vpColor::white, false); if (vpDisplay::getClick(I, dummy, button, false)) { // A click event was detected if (button == vpMouseButton::button3) - break; + break; else if (button == vpMouseButton::button1) { - if (motion_allowed) - motion_allowed = false; - else - motion_allowed = true; + if (motion_allowed) + motion_allowed = false; + else + motion_allowed = true; } } vpDisplay::flush(I); diff --git a/gui/sample-vpDisplayX-2.cpp b/gui/sample-vpDisplayX-2.cpp index 13c34b9..a1ce22b 100644 --- a/gui/sample-vpDisplayX-2.cpp +++ b/gui/sample-vpDisplayX-2.cpp @@ -5,18 +5,16 @@ int main() { - vpImage I(600, 700); #ifdef VISP_HAVE_X11 + vpImage I(600, 700); vpDisplayX display; display.init(I, 20, 20, "Track ball..."); -#endif vpImagePoint dummy, pos_text, center, pointer, ip1, ip2; vpMouseButton::vpMouseButtonType button; int radius = 20; - vpDisplay::display(I); - char text[200]; + std::string text; bool motion_allowed = false; center.set_u( I.getWidth()/2 ); center.set_v( I.getHeight()/2 ); @@ -27,14 +25,14 @@ int main() pos_text.set_u(30); pos_text.set_v(30); if (motion_allowed) - sprintf(text, "A left click to stop target motion..."); + text = "A left click to stop target motion..."; else - sprintf(text, "A left click to start target motion..."); - vpDisplay::displayCharString(I, pos_text, text, vpColor::red); + text = "A left click to start target motion..."; + vpDisplay::displayText(I, pos_text, text, vpColor::red); pos_text.set_u(30); pos_text.set_v(45); - sprintf(text, "A right click to quit..."); - vpDisplay::displayCharString(I, pos_text, text, vpColor::red); + text = "A right click to quit..."; + vpDisplay::displayText(I, pos_text, text, vpColor::red); if (vpDisplay::getPointerMotionEvent ( I, pointer ) ) { if (motion_allowed) { @@ -81,6 +79,7 @@ int main() vpDisplay::flush(I); vpTime::wait(1); } +#endif return 0; } diff --git a/gui/sample-vpDisplayX.cpp b/gui/sample-vpDisplayX.cpp index 5239fd2..fc16b68 100644 --- a/gui/sample-vpDisplayX.cpp +++ b/gui/sample-vpDisplayX.cpp @@ -3,19 +3,18 @@ int main() { +#if defined(VISP_HAVE_X11) vpImage I; // Grey level image // Read an image in PGM P5 format //vpImageIo::readPGM(I, "/local/soft/ViSP/ViSP-images/Klimt/Klimt.pgm"); vpImageIo::readPGM(I, "/tmp/Klimt.pgm"); -#if defined(VISP_HAVE_X11) vpDisplayX d; // Initialize the display with the image I. Display and image are // now link together. d.init(I); -#endif // Specify the window location vpDisplay::setWindowPosition(I, 400, 100); @@ -59,4 +58,5 @@ int main() // Wait for a click in the display window std::cout << "Wait for a button click..." << std::endl; vpDisplay::getClick(I); +#endif } diff --git a/io/CMakeLists.txt b/io/CMakeLists.txt index a7e184b..549fce8 100644 --- a/io/CMakeLists.txt +++ b/io/CMakeLists.txt @@ -1,7 +1,7 @@ -project(sample-core) - cmake_minimum_required(VERSION 3.0) +project(sample-core) + file(GLOB src_cpp RELATIVE ${CMAKE_CURRENT_LIST_DIR} "*.cpp") foreach(src ${src_cpp}) diff --git a/io/sample-vpParseArgv-2.cpp b/io/sample-vpParseArgv-2.cpp index e3515e4..0843329 100644 --- a/io/sample-vpParseArgv-2.cpp +++ b/io/sample-vpParseArgv-2.cpp @@ -16,7 +16,7 @@ int main(int argc, const char ** argv) long l_val = 123456; float f_val = 0.1f; double d_val = M_PI; - char *s_val; + std::string s_val; // Parse the command line to set the variables const char *optarg; @@ -29,7 +29,7 @@ int main(int argc, const char ** argv) case 'l': l_val = atol(optarg); break; case 'f': f_val = static_cast(atof(optarg)); break; case 'd': d_val = atof(optarg); break; - case 's': sprintf(s_val, "%s", optarg); break; + case 's': s_val = std::string(optarg); break; case 'h': printf("Usage: ...\n"); return EXIT_SUCCESS; break; default: diff --git a/json/CMakeLists.txt b/json/CMakeLists.txt new file mode 100644 index 0000000..0fda4dc --- /dev/null +++ b/json/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.0) + +project(sample-json) + +file(GLOB src_cpp RELATIVE ${CMAKE_CURRENT_LIST_DIR} "*.cpp") + +foreach(src ${src_cpp}) + # Compute the name of the binary to create + get_filename_component(binary ${src} NAME_WE) + + # From source compile the binary and add link rules + add_executable(${binary} ${src}) + # It is not requested to add explicitely ViSP libraries + if(VISP_FOUND) + include_directories(${VISP_INCLUDE_DIRS}) + target_link_libraries(${binary} ${VISP_LIBRARIES}) + endif() + + # Add test + add_test(${binary} ${binary}) +endforeach() diff --git a/json/sample-json-vpCameraParameters.cpp b/json/sample-json-vpCameraParameters.cpp new file mode 100644 index 0000000..65c3173 --- /dev/null +++ b/json/sample-json-vpCameraParameters.cpp @@ -0,0 +1,23 @@ +#include + +int main() +{ +#if defined(VISP_HAVE_NLOHMANN_JSON) + std::string filename = "cam.json"; + { + vpCameraParameters cam(801, 802, 325, 245); + std::ofstream file(filename); + const nlohmann::json j = cam; + file << j; + file.close(); + } + { + std::ifstream file(filename); + const nlohmann::json j = nlohmann::json::parse(file); + vpCameraParameters cam; + cam = j; + file.close(); + std::cout << "Read camera parameters from " << filename << ":\n" << cam << std::endl; + } +#endif +} diff --git a/json/sample-json-vpColVector.cpp b/json/sample-json-vpColVector.cpp new file mode 100644 index 0000000..517cb90 --- /dev/null +++ b/json/sample-json-vpColVector.cpp @@ -0,0 +1,31 @@ +#include + +int main() +{ +#if defined(VISP_HAVE_NLOHMANN_JSON) + std::string filename = "col-vector.json"; + { +#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) + vpColVector v({ 1, 2, 3, 4 }); +#else + vpColVector v(4); + v[0] = 1; + v[1] = 2; + v[2] = 3; + v[3] = 4; +#endif + std::ofstream file(filename); + const nlohmann::json j = v; + file << j; + file.close(); + } + { + std::ifstream file(filename); + const nlohmann::json j = nlohmann::json::parse(file); + vpColVector v; + v = j.get(); + file.close(); + std::cout << "Read homogeneous matrix from " << filename << ":\n" << v.t() << std::endl; + } +#endif +} diff --git a/json/sample-json-vpHomogeneousMatrix.cpp b/json/sample-json-vpHomogeneousMatrix.cpp new file mode 100644 index 0000000..fe92aeb --- /dev/null +++ b/json/sample-json-vpHomogeneousMatrix.cpp @@ -0,0 +1,30 @@ +#include + +int main() +{ +#if defined(VISP_HAVE_NLOHMANN_JSON) + std::string filename = "homo-mat.json"; + { +#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) + vpHomogeneousMatrix M(vpTranslationVector(0.1, 0.2, 0.3), vpRotationMatrix({ 0, 0, 1, 0, -1, 0, -1, 0, 0 })); +#else + vpHomogeneousMatrix M; + M[0][0] = 0; M[0][1] = 0; M[0][2] = 1; M[0][2] = 0.1; + M[1][0] = 0; M[1][1] = -1; M[1][2] = 0; M[1][2] = 0.2; + M[2][0] = -1; M[2][1] = 0; M[2][2] = 0; M[2][2] = 0.3; +#endif + std::ofstream file(filename); + const nlohmann::json j = M; + file << j; + file.close(); + } + { + std::ifstream file(filename); + const nlohmann::json j = nlohmann::json::parse(file); + vpHomogeneousMatrix M; + M = j; + file.close(); + std::cout << "Read homogeneous matrix from " << filename << ":\n" << M << std::endl; + } +#endif +} diff --git a/json/sample-json-vpMbGenericTracker.cpp b/json/sample-json-vpMbGenericTracker.cpp new file mode 100644 index 0000000..a3410b4 --- /dev/null +++ b/json/sample-json-vpMbGenericTracker.cpp @@ -0,0 +1,18 @@ +#include + +int main() +{ +#if defined(VISP_HAVE_NLOHMANN_JSON) + std::string filename = "mbt-generic.json"; + { + vpMbGenericTracker mbt; + mbt.saveConfigFile(filename); + } + { + vpMbGenericTracker mbt; + bool verbose = false; + std::cout << "Read model-based tracker settings from " << filename << std::endl; + mbt.loadConfigFile(filename, verbose); + } +#endif +} diff --git a/json/sample-json-vpMe.cpp b/json/sample-json-vpMe.cpp new file mode 100644 index 0000000..66d1764 --- /dev/null +++ b/json/sample-json-vpMe.cpp @@ -0,0 +1,34 @@ +#include + +int main() +{ +#if defined(VISP_HAVE_NLOHMANN_JSON) + std::string filename = "me.json"; + { + vpMe me; + me.setThreshold(10000); + me.setMaskNumber(180); + me.setMaskSign(0); + me.setMu1(0.5); + me.setMu2(0.5); + me.setNbTotalSample(0); + me.setPointsToTrack(200); + me.setRange(5); + me.setStrip(2); + + std::ofstream file(filename); + const nlohmann::json j = me; + file << j; + file.close(); + } + { + std::ifstream file(filename); + const nlohmann::json j = nlohmann::json::parse(file); + vpMe me; + me = j; + file.close(); + std::cout << "Read moving-edges settings from " << filename << ":" << std::endl; + me.print(); + } +#endif +} diff --git a/json/sample-json-vpPoseVector.cpp b/json/sample-json-vpPoseVector.cpp new file mode 100644 index 0000000..a2d2528 --- /dev/null +++ b/json/sample-json-vpPoseVector.cpp @@ -0,0 +1,23 @@ +#include + +int main() +{ +#if defined(VISP_HAVE_NLOHMANN_JSON) + std::string filename = "pose-vector.json"; + { + vpPoseVector pose(0.1, 0.2, 0.3, M_PI, M_PI_2, M_PI_4); + std::ofstream file(filename); + const nlohmann::json j = pose; + file << j; + file.close(); + } + { + std::ifstream file(filename); + const nlohmann::json j = nlohmann::json::parse(file); + vpPoseVector pose; + pose = j; + file.close(); + std::cout << "Read pose vector from " << filename << ":\n" << pose.t() << std::endl; + } +#endif +} diff --git a/klt/CMakeLists.txt b/klt/CMakeLists.txt index a7e184b..549fce8 100644 --- a/klt/CMakeLists.txt +++ b/klt/CMakeLists.txt @@ -1,7 +1,7 @@ -project(sample-core) - cmake_minimum_required(VERSION 3.0) +project(sample-core) + file(GLOB src_cpp RELATIVE ${CMAKE_CURRENT_LIST_DIR} "*.cpp") foreach(src ${src_cpp}) diff --git a/mbt/CMakeLists.txt b/mbt/CMakeLists.txt index a7e184b..549fce8 100644 --- a/mbt/CMakeLists.txt +++ b/mbt/CMakeLists.txt @@ -1,7 +1,7 @@ -project(sample-core) - cmake_minimum_required(VERSION 3.0) +project(sample-core) + file(GLOB src_cpp RELATIVE ${CMAKE_CURRENT_LIST_DIR} "*.cpp") foreach(src ${src_cpp}) diff --git a/me/CMakeLists.txt b/me/CMakeLists.txt index a7e184b..549fce8 100644 --- a/me/CMakeLists.txt +++ b/me/CMakeLists.txt @@ -1,7 +1,7 @@ -project(sample-core) - cmake_minimum_required(VERSION 3.0) +project(sample-core) + file(GLOB src_cpp RELATIVE ${CMAKE_CURRENT_LIST_DIR} "*.cpp") foreach(src ${src_cpp}) diff --git a/robot/CMakeLists.txt b/robot/CMakeLists.txt index a7e184b..549fce8 100644 --- a/robot/CMakeLists.txt +++ b/robot/CMakeLists.txt @@ -1,7 +1,7 @@ -project(sample-core) - cmake_minimum_required(VERSION 3.0) +project(sample-core) + file(GLOB src_cpp RELATIVE ${CMAKE_CURRENT_LIST_DIR} "*.cpp") foreach(src ${src_cpp}) diff --git a/sensor/CMakeLists.txt b/sensor/CMakeLists.txt index a7e184b..549fce8 100644 --- a/sensor/CMakeLists.txt +++ b/sensor/CMakeLists.txt @@ -1,7 +1,7 @@ -project(sample-core) - cmake_minimum_required(VERSION 3.0) +project(sample-core) + file(GLOB src_cpp RELATIVE ${CMAKE_CURRENT_LIST_DIR} "*.cpp") foreach(src ${src_cpp}) diff --git a/sensor/sample-vp1394TwoGrabber-13.cpp b/sensor/sample-vp1394TwoGrabber-13.cpp index 3ba8556..7cd474e 100755 --- a/sensor/sample-vp1394TwoGrabber-13.cpp +++ b/sensor/sample-vp1394TwoGrabber-13.cpp @@ -2,8 +2,9 @@ int main() { +#ifdef VISP_HAVE_DC1394_2 vpImage I; vp1394TwoGrabber g; g >> I; +#endif } - diff --git a/sensor/sample-vp1394TwoGrabber-14.cpp b/sensor/sample-vp1394TwoGrabber-14.cpp index fe9bf00..cac272d 100755 --- a/sensor/sample-vp1394TwoGrabber-14.cpp +++ b/sensor/sample-vp1394TwoGrabber-14.cpp @@ -2,8 +2,10 @@ int main() { +#ifdef VISP_HAVE_DC1394_2 vpImage I; vp1394TwoGrabber g; g >> I; +#endif } diff --git a/sensor/sample-vp1394TwoGrabber-2.cpp b/sensor/sample-vp1394TwoGrabber-2.cpp index 7d5a5e1..0beb5ce 100644 --- a/sensor/sample-vp1394TwoGrabber-2.cpp +++ b/sensor/sample-vp1394TwoGrabber-2.cpp @@ -27,8 +27,9 @@ int main() for (unsigned int camera=0; camera < ncameras; camera ++) { g.setCamera(camera); g.acquire(I[camera]); - sprintf(filename, "image-cam%d.pgm", camera); - vpImageIo::writePGM(I[camera], filename); + std::stringstream ss; + ss << "image-cam" << camera << ".pgm"; + vpImageIo::writePGM(I[camera], ss.str()); } delete [] I; } diff --git a/sensor/sample-vpOpenCVGrabber-2.cpp b/sensor/sample-vpOpenCVGrabber-2.cpp deleted file mode 100644 index d848a84..0000000 --- a/sensor/sample-vpOpenCVGrabber-2.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include - -#include - -#if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION < 0x030000) - -#include -#include -#include -#include - - -// usage: binary -// device name: 0 is the default to dial with the first camera, -// 1 to dial with a second camera attached to the computer -int main(int argc, char** argv) -{ - int device = 0; - if (argc > 1) - device = atoi(argv[1]); - - std::cout << "Use device: " << device << std::endl; - cv::VideoCapture cap(device); // open the default camera - if(!cap.isOpened()) // check if we succeeded - return -1; - cv::Mat frame; - cap >> frame; // get a new frame from camera - - IplImage iplimage = frame; - std::cout << "Image size: " << iplimage.width << " " - << iplimage.height << std::endl; - - //vpImage I; // for color images - vpImage I; // for gray images - vpImageConvert::convert(&iplimage, I); - vpDisplayOpenCV d(I); - - for(;;) { - cap >> frame; // get a new frame from camera - iplimage = frame; - - // Convert the image in ViSP format and display it - vpImageConvert::convert(&iplimage, I); - vpDisplay::display(I); - vpDisplay::flush(I); - if (vpDisplay::getClick(I, false)) // a click to exit - break; - } - // the camera will be deinitialized automatically in VideoCapture destructor - return 0; -} - -#else -int main() -{ - std::cout << "OpenCV is not available..." << std::endl; -} - -#endif diff --git a/sensor/sample-vpOpenCVGrabber.cpp b/sensor/sample-vpOpenCVGrabber.cpp deleted file mode 100644 index bf0fc8f..0000000 --- a/sensor/sample-vpOpenCVGrabber.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include - -int main() -{ -#if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION < 0x020408) - vpImage I; // Create a gray level image container - vpOpenCVGrabber g; // Create a grabber based on OpenCV third party lib - - g.open(I); // Open the framegrabber - g.acquire(I); // Acquire an image - vpImageIo::writePGM(I, "image.pgm"); // Write image on the disk -#endif -} diff --git a/sensor/sample-vpRealSense2-1.cpp b/sensor/sample-vpRealSense2-1.cpp index 8315bc1..c14feaf 100644 --- a/sensor/sample-vpRealSense2-1.cpp +++ b/sensor/sample-vpRealSense2-1.cpp @@ -1,8 +1,10 @@ #include #include #include + int main() { +#ifdef VISP_HAVE_REALSENSE2 vpRealSense2 rs; rs.open(); vpImage I(rs.getIntrinsics(RS2_STREAM_COLOR).height, rs.getIntrinsics(RS2_STREAM_COLOR).width); @@ -18,6 +20,7 @@ int main() if (vpDisplay::getClick(I, false)) break; } +#endif return 0; } diff --git a/sensor/sample-vpRealSense2-2.cpp b/sensor/sample-vpRealSense2-2.cpp index d8a9bb7..cdb2e28 100644 --- a/sensor/sample-vpRealSense2-2.cpp +++ b/sensor/sample-vpRealSense2-2.cpp @@ -1,8 +1,12 @@ #include +#ifdef VISP_HAVE_PCL #include #include +#endif + int main() { +#if defined(VISP_HAVE_REALSENSE2) && defined(VISP_HAVE_PCL) vpRealSense2 rs; rs.open(); pcl::PointCloud::Ptr pointcloud(new pcl::PointCloud); @@ -24,5 +28,6 @@ int main() } viewer->spinOnce(30); } +#endif return 0; } diff --git a/sensor/sample-vpRealSense2-3.cpp b/sensor/sample-vpRealSense2-3.cpp index 00922e6..9f75f61 100644 --- a/sensor/sample-vpRealSense2-3.cpp +++ b/sensor/sample-vpRealSense2-3.cpp @@ -1,7 +1,9 @@ #include #include #include + int main() { +#ifdef VISP_HAVE_REALSENSE2 vpRealSense2 rs; rs2::config config; config.enable_stream(RS2_STREAM_COLOR, 1920, 1080, RS2_FORMAT_RGBA8, 30); @@ -27,6 +29,7 @@ int main() { if (vpDisplay::getClick(Ic, false) || vpDisplay::getClick(Ii, false)) break; } +#endif return 0; } diff --git a/sensor/sample-vpRealSense2-4.cpp b/sensor/sample-vpRealSense2-4.cpp index 3c9bb37..202d78b 100644 --- a/sensor/sample-vpRealSense2-4.cpp +++ b/sensor/sample-vpRealSense2-4.cpp @@ -2,7 +2,9 @@ #include #include #include + int main() { +#ifdef VISP_HAVE_REALSENSE2 vpRealSense2 rs; rs2::config config; config.enable_stream(RS2_STREAM_COLOR, 640, 480, RS2_FORMAT_RGBA8, 30); @@ -30,6 +32,7 @@ int main() { if (vpDisplay::getClick(Ic, false) || vpDisplay::getClick(Id, false)) break; } +#endif return 0; } diff --git a/sensor/sample-vpRealSense2-5.cpp b/sensor/sample-vpRealSense2-5.cpp index 301273f..08597cd 100644 --- a/sensor/sample-vpRealSense2-5.cpp +++ b/sensor/sample-vpRealSense2-5.cpp @@ -1,8 +1,11 @@ #include + int main() { +#ifdef VISP_HAVE_REALSENSE2 vpRealSense2 rs; rs.open(); - std::cout << "RealSense sensor characteristics: \n" << rs << std::endl; + std::cout << "RealSense sensor characteristics: \n" << rs << std::endl; +#endif return 0; } diff --git a/tt/CMakeLists.txt b/tt/CMakeLists.txt index a7e184b..549fce8 100644 --- a/tt/CMakeLists.txt +++ b/tt/CMakeLists.txt @@ -1,7 +1,7 @@ -project(sample-core) - cmake_minimum_required(VERSION 3.0) +project(sample-core) + file(GLOB src_cpp RELATIVE ${CMAKE_CURRENT_LIST_DIR} "*.cpp") foreach(src ${src_cpp}) diff --git a/video/CMakeLists.txt b/video/CMakeLists.txt index a7e184b..549fce8 100644 --- a/video/CMakeLists.txt +++ b/video/CMakeLists.txt @@ -1,7 +1,7 @@ -project(sample-core) - cmake_minimum_required(VERSION 3.0) +project(sample-core) + file(GLOB src_cpp RELATIVE ${CMAKE_CURRENT_LIST_DIR} "*.cpp") foreach(src ${src_cpp}) diff --git a/vision/CMakeLists.txt b/vision/CMakeLists.txt index a7e184b..549fce8 100644 --- a/vision/CMakeLists.txt +++ b/vision/CMakeLists.txt @@ -1,7 +1,7 @@ -project(sample-core) - cmake_minimum_required(VERSION 3.0) +project(sample-core) + file(GLOB src_cpp RELATIVE ${CMAKE_CURRENT_LIST_DIR} "*.cpp") foreach(src ${src_cpp}) diff --git a/vision/sample-vpKeyPointSurf-2.cpp b/vision/sample-vpKeyPointSurf-2.cpp deleted file mode 100644 index 891ff29..0000000 --- a/vision/sample-vpKeyPointSurf-2.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include -#include -#include - -int main() -{ -#if defined (VISP_HAVE_OPENCV_NONFREE) && (VISP_HAVE_OPENCV_VERSION < 0x030000) - vpImage Ireference; - vpImage Icurrent; - vpKeyPointSurf surf; - - //First grab the reference image Irefrence - - //Select a part of the image by clincking on two points which define a rectangle - vpImagePoint corners[2]; - for (int i=0 ; i < 2 ; i++) - { - vpDisplay::getClick(Ireference, corners[i]); - } - - //Build the reference SURF points. - int nbrRef; - unsigned int height, width; - height = (unsigned int)(corners[1].get_i() - corners[0].get_i()); - width = (unsigned int)(corners[1].get_j() - corners[0].get_j()); - nbrRef = surf.buildReference(Ireference, corners[0], height, width); - - //Then grab another image which represents the current image Icurrent - - //Select a part of the image by clincking on two points which define a rectangle - for (int i=0 ; i < 2 ; i++) - { - vpDisplay::getClick(Icurrent, corners[i]); - } - - //Match points between the reference points and the SURF points computed in the current image. - int nbrMatched; - height = (unsigned int)(corners[1].get_i() - corners[0].get_i()); - width = (unsigned int)(corners[1].get_j() - corners[0].get_j()); - nbrMatched = surf.matchPoint(Icurrent, corners[0], height, width); - - //Display the matched points - surf.display(Ireference, Icurrent); - - return(0); -#endif -} diff --git a/vision/sample-vpKeyPointSurf.cpp b/vision/sample-vpKeyPointSurf.cpp deleted file mode 100644 index 035e729..0000000 --- a/vision/sample-vpKeyPointSurf.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include - -int main() -{ -#if defined(VISP_HAVE_OPENCV_NONFREE) && (VISP_HAVE_OPENCV_VERSION < 0x030000) - vpImage Irefrence; - vpImage Icurrent; - vpKeyPointSurf surf; - - // First grab the reference image Irefrence - - // Build the reference SURF points. - surf.buildReference(Irefrence); - - // Then grab another image which represents the current image Icurrent - - // Match points between the reference points and the SURF points computed in the current image. - surf.matchPoint(Icurrent); - - // Display the matched points - surf.display(Irefrence, Icurrent); - - return (0); -#endif -} - diff --git a/visual_features/CMakeLists.txt b/visual_features/CMakeLists.txt index a7e184b..549fce8 100644 --- a/visual_features/CMakeLists.txt +++ b/visual_features/CMakeLists.txt @@ -1,7 +1,7 @@ -project(sample-core) - cmake_minimum_required(VERSION 3.0) +project(sample-core) + file(GLOB src_cpp RELATIVE ${CMAKE_CURRENT_LIST_DIR} "*.cpp") foreach(src ${src_cpp}) diff --git a/vs/CMakeLists.txt b/vs/CMakeLists.txt index a7e184b..549fce8 100644 --- a/vs/CMakeLists.txt +++ b/vs/CMakeLists.txt @@ -1,7 +1,7 @@ -project(sample-core) - cmake_minimum_required(VERSION 3.0) +project(sample-core) + file(GLOB src_cpp RELATIVE ${CMAKE_CURRENT_LIST_DIR} "*.cpp") foreach(src ${src_cpp})