MRPT  2.0.3
test.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
11 #include <mrpt/img/CImage.h>
12 #include <mrpt/system/CTicTac.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  return 0;
57  }
58  catch (const std::exception& e)
59  {
60  std::cout << "MRPT exception caught: " << e.what() << std::endl;
61  return -1;
62  }
63  catch (...)
64  {
65  printf("Another exception!!");
66  return -1;
67  }
68 }
mrpt::system::CTicTac
A high-performance stopwatch, with typical resolution of nanoseconds.
Definition: system/CTicTac.h:17
myDataDir
std::string myDataDir
Definition: vision_stereo_rectify/test.cpp:23
mrpt::system::CTicTac::Tac
double Tac() noexcept
Stops the stopwatch.
Definition: CTicTac.cpp:86
main
int main()
Definition: vision_stereo_rectify/test.cpp:78
mrpt::img
Definition: CCanvas.h:16
mrpt::img::CImage::filterGaussian
void filterGaussian(CImage &out_img, int W=3, int H=3, double sigma=1.0) const
Filter the image with a Gaussian filter with a window size WxH, replacing "this" image by the filtere...
Definition: CImage.cpp:1727
mrpt::system::CTicTac::Tic
void Tic() noexcept
Starts the stopwatch.
Definition: CTicTac.cpp:75
mrpt::gui::CDisplayWindow
This class creates a window as a graphical user interface (GUI) for displaying images to the user.
Definition: CDisplayWindow.h:33
mrpt::gui
Classes for creating GUI windows for 2D and 3D visualization.
Definition: about_box.h:14
mrpt::img::CImage
A class for storing images as grayscale or RGB bitmaps.
Definition: img/CImage.h:148
CTicTac.h
CImage.h
Test_GaussWindows
void Test_GaussWindows()
Definition: vision_stereo_rectify/test.cpp:27
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:305
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:430
mrpt::system
Definition: backtrace.h:14



Page generated by Doxygen 1.8.17 for MRPT 2.0.3 at Fri May 15 15:49:54 UTC 2020