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/img/CImage.h>
12 #include <iostream>
13 
14 using namespace mrpt;
15 using namespace mrpt::vision;
16 using namespace mrpt::img;
17 using namespace std;
18 
19 /* ------------------------------------------------------------------------
20  Test_VideoFile
21  ------------------------------------------------------------------------ */
22 void Test_VideoFile()
23 {
24  CVideoFileWriter vid;
25 
26  cout << "Creating test.avi..." << endl;
27 
28  const int W = 352;
29  const int H = 288;
30 
31  vid.open("test.avi", 15, TImageSize(W, H)); // Use default codec
32  // vid.open("test.avi",15,TImageSize(W,H),"XVID");
33 
34  for (int i = 1; i < 100; i++)
35  {
36  CImage img(W, H);
37 
38  img.rectangle(0, 0, 320, 200, TColor::black());
39 
40  img.drawCircle(
41  160 + 50 * cos(0.05 * i), 120 + 50 * sin(0.05 * i), 30,
42  TColor(255, 255, 255));
43 
44  vid << img;
45 
46  cout << "frame " << i << endl;
47  }
48  vid.close();
49 
50  cout << "Video closed " << endl;
51 }
52 
53 // ------------------------------------------------------
54 // MAIN
55 // ------------------------------------------------------
56 int main(int argc, char** argv)
57 {
58  try
59  {
61 
62  return 0;
63  }
64  catch (std::exception& e)
65  {
66  std::cout << "Exception: " << e.what() << std::endl;
67  return -1;
68  }
69  catch (...)
70  {
71  printf("Untyped exception!");
72  return -1;
73  }
74 }
void close()
Finish the file writing and close the file output.
bool open(const std::string &out_file, double fps, const mrpt::img::TImageSize &frameSize, const std::string &fourcc=std::string(""), bool isColor=true)
Open a file for writing the video.
STL namespace.
GLint GLvoid * img
Definition: glext.h:3763
Classes for computer vision, detectors, features, etc.
Definition: CCamModel.h:18
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
An output stream which takes a sequence of images and writes a video file in any of a given of compat...
TPixelCoord TImageSize
A type for image sizes.
Definition: TPixelCoord.h:51
A RGB color - 8bit.
Definition: TColor.h:20
void Test_VideoFile()
A class for storing images as grayscale or RGB bitmaps.
Definition: img/CImage.h:130



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020