MatVid Class Reference

Utility functions for Mat videos. More...

#include <MatVid.hpp>

List of all members.

Static Public Member Functions

static Mat readseq (const string &filename, int flags, int fmin, int fmax, int fstep=1)
 load video from sequence of image files.
static Mat readavi (VideoCapture &vc, int nframes, int fstep=1, double scale=1.0)
 load video from AVI video.
static Mat create (int frames, int rows, int cols, int type)
 allocate a new Mat video.
static Mat frame (const Mat &vid, int f)
 get a frame from a Mat video.
static Mat subvid (const Mat &vid, const Range &frange, const Range &rrange, const Range &crange)
 get a sub-video from a Mat video, using Range.
static Mat subvid (const Mat &vid, int fmin, int fmax, int rmin, int rmax, int cmin, int cmax)
 get a sub-video from a Mat video.
static Mat repeat (const Mat &img, int nf)
 create a Mat video by repeating an image.
static void reduce (const Mat &vid, Mat &out, int reduceOp)
 reduce a video to a single image.
static double norm2 (const Mat &vid)
 compute L2-norm squared of vid.
static Mat vectorize (const Mat &vid, bool flag_col=true)
 vectorize a Mat video into a matrix.
static Mat unvectorize (const Mat &m, int rows, int cols)
 unvectorize a matrix into a Mat video.
static Mat vectorize1 (const Mat &m, bool flag_col=true)
 vectorize an image into a vector.
static Mat unvectorize1 (const Mat &v, int rows, int cols)
 unvectorize a vector into a Mat image.
static void show (const Mat &vid, double fps=30.0, double alpha=1.0, double beta=0.0)
 show a Mat video.
static Mat montage (const vector< Mat > &vids, int sizex=5, int spacing=2, const Scalar &fill=0, int border=0)
 create a montage of videos.
static void dump_matlab (const Mat &vid, ostream &output)
 debugging: dump a Mat video into a Matlab readable output stream.
static int savedat (string filename, const Mat &input, string ftype="double", string history="", string opt="")
 save all frames if video in Dat file.
static int savedat2 (string filename, Mat input, string ftype="double", string history="", string opt="")
static Mat loaddat (string filename, string opt="")
 load video frames from Dat file.
static void savedatinfo (string filename, DatDescriptor desc)
static DatDescriptor loaddatinfo (string filename, int verbose)
static void showvid (Mat vid, int fr)
static Mat loadavi (string filename)
static void saveavi (string filename, Mat img)

Detailed Description

Utility functions for Mat videos.

video is stored as a Mat class with 3 dimensions. pixels indices are: vid.at(t, y, x); vid.at(frame, row, col); the number of frames is vid.size[0], and the dimensions of each frame are vid.size[1] x vid.size[2] (y by x). Functions are provided for creating and processing these video Mats.

Definition at line 41 of file MatVid.hpp.


Member Function Documentation

Mat MatVid::create ( int  frames,
int  rows,
int  cols,
int  type 
) [static]

allocate a new Mat video.

Parameters:
frames number of frames (t)
rows number of rows (y)
cols number of columns (x)
type the data type (opencv type)
Returns:
Mat video

Definition at line 42 of file MatVid.cpp.

Here is the caller graph for this function:

Mat MatVid::frame ( const Mat &  vid,
int  f 
) [static]

get a frame from a Mat video.

Actually only returns a Mat that points to the frame. DOES NOT MAKE A COPY!

Parameters:
vid the Mat video
f frame number
Returns:
the Mat (2d image) inside vid.
See also:
subvid

Definition at line 233 of file MatVid.cpp.

Here is the caller graph for this function:

Mat MatVid::loaddat ( string  filename,
string  opt = "" 
) [static]

load video frames from Dat file.

Parameters:
filename the path from where to load data.
opt option string:"d" - dump descriptor, "t" - output has the same type as the dat-file (default is double)
Returns:
vector of video frames in Mat format
See also:
loaddat

Definition at line 478 of file MatVid.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Mat MatVid::montage ( const vector< Mat > &  vids,
int  sizex = 5,
int  spacing = 2,
const Scalar &  fill = 0,
int  border = 0 
) [static]

create a montage of videos.

Takes a set of videos and converts it into a montage video.

Parameters:
vids vector of Mat videos
sizex number of videos per row
spacing spacing between videos (in pixels)
fill fill color for the spaces between the videos
border border width around the whole montage
Returns:
the montage video
See also:
show

Definition at line 410 of file MatVid.cpp.

Here is the call graph for this function:

double MatVid::norm2 ( const Mat &  vid  )  [static]

compute L2-norm squared of vid.

Parameters:
vid the Mat video
Returns:
the L2-norm squared.

Definition at line 219 of file MatVid.cpp.

Here is the caller graph for this function:

Mat MatVid::readavi ( VideoCapture &  vc,
int  nframes,
int  fstep = 1,
double  scale = 1.0 
) [static]

load video from AVI video.

[broken].

See also:
readseq, create

Definition at line 100 of file MatVid.cpp.

Here is the call graph for this function:

Mat MatVid::readseq ( const string &  filename,
int  flags,
int  fmin,
int  fmax,
int  fstep = 1 
) [static]

