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