From 41c7980457a71b240c05babd8107794e73e1630c Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Wed, 6 Nov 2024 08:27:05 +0100 Subject: [PATCH 1/6] Code indentation --- tutorial/imgproc/brightness/tutorial-brightness-adjustment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorial/imgproc/brightness/tutorial-brightness-adjustment.cpp b/tutorial/imgproc/brightness/tutorial-brightness-adjustment.cpp index c0fd9c5112..e522ce22ff 100644 --- a/tutorial/imgproc/brightness/tutorial-brightness-adjustment.cpp +++ b/tutorial/imgproc/brightness/tutorial-brightness-adjustment.cpp @@ -173,7 +173,7 @@ int main(int argc, const char **argv) std::stringstream ss_gray; ss_gray << input_name << "_adjust_alpha=" << alpha << "_beta=" << beta << "_gray.png"; display(I_display, I_color_res, I_color_adjust, I_gray_res, I_gray_adjust, I_gray_display, - "Brightness and contrast adjustment. Click to continue.", ss_color.str(), ss_gray.str()); + "Brightness and contrast adjustment. Click to continue.", ss_color.str(), ss_gray.str()); //! [Gamma correction] if (method != VISP_NAMESPACE_NAME::GAMMA_MANUAL) { From 245db62b51c814954e39b4a4261e91edf8c90f79 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Wed, 6 Nov 2024 08:27:44 +0100 Subject: [PATCH 2/6] Fix to make tutorial-circle-hough.cpp working on an image sequence which first image number differ from 0 Fix warning around unused parameter "title" in drawingHelpers.cpp --- .../hough-transform/drawingHelpers.cpp | 1 + .../hough-transform/tutorial-circle-hough.cpp | 92 +++++++++---------- 2 files changed, 43 insertions(+), 50 deletions(-) diff --git a/tutorial/imgproc/hough-transform/drawingHelpers.cpp b/tutorial/imgproc/hough-transform/drawingHelpers.cpp index 322f8ca071..7e7d14d0b1 100644 --- a/tutorial/imgproc/hough-transform/drawingHelpers.cpp +++ b/tutorial/imgproc/hough-transform/drawingHelpers.cpp @@ -11,6 +11,7 @@ using namespace VISP_NAMESPACE_NAME; bool drawingHelpers::display(vpImage< vpRGBa> &I, const std::string &title, const bool &blockingMode) { vpDisplay::display(I); + vpDisplay::setTitle(I, title); vpDisplay::displayText(I, 15, 15, "Left click to continue...", vpColor::red); vpDisplay::displayText(I, 35, 15, "Right click to stop...", vpColor::red); vpDisplay::flush(I); diff --git a/tutorial/imgproc/hough-transform/tutorial-circle-hough.cpp b/tutorial/imgproc/hough-transform/tutorial-circle-hough.cpp index 04742e05c7..d36879a144 100644 --- a/tutorial/imgproc/hough-transform/tutorial-circle-hough.cpp +++ b/tutorial/imgproc/hough-transform/tutorial-circle-hough.cpp @@ -22,7 +22,9 @@ using namespace VISP_NAMESPACE_NAME; #endif -bool run_detection(const vpImage &I_src, vpImage &I_disp, vpImage &I_dispCanny, vpCircleHoughTransform &detector, const int &nbCirclesToDetect, const bool &blockingMode, const bool &displayCanny) +bool run_detection(const vpImage &I_src, vpImage &I_disp, vpImage &I_dispCanny, + vpCircleHoughTransform &detector, const int &nbCirclesToDetect, const bool &blockingMode, + const bool &displayCanny) { double t0 = vpTime::measureTimeMicros(); //! [Run detection] @@ -61,14 +63,10 @@ bool run_detection(const vpImage &I_src, vpImage &I_disp, #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_17) std::optional> opt_mask = std::nullopt; std::optional>>> opt_votingPoints = std::nullopt; -#elif (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) +#else vpImage *opt_mask = nullptr; std::vector>> *opt_votingPoints = nullptr; detector.computeVotingMask(I_src, detectedCircles, &opt_mask, &opt_votingPoints); // Get, if available, the voting points -#else - vpImage *opt_mask = NULL; - std::vector > > *opt_votingPoints = NULL; - detector.computeVotingMask(I_src, detectedCircles, &opt_mask, &opt_votingPoints); // Get, if available, the voting points #endif #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_17) @@ -94,25 +92,14 @@ bool run_detection(const vpImage &I_src, vpImage &I_disp, } } #if (VISP_CXX_STANDARD < VISP_CXX_STANDARD_17) -#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) - if (opt_mask != nullptr) -#else - if (opt_mask != NULL) -#endif - { + if (opt_mask != nullptr) { delete opt_mask; } -#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) - if (opt_votingPoints != nullptr) -#else - if (opt_votingPoints != NULL) -#endif - { + if (opt_votingPoints != nullptr) { delete opt_votingPoints; } #endif -//! [Iterate detections] - + //! [Iterate detections] if (displayCanny) { vpImage edgeMap = detector.getEdgeMap(); drawingHelpers::display(edgeMap, I_dispCanny, "Edge map", blockingMode); @@ -511,39 +498,9 @@ int main(int argc, char **argv) //! [Algo init] std::cout << detector; - //! [Display init] vpImage I_src; vpImage I_disp; vpImage I_dispCanny; - // Read the (first) image - char *filename = new char[opt_input.size() + 50]; - if (opt_input.find("%") != std::string::npos) { - // Read the first frame - sprintf(filename, opt_input.c_str(), 0); - } - else { - // Simply get the filename - strcpy(filename, opt_input.c_str()); - } - std::string filenameAsStr(filename); - delete[] filename; - vpImageIo::read(I_src, filenameAsStr); - I_disp.resize(I_src.getHeight(), I_src.getWidth()); - I_dispCanny.resize(I_src.getHeight(), I_src.getWidth()); -#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) - std::shared_ptr dColor = vpDisplayFactory::createDisplay(I_disp, -1, -1, "Input image");; - std::shared_ptr dCanny(nullptr); - if (opt_displayCanny) { - dCanny = vpDisplayFactory::createDisplay(I_dispCanny, I_src.getWidth() + 40, -1, "Edge-map"); - } -#else - vpDisplay *dColor = vpDisplayFactory::allocateDisplay(I_disp, -1, -1, "Input image");; - vpDisplay *dCanny(nullptr); - if (opt_displayCanny) { - dCanny = vpDisplayFactory::allocateDisplay(I_dispCanny, I_src.getWidth() + 40, -1, "Edge-map"); - } -#endif - //! [Display init] //! [Manage video] if (opt_input.find("%") != std::string::npos) { @@ -552,6 +509,24 @@ int main(int argc, char **argv) vpVideoReader g; g.setFileName(opt_input); g.open(I_src); + + //! [Display init] + I_disp.resize(I_src.getHeight(), I_src.getWidth()); + I_dispCanny.resize(I_src.getHeight(), I_src.getWidth()); +#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) + std::shared_ptr dColor = vpDisplayFactory::createDisplay(I_disp, -1, -1, "Input image");; + std::shared_ptr dCanny(nullptr); + if (opt_displayCanny) { + dCanny = vpDisplayFactory::createDisplay(I_dispCanny, I_src.getWidth() + 40, -1, "Edge-map"); + } +#else + vpDisplay *dColor = vpDisplayFactory::allocateDisplay(I_disp, -1, -1, "Input image");; + vpDisplay *dCanny(nullptr); + if (opt_displayCanny) { + dCanny = vpDisplayFactory::allocateDisplay(I_dispCanny, I_src.getWidth() + 40, -1, "Edge-map"); + } +#endif + //! [Display init] while (!g.end() && hasToContinue) { g.acquire(I_src); hasToContinue = run_detection(I_src, I_disp, I_dispCanny, detector, opt_nbCirclesToDetect, false, opt_displayCanny); @@ -567,6 +542,23 @@ int main(int argc, char **argv) } // Read the image and perform detection on it vpImageIo::read(I_src, opt_input); + + I_disp.resize(I_src.getHeight(), I_src.getWidth()); + I_dispCanny.resize(I_src.getHeight(), I_src.getWidth()); +#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) + std::shared_ptr dColor = vpDisplayFactory::createDisplay(I_disp, -1, -1, "Input image");; + std::shared_ptr dCanny(nullptr); + if (opt_displayCanny) { + dCanny = vpDisplayFactory::createDisplay(I_dispCanny, I_src.getWidth() + 40, -1, "Edge-map"); + } +#else + vpDisplay *dColor = vpDisplayFactory::allocateDisplay(I_disp, -1, -1, "Input image");; + vpDisplay *dCanny(nullptr); + if (opt_displayCanny) { + dCanny = vpDisplayFactory::allocateDisplay(I_dispCanny, I_src.getWidth() + 40, -1, "Edge-map"); + } +#endif + run_detection(I_src, I_disp, I_dispCanny, detector, opt_nbCirclesToDetect, true, opt_displayCanny); //! [Manage single image] } From 4fed1b81be77f8b89e254658a13b7071df3b5422 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Wed, 6 Nov 2024 08:30:23 +0100 Subject: [PATCH 3/6] Add last fixed issue in change log file --- ChangeLog.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index f85f39e125..2d9bc0549b 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -85,12 +85,13 @@ ViSP 3.x.x (Version in development) . [#1296] Unable to parse camera parameters with vpXmlParserCamera::parse() when camera name is empty . [#1307] Cannot set cxx standard when configuring for Visual Studio . [#1320] Broken links in the documentation - . [#1337] The pose of the automatic datageneration pipeline from blenderproc seems wrong + . [#1337] The pose of the automatic data generation pipeline from blenderproc seems wrong . [#1341] SVD computation fails with Lapack when m < n . [#1370] encountered compilation errors while building the ViSP library . [#1424] Unable to detect Yarp 3.9.0 . [#1485] Build issue around nlohmann_json usage with VTK 9.2.0 or more recent version used as an embedded 3rdparty by PCL + . [#1487] Segfault with vpCannyEdgeDetection with a certain image . [#1494] Memory management issue in vpArray2D::resize() . [#1495] vpMeLine is unable to seek extremities ---------------------------------------------- From 5f70567400e1f6332cef2d4de157d1ae0a58bd87 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Wed, 6 Nov 2024 10:43:45 +0100 Subject: [PATCH 4/6] =?UTF-8?q?Fix=20build=20error:=20=E2=80=98>>=E2=80=99?= =?UTF-8?q?=20should=20be=20=E2=80=98>=20>=E2=80=99=20within=20a=20nested?= =?UTF-8?q?=20template=20argument=20list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../imgproc/hough-transform/tutorial-circle-hough.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tutorial/imgproc/hough-transform/tutorial-circle-hough.cpp b/tutorial/imgproc/hough-transform/tutorial-circle-hough.cpp index d36879a144..cba47d2817 100644 --- a/tutorial/imgproc/hough-transform/tutorial-circle-hough.cpp +++ b/tutorial/imgproc/hough-transform/tutorial-circle-hough.cpp @@ -62,19 +62,17 @@ bool run_detection(const vpImage &I_src, vpImage &I_disp, } #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_17) std::optional> opt_mask = std::nullopt; - std::optional>>> opt_votingPoints = std::nullopt; + std::optional > > > opt_votingPoints = std::nullopt; #else vpImage *opt_mask = nullptr; - std::vector>> *opt_votingPoints = nullptr; + std::vector > > *opt_votingPoints = nullptr; detector.computeVotingMask(I_src, detectedCircles, &opt_mask, &opt_votingPoints); // Get, if available, the voting points #endif #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_17) if (opt_votingPoints) -#elif (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) - if (opt_votingPoints != nullptr) #else - if (opt_votingPoints != NULL) + if (opt_votingPoints != nullptr) #endif { const unsigned int crossSize = 3; From cb7aea6027a941e1a60d33e8055b5d68a27a88b1 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Wed, 6 Nov 2024 10:44:43 +0100 Subject: [PATCH 5/6] Update main CMakeLists.txt with yarp and Panda3D dirs --- CMakeLists.txt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b0b8331c42..4789c8db78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ ############################################################################# # # ViSP, open source Visual Servoing Platform software. -# Copyright (C) 2005 - 2023 by Inria. All rights reserved. +# Copyright (C) 2005 - 2024 by Inria. All rights reserved. # # This software is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -1896,7 +1896,7 @@ endif() status("") status(" Library dirs:") if(USE_EIGEN3) - status(" Eigen3 include dir:" "${Eigen3_DIR}") + status(" Eigen3 dir:" "${Eigen3_DIR}") endif() if(USE_MKL) status(" MKL include dir:" "${MKL_INCLUDE_DIRS}") @@ -1910,6 +1910,16 @@ endif() if(USE_PCL) status(" PCL dir:" "${PCL_DIR}") endif() +if(USE_PANDA3D) + if(Panda3D_DIR) + status(" Panda3D dir:" "${Panda3D_DIR}") + else() + status(" Panda3D dir:" "$ENV{Panda3D_DIR}") + endif() +endif() +if(USE_YARP) + status(" Yarp dir:" "${YARP_DIR}") +endif() # ========================== auxiliary ========================== status("") From 24f06509a61a02c2be989d5bbead6f364c807a2f Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Wed, 6 Nov 2024 13:11:52 +0100 Subject: [PATCH 6/6] Fix build on c++98 --- .../hough-transform/tutorial-circle-hough.cpp | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/tutorial/imgproc/hough-transform/tutorial-circle-hough.cpp b/tutorial/imgproc/hough-transform/tutorial-circle-hough.cpp index cba47d2817..5b17e5d36b 100644 --- a/tutorial/imgproc/hough-transform/tutorial-circle-hough.cpp +++ b/tutorial/imgproc/hough-transform/tutorial-circle-hough.cpp @@ -530,6 +530,15 @@ int main(int argc, char **argv) hasToContinue = run_detection(I_src, I_disp, I_dispCanny, detector, opt_nbCirclesToDetect, false, opt_displayCanny); vpTime::wait(40); } + +#if (VISP_CXX_STANDARD < VISP_CXX_STANDARD_11) + delete dColor; + if (dCanny != nullptr) { + if (opt_displayCanny) { + delete dCanny; + } + } +#endif } //! [Manage video] else { @@ -558,14 +567,17 @@ int main(int argc, char **argv) #endif run_detection(I_src, I_disp, I_dispCanny, detector, opt_nbCirclesToDetect, true, opt_displayCanny); - //! [Manage single image] - } #if (VISP_CXX_STANDARD < VISP_CXX_STANDARD_11) - delete dColor; - if (dCanny != nullptr) { - delete dCanny; - } + delete dColor; + if (dCanny != nullptr) { + if (opt_displayCanny) { + delete dCanny; + } + } #endif + //! [Manage single image] + } + return EXIT_SUCCESS; }