Main MRPT website > C++ reference for MRPT 1.9.9
test.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include <mrpt/system/CTicTac.h>
11 #include <mrpt/img/CImage.h>
13 #include <iostream>
14 
15 using namespace mrpt::gui;
16 using namespace mrpt::img;
17 using namespace mrpt::system;
18 using namespace std;
19 
20 #include <mrpt/examples_config.h>
21 string myDataDir(
22  MRPT_EXAMPLES_BASE_DIRECTORY + string("img_gauss_filtering_example/"));
23 
24 // ------------------------------------------------------
25 // Test
26 // ------------------------------------------------------
27 void Test_GaussWindows()
28 {
29  CTicTac tictac;
30  CImage inImg, outImg;
31 
32  inImg.loadFromFile(myDataDir + "test_in.jpg");
33 
34  // Smoothed image:
35  // ---------------------------
36  tictac.Tic();
37 
38  inImg.filterGaussian(outImg, 11, 11); // Window size
39 
40  printf("Smoothed image in %.03fms\n", 1000 * tictac.Tac());
41 
42  CDisplayWindow win1("Original Image");
43  CDisplayWindow win2("Smoothed Image");
44 
45  win1.showImage(inImg);
46  win2.showImage(outImg);
47 
49 }
50 
51 int main()
52 {
53  try
54  {
56 
57  return 0;
58  }
59  catch (std::exception& e)
60  {
61  std::cout << "MRPT exception caught: " << e.what() << std::endl;
62  return -1;
63  }
64  catch (...)
65  {
66  printf("Another exception!!");
67  return -1;
68  }
69 }
mrpt::system::CTicTac
A high-performance stopwatch, with typical resolution of nanoseconds.
Definition: system/CTicTac.h:19
myDataDir
std::string myDataDir
Definition: vision_stereo_rectify/test.cpp:23
mrpt::system::CTicTac::Tac
double Tac() noexcept
Stops the stopwatch.
Definition: CTicTac.cpp:90
main
int main()
Definition: vision_stereo_rectify/test.cpp:78
mrpt::img
Definition: CCanvas.h:17
mrpt::system::CTicTac::Tic
void Tic() noexcept
Starts the stopwatch.
Definition: CTicTac.cpp:79
mrpt::gui::CDisplayWindow
This class creates a window as a graphical user interface (GUI) for displaying images to the user.
Definition: CDisplayWindow.h:30
mrpt::gui
Classes for creating GUI windows for 2D and 3D visualization.
Definition: about_box.h:16
mrpt::img::CImage
A class for storing images as grayscale or RGB bitmaps.
Definition: img/CImage.h:130
CTicTac.h
CImage.h
Test_GaussWindows
void Test_GaussWindows()
Definition: vision_stereo_rectify/test.cpp:27
mrpt::img::CImage::filterGaussian
void filterGaussian(CImage &out_img, int W=3, int H=3) const
Filter the image with a Gaussian filter with a window size WxH, replacing "this" image by the filtere...
Definition: CImage.cpp:2167
mrpt::img::CImage::loadFromFile
bool loadFromFile(const std::string &fileName, int isColor=-1)
Load image from a file, whose format is determined from the extension (internally uses OpenCV).
Definition: CImage.cpp:271
CDisplayWindow.h
mrpt::system::pause
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...
Definition: os.cpp:428
mrpt::system
This namespace provides a OS-independent interface to many useful functions: filenames manipulation,...
Definition: math_frwds.h:25



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