load video from sequence of image files.

For each frame number (fmin:fstep:fmax), the filename is passed through sprintf to insert the frame number. The output video is always grayscale, and color images are automatically converted to grayscale.

Parameters:
filename the filename.
flags [unused]
fmin first frame number
fmax last frame number
fstep frame step increment
Returns:
the video as a Mat
See also:
readavi, create

Definition at line 48 of file MatVid.cpp.

Here is the call graph for this function:

void MatVid::reduce ( const Mat &  vid,
Mat &  out,
int  reduceOp 
) [static]

reduce a video to a single image.

This is analogous to "reduce" in OpenCV, except the reduction is applied to a video along the frames. (for SUM and AVG, converts to OPT_MAT_TYPE).

Parameters:
vid the Mat video
out destination matrix
reduceOp reduce operation (see OpenCV reduce)

Definition at line 187 of file MatVid.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Mat MatVid::repeat ( const Mat &  img,
int  nf 
) [static]

create a Mat video by repeating an image.

Repeats img nf times and returns it. The returned Mat has copies the data from the image.

Parameters:
img the image
nf number of frames
Returns:
the Mat video

Definition at line 174 of file MatVid.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int MatVid::savedat ( string  filename,
const Mat &  input,
string  ftype = "double",
string  history = "",
string  opt = "" 
) [static]

save all frames if video in Dat file.

Input video frames can have different channels and must have type CV_8U or CV_64F

Parameters:
filename the path where to store the output file.
input vector containing input frames for video
ftype format in which to store data, can have value "unsigned_1" or "double" (default="double")
history optional history string to store histor of file
opt [future use for zip files]
Returns:
0 in case of success
See also:
loaddat

Definition at line 554 of file MatVid.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void MatVid::show ( const Mat &  vid,
double  fps = 30.0,
double  alpha = 1.0,
double  beta = 0.0 
) [static]

show a Mat video.

If vid type is OPT_MAT_TYPE, then converts to 8-bit grayscale as: pix8 = alpha*pixel+beta

Parameters:
vid the Mat video
fps frames per second
alpha scale pixel values
beta add to pixel values
See also:
montage

Definition at line 388 of file MatVid.cpp.

Here is the call graph for this function:

Mat MatVid::subvid ( const Mat &  vid,
int  fmin,
int  fmax,
int  rmin,
int  rmax,
int  cmin,
int  cmax 
) [static]

get a sub-video from a Mat video.

Actually only returns a Mat pointing to the sub-video. DOES NOT MAKE A COPY! Uses the same indexing as Range.

Parameters:
vid the Mat video
fmin frame start
fmax frame end
rmin row start
rmax row end
cmin column start
cmax column end
Returns:
the sub-video Mat
See also:
frame

Definition at line 169 of file MatVid.cpp.

Here is the call graph for this function:

Mat MatVid::subvid ( const Mat &  vid,
const Range &  frange,
const Range &  rrange,
const Range &  crange 
) [static]

get a sub-video from a Mat video, using Range.

Actually only returns a Mat pointing to the sub-video. DOES NOT MAKE A COPY!

Parameters:
vid the Mat video
frange frame range
rrange row range
crange column range
Returns:
the sub-video Mat
See also:
frame

Definition at line 151 of file MatVid.cpp.

Here is the caller graph for this function:

Mat MatVid::unvectorize ( const Mat &  m,
int  rows,
int  cols 
) [static]

unvectorize a matrix into a Mat video.

Parameters:
m the vectorized video matrix
rows number of rows in a video frame
cols number of columns in a video frame
Returns:
the Mat video
See also:
vectorize, vectorize1, unvectorize1

Definition at line 307 of file MatVid.cpp.

Here is the call graph for this function:

Mat MatVid::unvectorize1 ( const Mat &  v,
int  rows,
int  cols 
) [static]

unvectorize a vector into a Mat image.

Parameters:
v the vectorized image
rows number of rows in the image
cols number of columns in the image
Returns:
the image
See also:
vectorize, unvectorize, vectorize1

Definition at line 365 of file MatVid.cpp.

Here is the caller graph for this function:

Mat MatVid::vectorize ( const Mat &  vid,
bool  flag_col = true 
) [static]

vectorize a Mat video into a matrix.

[Currently only supports flag_col=true]

Parameters:
vid the Mat video [T x Y x X]
flag_col if true, store as columns. Otherwise, store as rows.
Returns:
the vectorized video [XY x T]
See also:
unvectorize, vectorize1, unvectorize1

Definition at line 269 of file MatVid.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Mat MatVid::vectorize1 ( const Mat &  m,
bool  flag_col = true 
) [static]

vectorize an image into a vector.

[Currently only supports flag_col=true]

Parameters:
m the Mat image [Y x X]
flag_col if true, store as columns. Otherwise, store as rows.
Returns:
the image vector [XY x 1]
See also:
vectorize, unvectorize, unvectorize1

Definition at line 332 of file MatVid.cpp.


The documentation for this class was generated from the following files:

Generated on 18 Dec 2014 for libdt-OpenCV by  doxygen 1.6.1