#include #include #include // Select the platform #if !defined PLATFORM_N900 && !defined PLATFORM_F2 #define PLATFORM_N900 #endif #if defined PLATFORM_N900 #include namespace Plat = FCam::N900; #endif #if defined PLATFORM_F2 #include namespace Plat = FCam::F2; #endif /** \file */ /***********************************************************/ /* A program that takes a single shot */ /* */ /* This example is a simple demonstration of the usage of */ /* the FCam API. */ /***********************************************************/ int main(int argc, char ** argv) { // Make the image sensor Plat::Sensor sensor; // Make a new shot FCam::Shot shot1; shot1.exposure = 50000; // 50 ms exposure shot1.gain = 1.0f; // minimum ISO // Specify the output resolution and format, and allocate storage for the resulting image shot1.image = FCam::Image(2592, 1968, FCam::UYVY); // Order the sensor to capture a shot. //sensor.stream(shot1); //sensor.stopStreaming(); sensor.capture(shot1); //assert(sensor.shotsPending() == 1); // There should be exactly one shot. // Retrieve the frame from the sensor. FCam::Frame frame = sensor.getFrame(); // This frame should be the result of the shot we made. assert(frame.shot().id == shot1.id); // If we were given a filename as a command line arg, save this frame. if (argc > 1) FCam::saveJPEG(frame, argv[1]); // Check that the pipeline is empty. assert(sensor.framesPending() == 0); assert(sensor.shotsPending() == 0); return 0; }