32 #include <opencv2/core/core.hpp> 33 #include <opencv2/highgui/highgui.hpp> 34 #include <opencv2/imgproc/imgproc.hpp> 40 #include <sensor_msgs/Image.h> 76 priv.
param(
"mask", mask, std::string(
""));
79 mask_ = cv::imread(mask, 0);
93 mask_ = cv::Mat::ones(cv_image->image.size(), CV_8U);
95 else if (
mask_.rows != cv_image->image.rows ||
mask_.cols != cv_image->image.cols)
97 cv::resize(
mask_,
mask_, cv_image->image.size(), 1.0, 1.0, cv::INTER_NEAREST);
102 if (over_exposure_threshold_ < 255 && over_exposure_threshold_ > 0)
105 cv::Mat element = cv::getStructuringElement(
109 cv::dilate(over_exposed, over_exposed, element);
111 mask =
mask_.clone();
112 mask.setTo(0, over_exposed);
Subscriber subscribe(const std::string &base_topic, uint32_t queue_size, const boost::function< void(const sensor_msgs::ImageConstPtr &)> &callback, const ros::VoidPtr &tracked_object=ros::VoidPtr(), const TransportHints &transport_hints=TransportHints())
ros::NodeHandle & getNodeHandle() const
Publisher advertise(const std::string &base_topic, uint32_t queue_size, bool latch=false)
~ContrastStretchNodelet()
ros::NodeHandle & getPrivateNodeHandle() const
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
image_transport::Publisher image_pub_
SWRI_NODELET_EXPORT_CLASS(swri_image_util, DrawPolygonNodelet)
CvImagePtr toCvCopy(const sensor_msgs::ImageConstPtr &source, const std::string &encoding=std::string())
image_transport::Subscriber image_sub_
void ImageCallback(const sensor_msgs::ImageConstPtr &image)
void publish(const sensor_msgs::Image &message) const
double over_exposure_threshold_
int32_t over_exposure_dilation_
void ContrastStretch(int32_t grid_size, const cv::Mat &source_image, cv::Mat &dest_image, const cv::Mat &mask=cv::Mat(), double max_min=0.0, double min_max=0.0)