From 3555dbc29ae317212e52daf7cab04e4f740afdbe Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Wed, 3 Apr 2024 15:08:48 +0200 Subject: [PATCH] Rename tuner tutorial and introduce a new tutorial to explain the HSV segmentation basics --- tutorial/segmentation/color/CMakeLists.txt | 10 +++- tutorial/segmentation/color/ballons.jpg | Bin 0 -> 22516 bytes ...tuner.cpp => tutorial-hsv-range-tuner.cpp} | 19 ++++--- .../color/tutorial-hsv-segmentation-basic.cpp | 52 ++++++++++++++++++ 4 files changed, 72 insertions(+), 9 deletions(-) create mode 100644 tutorial/segmentation/color/ballons.jpg rename tutorial/segmentation/color/{tutorial-hsv-tuner.cpp => tutorial-hsv-range-tuner.cpp} (94%) create mode 100644 tutorial/segmentation/color/tutorial-hsv-segmentation-basic.cpp diff --git a/tutorial/segmentation/color/CMakeLists.txt b/tutorial/segmentation/color/CMakeLists.txt index d2081ab26a..2d8f4b04d4 100644 --- a/tutorial/segmentation/color/CMakeLists.txt +++ b/tutorial/segmentation/color/CMakeLists.txt @@ -6,15 +6,23 @@ find_package(VISP REQUIRED visp_core visp_sensor visp_io visp_gui) # set the list of source files set(tutorial_cpp + tutorial-hsv-range-tuner.cpp tutorial-hsv-segmentation.cpp + tutorial-hsv-segmentation-basic.cpp tutorial-hsv-segmentation-pcl.cpp tutorial-hsv-segmentation-pcl-viewer.cpp - tutorial-hsv-tuner.cpp ) +file(GLOB tutorial_data "*.jpg") + foreach(cpp ${tutorial_cpp}) visp_add_target(${cpp}) if(COMMAND visp_add_dependency) visp_add_dependency(${cpp} "tutorials") endif() endforeach() + +# Copy the data files to the same location than the target +foreach(data ${tutorial_data}) + visp_copy_data(tutorial-hsv-segmentation-basic.cpp ${data}) +endforeach() diff --git a/tutorial/segmentation/color/ballons.jpg b/tutorial/segmentation/color/ballons.jpg new file mode 100644 index 0000000000000000000000000000000000000000..9cc0c01f600589d204302697fd08bf15a6b68054 GIT binary patch literal 22516 zcmeFZWk4NEvnV<^1a}A!+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syR}tud3OITDlu8Og$93 zegVyUsBr^G93bNJ0BEV+9)ZFH$T2ygqcAL`n6c9~0WOmwXpTo7gl+=W z&?TF@1OO2&fP)!pFQsZ~x+L~))ixb4(3eW#Ubn4VrB(0vIOqgut*c-N@_#(8tg~lK~-U5bY{VW)pQ0^V1kktQjN7szGR9s z3ZGG=>=-{6PX7QZ{?DhND3<0RCuH;iAeJR0t@XWmh4TV70@Y{oLM4Qz$Uh-hm*fLN6p3RMTUXU4iB^l3b_$ESCqO{DO1V%B zW34T$-#Wyx9mINt2JoPRltiS&>r86taI(*4pSR@L5rc-I`K1xD6hu+Xf~0}%-Q91B zvq1%!9T?^&Yb|B~3cyy_dN@Ebt^z1Xv;=p^62u8&_BwAn-UsCfAPOlG#FzAp(=)xr z9_?>fRIO-%D27219EgkqfKp5#AF=r8lCiKf<&mP0c}M^Thezhl4Owprhi}YQp+zWy zb}h$tn@R>Dy~Do_f-`-fpneaYfSmv=BTJ6+7EsCxFxgQ60%_gjX<*%kA;Hgck{?V4FZW>=983q+K$fuD{W&Go1 zWi@zp`;-W0ECG+EU|jpSF+T3a6$iSZUFC~a#}&OGE~485`Qp6a43ZWfZ!zpyT9qb|Jep_*q{Ia literal 0 HcmV?d00001 diff --git a/tutorial/segmentation/color/tutorial-hsv-tuner.cpp b/tutorial/segmentation/color/tutorial-hsv-range-tuner.cpp similarity index 94% rename from tutorial/segmentation/color/tutorial-hsv-tuner.cpp rename to tutorial/segmentation/color/tutorial-hsv-range-tuner.cpp index 07ff2c7077..e3097db390 100644 --- a/tutorial/segmentation/color/tutorial-hsv-tuner.cpp +++ b/tutorial/segmentation/color/tutorial-hsv-range-tuner.cpp @@ -1,4 +1,4 @@ -//! \example tutorial-hsv-tuner.cpp +//! \example tutorial-hsv-range-tuner.cpp #include @@ -158,10 +158,11 @@ int main(int argc, char *argv[]) vpImage H(height, width); vpImage S(height, width); vpImage V(height, width); - vpImage Ic_segmented(height, width, 0); + vpImage mask(height, width); + vpImage Ic_segmented(height, width); vpDisplayX d_Ic(Ic, 0, 0, "Current frame"); - vpDisplayX d_Ic_segmented(Ic_segmented, Ic.getWidth()+75, 0, "HSV segmented frame"); + vpDisplayX d_Ic_segmented(Ic_segmented, Ic.getWidth()+75, 0, "Segmented frame"); bool quit = false; while (!quit) { @@ -172,11 +173,13 @@ int main(int argc, char *argv[]) reinterpret_cast(V.bitmap), Ic.getSize()); vpImageTools::inRange(reinterpret_cast(H.bitmap), - reinterpret_cast(S.bitmap), - reinterpret_cast(V.bitmap), - hsv_values_trackbar, - reinterpret_cast(Ic_segmented.bitmap), - Ic_segmented.getSize()); + reinterpret_cast(S.bitmap), + reinterpret_cast(V.bitmap), + hsv_values_trackbar, + reinterpret_cast(mask.bitmap), + mask.getSize()); + + vpImageTools::inMask(Ic, mask, Ic_segmented); vpDisplay::display(Ic); vpDisplay::display(Ic_segmented); diff --git a/tutorial/segmentation/color/tutorial-hsv-segmentation-basic.cpp b/tutorial/segmentation/color/tutorial-hsv-segmentation-basic.cpp new file mode 100644 index 0000000000..c1ebbb399e --- /dev/null +++ b/tutorial/segmentation/color/tutorial-hsv-segmentation-basic.cpp @@ -0,0 +1,52 @@ +#include +#include +#include +#include + +int main() +{ + vpImage I; + vpImageIo::read(I, "ballons.jpg"); + + unsigned int width = I.getWidth(); + unsigned int height = I.getHeight(); + + vpImage H(height, width); + vpImage S(height, width); + vpImage V(height, width); + + vpImageConvert::RGBaToHSV(reinterpret_cast(I.bitmap), + reinterpret_cast(H.bitmap), + reinterpret_cast(S.bitmap), + reinterpret_cast(V.bitmap), I.getSize()); + + int h = 14, s = 255, v = 209; + int offset = 30; + int h_low = std::max(0, h - offset), h_high = std::min(h + offset, 255); + int s_low = std::max(0, s - offset), s_high = std::min(s + offset, 255); + int v_low = std::max(0, v - offset), v_high = std::min(v + offset, 255); + std::vector hsv_range({ h_low, h_high, s_low, s_high, v_low, v_high }); + + vpImage mask(height, width); + vpImageTools::inRange(reinterpret_cast(H.bitmap), + reinterpret_cast(S.bitmap), + reinterpret_cast(V.bitmap), + hsv_range, + reinterpret_cast(mask.bitmap), + mask.getSize()); + + vpImage I_segmented(height, width); + vpImageTools::inMask(I, mask, I_segmented); + + vpDisplayX d_I(I, 0, 0, "Current frame"); + vpDisplayX d_mask(mask, I.getWidth()+75, 0, "HSV mask"); + vpDisplayX d_I_segmented(I_segmented, 2*mask.getWidth()+80, 0, "Segmented frame"); + + vpDisplay::display(I); + vpDisplay::display(mask); + vpDisplay::display(I_segmented); + vpDisplay::flush(I); + vpDisplay::flush(mask); + vpDisplay::flush(I_segmented); + vpDisplay::getClick(I); +}