Compare commits
2 Commits
8da179cd6f
...
4a8602bb42
Author | SHA1 | Date | |
---|---|---|---|
4a8602bb42 | |||
cbe9684564 |
@ -34,17 +34,32 @@ 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(double exposure_time);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char* argv[] ) {
|
||||
uint32_t frameCount = 100;
|
||||
@ -59,6 +74,8 @@ 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";
|
||||
|
||||
@ -72,6 +89,9 @@ 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"
|
||||
@ -100,6 +120,23 @@ 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]);
|
||||
}
|
||||
@ -157,7 +194,8 @@ 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 );
|
||||
@ -236,6 +274,7 @@ 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] );
|
||||
|
Loading…
Reference in New Issue
Block a user