FCam Namespace Reference

Main namespace for the API. More...


Classes

class  Action
 An abstract base class for actions. More...
class  CopyableAction
 For convenience, derived FCam::Action Action classes may inherit from this so they don't have to implement the FCam::Action::copy method. More...
class  AsyncFileWriter
 The AsyncFileWriter saves frames in a low priority background thread. More...
class  AutoFocus
 This class does autofocus, by sweeping the sensor back and forth until a nice thing to focus on is found. More...
struct  Size
 A class to represent sizes of two dimensional objects like images. More...
struct  Rect
 A class to represent rectangles, like regions of an image. More...
class  HistogramConfig
 The configuration of the histogram generator. More...
class  SharpnessMapConfig
 The configuration of the sharpness map generator. More...
class  Histogram
 A histogram returned by the histogram generator. More...
class  SharpnessMap
 A sharpness map returned by the sharpness map generator. More...
class  Device
 An abstract base class for devices. More...
class  Event
 An Event marks a change in device state or an error condition. More...
class  EventGenerator
 A base class for things that generate events. More...
class  Flash
 An abstract base class for camera flashes. More...
class  Frame
 Data returned by the sensor as a result of a shot. More...
class  Image
 A reference-counted Image object. More...
class  Lens
 An abstract base class for lens devices, to establish a uniform interface to common lens functions. More...
class  Sensor
 A base class for image sensors. More...
class  Shot
 Shot collects parameters for capturing a frame. More...
class  Time
 Time represents a wall clock time. More...

Namespaces

namespace  F2
 The namespace for the F2 platform.
namespace  N900
 The namespace for the N900 platform.

Enumerations

enum  ImageFormat {
  RGB24 = 0, RGB16, UYVY, YUV24,
  RAW, UNKNOWN
}
 The various image formats supported by FCam. More...

Functions

void autoExpose (Shot *s, Frame::Ptr f, float maxGain=32.0f,int maxExposure=125000,float smoothness=0.5)
 Given a shot pointer and a frame, modify the shot parameters to make it better exposed, given the histogram data present in that frame.
int bytesPerPixel (ImageFormat)
 How many bytes per pixel are used by a given format.
bool getNextEvent (Event *)
 Copies the next pending event into the pointer given.
Image demosaic (Frame::Ptr, float gamma=1.8)
 Demosaic and gamma correct a raw frame, and return a slightly smaller RGB24 format image.
void saveDNG (Frame::Ptr frame, std::string filename, Lens *lens=NULL, Flash *flash=NULL)
 Save a DNG file.
void saveDump (Frame::Ptr frame, std::string filename)
 Save a YUYV, UYVY, or RAW dump file.
void saveJPEG (Frame::Ptr frame, std::string filename, int quality=80, Lens *lens=NULL, Flash *flash=NULL)
 Save a JPEG file.


Detailed Description

Main namespace for the API.

FCam is the main namespace for the API. There are sub-namespaces for each platform, currently two: N900 and F2.


Enumeration Type Documentation

The various image formats supported by FCam.

Enumerator:
RGB24  24 bit per pixel RGB, with 8 bits for each channel
RGB16  16 bit per pixel RGB, broken down into 5 bits for R, 6 for G, and 5 for B
UYVY  16 bit per pixel UYVY.

The even numbered bytes alternate between U and V (chrominance), and the odd numbered bytes are Y (luminance). This is usually the best format for blitting to overlays, and is also typically the best format if you just want grayscale data for computer vision applications (in which case, just ignore the even-numbered bytes).

YUV24  24 bit per pixel YUV, with 8 bits for each channels
RAW  16 bit per pixel raw sensor data.

Call Sensor::getBayerPattern for the correct interpretation. Most sensors are not natively 16-bit, so the high 4-6 bits will commonly be zero (for 12 or 10 bit sensors respectively).

UNKNOWN  An unknown or invalid format.

Definition at line 21 of file Base.h.


Function Documentation

void FCam::autoExpose ( Shot *  s,
Frame::Ptr  f,
float  maxGain = 32.0f,
int  maxExposure = 125000,
float  smoothness = 0.5 
)

Given a shot pointer and a frame, modify the shot parameters to make it better exposed, given the histogram data present in that frame.

Other parameters are the maximum allowable gain, the maximum allowable exposure, and how smooth changes should be. 0 makes instant changes (and could even oscillate out of control. 1 never changes at all. 0.5 is recommended.

If the algorithm needs to increase brightness, it does so in this order.

  • Increase the exposure time up to just less than the frame time of the given shot
  • Increase the gain up to the maximum gain
  • Increase the exposure time up to the maximum exposure time
If the algorithm needs to decrease brightness, it does so in the reverse order.

Definition at line 8 of file AutoExposure.cpp.

bool FCam::getNextEvent ( Event *   ) 

Copies the next pending event into the pointer given.

Returns false if there are no outstanding events. You should periodically process all pending events like so:

FCam::Event event;
while (getNextEvent(&event)) {
    switch(event.type) {
    case FCam::Event::Error:
        ...
        break;
    case FCam::Event::Warning:
        ...
        break;
    case FCam::Event::ShutterPressed:
        ...
        break;
    ...
    default:
        cerr << "Unknown event: " << event.description();
    }
}

Definition at line 8 of file Event.cpp.

Image FCam::demosaic ( Frame::Ptr  ,
float  gamma = 1.8 
)

Demosaic and gamma correct a raw frame, and return a slightly smaller RGB24 format image.

Two pixels are lost from each side of the image.

Todo:
This method currently does bilinear interpolation, which needs to be improved.

Definition at line 11 of file Demosaic.cpp.

void FCam::saveDNG ( Frame::Ptr  frame,
std::string  filename,
Lens *  lens = NULL,
Flash *  flash = NULL 
)

Save a DNG file.

The frame must have an image in RAW format. The frame and frame.sensor are queried for all relevant data to put in the DNG tags and color matrices. You can also pass in a lens and flash to include their metadata as DNG tags.

Definition at line 107 of file DNG.cpp.

void FCam::saveDump ( Frame::Ptr  frame,
std::string  filename 
)

Save a YUYV, UYVY, or RAW dump file.

For debugging incoming YUV or RAW data, saves an image in a very basic image format: Header: 5 4-byte integers representing frames, width, height, channels, and type. Frames will always be 1. Type is either 0 = YUYV data ( horizontally subsampled chrominance in a byte pattern Y U Y V) 1 = UYVY data ( horizontally subsampled chrominance in a byte pattern U Y V Y) 2 = RAW data (16-bit raw sensor pixel values, in a Bayer mosaic) Channels will be 2 for YUYV/UYVY, 1 for RAW data.

Definition at line 7 of file Dump.cpp.

void FCam::saveJPEG ( Frame::Ptr  frame,
std::string  filename,
int  quality = 80,
Lens *  lens = NULL,
Flash *  flash = NULL 
)

Save a JPEG file.

The frame must have an image in RAW, UYVY, or RGB format. The frame and frame.sensor are queried for all relevant data to put in the EXIF tags. You can also pass in a jpeg quality level between 0 and 100, and a lens and flash to include their metadata as EXIF tags.

Definition at line 78 of file JPEG.cpp.


Generated on Mon Jan 18 20:48:12 2010 for FCam by  doxygen 1.5.6