IRI ROS Specific Algorithm Class. More...
#include <remove_background_alg_node.h>
Public Member Functions | |
RemoveBackgroundAlgNode (void) | |
Constructor. | |
~RemoveBackgroundAlgNode (void) | |
Destructor. | |
Protected Member Functions | |
void | addNodeDiagnostics (void) |
node add diagnostics | |
void | mainNodeThread (void) |
main node thread | |
void | node_config_update (Config &config, uint32_t level) |
dynamic reconfigure server callback | |
Private Member Functions | |
void | image_in_callback (const sensor_msgs::Image::ConstPtr &msg) |
cv::Mat | processImage (cv::Mat image) |
Remove background using OpenCV filtering. | |
bool | set_background_imageCallback (iri_perception_msgs::SetImage::Request &req, iri_perception_msgs::SetImage::Response &res) |
Private Attributes | |
cv::Mat | background_image_ |
uint8_t | binarize_threshold_ |
bool | has_background_ |
CMutex | image_in_mutex_ |
ros::Subscriber | image_in_subscriber_ |
sensor_msgs::Image | Image_msg_ |
ros::Publisher | image_out_publisher_ |
CMutex | set_background_image_mutex_ |
ros::ServiceServer | set_background_image_server_ |
IRI ROS Specific Algorithm Class.
Definition at line 50 of file remove_background_alg_node.h.
Constructor.
This constructor initializes specific class attributes and all ROS communications variables to enable message exchange.
Definition at line 6 of file remove_background_alg_node.cpp.
Destructor.
This destructor frees all necessary dynamic memory allocated within this this class.
Definition at line 31 of file remove_background_alg_node.cpp.
void RemoveBackgroundAlgNode::addNodeDiagnostics | ( | void | ) | [protected, virtual] |
node add diagnostics
In this abstract function additional ROS diagnostics applied to the specific algorithms may be added.
Implements algorithm_base::IriBaseAlgorithm< RemoveBackgroundAlgorithm >.
Definition at line 147 of file remove_background_alg_node.cpp.
void RemoveBackgroundAlgNode::image_in_callback | ( | const sensor_msgs::Image::ConstPtr & | msg | ) | [private] |
Definition at line 50 of file remove_background_alg_node.cpp.
void RemoveBackgroundAlgNode::mainNodeThread | ( | void | ) | [protected, virtual] |
main node thread
This is the main thread node function. Code written here will be executed in every node loop while the algorithm is on running state. Loop frequency can be tuned by modifying loop_rate attribute.
Here data related to the process loop or to ROS topics (mainly data structs related to the MSG and SRV files) must be updated. ROS publisher objects must publish their data in this process. ROS client servers may also request data to the corresponding server topics.
Implements algorithm_base::IriBaseAlgorithm< RemoveBackgroundAlgorithm >.
Definition at line 36 of file remove_background_alg_node.cpp.
void RemoveBackgroundAlgNode::node_config_update | ( | Config & | config, |
uint32_t | level | ||
) | [protected, virtual] |
dynamic reconfigure server callback
This method is called whenever a new configuration is received through the dynamic reconfigure. The derivated generic algorithm class must implement it.
config | an object with new configuration from all algorithm parameters defined in the config file. |
level | integer referring the level in which the configuration has been changed. |
Implements algorithm_base::IriBaseAlgorithm< RemoveBackgroundAlgorithm >.
Definition at line 135 of file remove_background_alg_node.cpp.
cv::Mat RemoveBackgroundAlgNode::processImage | ( | cv::Mat | image | ) | [private] |
Remove background using OpenCV filtering.
Remove background using OpenCV. First image is saved as background, and after that one it returns the differences with all images
Definition at line 110 of file remove_background_alg_node.cpp.
bool RemoveBackgroundAlgNode::set_background_imageCallback | ( | iri_perception_msgs::SetImage::Request & | req, |
iri_perception_msgs::SetImage::Response & | res | ||
) | [private] |
Definition at line 80 of file remove_background_alg_node.cpp.
cv::Mat RemoveBackgroundAlgNode::background_image_ [private] |
Definition at line 75 of file remove_background_alg_node.h.
uint8_t RemoveBackgroundAlgNode::binarize_threshold_ [private] |
Definition at line 76 of file remove_background_alg_node.h.
bool RemoveBackgroundAlgNode::has_background_ [private] |
Definition at line 74 of file remove_background_alg_node.h.
CMutex RemoveBackgroundAlgNode::image_in_mutex_ [private] |
Definition at line 60 of file remove_background_alg_node.h.
Definition at line 58 of file remove_background_alg_node.h.
sensor_msgs::Image RemoveBackgroundAlgNode::Image_msg_ [private] |
Definition at line 55 of file remove_background_alg_node.h.
Definition at line 54 of file remove_background_alg_node.h.
CMutex RemoveBackgroundAlgNode::set_background_image_mutex_ [private] |
Definition at line 65 of file remove_background_alg_node.h.
Definition at line 63 of file remove_background_alg_node.h.