上传上海主机厂一部分测试代码

main
Jeffrey_Li 1 year ago
parent 088f6fb1a0
commit 1e9c49ec92

@ -143,6 +143,20 @@ int AlgJd::detect(cv::Mat& _frame, cv::Mat &out, std::vector<std::pair<int, cv::
return results.size();
}
void AlgJd::analyse(cv::Mat vec_in, std::vector<std::pair<int, cv::Rect> >& vec_results)
{
for (int i = 0; i < vec_results.size(); i++)
{
std::pair<int, cv::Rect> 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<cv::String> getOutputsNames(const cv::dnn::Net& net)
{

@ -17,6 +17,7 @@ class AlgJd
bool test_detect_batcht(int shoot);
int detect(cv::Mat& in, cv::Mat &out, std::vector<std::pair<int, cv::Rect> > &results);
void detect_batch(std::vector<cv::Mat>& vec_in, std::vector<cv::Mat> &vec_out, std::vector<std::vector<std::pair<int, cv::Rect> > > &vec_results);
void analyse(cv::Mat vec_in, std::vector<std::pair<int, cv::Rect> > & vec_results);
private:
cv::dnn::Net net;
};

@ -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();
}
}

Loading…
Cancel
Save