Skip to content
Snippets Groups Projects
Commit c264bd6b authored by Angel Santamaria-Navarro's avatar Angel Santamaria-Navarro
Browse files

Add ROIEnhanced and update buildImageProcessed function

parent dbb36759
No related branches found
No related tags found
No related merge requests found
......@@ -368,7 +368,7 @@ Eigen::Matrix3s normalizePointsIsotrop(const Eigen::MatrixXs& l_in, Eigen::Matri
return T;
}
cv::Mat buildImageProcessed(const cv::Mat& _img, const std::vector<KeyPointEnhanced>& _kps_e)
cv::Mat buildImageProcessed(const cv::Mat& _img, const std::vector<KeyPointEnhanced>& _kps_e, const std::vector<ROIEnhanced>& _rois_e)
{
// Check if image is RGB, if not convert it
cv::Mat img;
......@@ -377,6 +377,19 @@ cv::Mat buildImageProcessed(const cv::Mat& _img, const std::vector<KeyPointEnhan
else
img = _img.clone();
// Draw ROIs
for (auto roi_e : _rois_e)
{
if (roi_e.alpha > 0.0)
{
assert(roi_e.thick!=-1);
cv::Mat color(roi_e.roi.size(), CV_8UC3, roi_e.color);
cv::Mat roi = img(roi_e.roi);
cv::addWeighted(color, roi_e.alpha, roi, 1.0 - roi_e.alpha , 0.0, roi);
}
cv::rectangle(img, roi_e.roi, roi_e.color, roi_e.thick, 8, 0);
}
// Draw KeyPoints
for (auto kp_e : _kps_e)
{
......
......@@ -499,7 +499,30 @@ struct KeyPointEnhanced
bool is_inlier;
};
cv::Mat buildImageProcessed(const cv::Mat& _img, const std::vector<KeyPointEnhanced>& _kps_e);
struct ROIEnhanced
{
ROIEnhanced(const cv::Rect& _roi, const bool& _is_inlier) :
roi(_roi),
is_inlier(_is_inlier)
{
// Default values
thick = 1;
alpha = 0.1;
if (is_inlier)
color = cv::Scalar(0, 255, 0); // green
else
color = cv::Scalar(255, 0, 0); // blue
}
cv::Rect roi;
bool is_inlier;
int thick;
Scalar alpha;
cv::Scalar color;
};
cv::Mat buildImageProcessed(const cv::Mat& _img, const std::vector<KeyPointEnhanced>& _kps_e, const std::vector<ROIEnhanced>& _rois_e);
// end of draw functions //////////////////////////////////////////////////
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment