From 1751be75b0c3e22d2bdfa9cebdbf01995a83d2c0 Mon Sep 17 00:00:00 2001 From: gaotingquan Date: Wed, 24 Feb 2021 11:15:30 +0000 Subject: [PATCH] Fix the bug about raising error when reading image failed --- deploy/cpp_infer/src/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/deploy/cpp_infer/src/main.cpp b/deploy/cpp_infer/src/main.cpp index 49c68f55..5c9042d4 100644 --- a/deploy/cpp_infer/src/main.cpp +++ b/deploy/cpp_infer/src/main.cpp @@ -50,6 +50,11 @@ int main(int argc, char **argv) { cv::Mat srcimg = cv::imread(img_path, cv::IMREAD_COLOR); + if (!srcimg.data) { + std::cerr << "[ERROR] image read failed! image path: " << img_path << "\n"; + exit(1); + } + DBDetector det(config.det_model_dir, config.use_gpu, config.gpu_id, config.gpu_mem, config.cpu_math_library_num_threads, config.use_mkldnn, config.max_side_len, config.det_db_thresh, -- GitLab