src/feature_detector/src/parameter_manager.cpp
// TODO: There is still a bug hiding in here.
//  The program crashes when you select an area from top-right to bottom-left,
//  with bottom-left far out of the image. (OpenCV Error '-215'.)
There is still a bug hiding in here.
The program crashes when you select an area from top-right to bottom-left,
with bottom-left far out of the image.
There is still a bug hiding in here . The program crashes when you select an area from top - right to bottom - left with bottom - left far out of the image .
cv::Rect computeTruncatedROIForImage(const cv::Rect& roi, const cv::Mat& image)
{
  cv::Rect truncated_roi;
  truncated_roi.x = max(roi.x, 0);
  truncated_roi.y = max(roi.y, 0);
  truncated_roi.width =
      min(roi.width, image.size().width - roi.x);
  truncated_roi.height =
      min(roi.height, image.size().height - roi.y);
  return truncated_roi;
}
cv :: Rect computeTruncatedROIForImage ( const cv :: Rect & roi , const cv :: Mat & image ) { cv :: Rect truncated_roi ; truncated_roi . x = max ( roi . x , 0 ) ; truncated_roi . y = max ( roi . y , 0 ) ; truncated_roi . width = min ( roi . width , image . size ( ) . width - roi . x ) ; truncated_roi . height = min ( roi . height , image . size ( ) . height - roi . y ) ; return truncated_roi ; }
TODO: There is still a bug hiding in here.
TODO : There is still a bug hiding in here .