-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TUTO] Added a tutorial for vpCannyEdgeDetection
- Loading branch information
rlagneau
committed
Oct 18, 2023
1 parent
40de54c
commit 4f86c52
Showing
4 changed files
with
494 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* ViSP, open source Visual Servoing Platform software. | ||
* Copyright (C) 2005 - 2023 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 | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* See the file LICENSE.txt at the root directory of this source | ||
* distribution for additional information about the GNU GPL. | ||
* | ||
* For using ViSP with software that can not be combined with the GNU | ||
* GPL, please contact Inria about acquiring a ViSP Professional | ||
* Edition License. | ||
* | ||
* See https://visp.inria.fr for more information. | ||
* | ||
* This software was developed at: | ||
* Inria Rennes - Bretagne Atlantique | ||
* Campus Universitaire de Beaulieu | ||
* 35042 Rennes Cedex | ||
* France | ||
* | ||
* If you have questions regarding the use of this file, please contact | ||
* Inria at [email protected] | ||
* | ||
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
*/ | ||
|
||
#include "drawingHelpers.h" | ||
|
||
#include <visp3/core/vpImageConvert.h> | ||
|
||
#if defined(VISP_HAVE_X11) | ||
vpDisplayX drawingHelpers::d; | ||
#elif defined(HAVE_OPENCV_HIGHGUI) | ||
vpDisplayOpenCV drawingHelpers::d; | ||
#elif defined(VISP_HAVE_GTK) | ||
vpDisplayGTK drawingHelpers::d; | ||
#elif defined(VISP_HAVE_GDI) | ||
vpDisplayGDI drawingHelpers::d; | ||
#elif defined(VISP_HAVE_D3D9) | ||
vpDisplayD3D drawingHelpers::d; | ||
#endif | ||
|
||
vpImage<vpRGBa> drawingHelpers::I_disp; | ||
|
||
bool drawingHelpers::display(vpImage<vpRGBa> &I, const std::string &title, const bool &blockingMode) | ||
{ | ||
I_disp = I; | ||
d.init(I_disp); | ||
vpDisplay::setTitle(I_disp, title.c_str()); | ||
|
||
vpDisplay::display(I_disp); | ||
vpDisplay::displayText(I_disp, 15, 15, "Left click to continue...", vpColor::red); | ||
vpDisplay::displayText(I_disp, 35, 15, "Right click to stop...", vpColor::red); | ||
vpDisplay::flush(I_disp); | ||
vpMouseButton::vpMouseButtonType button; | ||
vpDisplay::getClick(I_disp, button, blockingMode); | ||
bool hasToContinue = true; | ||
if (button == vpMouseButton::button3) | ||
{ | ||
// Right click => stop the program | ||
hasToContinue = false; | ||
} | ||
|
||
return hasToContinue; | ||
} | ||
|
||
bool drawingHelpers::display(vpImage<unsigned char> &D, const std::string &title, const bool &blockingMode) | ||
{ | ||
vpImage<vpRGBa> I; // Image to display | ||
vpImageConvert::convert(D, I); | ||
return display(I, title, blockingMode); | ||
} | ||
|
||
bool drawingHelpers::display(vpImage<double> &D, const std::string &title, const bool &blockingMode) | ||
{ | ||
vpImage<unsigned char> I; // Image to display | ||
vpImageConvert::convert(D, I); | ||
return display(I, title, blockingMode); | ||
} | ||
|
||
bool drawingHelpers::display(vpImage<float> &F, const std::string &title, const bool &blockingMode) | ||
{ | ||
vpImage<unsigned char> I; // Image to display | ||
vpImageConvert::convert(F, I); | ||
return display(I, title, blockingMode); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* | ||
* ViSP, open source Visual Servoing Platform software. | ||
* Copyright (C) 2005 - 2023 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 | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* See the file LICENSE.txt at the root directory of this source | ||
* distribution for additional information about the GNU GPL. | ||
* | ||
* For using ViSP with software that can not be combined with the GNU | ||
* GPL, please contact Inria about acquiring a ViSP Professional | ||
* Edition License. | ||
* | ||
* See https://visp.inria.fr for more information. | ||
* | ||
* This software was developed at: | ||
* Inria Rennes - Bretagne Atlantique | ||
* Campus Universitaire de Beaulieu | ||
* 35042 Rennes Cedex | ||
* France | ||
* | ||
* If you have questions regarding the use of this file, please contact | ||
* Inria at [email protected] | ||
* | ||
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
*/ | ||
#ifndef _drawingHelpers_h_ | ||
#define _drawingHelpers_h_ | ||
|
||
#include <visp3/core/vpImage.h> | ||
#include <visp3/gui/vpDisplayGDI.h> | ||
#include <visp3/gui/vpDisplayOpenCV.h> | ||
#include <visp3/gui/vpDisplayX.h> | ||
|
||
namespace drawingHelpers | ||
{ | ||
#if defined(VISP_HAVE_X11) | ||
extern vpDisplayX d; | ||
#elif defined(HAVE_OPENCV_HIGHGUI) | ||
extern vpDisplayOpenCV d; | ||
#elif defined(VISP_HAVE_GTK) | ||
extern vpDisplayGTK d; | ||
#elif defined(VISP_HAVE_GDI) | ||
extern vpDisplayGDI d; | ||
#elif defined(VISP_HAVE_D3D9) | ||
extern vpDisplayD3D d; | ||
#endif | ||
|
||
extern vpImage<vpRGBa> I_disp; /*!< Displayed image.*/ | ||
|
||
/** | ||
* \brief Display a RGB image and catch the user clicks to know if | ||
* the user wants to stop the program. | ||
* | ||
* \param[out] I The RGB image to display. | ||
* \param[in] title The title of the window. | ||
* \param[in] blockingMode If true, wait for a click to switch to the next image. | ||
* \return true The user wants to continue the application. | ||
* \return false The user wants to stop the application. | ||
*/ | ||
bool display(vpImage<vpRGBa> &I, const std::string &title, const bool &blockingMode); | ||
|
||
/** | ||
* \brief Display a gray-scale image and catch the user clicks to know if | ||
* the user wants to stop the program. | ||
* | ||
* \param[out] I The gray-scale image to display. | ||
* \param[in] title The title of the window. | ||
* \param[in] blockingMode If true, wait for a click to switch to the next image. | ||
* \return true The user wants to continue the application. | ||
* \return false The user wants to stop the application. | ||
*/ | ||
bool display(vpImage<unsigned char> &I, const std::string &title, const bool &blockingMode); | ||
|
||
/** | ||
* \brief Display a double precision image and catch the user clicks to know if | ||
* the user wants to stop the program. | ||
* | ||
* \param[out] I The double precision image to display. | ||
* \param[in] title The title of the window. | ||
* \param[in] blockingMode If true, wait for a click to switch to the next image. | ||
* \return true The user wants to continue the application. | ||
* \return false The user wants to stop the application. | ||
*/ | ||
bool display(vpImage<double> &D, const std::string &title, const bool &blockingMode); | ||
|
||
/** | ||
* \brief Display a floating-point precision image and catch the user clicks to know if | ||
* the user wants to stop the program. | ||
* | ||
* \param[out] I The floating-point precision image to display. | ||
* \param[in] title The title of the window. | ||
* \param[in] blockingMode If true, wait for a click to switch to the next image. | ||
* \return true The user wants to continue the application. | ||
* \return false The user wants to stop the application. | ||
*/ | ||
bool display(vpImage<float> &F, const std::string &title, const bool &blockingMode); | ||
} | ||
|
||
#endif |
Oops, something went wrong.