Go to the documentation of this file.
23 #include <mrpt/examples_config.h>
24 string myDataDir(MRPT_EXAMPLES_BASE_DIRECTORY +
string(
"img_basic_example/"));
38 if (!
img.loadFromFile(
myDataDir +
string(
"frame_color.jpg")))
40 cerr <<
"Cannot load " <<
myDataDir +
string(
"frame_color.jpg") << endl;
43 printf(
"Image loaded in %.03fms\n", 1000 * tictac.
Tac());
52 cout <<
"Push a key in the console or in the window to continue...";
54 cout <<
"Done" << endl;
56 timlog.
enter(
"grayscale1");
58 timlog.
leave(
"grayscale1");
64 cout <<
"Push a key in the console or in the window to continue...";
66 cout <<
"Done" << endl;
72 CDisplayWindow win1(
"win1"), win2(
"win2"), win3(
"win3"), win4(
"win4");
77 for (
int i = 0; i < 50; i++)
79 timlog.
enter(
"grayscale2");
80 imgSmall.grayscale(imgGray);
81 timlog.
leave(
"grayscale2");
89 imgSmall.rectangle(85, 35, 170, 170,
TColor(255, 0, 0), 10);
91 imgSmall.line(550, 75, 650, 25,
TColor(0, 0, 255));
92 imgSmall.line(-10, -20, 20, 30,
TColor(0, 0, 255));
97 COV(0, 1) = COV(1, 0) = -30;
98 imgSmall.ellipseGaussian(&COV, 600.0f, 50.0f, 2,
TColor(255, 255, 0), 4);
101 imgSmall.drawImage(400, 500, imgGray);
105 win1.showImage(imgSmall);
107 win2.showImage(imgSmall2);
109 win3.showImage(imgGray);
110 win3.setPos(810, 300);
111 win4.showImage(imgSmallRGB);
112 win4.setPos(300, 400);
114 cout <<
"Press any key on 'win4' to exit" << endl;
119 printf(
"jpeg file saved in %.03fms\n", 1000.0f * tictac.
Tac());
121 imgSmall2.saveToFile(
"frame_out_small.png");
136 catch (std::exception& e)
138 std::cout <<
"MRPT exception caught: " << e.what() << std::endl;
143 printf(
"Untyped exception!!");
A high-performance stopwatch, with typical resolution of nanoseconds.
CImage scaleHalfSmooth() const
Returns a new image scaled down to half its original size (averaging between every two rows)
A versatile "profiler" that logs the time spent within each pair of calls to enter(X)-leave(X),...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void enter(const char *func_name)
Start of a named section.
void ellipseGaussian(const MATRIX2X2 *cov2D, const double mean_x, const double mean_y, double confIntervalStds=2, const mrpt::img::TColor &color=mrpt::img::TColor(255, 255, 255), unsigned int width=1, int nEllipsePoints=20)
Draws an ellipse representing a given confidence interval of a 2D Gaussian distribution.
double leave(const char *func_name)
End of a named section.
double Tac() noexcept
Stops the stopwatch.
This class is a "CSerializable" wrapper for "CMatrixFloat".
void Tic() noexcept
Starts the stopwatch.
This class creates a window as a graphical user interface (GUI) for displaying images to the user.
Classes for creating GUI windows for 2D and 3D visualization.
A class for storing images as grayscale or RGB bitmaps.
bool saveToFile(const std::string &fileName, int jpeg_quality=95) const
Save the image to a file, whose format is determined from the extension (internally uses OpenCV).
This base provides a set of functions for maths stuff.
GLsizei const GLchar ** string
void TestImageConversion()
void pause(const std::string &msg=std::string("Press any key to continue...")) noexcept
Shows the message "Press any key to continue" (or other custom message) to the current standard outpu...
This namespace provides a OS-independent interface to many useful functions: filenames manipulation,...
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |