From 860ee1619ae615eb600c43c75872a8ece4c9ce8e Mon Sep 17 00:00:00 2001 From: syyxsxx Date: Mon, 31 Aug 2020 15:46:07 +0800 Subject: [PATCH] fix mask --- deploy/cpp/src/paddlex.cpp | 4 ++-- deploy/cpp/src/visualize.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/deploy/cpp/src/paddlex.cpp b/deploy/cpp/src/paddlex.cpp index e737012..bd9b3ff 100644 --- a/deploy/cpp/src/paddlex.cpp +++ b/deploy/cpp/src/paddlex.cpp @@ -362,7 +362,7 @@ bool Model::predict(const cv::Mat& im, DetResult* result) { bin_mask, cv::Size(box->mask.shape[0], box->mask.shape[1])); cv::threshold(bin_mask, bin_mask, 0.5, 1, cv::THRESH_BINARY); - auto mask_int_begin = reinterpret_cast(bin_mask.data); + auto mask_int_begin = reinterpret_cast(bin_mask.data); auto mask_int_end = mask_int_begin + box->mask.shape[0] * box->mask.shape[1]; box->mask.data.assign(mask_int_begin, mask_int_end); @@ -546,7 +546,7 @@ bool Model::predict(const std::vector& im_batch, bin_mask, cv::Size(box->mask.shape[0], box->mask.shape[1])); cv::threshold(bin_mask, bin_mask, 0.5, 1, cv::THRESH_BINARY); - auto mask_int_begin = reinterpret_cast(bin_mask.data); + auto mask_int_begin = reinterpret_cast(bin_mask.data); auto mask_int_end = mask_int_begin + box->mask.shape[0] * box->mask.shape[1]; box->mask.data.assign(mask_int_begin, mask_int_end); diff --git a/deploy/cpp/src/visualize.cpp b/deploy/cpp/src/visualize.cpp index ec24f17..a0caf9c 100644 --- a/deploy/cpp/src/visualize.cpp +++ b/deploy/cpp/src/visualize.cpp @@ -84,8 +84,8 @@ cv::Mat Visualize(const cv::Mat& img, if (boxes[i].mask.data.size() == 0) { continue; } - cv::Mat bin_mask(boxes[i].mask.shape[0], - boxes[i].mask.shape[1], + cv::Mat bin_mask(boxes[i].mask.shape[1], + boxes[i].mask.shape[0], CV_8UC1, boxes[i].mask.data.data()); cv::Mat full_mask = cv::Mat::zeros(vis_img.size(), CV_8UC1); -- GitLab