allow setting gains for two cameras, just a hack
This commit is contained in:
parent
cbe9684564
commit
4a8602bb42
@ -34,6 +34,7 @@ typedef high_resolution_clock Time;
|
|||||||
typedef milliseconds ms;
|
typedef milliseconds ms;
|
||||||
typedef duration<float> fsec;
|
typedef duration<float> fsec;
|
||||||
|
|
||||||
|
|
||||||
uint32_t sensorHeight(CInstantCamera &camera) {
|
uint32_t sensorHeight(CInstantCamera &camera) {
|
||||||
CIntegerParameter maxheight( camera.GetNodeMap(), "SensorHeight" );
|
CIntegerParameter maxheight( camera.GetNodeMap(), "SensorHeight" );
|
||||||
return maxheight.GetValue();
|
return maxheight.GetValue();
|
||||||
@ -52,7 +53,13 @@ void exposureTime(CInstantCamera &camera, double exposure_time) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//void exposureTime(double 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[] ) {
|
int main( int argc, char* argv[] ) {
|
||||||
uint32_t frameCount = 100;
|
uint32_t frameCount = 100;
|
||||||
@ -68,6 +75,7 @@ int main( int argc, char* argv[] ) {
|
|||||||
int yOffset = 0;
|
int yOffset = 0;
|
||||||
int camIndex = 0;
|
int camIndex = 0;
|
||||||
double exposure_time = 10000;
|
double exposure_time = 10000;
|
||||||
|
double gains[2] = {5.0, 5.0};
|
||||||
string errorMessage = "";
|
string errorMessage = "";
|
||||||
String_t filename = "_TestVideo.mp4";
|
String_t filename = "_TestVideo.mp4";
|
||||||
|
|
||||||
@ -82,6 +90,8 @@ int main( int argc, char* argv[] ) {
|
|||||||
<< "\t --xoffs|-x \t image x offset in pixel, defaults to 0\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 --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 --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 --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 --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"
|
<< "\t --quality|-q \t the qualtiy of the compression (0 < q <= 100), defaults to 50\n"
|
||||||
@ -113,6 +123,20 @@ int main( int argc, char* argv[] ) {
|
|||||||
if ((arg == "--exposure" || arg == "-e") && i + 1 < argc) {
|
if ((arg == "--exposure" || arg == "-e") && i + 1 < argc) {
|
||||||
exposure_time = std::atoi(argv[++i]);
|
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) {
|
if ((arg == "--index" || arg == "-i") && i + 1 < argc) {
|
||||||
camIndex = std::atoi(argv[++i]);
|
camIndex = std::atoi(argv[++i]);
|
||||||
}
|
}
|
||||||
@ -170,14 +194,14 @@ int main( int argc, char* argv[] ) {
|
|||||||
CEnumParameter pixelFormat( nodemap, "PixelFormat" );
|
CEnumParameter pixelFormat( nodemap, "PixelFormat" );
|
||||||
CEnumParameter trigmode( nodemap, "TriggerMode");
|
CEnumParameter trigmode( nodemap, "TriggerMode");
|
||||||
CEnumParameter trigsource( nodemap, "TriggerSource");
|
CEnumParameter trigsource( nodemap, "TriggerSource");
|
||||||
exposureTime(cameras[i], exposure_time);
|
exposureTime( cameras[i], exposure_time );
|
||||||
|
detectorGain( cameras[i], gains[i] );
|
||||||
trigmode.TrySetValue( "On" );
|
trigmode.TrySetValue( "On" );
|
||||||
trigsource.TrySetValue( "Software" );
|
trigsource.TrySetValue( "Software" );
|
||||||
width.TrySetValue( cWidth, IntegerValueCorrection_Nearest );
|
width.TrySetValue( cWidth, IntegerValueCorrection_Nearest );
|
||||||
height.TrySetValue( cHeight, IntegerValueCorrection_Nearest );
|
height.TrySetValue( cHeight, IntegerValueCorrection_Nearest );
|
||||||
offsetX.TrySetValue( xOffset, IntegerValueCorrection_Nearest );
|
offsetX.TrySetValue( xOffset, IntegerValueCorrection_Nearest );
|
||||||
offsetY.TrySetValue( yOffset, IntegerValueCorrection_Nearest );
|
offsetY.TrySetValue( yOffset, IntegerValueCorrection_Nearest );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CIntegerParameter width( cameras[0].GetNodeMap(), "Width" );
|
CIntegerParameter width( cameras[0].GetNodeMap(), "Width" );
|
||||||
|
Loading…
Reference in New Issue
Block a user