GSoC2011SfM  0.1
Google Summer of Code 2011: Structure from motion
Public Member Functions | Protected Attributes
OpencvSfM::MotionProcessor Class Reference

This class try to create a commun interface for files loading. Indeed, if you want to use webcam, avi file of list of files, you will have to do some annoying processing, like iterate the different files of the directory. With MotionProcessor, you can now use a folder of image the same way you use a webcam or a video file. More...

#include <MotionProcessor.h>

List of all members.

Public Member Functions

bool isBidirectional ()
bool setInputSource (int idWebCam)
bool setInputSource (std::vector< std::string > list_images)
bool setInputSource (std::string nameOfFile, TypeOfMotionProcessor inputType=IS_DIRECTORY)
bool setInputSource (std::string prefix, std::string suffix, int startNumber=0)
cv::Mat getFrame ()
bool setProperty (int idProp, double value)
double getProperty (int idProp)

Protected Attributes

TypeOfMotionProcessor type_of_input_
 This attribut is used to know which type is the input ( webcam, video file, list of file or just one image )
cv::VideoCapture capture_
 When the camera is attached to an avi file or webcam, this will be usefull to get frame...
std::vector< std::string > nameOfFiles_
 If the motion processor use directory as input, we store here the names of files.
std::string sourceName_
std::string suffix_
unsigned int pos_in_loading_process_
unsigned int numFrame_
 When the camera is attached to a list of file, numFrame_ will be used to know how many frames we have take.
int wantedWidth_
 if below 0, represent the wanted width of Mat returned by getFrame( );
int wantedHeight_
 if below 0, represent the wanted height of Mat returned by getFrame( );
uchar convertToRGB_

Detailed Description

This class try to create a commun interface for files loading. Indeed, if you want to use webcam, avi file of list of files, you will have to do some annoying processing, like iterate the different files of the directory. With MotionProcessor, you can now use a folder of image the same way you use a webcam or a video file.

The class is still in development as the way to open folder is not really clear... The easy way would be to use "dirent.h" header, but the easy thing is not always the best thing...

Definition at line 28 of file MotionProcessor.h.


Member Function Documentation

cv::Mat OpencvSfM::MotionProcessor::getFrame ( )

use this method if you want to get a picture from this motion handler

Returns:
The current frame. If the video is finished, the Mat returned is not usable! Test if the matrix is empty before using it!

Definition at line 131 of file MotionProcessor.cpp.

Referenced by OpencvSfM::SequenceAnalyzer::SequenceAnalyzer().

double OpencvSfM::MotionProcessor::getProperty ( int  idProp)

use this method to get actual properties of pictures retrived by this MotionProcessor. the properties are the same than VideoCapture ( see http://opencv.willowgarage.com/documentation/cpp/reading_and_writing_images_and_video.html#cv-videocapture-get )

Parameters:
idPropProperty identifier
Returns:
the value of the property

Definition at line 302 of file MotionProcessor.cpp.

bool OpencvSfM::MotionProcessor::isBidirectional ( ) [inline]

Use this function to know if this flux is bidirectional ( i.e. frames can be iterate randomly ) Can be used to know if the sequence is finite

Returns:
true is you can access to frames randomly, false else

Definition at line 69 of file MotionProcessor.h.

Referenced by OpencvSfM::SequenceAnalyzer::SequenceAnalyzer().

bool OpencvSfM::MotionProcessor::setInputSource ( int  idWebCam)

You can attach this motion handler to a webcam use this method to set it as the input source!

Parameters:
idWebCamid of the webcam
Returns:
true if input source opened without problems

Definition at line 57 of file MotionProcessor.cpp.

bool OpencvSfM::MotionProcessor::setInputSource ( std::vector< std::string >  list_images)

You can attach this motion handler to a list of picture use this method to set it as the input source!

Parameters:
list_imageslist of pictures' names
Returns:
true if input source opened without problems

Definition at line 73 of file MotionProcessor.cpp.

bool OpencvSfM::MotionProcessor::setInputSource ( std::string  nameOfFile,
TypeOfMotionProcessor  inputType = IS_DIRECTORY 
)

You can attach this motion handler to a video file or a single picture. use this method to set it as the input source!

Parameters:
nameOfFilename of the media file ( picture or avi movie )
inputTypetype of input ( can be either IS_DIRECTORY, IS_VIDEO or IS_SINGLE_FILE )
Returns:
true if input source opened without problems

Definition at line 81 of file MotionProcessor.cpp.

bool OpencvSfM::MotionProcessor::setInputSource ( std::string  prefix,
std::string  suffix,
int  startNumber = 0 
)

You can attach this motion handler to a list of file. use this method to set the input source! For example, if the files are img1.jpg, img2.jpg, ... img125.jpg, prefix will be equal to "img", suffix to ".jpg" and startNumber equal to 1

Parameters:
prefixthe part of the files names which stay the same ( img )
suffixthe type of the files ( .jpg for instance )
startNumberthe first number to use...
Returns:
true if input source opened without problems

Definition at line 120 of file MotionProcessor.cpp.

bool OpencvSfM::MotionProcessor::setProperty ( int  idProp,
double  value 
)

use this method to change the properties of pictures retrived by this MotionProcessor. the properties are the same than VideoCapture ( see http://opencv.willowgarage.com/documentation/cpp/reading_and_writing_images_and_video.html#cv-videocapture-get )

Parameters:
idPropProperty identifier
valuenew value of the property

Definition at line 227 of file MotionProcessor.cpp.

Referenced by OpencvSfM::SequenceAnalyzer::SequenceAnalyzer().


Member Data Documentation

if >0 the loaded image is forced to be a 3-channel color image if =0 the loaded image is forced to be grayscale if <0 the loaded image will be loaded as-is

Definition at line 58 of file MotionProcessor.h.

When the camera is attached to a list of file, pos_in_loading_process_ will be used to store actual number of image ( not always the same than numFrame_ ).

Definition at line 48 of file MotionProcessor.h.

std::string OpencvSfM::MotionProcessor::sourceName_ [protected]

When the camera is attached to a list of file, sourceName_ will be used to store name of the prefix. For example, if the files are img1.jpg, img2.jpg, ... img125.jpg, sourceName_ will be equal to img

Definition at line 38 of file MotionProcessor.h.

std::string OpencvSfM::MotionProcessor::suffix_ [protected]

When the camera is attached to a list of file, suffix_ will be used to store name of the suffix. For example, if the files are img1.jpg, img2.jpg, ... img125.jpg, suffix_ will be equal to .jpg

Definition at line 43 of file MotionProcessor.h.


The documentation for this class was generated from the following files:
 All Classes Functions Variables