34 bool do_smooth =
false;
35 bool do_grayscale =
false;
38 cout <<
"Number of octaves to use [4]: ";
42 int i = atoi(s.c_str());
43 if (i > 0) N_OCTAVES = i;
48 cout <<
"Please, select the input video file or camera...\n";
54 cout <<
"Video stream open OK\n";
61 std::vector<COpenGLViewport::Ptr> gl_views(N_OCTAVES);
64 gl_views[0] = theScene->getViewport(
"main");
68 for (
size_t i = 1; i < N_OCTAVES; i++)
69 gl_views[i] = theScene->createViewport(
format(
"view_%i", (
int)i));
78 (double(1 << (N_OCTAVES - 1))) / ((1 << N_OCTAVES) - 1);
82 for (
size_t i = 0; i < N_OCTAVES; i++)
93 win.unlockAccess3DScene();
101 "Keys: 's'=Smoothing, 'g': Grayscale 'f': Features",
108 cout <<
"Close the window to end.\n";
111 win.addTextMessage(5, 5,
format(
"%.02fFPS",
win.getRenderingFPS()));
112 std::this_thread::sleep_for(1ms);
128 N_OCTAVES, do_smooth, do_grayscale);
130 win.get3DSceneAndLock();
132 for (
size_t i = 0; i < N_OCTAVES; i++)
142 "Smooth=%i Grayscale=%i",
int(do_smooth ? 1 : 0),
143 int(do_grayscale ? 1 : 0)),
147 win.unlockAccess3DScene();
154 int key =
win.getPushedKey(&kmods);
158 if (key ==
's' || key ==
'S') do_smooth = !do_smooth;
159 if (key ==
'g' || key ==
'G') do_grayscale = !do_grayscale;
176 catch (
const std::exception& e)
183 printf(
"Untyped exception!!");
Declares a class derived from "CObservation" that encapsules an image from a camera, whose relative pose to robot is also stored.
CCameraSensor::Ptr prepareVideoSourceFromUserSelection()
Show to the user a list of possible camera drivers and creates and open the selected camera...
std::string std::string format(std::string_view fmt, ARGS &&... args)
void setImageView(const mrpt::img::CImage &img)
Set this viewport into "image view"-mode, where an image is efficiently drawn (fitting the viewport a...
A viewport within a COpenGLScene, containing a set of OpenGL objects to render.
Holds and builds a pyramid of images: starting with an image at full resolution (octave=1), it builds a number of half-resolution images: octave=2 at 1/2 , octave=3 at 1/2^2, octave=N at 1/2^(N-1).
#define ASSERT_(f)
Defines an assertion mechanism.
std::vector< mrpt::img::CImage > images
The individual images:
This namespace contains representation of robot actions and observations.
Classes for computer vision, detectors, features, etc.
#define IS_CLASS(obj, class_name)
True if the given reference to object (derived from mrpt::rtti::CObject) is of the given class...
mrpt::gui::CDisplayWindow3D::Ptr win
bool buildPyramidFast(mrpt::img::CImage &img, const size_t nOctaves, const bool smooth_halves=true, const bool convert_grayscale=false)
Exactly like buildPyramid(), but if the input image has not to be converted from RGB to grayscale...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
The namespace for 3D scene representation and rendering.
std::string exception_to_str(const std::exception &e)
Builds a nice textual representation of a nested exception, which if generated using MRPT macros (THR...
Classes for creating GUI windows for 2D and 3D visualization.
void setViewportPosition(const double x, const double y, const double width, const double height)
Change the viewport position and dimension on the rendering window.
A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.