You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.4 KiB
49 lines
1.4 KiB
|
|
#include "Pin_QX_Det.h"
|
|
#include "CheckUtil.hpp"
|
|
#include <numeric>
|
|
#include <random>
|
|
#include "CheckErrorCodeDefine.hpp"
|
|
|
|
Pin_QX_Det::Pin_QX_Det(std::shared_ptr<DetLog> &log_ref)
|
|
: m_pdetlog(log_ref)
|
|
{
|
|
std::string m_strSavePath;
|
|
AI_Factory = AIFactory::GetInstance();
|
|
}
|
|
Pin_QX_Det::~Pin_QX_Det()
|
|
{
|
|
}
|
|
|
|
int Pin_QX_Det::GetPinMask(const cv::Mat &img, DetConfigResult *pDetConfig, Mat &mask)
|
|
{
|
|
std::shared_ptr<AIModel_Base> pSocket_Pin;
|
|
pSocket_Pin = AI_Factory->Pin_Loc;
|
|
cv::Size sz;
|
|
sz.width = pSocket_Pin->input_0.width;
|
|
sz.height = pSocket_Pin->input_0.height;
|
|
cv::Mat detImg;
|
|
cout<< pDetConfig->strChannel << ": " << "---Pin---";
|
|
cout << "imgSize: " << img.size() << ", " << "detImgSize: " << detImg.size() << ", " << "szSize: " << sz << endl;
|
|
|
|
cv::resize(img, detImg, sz);
|
|
int re = 0;
|
|
if (detImg.channels() != 1)
|
|
{
|
|
cv::cvtColor(detImg, detImg, cv::COLOR_RGB2GRAY);
|
|
}
|
|
|
|
re = pSocket_Pin->AIDet(detImg, mask);
|
|
if (re != 0)
|
|
{
|
|
m_pdetlog->AddCheckstr(PrintLevel_3, DET_LOG_LEVEL_3, "AI_Pin ", "AICheck_Pin----error %d ", re);
|
|
int re123 = 100 + re;
|
|
return re123;
|
|
}
|
|
|
|
if (pDetConfig->bSaveResultImg)
|
|
{
|
|
cv::imwrite(pDetConfig->strChannel +"_pin_" +"in.png", detImg);
|
|
cv::imwrite(pDetConfig->strChannel +"_pin_" +"out_mask.png", mask);
|
|
}
|
|
} |