34 bool do_smooth =
false;
35 bool do_grayscale =
false;
36 bool do_features =
false;
39 cout <<
"Number of octaves to use [4]: ";
43 int i = atoi(
s.c_str());
44 if (i > 0) N_OCTAVES = i;
49 cout <<
"Please, select the input video file or camera...\n";
55 cout <<
"Video stream open OK\n";
62 std::vector<COpenGLViewport::Ptr> gl_views(N_OCTAVES);
65 gl_views[0] = theScene->getViewport(
"main");
69 for (
size_t i = 1; i < N_OCTAVES; i++)
70 gl_views[i] = theScene->createViewport(
format(
"view_%i", (
int)i));
79 (double(1 << (N_OCTAVES - 1))) / ((1 << N_OCTAVES) - 1);
83 for (
size_t i = 0; i < N_OCTAVES; i++)
94 win.unlockAccess3DScene();
102 "Keys: 's'=Smoothing, 'g': Grayscale 'f': Features",
TColorf(.8, .8, 0),
112 cout <<
"Close the window to end.\n";
115 win.addTextMessage(5, 5,
format(
"%.02fFPS",
win.getRenderingFPS()));
116 std::this_thread::sleep_for(1ms);
132 N_OCTAVES, do_smooth, do_grayscale);
137 static const int threshold = 20;
145 CFeatureExtraction::detectFeatures_SSE2_FASTER12(
146 gray_img, feats, threshold);
153 win.get3DSceneAndLock();
155 for (
size_t i = 0; i < N_OCTAVES; i++)
165 "Smooth=%i Grayscale=%i Features=%i",
166 int(do_smooth ? 1 : 0),
int(do_grayscale ? 1 : 0),
167 int(do_features ? 1 : 0)),
168 TColorf(.8, .8, 0),
"sans", 10,
174 win.unlockAccess3DScene();
181 int key =
win.getPushedKey(&kmods);
185 if (key ==
's' || key ==
'S') do_smooth = !do_smooth;
186 if (key ==
'g' || key ==
'G') do_grayscale = !do_grayscale;
187 if (key ==
'f' || key ==
'F') do_features = !do_features;
204 catch (std::exception& e)
206 std::cout <<
"MRPT exception caught: " << e.what() << std::endl;
211 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...
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.
mrpt::gui::CDisplayWindow3D::Ptr win
GLsizei const GLchar ** string
void 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.
#define IS_CLASS(ptrObj, class_name)
Evaluates to true if the given pointer to an object (derived from mrpt::rtti::CObject) is of the give...
A RGB color - floats in the range [0,1].
The namespace for 3D scene representation and rendering.
GLenum GLsizei GLenum format
Classes for creating GUI windows for 2D and 3D visualization.
renders glyphs as filled polygons
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 class for storing images as grayscale or RGB bitmaps.
A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.