1 #include <opencv2/highgui/highgui.hpp> 26 previous_shift_x_ = shift_x;
27 previous_shift_y_ = shift_y;
38 cv::boxFilter(
occupancy_grid_fast_, nearest_neighbor_mean_fast, -1, cv::Size(size, size), cv::Point(-1, -1),
true,
39 cv::BORDER_REPLICATE);
40 cv::boxFilter(
occupancy_grid_slow_, nearest_neighbor_mean_slow, -1, cv::Size(size, size), cv::Point(-1, -1),
true,
41 cv::BORDER_REPLICATE);
63 cv::bitwise_and(nearest_neighbor_mean_slow, fg_mask, fg_mask);
66 cv::Mat setBorderToZero = cv::Mat(
current_frame_.size(), CV_8UC1, 0.0);
70 cv::bitwise_and(setBorderToZero, fg_mask, fg_mask);
76 cv::Mat element = cv::getStructuringElement(cv::MORPH_ELLIPSE,
79 cv::dilate(fg_mask, fg_mask, element);
80 cv::dilate(fg_mask, fg_mask, element);
81 cv::erode(fg_mask, fg_mask, element);
90 cv::Mat temp_fast, temp_slow;
91 cv::Mat translation_mat = (cv::Mat_<double>(2, 3, CV_64F) << 1, 0, -shift_x, 0, 1, -shift_y);
105 cv::Mat im = image.clone();
107 cv::imshow(name, im);
void apply(const cv::Mat &image, cv::Mat &fg_mask, int shift_x=0, int shift_y=0)
Computes a foreground mask.
cv::Mat occupancy_grid_fast_
double alpha_fast
Filter constant (learning rate) of the fast filter part.
void visualize(const std::string &name, const cv::Mat &image)
OpenCV Visualization.
double alpha_slow
Filter constant (learning rate) of the slow filter part.
double min_sep_between_fast_and_slow_filter
double max_occupancy_neighbors
void transformToCurrentFrame(int shift_x, int shift_y)
Transform/shift all internal matrices/grids according to a given translation vector.
cv::Mat occupancy_grid_slow_
double min_occupancy_probability
BackgroundSubtractor(const Params ¶meters)
Constructor that accepts a specific parameter configuration.
void updateParameters(const Params ¶meters)
Update internal parameters.