libeblearntools
|
#include <camera.h>
Public Member Functions | |
camera (int height=-1, int width=-1, std::ostream &out=std::cout, std::ostream &err=std::cerr) | |
virtual | ~camera () |
Destructor. | |
virtual idx< Tdata > | grab ()=0 |
Return a new frame. | |
virtual string | grab_filename () |
virtual void | next () |
virtual void | previous () |
Move to the previous frame, without returning the frame. | |
virtual bool | empty () |
Return true if no frames available, false otherwise. | |
virtual void | skip (uint n) |
Skip n frames. | |
virtual void | set_input_narrow (int dim, int size, int off) |
virtual void | set_grayscale () |
This will force the camera to output grayscale images. | |
virtual bool | start_recording (uint window_id=0, const char *name=NULL) |
virtual bool | record_frame () |
Dump all frames declared to be recorded by start_recording(). | |
virtual bool | stop_recording (float fps, const char *root=NULL) |
virtual float | fps () |
Return the number of frames per second obtained via grab(). | |
virtual uint | frame_id () |
Return the id for current frame. | |
virtual string | frame_name () |
Return a name for current frame. | |
virtual string | frame_fullname () |
Return the complete filename for current frame (including path). | |
virtual int | remaining () |
Return the number of frames left to process, -1 if unknown. | |
virtual int | size () |
Protected Member Functions | |
virtual idx< Tdata > | postprocess () |
Protected Attributes | |
idx< Tdata > | frame |
frame buffer | |
int | height |
resize input | |
int | width |
resize input | |
bool | bresize |
resize or not | |
bool | mresize |
mean resize or not | |
uint | resize_mode |
resize mode: 0, 1 or 2 | |
uint | frame_id_ |
frame counter | |
string | frame_name_ |
frame name | |
bool | grabbed |
false if no frame grabbed yet | |
uint | wid |
window to record from | |
string | recording_name |
name of video | |
uint | record_cnt |
frame counter for recording | |
float | fps_grab |
frames per second of grabbing | |
string | audio_filename |
filename of audio file | |
std::ostream & | out |
stream where to output info | |
std::ostream & | err |
stream where to output info | |
timer | tfps |
timer for computing fps. | |
long | fps_ms_elapsed |
ms elapsed since last reset | |
uint | cntfps |
counter for computing fps. | |
int | narrow_dim |
int | narrow_size |
int | narrow_off |
Narrow parameters. | |
bool | grayscale |
If true, output grayscale images. |
The camera class is an abstract class that serves as an interface to different camera implementation, such as camera_opencv, etc. It allows to grab images from camera in the idx format, and also to save gui outputs into video files.
ebl::camera< Tdata >::camera | ( | int | height = -1 , |
int | width = -1 , |
||
std::ostream & | out = std::cout , |
||
std::ostream & | err = std::cerr |
||
) |
Initialize a camera. height and width are optional parameters that resize the input image to those dimensions if given (different than -1). One may want to decrease the input resolution first to speed up operations, for example when computing multiple resolutions.
height | Resize input frame to this height if different than -1. |
width | Resize input frame to this width if different than -1. |
string ebl::camera< Tdata >::grab_filename | ( | ) | [virtual] |
Do not read the file, instead return the filename to be grabbed. This method should only be used by file-based cameras.
Reimplemented in ebl::camera_directory< Tdata >.
void ebl::camera< Tdata >::next | ( | ) | [virtual] |
Move to the next frame, without returning the frame. This is called by grab before grabbing. This can be used to get frames infos without grabbing.
Reimplemented in ebl::camera_directory< Tdata >.
idx< Tdata > ebl::camera< Tdata >::postprocess | ( | ) | [inline, protected, virtual] |
Return post processed frame after grabbing it, e.g. resize frame to target height and width (if specified). This also increments frame counter.
void ebl::camera< Tdata >::set_input_narrow | ( | int | dim, |
int | size, | ||
int | off | ||
) | [virtual] |
This will narrow all images coming out of the camera in dimension 'dim' with size 'size' starting at offset 'off'.
int ebl::camera< Tdata >::size | ( | ) | [virtual] |
Return the total number of frames to process from the initialization, of the camera, -1 if unknown.
Reimplemented in ebl::camera_directory< Tdata >.
bool ebl::camera< Tdata >::start_recording | ( | uint | window_id = 0 , |
const char * | name = NULL |
||
) | [virtual] |
Start recording of frames from window window_id into path. This creates a directory name in path. No frames are actually recorded,
bool ebl::camera< Tdata >::stop_recording | ( | float | fps, |
const char * | root = NULL |
||
) | [virtual] |
Create all videos started with start_recording() using frames dumped with record_frame(), using fps frames per second.
root | Indicates the root where the images are and where to save the video. |