Go to the documentation of this file.00001 #include <stdlib.h>
00002 #include <stdio.h>
00003 #include <assert.h>
00004
00005
00006 #include <FCam/N900.h>
00007 namespace Plat = FCam::N900;
00008
00011
00012
00013
00014
00015
00016
00017
00018 void errorCheck();
00019
00020 int main(int argc, char ** argv) {
00021
00022
00023 Plat::Sensor sensor;
00024
00025
00026 FCam::Shot shot1;
00027 shot1.exposure = 50000;
00028 shot1.gain = 1.0f;
00029
00030
00031 shot1.image = FCam::Image(2592, 1968, FCam::UYVY);
00032
00033
00034 sensor.capture(shot1);
00035
00036
00037 errorCheck();
00038
00039 assert(sensor.shotsPending() == 1);
00040
00041
00042 FCam::Frame frame = sensor.getFrame();
00043
00044
00045 assert(frame.shot().id == shot1.id);
00046
00047
00048 assert(frame.valid());
00049 assert(frame.image().valid());
00050
00051
00052 FCam::saveJPEG(frame, "/home/user/MyDocs/DCIM/example1.jpg");
00053
00054
00055 assert(sensor.framesPending() == 0);
00056 assert(sensor.shotsPending() == 0);
00057
00058 return 0;
00059 }
00060
00061
00062
00063
00064 void errorCheck() {
00065
00066 FCam::Event e;
00067 while (FCam::getNextEvent(&e, FCam::Event::Error) ) {
00068 printf("Error: %s\n", e.description.c_str());
00069 if (e.data == FCam::Event::DriverMissingError) {
00070 printf("example1: FCam can't find its driver. Did you install "
00071 "fcam-drivers on your platform, and reboot the device "
00072 "after installation?\n");
00073 exit(1);
00074 }
00075 if (e.data == FCam::Event::DriverLockedError) {
00076 printf("example1: Another FCam program appears to be running "
00077 "already. Only one can run at a time.\n");
00078 exit(1);
00079 }
00080 }
00081 }