FileLoader Class Reference
Load images from files. More...
#include <cams/fileloader.h>

Public Member Functions | |
| FileLoader (const char *filename) | |
| Constructor. | |
| FileLoader (colorspace_t cspace, const char *filename, unsigned int width, unsigned int height) | |
| Legacy constructor. | |
| FileLoader (const CameraArgumentParser *cap) | |
| Constructor. | |
| ~FileLoader () | |
| Destructor. | |
| virtual void | open () |
| Open the camera. | |
| virtual void | start () |
| Start image transfer from the camera. | |
| virtual void | stop () |
| Stop image transfer from the camera. | |
| virtual void | close () |
| Close camera. | |
| virtual void | capture () |
| Capture an image. | |
| virtual void | flush () |
| Flush image queue. | |
| virtual bool | ready () |
| Camera is ready for taking pictures. | |
| virtual void | print_info () |
| Print out camera information. | |
| virtual unsigned char * | buffer () |
| Get access to current image buffer. | |
| virtual unsigned int | buffer_size () |
| Size of buffer. | |
| virtual void | dispose_buffer () |
| Dispose current buffer. | |
| virtual unsigned int | pixel_width () |
| Width of image in pixels. | |
| virtual unsigned int | pixel_height () |
| Height of image in pixels. | |
| virtual colorspace_t | colorspace () |
| Colorspace of returned image. | |
| virtual void | set_image_number (unsigned int n) |
| Set image number to retrieve. | |
| void | set_colorspace (colorspace_t c) |
| Set the colorspace of the image. | |
| void | set_pixel_width (unsigned int w) |
| Set width. | |
| void | set_pixel_height (unsigned int h) |
| Set height. | |
Friends | |
| int | file_select (struct dirent *) |
Detailed Description
Load images from files.The file loader tries to determine the image format of the given image using the the file type utility. Currently it recognizes JPEG and FvRaw image files.
Definition at line 33 of file fileloader.h.
Constructor & Destructor Documentation
| FileLoader::FileLoader | ( | const char * | filename | ) |
Constructor.
- Parameters:
-
filename name of file to open, full path or relative to working directory
Definition at line 84 of file fileloader.cpp.
| FileLoader::FileLoader | ( | colorspace_t | cspace, | |
| const char * | filename, | |||
| unsigned int | width, | |||
| unsigned int | height | |||
| ) |
Legacy constructor.
Before FvRaw FireVision had the ability to store the pure buffer of an image without any header. Because of this additional information like colorspace, width and height of the image had to be supplied. The number of bytes that has to be read for the image is calculated from the given parameters.
- Parameters:
-
cspace color space of image filename filename to open width width of image height height of image
Definition at line 144 of file fileloader.cpp.
| FileLoader::FileLoader | ( | const CameraArgumentParser * | cap | ) |
Constructor.
Initialize with the parameters from the given camera argument parser. The following parameters are supported:
- file=FILENAME: open the given file
- dir=DIRECTORY: sequentially open files in this directory
- ext=EXTENSION: only open files with this extension
- Parameters:
-
cap camera argument parser
Definition at line 108 of file fileloader.cpp.
References CameraArgumentParser::get(), and CameraArgumentParser::has().
| FileLoader::~FileLoader | ( | ) |
Member Function Documentation
| unsigned char * FileLoader::buffer | ( | ) | [virtual] |
Get access to current image buffer.
This will return a pointer to the current buffer. The buffer contains an image of the given colorspace, width and height.
- Returns:
- pointer to image buffer
Implements Camera.
Definition at line 235 of file fileloader.cpp.
| unsigned int FileLoader::buffer_size | ( | ) | [virtual] |
Size of buffer.
Gets the size in bytes of the buffer returned by buffer().
- Returns:
- size of buffer in bytes
Implements Camera.
Definition at line 242 of file fileloader.cpp.
| void FileLoader::capture | ( | ) | [virtual] |
Capture an image.
Although cameras shall operate with a continuous image flow where possible sometimes capturing an image means copying a buffer or advancing a buffer list pointer. This shall be done in this method. For a camera-using application it is mandatory to call capture() just before accessing the image buffer.
Implements Camera.
Definition at line 218 of file fileloader.cpp.
| void FileLoader::close | ( | ) | [virtual] |
Close camera.
This closes the camera device. The camera must have been stopped before calling close().
Implements Camera.
Definition at line 249 of file fileloader.cpp.
| colorspace_t FileLoader::colorspace | ( | ) | [virtual] |
Colorspace of returned image.
- Returns:
- colorspace of image returned by buffer()
Implements Camera.
Definition at line 299 of file fileloader.cpp.
| void FileLoader::dispose_buffer | ( | ) | [virtual] |
Dispose current buffer.
Some cameras need disposal of the current buffer (for example to free space in a queue to retrieve the next image). This is done with this method. It has to be called after all work has been done on the image as desired. After dispose_buffer() has been called no further access may happen to the image buffer or undesired behavior may happen.
Implements Camera.
Definition at line 260 of file fileloader.cpp.
| void FileLoader::flush | ( | ) | [virtual] |
Flush image queue.
Some cameras may have an image buffer queue. With this it can happen that if the processing of an image took longer than desired it is needed to flush this buffer queue.
Implements Camera.
Definition at line 266 of file fileloader.cpp.
| void FileLoader::open | ( | ) | [virtual] |
Open the camera.
The camera is opened, but image transfer not yet started. This can be used to detect general problems with the camera while delaying the real transfer startup until it is needed.
Implements Camera.
Definition at line 175 of file fileloader.cpp.
| unsigned int FileLoader::pixel_height | ( | ) | [virtual] |
Height of image in pixels.
- Returns:
- height of image in pixels
Implements Camera.
Definition at line 292 of file fileloader.cpp.
| unsigned int FileLoader::pixel_width | ( | ) | [virtual] |
Width of image in pixels.
- Returns:
- width of image in pixels
Implements Camera.
Definition at line 285 of file fileloader.cpp.
| void FileLoader::print_info | ( | ) | [virtual] |
Print out camera information.
Shall print out camera information and current setup information on stdout.
Implements Camera.
Definition at line 212 of file fileloader.cpp.
| bool FileLoader::ready | ( | ) | [virtual] |
Camera is ready for taking pictures.
The camera has been opened and started correctly and may now provide images.
- Returns:
- true, if the camera is ready, false otherwise
Implements Camera.
Definition at line 272 of file fileloader.cpp.
| void FileLoader::set_colorspace | ( | colorspace_t | c | ) |
Set the colorspace of the image.
- Parameters:
-
c colorspace
Definition at line 309 of file fileloader.cpp.
| void FileLoader::set_image_number | ( | unsigned int | n | ) | [virtual] |
Set image number to retrieve.
If a camera is able to retrieve several images this method can be used to select the image to be retrieved with the next call to capture().
- Parameters:
-
n image number to set
Implements Camera.
Definition at line 279 of file fileloader.cpp.
| void FileLoader::set_pixel_height | ( | unsigned int | h | ) |
| void FileLoader::set_pixel_width | ( | unsigned int | w | ) |
| void FileLoader::start | ( | ) | [virtual] |
Start image transfer from the camera.
For many cameras opening the camera and starting transmission of images are two tasks. This method will simply initiate the transfer after the camera as been opened. And exception shall be thrown if the camera has not been opened.
Implements Camera.
Definition at line 193 of file fileloader.cpp.
| void FileLoader::stop | ( | ) | [virtual] |
Stop image transfer from the camera.
This will stop the image transfer initiated with start(). This can be used to start and stop the image transfer at will without opening and closing operations inbetween.
Implements Camera.
Definition at line 205 of file fileloader.cpp.
The documentation for this class was generated from the following files:
- src/firevision/cams/fileloader.h
- src/firevision/cams/fileloader.cpp

