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/img/CImage.h
>
11
#include <
mrpt/vision/CVideoFileWriter.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
{
60
Test_VideoFile
();
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
}
mrpt::vision
Classes for computer vision, detectors, features, etc.
Definition:
CCamModel.h:20
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition:
CKalmanFilterCapable.h:30
mrpt::vision::CVideoFileWriter
An output stream which takes a sequence of images and writes a video file in any of a given of compat...
Definition:
CVideoFileWriter.h:43
CVideoFileWriter.h
main
int main()
Definition:
vision_stereo_rectify/test.cpp:78
mrpt::vision::CVideoFileWriter::close
void close()
Finish the file writing and close the file output.
Definition:
CVideoFileWriter.cpp:90
mrpt::img
Definition:
CCanvas.h:17
mrpt::img::TColor
A RGB color - 8bit.
Definition:
TColor.h:22
mrpt::img::CImage
A class for storing images as grayscale or RGB bitmaps.
Definition:
img/CImage.h:130
img
GLint GLvoid * img
Definition:
glext.h:3763
CImage.h
Test_VideoFile
void Test_VideoFile()
Definition:
vision_stereo_rectify/test.cpp:22
mrpt::img::TImageSize
TPixelCoord TImageSize
A type for image sizes.
Definition:
TPixelCoord.h:53
mrpt::vision::CVideoFileWriter::open
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.
Definition:
CVideoFileWriter.cpp:38
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