[65f502]: contrib / brl / bbas / bwm / video / bwm_video_cam_istream.h  Maximize  Restore  History

Download this file

99 lines (69 with data), 2.8 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#ifndef bwm_video_cam_istream_h_
#define bwm_video_cam_istream_h_
//-----------------------------------------------------------------------------
//:
// \file
// \author J.L. Mundy
// \brief A stream for cameras to complement the vidl video stream
//
// \verbatim
// Modifications
// Original December 25, 2006
// \endverbatim
//
//-----------------------------------------------------------------------------
#include <vcl_vector.h>
#include <vcl_string.h>
#include <vbl/vbl_ref_count.h>
#include <vpgl/vpgl_perspective_camera.h>
class bwm_video_cam_istream : public vbl_ref_count
{
// PUBLIC INTERFACE----------------------------------------------------------
public:
// Constructors/Initializers/Destructors-------------------------------------
//: Constructor - default
bwm_video_cam_istream();
//: Constructor - from a file glob string
bwm_video_cam_istream(const vcl_string& glob);
//: Constructor - from a vector of file paths
bwm_video_cam_istream(const vcl_vector<vcl_string>& paths);
//: Destructor
~bwm_video_cam_istream() { close(); }
//: Open a new stream using a file glob (see vul_file_iterator)
// \note files are loaded in alphanumeric order by path name
bool open(const vcl_string& glob);
//: Open a new stream using a vector of file paths
// \note all files are tested and only valid image files are retained
bool open(const vcl_vector<vcl_string>& paths);
//: Close the stream
void close();
//: Return true if the stream is open for reading
bool is_open() const { return !cam_paths_.empty(); }
//: Return true if the stream is in a valid state
bool is_valid() const { return is_open() &&
index_ < cam_paths_.size(); }
//: Return true if the stream support seeking
bool is_seekable() const { return true; }
//: Return the current camera number
unsigned int camera_number() const { return index_; }
//: Advance to the next camera (but do not open the next image)
bool advance();
//: Read the next camera from the stream
vpgl_perspective_camera<double>* read_camera();
//: Return the current camera in the stream
vpgl_perspective_camera<double>* current_camera();
//: Seek to the given camera number (but do not load the camera)
// \returns true if successful
bool seek_camera(unsigned int camera_number);
protected:
// INTERNALS-----------------------------------------------------------------
// Data Members--------------------------------------------------------------
private:
//: The vector of cameras
vcl_vector<vcl_string> cam_paths_;
//: The current camera index
unsigned int index_;
//: The current camera (cached)
vpgl_perspective_camera<double>* current_camera_;
};
#endif