From 3cf5c0b991ac3fb49115de59fbe7d77fc4599e36 Mon Sep 17 00:00:00 2001 From: Nick D'Ademo Date: Mon, 13 Jan 2014 22:01:09 +1100 Subject: [PATCH 1/3] Added get and set for extra PVAPI property: CV_CAP_PROP_FRAMESTARTTRIGGERMODE --- .../include/opencv2/highgui/highgui_c.h | 9 ++++- modules/highgui/src/cap_pvapi.cpp | 38 +++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/modules/highgui/include/opencv2/highgui/highgui_c.h b/modules/highgui/include/opencv2/highgui/highgui_c.h index 1a42e5804..249eec2b6 100644 --- a/modules/highgui/include/opencv2/highgui/highgui_c.h +++ b/modules/highgui/include/opencv2/highgui/highgui_c.h @@ -420,8 +420,13 @@ enum CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON = CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION, // Properties of cameras available through GStreamer interface - CV_CAP_GSTREAMER_QUEUE_LENGTH = 200, // default is 1 - CV_CAP_PROP_PVAPI_MULTICASTIP = 300, // ip for anable multicast master mode. 0 for disable multicast + CV_CAP_GSTREAMER_QUEUE_LENGTH = 200, // default is 1 + CV_CAP_PROP_PVAPI_MULTICASTIP = 300, // ip for anable multicast master mode. 0 for disable multicast + CV_CAP_PROP_FRAMESTARTTRIGGERMODE = 301, // 0: For Freerun + // 1: For SyncIn1 + // 2: For SyncIn2 + // 3: For Fixedrate + // 4: For Software // Properties of cameras available through XIMEA SDK interface CV_CAP_PROP_XI_DOWNSAMPLING = 400, // Change image resolution by binning or skipping. diff --git a/modules/highgui/src/cap_pvapi.cpp b/modules/highgui/src/cap_pvapi.cpp index 6ed3aea84..69a4823f0 100644 --- a/modules/highgui/src/cap_pvapi.cpp +++ b/modules/highgui/src/cap_pvapi.cpp @@ -254,6 +254,11 @@ double CvCaptureCAM_PvAPI::getProperty( int property_id ) case CV_CAP_PROP_FRAME_HEIGHT: PvAttrUint32Get(Camera.Handle, "Height", &nTemp); return (double)nTemp; + case CV_CAP_PROP_MONOCROME: + if (monocrome) + return 1; + else + return 0; case CV_CAP_PROP_EXPOSURE: PvAttrUint32Get(Camera.Handle,"ExposureValue",&nTemp); return (double)nTemp; @@ -280,6 +285,21 @@ double CvCaptureCAM_PvAPI::getProperty( int property_id ) case CV_CAP_PROP_GAIN: PvAttrUint32Get(Camera.Handle, "GainValue", &nTemp); return (double)nTemp; + case CV_CAP_PROP_FRAMESTARTTRIGGERMODE: + char triggerMode[256]; + PvAttrEnumGet(Camera.Handle, "FrameStartTriggerMode", triggerMode, 256, NULL); + if (strcmp(triggerMode, "Freerun")==0) + return 0.0; + else if (strcmp(triggerMode, "SyncIn1")==0) + return 1.0; + else if (strcmp(triggerMode, "SyncIn2")==0) + return 2.0; + else if (strcmp(triggerMode, "FixedRate")==0) + return 3.0; + else if (strcmp(triggerMode, "Software")==0) + return 4.0; + else + return -1.0; } return -1.0; } @@ -368,6 +388,24 @@ bool CvCaptureCAM_PvAPI::setProperty( int property_id, double value ) return false; } break; + case CV_CAP_PROP_FRAMESTARTTRIGGERMODE: + tPvErr error; + if (value==0) + error = PvAttrEnumSet(Camera.Handle, "FrameStartTriggerMode", "Freerun"); + else if (value==1) + error = PvAttrEnumSet(Camera.Handle, "FrameStartTriggerMode", "SyncIn1"); + else if (value==2) + error = PvAttrEnumSet(Camera.Handle, "FrameStartTriggerMode", "SyncIn2"); + else if (value==3) + error = PvAttrEnumSet(Camera.Handle, "FrameStartTriggerMode", "FixedRate"); + else if (value==4) + error = PvAttrEnumSet(Camera.Handle, "FrameStartTriggerMode", "Software"); + else + error = ePvErrOutOfRange; + if(error==ePvErrSuccess) + break; + else + return false; default: return false; } From 25870fa66ba59537f5e034c807f23f121fa05859 Mon Sep 17 00:00:00 2001 From: Nick D'Ademo Date: Tue, 14 Jan 2014 21:38:57 +1100 Subject: [PATCH 2/3] Added PVAPI enums to highgui.hpp Added "PVAPI_" prefix to FrameStartTriggerMode definition --- modules/highgui/include/opencv2/highgui.hpp | 10 +++++++++- modules/highgui/include/opencv2/highgui/highgui_c.h | 12 +++++------- modules/highgui/src/cap_pvapi.cpp | 4 ++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/modules/highgui/include/opencv2/highgui.hpp b/modules/highgui/include/opencv2/highgui.hpp index eb4ee8c03..bde6b296d 100644 --- a/modules/highgui/include/opencv2/highgui.hpp +++ b/modules/highgui/include/opencv2/highgui.hpp @@ -385,9 +385,17 @@ enum { CAP_PROP_GSTREAMER_QUEUE_LENGTH = 200 // default is 1 // PVAPI -enum { CAP_PROP_PVAPI_MULTICASTIP = 300 // ip for anable multicast master mode. 0 for disable multicast +enum { CAP_PROP_PVAPI_MULTICASTIP = 300 // ip for anable multicast master mode. 0 for disable multicast + CAP_PROP_PVAPI_FRAMESTARTTRIGGERMODE = 301 // FrameStartTriggerMode: Determines how a frame is initiated }; +// PVAPI: FrameStartTriggerMode +enum { CAP_PVAPI_FSTRIGMODE_FREERUN = 0, // Freerun + CAP_PVAPI_FSTRIGMODE_SYNCIN1 = 1, // SyncIn1 + CAP_PVAPI_FSTRIGMODE_SYNCIN2 = 2, // SyncIn2 + CAP_PVAPI_FSTRIGMODE_FIXEDRATE = 3, // FixedRate + CAP_PVAPI_FSTRIGMODE_SOFTWARE = 4 // Software + }; // Properties of cameras available through XIMEA SDK interface enum { CAP_PROP_XI_DOWNSAMPLING = 400, // Change image resolution by binning or skipping. diff --git a/modules/highgui/include/opencv2/highgui/highgui_c.h b/modules/highgui/include/opencv2/highgui/highgui_c.h index 249eec2b6..72e84d54f 100644 --- a/modules/highgui/include/opencv2/highgui/highgui_c.h +++ b/modules/highgui/include/opencv2/highgui/highgui_c.h @@ -420,13 +420,11 @@ enum CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON = CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION, // Properties of cameras available through GStreamer interface - CV_CAP_GSTREAMER_QUEUE_LENGTH = 200, // default is 1 - CV_CAP_PROP_PVAPI_MULTICASTIP = 300, // ip for anable multicast master mode. 0 for disable multicast - CV_CAP_PROP_FRAMESTARTTRIGGERMODE = 301, // 0: For Freerun - // 1: For SyncIn1 - // 2: For SyncIn2 - // 3: For Fixedrate - // 4: For Software + CV_CAP_GSTREAMER_QUEUE_LENGTH = 200, // default is 1 + + // PVAPI + CV_CAP_PROP_PVAPI_MULTICASTIP = 300, // ip for anable multicast master mode. 0 for disable multicast + CV_CAP_PROP_PVAPI_FRAMESTARTTRIGGERMODE = 301, // FrameStartTriggerMode: Determines how a frame is initiated // Properties of cameras available through XIMEA SDK interface CV_CAP_PROP_XI_DOWNSAMPLING = 400, // Change image resolution by binning or skipping. diff --git a/modules/highgui/src/cap_pvapi.cpp b/modules/highgui/src/cap_pvapi.cpp index 69a4823f0..4b27ab160 100644 --- a/modules/highgui/src/cap_pvapi.cpp +++ b/modules/highgui/src/cap_pvapi.cpp @@ -285,7 +285,7 @@ double CvCaptureCAM_PvAPI::getProperty( int property_id ) case CV_CAP_PROP_GAIN: PvAttrUint32Get(Camera.Handle, "GainValue", &nTemp); return (double)nTemp; - case CV_CAP_PROP_FRAMESTARTTRIGGERMODE: + case CV_CAP_PROP_PVAPI_FRAMESTARTTRIGGERMODE: char triggerMode[256]; PvAttrEnumGet(Camera.Handle, "FrameStartTriggerMode", triggerMode, 256, NULL); if (strcmp(triggerMode, "Freerun")==0) @@ -388,7 +388,7 @@ bool CvCaptureCAM_PvAPI::setProperty( int property_id, double value ) return false; } break; - case CV_CAP_PROP_FRAMESTARTTRIGGERMODE: + case CV_CAP_PROP_PVAPI_FRAMESTARTTRIGGERMODE: tPvErr error; if (value==0) error = PvAttrEnumSet(Camera.Handle, "FrameStartTriggerMode", "Freerun"); From 75b80e5d7d7bba39b8cca1160ab14ccaa068f0f5 Mon Sep 17 00:00:00 2001 From: Nick D'Ademo Date: Thu, 16 Jan 2014 20:17:49 +1100 Subject: [PATCH 3/3] Added missing comma in enum. --- modules/highgui/include/opencv2/highgui.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/highgui/include/opencv2/highgui.hpp b/modules/highgui/include/opencv2/highgui.hpp index bde6b296d..e80fa3333 100644 --- a/modules/highgui/include/opencv2/highgui.hpp +++ b/modules/highgui/include/opencv2/highgui.hpp @@ -385,8 +385,8 @@ enum { CAP_PROP_GSTREAMER_QUEUE_LENGTH = 200 // default is 1 // PVAPI -enum { CAP_PROP_PVAPI_MULTICASTIP = 300 // ip for anable multicast master mode. 0 for disable multicast - CAP_PROP_PVAPI_FRAMESTARTTRIGGERMODE = 301 // FrameStartTriggerMode: Determines how a frame is initiated +enum { CAP_PROP_PVAPI_MULTICASTIP = 300, // ip for anable multicast master mode. 0 for disable multicast + CAP_PROP_PVAPI_FRAMESTARTTRIGGERMODE = 301 // FrameStartTriggerMode: Determines how a frame is initiated }; // PVAPI: FrameStartTriggerMode