GSoC2011SfM
0.1
Google Summer of Code 2011: Structure from motion
|
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>
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_ |
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.
cv::Mat OpencvSfM::MotionProcessor::getFrame | ( | ) |
use this method if you want to get a picture from this motion handler
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 )
idProp | Property identifier |
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
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!
idWebCam | id of the webcam |
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!
list_images | list of pictures' names |
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!
nameOfFile | name of the media file ( picture or avi movie ) |
inputType | type of input ( can be either IS_DIRECTORY, IS_VIDEO or IS_SINGLE_FILE ) |
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
prefix | the part of the files names which stay the same ( img ) |
suffix | the type of the files ( .jpg for instance ) |
startNumber | the first number to use... |
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 )
idProp | Property identifier |
value | new value of the property |
Definition at line 227 of file MotionProcessor.cpp.
Referenced by OpencvSfM::SequenceAnalyzer::SequenceAnalyzer().
uchar OpencvSfM::MotionProcessor::convertToRGB_ [protected] |
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.
unsigned int OpencvSfM::MotionProcessor::pos_in_loading_process_ [protected] |
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.