Basic Image AlgorithmS Library
2.8.0
Main Page
Related Pages
Modules
Classes
Examples
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
Image
VideoStream.hh
1
#ifndef __VIDEOSTREAM_HH__
2
#define __VIDEOSTREAM_HH__
3
4
#include <bias_config.h>
5
6
7
#include <string>
8
#include <iostream>
9
#include <fstream>
10
11
#include <Base/Image/ImageBase.hh>
12
13
14
namespace
BIAS {
15
16
/** To allow capturing of camera image to disk efficiently, (avoid
17
multiple memcopy operations), this class defines an interface to
18
file containing one header and multiple images. All data for
19
write() must be aligned to 512-byte boundaries to allow
20
unbuffered operations with open(,O_DIRECT). This can only
21
guaranteed by circumventing all C++ stuff like new() and
22
operator<<(). These video stream file are written by
23
MIP::VideoSource_() and can be split into multiple images with
24
this class.
25
@author Jan-Friso Evers-Senne
26
*/
27
28
/*
29
File structure:
30
- one header: 512 byte
31
- N sets of size AlignedData_:
32
- VSImageHeader (time stamp and raw uuid)
33
- ImageData (size: width * height * *channelsount * bytesperpixel)
34
*/
35
class
BIASImage_EXPORT
VideoStream
{
36
public
:
37
38
// this header only occur once at the beginning of each stream file
39
// size doesn't matter, but alignment matters.
40
class
BIASImage_EXPORT
VSHeader
{
41
public
:
42
unsigned
int
Width
,Height;
// 8 byte
43
unsigned
char
ChannelCount
,BytesPerPixel;
// 4 byte
44
ImageBase::EStorageType
StorageType
;
// 4 byte
45
ImageBase::EColorModel
ColorModel
;
// 4 byte
46
// size of image in byte = width *height*channelcount * bytesperpixel
47
// this is the next multiple-of-512 size
48
unsigned
int
AlignedSize
;
// 4 byte
49
// Sum: 24
50
51
// Padding must fill-up this struct to _exactly_ 512 byte
52
unsigned
char
Padding[488];
53
};
54
55
class
BIASImage_EXPORT
VSImageHeader
{
56
public
:
57
long
int
tsec,
tusec
;
58
// uuid as string with like (use 40 instead of 37 char)
59
// c08ded6e-8419-11d9-8e06-000d614f5bc5
60
char
uuid[40];
61
};
62
63
public
:
64
/** destructor mandatory because copy constructor is.
65
@author Jan Woetzel 08/2005 */
66
virtual
~
VideoStream
();
67
68
VideoStream
();
69
70
VideoStream
(
const
std::string & file);
71
72
/** copy constructor mandatory because of ifstrseam member
73
@author Jan Woetzel 08/2005 */
74
VideoStream
(
const
VideoStream
& src);
75
76
/** assignment operator is mandatory because copy constructor is.
77
@author Jan Woetzel 08/2005 */
78
BIAS::VideoStream
& operator=(
const
BIAS::VideoStream
& src);
79
80
81
int
Open(
const
std::string & file);
82
int
Close();
83
void
PrintHeader();
84
85
// go through video stream and export count frames starting at start
86
int
SplitIntoFiles(
const
std::string &prefix,
unsigned
int
start=0,
87
unsigned
int
count =0);
88
89
90
// --- data members: ---
91
protected
:
92
93
//BIASImage_EXPORT
94
95
VSHeader
Header_
;
96
std::ifstream
Ifs_
;
97
98
unsigned
int
ImageSize_
;
99
unsigned
int
NumImages_
;
100
unsigned
long
int
FileSize_
;
101
102
};
103
104
}
// namespace
105
106
107
#endif
BIAS::ImageBase::EColorModel
EColorModel
These are the most often used color models.
Definition:
ImageBase.hh:127
BIAS::VideoStream::Header_
VSHeader Header_
Definition:
VideoStream.hh:95
BIAS::VideoStream::VSHeader::ColorModel
ImageBase::EColorModel ColorModel
Definition:
VideoStream.hh:45
BIAS::VideoStream::VSHeader::Width
unsigned int Width
Definition:
VideoStream.hh:42
BIAS::ImageBase::EStorageType
EStorageType
Definition:
ImageBase.hh:109
BIAS::VideoStream::NumImages_
unsigned int NumImages_
Definition:
VideoStream.hh:99
BIAS::VideoStream::VSHeader::StorageType
ImageBase::EStorageType StorageType
Definition:
VideoStream.hh:44
BIAS::VideoStream::VSImageHeader
Definition:
VideoStream.hh:55
BIAS::VideoStream
To allow capturing of camera image to disk efficiently, (avoid multiple memcopy operations), this class defines an interface to file containing one header and multiple images.
Definition:
VideoStream.hh:35
BIAS::VideoStream::VSImageHeader::tusec
long int tusec
Definition:
VideoStream.hh:57
BIAS::VideoStream::VSHeader::AlignedSize
unsigned int AlignedSize
Definition:
VideoStream.hh:48
BIAS::VideoStream::ImageSize_
unsigned int ImageSize_
Definition:
VideoStream.hh:98
BIAS::VideoStream::VSHeader
Definition:
VideoStream.hh:40
BIAS::VideoStream::VSHeader::ChannelCount
unsigned char ChannelCount
Definition:
VideoStream.hh:43
BIAS::VideoStream::FileSize_
unsigned long int FileSize_
Definition:
VideoStream.hh:100
BIAS::VideoStream::Ifs_
std::ifstream Ifs_
Definition:
VideoStream.hh:96
Generated on Tue Feb 6 2018 02:01:40 for Basic Image AlgorithmS Library by
1.8.5