• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

src/Frame.cpp

00001 #include <sstream>
00002 
00003 #include "FCam/Frame.h"
00004 #include "FCam/Action.h"
00005 #include "Debug.h"
00006 
00007 namespace FCam {
00008    
00009     // This function exists so that _Frame's vtable has an object file
00010     // to live in
00011     _Frame::_Frame(): exposure(0), frameTime(0), gain(0.0f), whiteBalance(5000) {}
00012 
00013     _Frame::~_Frame() {}
00014 
00015     // Debugging dump function
00016     void _Frame::debug(const char *name) const {
00017         printf("\tDump of FCam::Frame %s at %llx:\n", name, (long long unsigned)this);
00018         printf("\t  Exposure start time: %s end time: %s\n", exposureStartTime.toString().c_str(), exposureEndTime.toString().c_str());
00019         printf("\t  Processing done time: %s\n", processingDoneTime.toString().c_str());
00020         printf("\t  Exposure: %d us, Frame time: %d us\n", exposure, frameTime);
00021         printf("\t  Gain: %f, White balance: %d K\n", gain, whiteBalance);
00022         printf("\t  Histogram details:\n");
00023         printf("\t\tValid: %s\n", histogram.valid() ? "yes" : "no");
00024         printf("\t\tBuckets: %d, Channels: %d\n", histogram.buckets(), histogram.channels());
00025         printf("\t\tRegion: (%d, %d) - (%d, %d)\n", histogram.region().x, histogram.region().y, 
00026                histogram.region().x+histogram.region().width, 
00027                histogram.region().y+histogram.region().height);
00028         printf("\t  Sharpness map details:\n");
00029         printf("\t\tValid: %s\n", sharpness.valid() ? "yes" : "no");
00030         printf("\t\tChannels: %d, Size: %d x %d\n", sharpness.channels(), sharpness.width(), sharpness.height());
00031         printf("\t  Camera RAW to sRGB(linear) conversion matrix at current white balance setting:\n");
00032         float matrix[16];
00033         rawToRGBColorMatrix(whiteBalance, matrix);
00034         printf("\t\t[ [ %5.3f %5.3f %5.3f %5.3f ]\n", matrix[0], matrix[1], matrix[2], matrix[3]);
00035         printf("\t\t  [ %5.3f %5.3f %5.3f %5.3f ]\n", matrix[4], matrix[5], matrix[6], matrix[7]);
00036         printf("\t\t  [ %5.3f %5.3f %5.3f %5.3f ]\n", matrix[8], matrix[9], matrix[10], matrix[11]);
00037         printf("\t\t  [ %5.3f %5.3f %5.3f %5.3f ] ]\n", matrix[12], matrix[13], matrix[14], matrix[15]);
00038         printf("\t  Sensor bayer pattern: %s\n", (bayerPattern() == RGGB ? "RGGB" :
00039                                                   bayerPattern() == BGGR ? "BGGR" :
00040                                                   bayerPattern() == GRBG ? "GRBG" :
00041                                                   bayerPattern() == GBRG ? "GBRG" :
00042                                                   "Not Bayer"));
00043         printf("\t  Min raw value: %d, max raw value: %d\n", minRawValue(), maxRawValue() );
00044         printf("\t  Camera Model: %s, Manufacturer: %s\n", model().c_str(), manufacturer().c_str());
00045         printf("\t  Tag map contents:\n");
00046         for (TagMap::const_iterator it = tags.begin(); it != tags.end(); it++) {
00047             std::string val = (*it).second.toString();
00048             if (val.size() > 100) {
00049                 std::stringstream s;
00050                 s << val.substr(0,100) << "...(truncating " << val.size()-100 << " characters)";
00051                 val = s.str();
00052             }
00053             printf("\t   Key: \"%s\" Value: %s\n", (*it).first.c_str(), val.c_str());
00054         }
00055         printf("\t  Requested shot contents:\n");
00056         printf("\t\tID: %d, wanted: %s\n", shot().id, shot().wanted ? "yes" : "no");
00057         printf("\t\tRequested exposure: %d, frame time: %d\n", shot().exposure, shot().frameTime);
00058         printf("\t\tRequested gain: %f, requested white balance: %d K\n", shot().gain, shot().whiteBalance);
00059         printf("\t\tRequested histogram configuration:\n");
00060         printf("\t\t\tEnabled: %s, buckets: %d\n", shot().histogram.enabled ? "yes" : "no", shot().histogram.buckets);
00061         printf("\t\t\tRegion: (%d, %d) - (%d, %d)\n", shot().histogram.region.x, shot().histogram.region.y, 
00062                shot().histogram.region.x+shot().histogram.region.width, 
00063                shot().histogram.region.y+shot().histogram.region.height);
00064         printf("\t\tRequested sharpness map configuration:\n");
00065         printf("\t\t\tEnabled: %s, size: %d x %d\n", shot().sharpness.enabled ? "yes" : "no", 
00066                shot().sharpness.size.width, shot().sharpness.size.height);
00067         printf("\t\tRequested actions:\n");
00068         for (std::set<Action *>::const_iterator it=shot().actions().begin(); it != shot().actions().end(); it++) {
00069             printf("\t\t\tAction object at %llx to fire at %d us into exposure, latency of %d us.\n", (long long unsigned)*it, (*it)->time, (*it)->latency);
00070         }
00071         printf("\t**  Dump of requested image object follows\n");
00072         shot().image.debug("Frame::Shot::image");
00073 
00074         printf("\t**  Dump of frame image data follows\n");
00075         image.debug("Frame::image");        
00076     }
00077 }

Generated on Thu Jul 15 2010 17:51:28 for FCam by  doxygen 1.7.1