From 1e9c49ec9297477a519556bc30ffb4d96c3ee33f Mon Sep 17 00:00:00 2001 From: Jeffrey_Li <412100639@qq.com> Date: Thu, 17 Aug 2023 00:28:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=B8=8A=E6=B5=B7=E4=B8=BB?= =?UTF-8?q?=E6=9C=BA=E5=8E=82=E4=B8=80=E9=83=A8=E5=88=86=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cigarette/alg_jd.cpp | 14 ++++++++++++++ Cigarette/alg_jd.h | 1 + Cigarette/cigarette.cpp | 6 ++++++ 3 files changed, 21 insertions(+) diff --git a/Cigarette/alg_jd.cpp b/Cigarette/alg_jd.cpp index 0a27ba5..e78a034 100644 --- a/Cigarette/alg_jd.cpp +++ b/Cigarette/alg_jd.cpp @@ -143,6 +143,20 @@ int AlgJd::detect(cv::Mat& _frame, cv::Mat &out, std::vector >& vec_results) +{ + for (int i = 0; i < vec_results.size(); i++) + { + std::pair element; + cv::Rect TempRect = vec_results[i].second; + cv::Point position = cv::Point(TempRect.x + (TempRect.width / 2), TempRect.y + (TempRect.height / 2)); + cv::Mat topography = vec_in(TempRect); + cv::imshow("analyse", topography); + cv::waitKey(1); + } + +} + // Get the names of the output layers static std::vector getOutputsNames(const cv::dnn::Net& net) { diff --git a/Cigarette/alg_jd.h b/Cigarette/alg_jd.h index 9b3bc83..61c572d 100644 --- a/Cigarette/alg_jd.h +++ b/Cigarette/alg_jd.h @@ -17,6 +17,7 @@ class AlgJd bool test_detect_batcht(int shoot); int detect(cv::Mat& in, cv::Mat &out, std::vector > &results); void detect_batch(std::vector& vec_in, std::vector &vec_out, std::vector > > &vec_results); + void analyse(cv::Mat vec_in, std::vector > & vec_results); private: cv::dnn::Net net; }; diff --git a/Cigarette/cigarette.cpp b/Cigarette/cigarette.cpp index 776a9c4..95753ad 100644 --- a/Cigarette/cigarette.cpp +++ b/Cigarette/cigarette.cpp @@ -685,6 +685,9 @@ void Cigarette::TestImg() alg_test.detect(imagein, output,results); cv::imshow("TestImg", output); cv::waitKeyEx(1); +#ifdef __ExportData + alg_test.analyse(imagein, results); +#endif } void Cigarette::TestImgs() @@ -718,6 +721,9 @@ void Cigarette::TestImgs() cv::imshow("TestImg", output); int k = cv::waitKeyEx(1); if (k == 27)break;//ESC¼ü +#ifdef __ExportData + alg_test.analyse(imagein, results); +#endif QCoreApplication::processEvents(); } }