00001 // TestJPEG.cpp - Simple JPEG saving code test 00002 00003 #include <stdio.h> 00004 #include <FCam/Dummy.h> 00005 00006 int main(int argc, char **argv) { 00007 00008 FCam::Dummy::Sensor sensor; 00009 00010 FCam::Dummy::Shot shot; 00011 shot.testPattern = FCam::Dummy::CHECKERBOARD; 00012 shot.exposure = 5000; 00013 shot.gain = 1.0f; 00014 shot.image = FCam::Image(sensor.maxImageSize(), FCam::RGB24); 00015 00016 sensor.capture(shot); 00017 FCam::Dummy::Frame frame = sensor.getFrame(); 00018 00019 std::string testName("testJPG_1.jpg"); 00020 00021 saveJPEG(frame, testName); 00022 00023 FCam::Event e; 00024 bool errors = false; 00025 if (FCam::getNextEvent(&e, FCam::Event::Error)) { 00026 do { 00027 if (e.type == FCam::Event::Error) { 00028 errors = true; 00029 printf("** FCam error [%d] %d at %s: %s\n", e.type, e.data, e.time.toString().c_str(), e.description.c_str()); 00030 } 00031 } while (FCam::getNextEvent(&e, FCam::Event::Error)); 00032 if (errors) { 00033 printf ("Error during JPEG testing\n"); 00034 return 1; 00035 } 00036 } 00037 00038 00039 00040 }