diff options
author | Michael Welter <michael@welter-4d.de> | 2022-05-21 09:24:43 +0200 |
---|---|---|
committer | Michael Welter <michael@welter-4d.de> | 2022-05-21 09:41:13 +0200 |
commit | af50614c485fede08540e8844b726b434de76d83 (patch) | |
tree | 608303579cb93798962917b2e6fd67ccb8dc8c47 /tracker-neuralnet | |
parent | e3de47abc3eba2d1cebc94943a203623c6545f3f (diff) |
tracker/nn: Fix drawing of uninitialized face ROI buffer
Diffstat (limited to 'tracker-neuralnet')
-rw-r--r-- | tracker-neuralnet/ftnoir_tracker_neuralnet.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp b/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp index 5439b38e..c8aab8de 100644 --- a/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp +++ b/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp @@ -394,8 +394,8 @@ PoseEstimator::PoseEstimator(Ort::MemoryInfo &allocator_info, Ort::Session &&_se const cv::Size input_image_shape = get_input_image_shape(session_); - scaled_frame_ = cv::Mat(input_image_shape, CV_8U); - input_mat_ = cv::Mat(input_image_shape, CV_32F); + scaled_frame_ = cv::Mat(input_image_shape, CV_8U, cv::Scalar(0)); + input_mat_ = cv::Mat(input_image_shape, CV_32F, cv::Scalar(0.f)); { const std::int64_t input_shape[4] = { 1, 1, input_image_shape.height, input_image_shape.width }; @@ -587,12 +587,10 @@ std::optional<PoseEstimator::Face> PoseEstimator::run( cv::Mat PoseEstimator::last_network_input() const { + assert(!input_mat_.empty()); cv::Mat ret; - if (!input_mat_.empty()) - { - input_mat_.convertTo(ret, CV_8U, 255., 127.); - cv::cvtColor(ret, ret, cv::COLOR_GRAY2RGB); - } + input_mat_.convertTo(ret, CV_8U, 255., 127.); + cv::cvtColor(ret, ret, cv::COLOR_GRAY2RGB); return ret; } |