Compare commits

..

No commits in common. "4a8602bb4211307b21277bf5cc753f137f0c7fa8" and "8da179cd6fe329521bd2ec1433715840e2d4f64c" have entirely different histories.

View File

@ -34,32 +34,17 @@ typedef high_resolution_clock Time;
typedef milliseconds ms;
typedef duration<float> fsec;
uint32_t sensorHeight(CInstantCamera &camera) {
CIntegerParameter maxheight( camera.GetNodeMap(), "SensorHeight" );
return maxheight.GetValue();
}
uint32_t sensorWidth(CInstantCamera &camera) {
CIntegerParameter maxwidth( camera.GetNodeMap(), "SensorWidth" );
return maxwidth.IsValid() && maxwidth.IsReadable() ? maxwidth.GetValue() : 0;
}
void exposureTime(CInstantCamera &camera, double exposure_time) {
GenApi::INodeMap& nodemap = camera.GetNodeMap();
CFloatParameter(nodemap, "ExposureTime").SetValue(exposure_time);
}
void detectorGain(CInstantCamera &camera, double gain) {
GenApi::INodeMap& nodemap = camera.GetNodeMap();
CEnumParameter(nodemap, "GainAuto").SetValue("Off");
CEnumParameter(nodemap, "GainSelector").SetValue("All");
CFloatParameter(nodemap, "Gain").SetValue(gain);
}
//void exposureTime(double exposure_time);
int main( int argc, char* argv[] ) {
uint32_t frameCount = 100;
@ -74,11 +59,9 @@ int main( int argc, char* argv[] ) {
int xOffset = 0;
int yOffset = 0;
int camIndex = 0;
double exposure_time = 10000;
double gains[2] = {5.0, 5.0};
string errorMessage = "";
String_t filename = "_TestVideo.mp4";
for (int i = 1; i < argc; ++i) {
std::string arg = argv[i];
if ((arg == "--help") || arg == "?"){
@ -89,9 +72,6 @@ int main( int argc, char* argv[] ) {
<< "\t --height|-h \t the image height in pixel, defaults to 2000\n"
<< "\t --xoffs|-x \t image x offset in pixel, defaults to 0\n"
<< "\t --yoffs|-y \t image y-offset in pixel, defaults to 0\n"
<< "\t --exposure|-e \t exposure time in us, defaults to 10000\n"
<< "\t --gain1|-g1 \t gain for camera 1 in db, defaults to 5.0\n"
<< "\t --gain2|-g2 \t gain for camera 2 in db, defaults to 5.0\n"
<< "\t --cameras|-c \t the desired number of cameras to grab at the same time, defaults to 1\n"
<< "\t --framecount|-n \t the number of frames, defaults to 100\n"
<< "\t --quality|-q \t the qualtiy of the compression (0 < q <= 100), defaults to 50\n"
@ -120,23 +100,6 @@ int main( int argc, char* argv[] ) {
if ((arg == "--yoffs" || arg == "-y") && i + 1 < argc) {
yOffset = std::atoi(argv[++i]);
}
if ((arg == "--exposure" || arg == "-e") && i + 1 < argc) {
exposure_time = std::atoi(argv[++i]);
}
if ((arg == "--gain1" || arg == "-g1") && i + 1 < argc) {
try {
gains[0] = std::stod(argv[++i]);
} catch (...) {
gains[0] = 5.0;
}
}
if ((arg == "--gain2" || arg == "-g2") && i + 1 < argc) {
try {
gains[1] = std::stod(argv[++i]);
} catch (...) {
gains[1] = 5.0;
}
}
if ((arg == "--index" || arg == "-i") && i + 1 < argc) {
camIndex = std::atoi(argv[++i]);
}
@ -194,8 +157,7 @@ int main( int argc, char* argv[] ) {
CEnumParameter pixelFormat( nodemap, "PixelFormat" );
CEnumParameter trigmode( nodemap, "TriggerMode");
CEnumParameter trigsource( nodemap, "TriggerSource");
exposureTime( cameras[i], exposure_time );
detectorGain( cameras[i], gains[i] );
trigmode.TrySetValue( "On" );
trigsource.TrySetValue( "Software" );
width.TrySetValue( cWidth, IntegerValueCorrection_Nearest );
@ -274,7 +236,6 @@ int main( int argc, char* argv[] ) {
for ( int i =0; i < camCount; ++i ) {
success = success & frames[i]->GrabSucceeded();
}
if (success) {
if ( camCount > 1 ) {
leftImage.AttachGrabResultBuffer( frames[0] );
@ -287,7 +248,7 @@ int main( int argc, char* argv[] ) {
} else {
cout << "Error: " << std::hex << frames[0]->GetErrorCode() << std::dec << " " << frames[0]->GetErrorDescription() << endl;
}
counter += 1;
done = high_resolution_clock::now();
total_duration = duration_cast<microseconds>(done - before);