diff --git a/CATKIN_IGNORE b/CATKIN_IGNORE new file mode 100644 index 0000000..e69de29 diff --git a/pointgrey_camera_driver/cfg/PointGrey.cfg b/pointgrey_camera_driver/cfg/PointGrey.cfg index 4ec1385..3825188 100755 --- a/pointgrey_camera_driver/cfg/PointGrey.cfg +++ b/pointgrey_camera_driver/cfg/PointGrey.cfg @@ -136,11 +136,29 @@ codings = gen.enum([gen.const("Mono8", str_t, "mono8", ""), gen.const("Mono16", str_t, "mono16", ""), gen.const("Raw8", str_t, "raw8", ""), gen.const("Raw16", str_t, "raw16", ""), - gen.const("RGB8", str_t, "rgb8", "")], + gen.const("RGB8", str_t, "rgb8", ""), + gen.const("YUV422", str_t, "yuv422", "")], "Format7 color coding methods") - + gen.add("format7_color_coding", str_t, SensorLevels.RECONFIGURE_STOP, "Color coding (only for Format7 modes)", "raw8", edit_method = codings) + +# Color processing http://www.ptgrey.com/KB/10141 +gen.add("color_processing", bool_t, SensorLevels.RECONFIGURE_RUNNING, "Enable color processing.", False) +color_processing_algos = gen.enum([gen.const("DEFAULT", str_t, "DEFAULT", ""), + gen.const("NO", str_t, "NO_COLOR_PROCESSING", ""), + gen.const("NEAREST_NEIGHBOR", str_t, "NEAREST_NEIGHBOR", ""), + gen.const("EDGE_SENSING", str_t, "EDGE_SENSING", ""), + gen.const("HQ_LINEAR", str_t, "HQ_LINEAR", ""), + gen.const("RIGOROUS", str_t, "RIGOROUS", ""), + gen.const("IPP", str_t, "IPP", ""), + gen.const("DIRECTIONAL_FILTER", str_t, "DIRECTIONAL_FILTER", ""), + gen.const("WEIGHTED_DIRECTIONAL_FILTER", str_t, "WEIGHTED_DIRECTIONAL_FILTER", "")], + "Color processing algorithms") + +gen.add("color_processing_algo", str_t, SensorLevels.RECONFIGURE_RUNNING, "Color processing algorithms", "DEFAULT", edit_method = color_processing_algos) + + # Trigger parameters gen.add("enable_trigger", bool_t, SensorLevels.RECONFIGURE_RUNNING, "Enable the external triggering mode.", False) diff --git a/pointgrey_camera_driver/include/pointgrey_camera_driver/PointGreyCamera.h b/pointgrey_camera_driver/include/pointgrey_camera_driver/PointGreyCamera.h index b8d91d6..d895590 100644 --- a/pointgrey_camera_driver/include/pointgrey_camera_driver/PointGreyCamera.h +++ b/pointgrey_camera_driver/include/pointgrey_camera_driver/PointGreyCamera.h @@ -186,6 +186,9 @@ class PointGreyCamera /// If true, camera is currently running in color mode, otherwise camera is running in mono mode bool isColor_; + bool color_processing_; + FlyCapture2::ColorProcessingAlgorithm color_processing_algo_; + // For GigE cameras: /// If true, GigE packet size is automatically determined, otherwise packet_size_ is used: bool auto_packet_size_; @@ -241,6 +244,17 @@ class PointGreyCamera */ bool getFormat7PixelFormatFromString(std::string &sformat, FlyCapture2::PixelFormat &fmt7PixFmt); + /*! + * \brief Converts the dynamic_reconfigure string type into a FlyCapture2::ColorProcessingAlgorithm + * + * This function will convert the string input from dynamic_reconfigure into the proper datatype for use with FlyCapture enum. + * \param cproc input Color Processing Algorithm. + * \param algo_out FlyCapture2::ColorProcessingAlgorithm, will be changed to either the corresponding type as cproc, or to the most compatible type. + * + * \return Returns true when the configuration could be applied without modification. + */ + bool getColorProcessingAlgoFromString(std::string &cproc, FlyCapture2::ColorProcessingAlgorithm &algo_out); + bool setProperty(const FlyCapture2::PropertyType &type, const bool &autoSet, unsigned int &valueA, unsigned int &valueB); /*! diff --git a/pointgrey_camera_driver/src/PointGreyCamera.cpp b/pointgrey_camera_driver/src/PointGreyCamera.cpp index 0009fe8..cf3a560 100644 --- a/pointgrey_camera_driver/src/PointGreyCamera.cpp +++ b/pointgrey_camera_driver/src/PointGreyCamera.cpp @@ -55,12 +55,15 @@ bool PointGreyCamera::setNewConfiguration(pointgrey_camera_driver::PointGreyConf PointGreyCamera::connect(); } - // Activate mutex to prevent us from grabbing images during this time - boost::mutex::scoped_lock scopedLock(mutex_); - // return true if we can set values as desired. bool retVal = true; + color_processing_=config.color_processing; + retVal &= PointGreyCamera::getColorProcessingAlgoFromString(config.color_processing_algo,color_processing_algo_); + + // Activate mutex to prevent us from grabbing images during this time + boost::mutex::scoped_lock scopedLock(mutex_); + // Check video mode VideoMode vMode; // video mode desired Mode fmt7Mode; // fmt7Mode to set @@ -75,12 +78,25 @@ bool PointGreyCamera::setNewConfiguration(pointgrey_camera_driver::PointGreyConf { PixelFormat fmt7PixFmt; PointGreyCamera::getFormat7PixelFormatFromString(config.format7_color_coding, fmt7PixFmt); + switch(fmt7PixFmt) + { + case PIXEL_FORMAT_RAW8: ROS_INFO_STREAM("Setting PIXEL_FORMAT_RAW8");break; + case PIXEL_FORMAT_RAW16: ROS_INFO_STREAM("Setting PIXEL_FORMAT_RAW16");break; + case PIXEL_FORMAT_MONO8: ROS_INFO_STREAM("Setting PIXEL_FORMAT_MONO8");break; + case PIXEL_FORMAT_MONO16: ROS_INFO_STREAM("Setting PIXEL_FORMAT_MONO16");break; + case PIXEL_FORMAT_422YUV8: ROS_INFO_STREAM("Setting PIXEL_FORMAT_422YUV8");break; + case PIXEL_FORMAT_RGB8: ROS_INFO_STREAM("Setting PIXEL_FORMAT_RGB8");break; + case PIXEL_FORMAT_BGR: ROS_INFO_STREAM("Setting PIXEL_FORMAT_BGR");break; + default: ROS_INFO_STREAM("GetDefaultOutputFormat "<