添加配置相关功能

This commit is contained in:
wangxx1809 2024-05-31 11:49:20 +08:00
parent 67b2b0986a
commit 824164da5b
14 changed files with 512 additions and 504 deletions

View File

@ -126,16 +126,16 @@ void ServoManager::StopLog(AxisLog* lc)
EnterCriticalSection(&m_LogLoadCS);
m_IsLogReady = false;
if (!m_MoldStat.logLoadList.empty()) {
lc->m_MoldDataCount = m_MoldStat.logLoadList.size();
lc->m_MoldDataCount =(uint32_t) m_MoldStat.logLoadList.size();
lc->m_MoldData = new float[lc->m_MoldDataCount];
}
int moldFlag = 0;
uint32_t moldFlag = 0;
for (list<float>::iterator it = m_MoldStat.logLoadList.begin(); it != m_MoldStat.logLoadList.end(); it++) {
if (moldFlag < lc->m_MoldDataCount)lc->m_MoldData[moldFlag++] = (*it);
}
if (!m_LoadStat.logLoadList.empty()) {
lc->m_LoadDataCount = m_LoadStat.logLoadList.size();
lc->m_LoadDataCount = (uint32_t)m_LoadStat.logLoadList.size();
lc->m_LoadData = new float[lc->m_LoadDataCount];
}
int powderFlag = 0;
@ -144,10 +144,10 @@ void ServoManager::StopLog(AxisLog* lc)
}
if (!m_ArmStat.logLoadList.empty()) {
lc->m_ArmDataCount = m_ArmStat.logLoadList.size();
lc->m_ArmDataCount = (uint32_t)m_ArmStat.logLoadList.size();
lc->m_ArmData = new float[lc->m_ArmDataCount];
}
int armFlag = 0;
uint32_t armFlag = 0;
for (list<float>::iterator it = m_ArmStat.logLoadList.begin(); it != m_ArmStat.logLoadList.end(); it++) {
if (armFlag < lc->m_ArmDataCount)lc->m_ArmData[armFlag++] = (*it);
}
@ -156,7 +156,7 @@ void ServoManager::StopLog(AxisLog* lc)
lc->m_SupplyDataCount = m_SupplyStat.logLoadList.size();
lc->m_SupplyData = new float[lc->m_SupplyDataCount];
}
int supplyFlag = 0;
uint32_t supplyFlag = 0;
for (list<float>::iterator it = m_SupplyStat.logLoadList.begin(); it != m_SupplyStat.logLoadList.end(); it++) {
if (supplyFlag < lc->m_SupplyDataCount)lc->m_SupplyData[supplyFlag++] = (*it);
}

View File

@ -467,8 +467,7 @@ void ConfigManager::SendCfgToClients() {
m_MachineCfg.SendToClients(MACHINECFGPARAM);
m_FavoriteCfg.SendToClients(FAVORITECFGPARAM);
m_CameraCalibrationCfg.SendToClients(CAMERACALIBRATIONCFGPARAM);
m_MoldCfg->SendToClients(MOLDCFGPARAM);
m_LoadCfg->SendToClients(LOADCFGPARAM);
@ -476,7 +475,6 @@ void ConfigManager::SendCfgToClients() {
m_SupplyCfg->SendToClients(SUPPLYCFGPARAM);
m_CleanCfg->SendToClients(CLEANCFGPARAM);
m_EleCfg->SendToClients(ELECFGPARAM);
}
void ConfigManager::UpdateCfg(const ReadData& rd) {
@ -494,6 +492,10 @@ void ConfigManager::UpdateCfg(const ReadData& rd) {
m_InfraredTempCfg.Update(rd, INFRAREDTEMPCFGPARAM); break;
case MACHINECFG:
m_MachineCfg.Update(rd, MACHINECFGPARAM); break;
case FAVORITECFG:
m_FavoriteCfg.UpdateSub(rd); break;
case CAMERACALIBRATIONCFG:
m_CameraCalibrationCfg.Update(rd, CAMERACALIBRATIONCFGPARAM); break;
default:
break;
}

View File

@ -107,8 +107,8 @@ public:
//vector<LaserCfg*> *GetMatchLaser() { return &m_pLaserCfgDao->m_MatchLaser; }
//LaserCfgDao* GetLaserCfgDao() { return m_pLaserCfgDao; }
FavoriteCfg* GetFavoriteCfg() { return &m_FavoriteCfg; } //已传
FixPointDao* GetFixPointDao() { return m_ScannerControlCfgDao->GetFixPointDao(); }
CameraCalibrationCfg* GetCameraCalibrationCfg() { return &m_CameraCalibrationCfg; }
FixPointDao* GetFixPointDao() { return m_ScannerControlCfgDao->GetFixPointDao(); } //传
CameraCalibrationCfg* GetCameraCalibrationCfg() { return &m_CameraCalibrationCfg; } //传
void SaveCameraCalibrationCfg() {
SQLite::Transaction transaction(*m_pDB);
m_pBaseConfigDao->SaveCameraCalibrationCfg(m_CameraCalibrationCfg);

View File

@ -1,59 +1,58 @@
#include "CameraCalibrationCfg.h"
#include "CameraCalibrationCfg.h"
#include "BaseConfig.h"
#include "../../utils/StringHelper.h"
CameraCalibrationCfg::CameraCalibrationCfg()
: m_HadCalibration(new BoolData("HadCalibration"))
, m_CalibrationHPoints(new UIntData("CalibrationHPoints", u8"标定横向角点数",26))
, m_CalibrationVPoints(new UIntData("CalibrationVPoints", u8"标定纵向角点数",27))
, m_CalibrationGridHSize(new UIntData("CalibrationGridHSize", u8"标定方格横向尺寸",10))
, m_CalibrationGridVSize(new UIntData("CalibrationGridVSize", u8"标定方格纵向尺寸",10))
, m_CameraMatrix00(new DoubleData("CameraMatrix00"))
, m_CameraMatrix01(new DoubleData("CameraMatrix01"))
, m_CameraMatrix02(new DoubleData("CameraMatrix02"))
, m_CameraMatrix10(new DoubleData("CameraMatrix10"))
, m_CameraMatrix11(new DoubleData("CameraMatrix11"))
, m_CameraMatrix12(new DoubleData("CameraMatrix12"))
, m_CameraMatrix20(new DoubleData("CameraMatrix20"))
, m_CameraMatrix21(new DoubleData("CameraMatrix21"))
, m_CameraMatrix22(new DoubleData("CameraMatrix22"))
, m_DistCoeffs0(new DoubleData("DistCoeffs0"))
, m_DistCoeffs1(new DoubleData("DistCoeffs1"))
, m_DistCoeffs2(new DoubleData("DistCoeffs2"))
, m_DistCoeffs3(new DoubleData("DistCoeffs3"))
, m_DistCoeffs4(new DoubleData("DistCoeffs4"))
, m_FittingMagX(new UIntData("FittingMagX", u8"放大倍数",20))
, m_ImageTopLeftX(new IntData("ImageTopLeftX"))
, m_ImageTopLeftY(new IntData("ImageTopLeftY"))
, m_ImageTopRightX(new IntData("ImageTopRightX"))
, m_ImageTopRightY(new IntData("ImageTopRightY"))
, m_ImageBottomLeftX(new IntData("ImageBottomLeftX"))
, m_ImageBottomLeftY(new IntData("ImageBottomLeftY"))
, m_ImageBottomRightX(new IntData("ImageBottomRightX"))
, m_ImageBottomRightY(new IntData("ImageBottomRightY"))
, m_PlatformTopLeftX(new IntData("PlatformTopLeftX"))
, m_PlatformTopLeftY(new IntData("PlatformTopLeftY"))
, m_PlatformTopRightX(new IntData("PlatformTopRightX"))
, m_PlatformTopRightY(new IntData("PlatformTopRightY"))
, m_PlatformBottomLeftX(new IntData("PlatformBottomLeftX"))
, m_PlatformBottomLeftY(new IntData("PlatformBottomLeftY"))
, m_PlatformBottomRightX(new IntData("PlatformBottomRightX"))
, m_PlatformBottomRightY(new IntData("PlatformBottomRightY"))
, m_BinaryThresholdOffset(new IntData("BinaryThresholdOffset", u8"", 25))
, m_GrayRef(new IntData("GrayRef", u8"", 145))
, m_MagnifyScale(new UIntData("MagnifyScale", u8"", 10))
, m_MatchRatio(new FloatData("MatchRatio",u8"", 0.9f))
, m_BlackFace(new BoolData("BlackFace", u8"", true))
, m_ShowBinImage(new BoolData("ShowBinImage"))
, m_ShowCorners(new BoolData("ShowCorners"))
, m_ShowAssist(new BoolData("ShowAssist"))
, m_CoverImageJoin(new BoolData("CoverImageJoin"))
{
m_HadCalibration = false;
m_CalibrationHPoints = 26;
m_CalibrationVPoints = 27;
m_CalibrationGridHSize = 10;
m_CalibrationGridVSize = 10;
m_CameraMatrix00=0.0;
m_CameraMatrix01=0.0;
m_CameraMatrix02=0.0;
m_CameraMatrix10=0.0;
m_CameraMatrix11=0.0;
m_CameraMatrix12=0.0;
m_CameraMatrix20=0.0;
m_CameraMatrix21=0.0;
m_CameraMatrix22=0.0;
m_DistCoeffs0=0.0;
m_DistCoeffs1=0.0;
m_DistCoeffs2=0.0;
m_DistCoeffs3=0.0;
m_DistCoeffs4=0.0;
m_FittingMagX = 20;
m_ImageTopLeftX=0;
m_ImageTopLeftY= 0;
m_ImageTopRightX= 0;
m_ImageTopRightY= 0;
m_ImageBottomLeftX= 0;
m_ImageBottomLeftY= 0;
m_ImageBottomRightX= 0;
m_ImageBottomRightY= 0;
m_PlatformTopLeftX=0;
m_PlatformTopLeftY=0;
m_PlatformTopRightX=0;
m_PlatformTopRightY=0;
m_PlatformBottomLeftX=0;
m_PlatformBottomLeftY=0;
m_PlatformBottomRightX=0;
m_PlatformBottomRightY=0;
m_GrayRef = 145;
m_BinaryThresholdOffset = 25;
m_MagnifyScale = 10;
m_MatchRatio = 0.9f;
m_BlackFace = true;
m_ShowBinImage = false;
m_ShowAssist = false;
m_CoverImageJoin = false;
size_t ptrSize = sizeof(nullptr); //指针大小
void* startPtr = &m_startFlag + 1;
size_t count = ((size_t)&m_endFlag - (size_t)startPtr) / ptrSize;
InsertMp(startPtr, count);
}
@ -78,271 +77,271 @@ void CameraCalibrationCfg::GetUpdateSql(vector<string>& ups)
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
m_HadCalibration?"1":"0",
m_HadCalibration->GetValue() ? "1" : "0",
strtail.c_str(), CameraCalibrationCfg::FIELD_HAD_CALIBRATION.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_CalibrationHPoints).c_str(),
to_string(m_CalibrationHPoints->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_CALIBRATION_H_POINTS.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_CalibrationVPoints).c_str(),
to_string(m_CalibrationVPoints->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_CALIBRATION_V_POINTS.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_CalibrationGridHSize).c_str(),
to_string(m_CalibrationGridHSize->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_CALIBRATION_GRID_H_SIZE.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_CalibrationGridVSize).c_str(),
to_string(m_CalibrationGridVSize->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_CALIBRATION_GRID_V_SIZE.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
StringHelper::Double2String(m_CameraMatrix00).c_str(),
StringHelper::Double2String(m_CameraMatrix00->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_00.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
StringHelper::Double2String(m_CameraMatrix01).c_str(),
StringHelper::Double2String(m_CameraMatrix01->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_01.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
StringHelper::Double2String(m_CameraMatrix02).c_str(),
StringHelper::Double2String(m_CameraMatrix02->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_02.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
StringHelper::Double2String(m_CameraMatrix10).c_str(),
StringHelper::Double2String(m_CameraMatrix10->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_10.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
StringHelper::Double2String(m_CameraMatrix11).c_str(),
StringHelper::Double2String(m_CameraMatrix11->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_11.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
StringHelper::Double2String(m_CameraMatrix12).c_str(),
StringHelper::Double2String(m_CameraMatrix12->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_12.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
StringHelper::Double2String(m_CameraMatrix20).c_str(),
StringHelper::Double2String(m_CameraMatrix20->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_20.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
StringHelper::Double2String(m_CameraMatrix21).c_str(),
StringHelper::Double2String(m_CameraMatrix21->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_21.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
StringHelper::Double2String(m_CameraMatrix22).c_str(),
StringHelper::Double2String(m_CameraMatrix22->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_22.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
StringHelper::Double2String(m_DistCoeffs0,"%.20f").c_str(),
StringHelper::Double2String(m_DistCoeffs0->GetValue(),"%.20f").c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_DIST_COEFFS_0.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
StringHelper::Double2String(m_DistCoeffs1, "%.20f").c_str(),
StringHelper::Double2String(m_DistCoeffs1->GetValue(), "%.20f").c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_DIST_COEFFS_1.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
StringHelper::Double2String(m_DistCoeffs2, "%.20f").c_str(),
StringHelper::Double2String(m_DistCoeffs2->GetValue(), "%.20f").c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_DIST_COEFFS_2.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
StringHelper::Double2String(m_DistCoeffs3, "%.20f").c_str(),
StringHelper::Double2String(m_DistCoeffs3->GetValue(), "%.20f").c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_DIST_COEFFS_3.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
StringHelper::Double2String(m_DistCoeffs4, "%.20f").c_str(),
StringHelper::Double2String(m_DistCoeffs4->GetValue(), "%.20f").c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_DIST_COEFFS_4.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_FittingMagX).c_str(),
to_string(m_FittingMagX->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_FITTING_MAG_X.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_ImageTopLeftX).c_str(),
to_string(m_ImageTopLeftX->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_IMAGE_TOP_LEFT_X.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_ImageTopLeftY).c_str(),
to_string(m_ImageTopLeftY->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_IMAGE_TOP_LEFT_Y.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_ImageTopRightX).c_str(),
to_string(m_ImageTopRightX->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_IMAGE_TOP_RIGHT_X.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_ImageTopRightY).c_str(),
to_string(m_ImageTopRightY->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_IMAGE_TOP_RIGHT_Y.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_ImageBottomLeftX).c_str(),
to_string(m_ImageBottomLeftX->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_LEFT_X.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_ImageBottomLeftY).c_str(),
to_string(m_ImageBottomLeftY->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_LEFT_Y.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_ImageBottomRightX).c_str(),
to_string(m_ImageBottomRightX->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_RIGHT_X.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_ImageBottomRightY).c_str(),
to_string(m_ImageBottomRightY->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_RIGHT_Y.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_PlatformTopLeftX).c_str(),
to_string(m_PlatformTopLeftX->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_TOP_LEFT_X.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_PlatformTopLeftY).c_str(),
to_string(m_PlatformTopLeftY->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_TOP_LEFT_Y.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_PlatformTopRightX).c_str(),
to_string(m_PlatformTopRightX->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_TOP_RIGHT_X.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_PlatformTopRightY).c_str(),
to_string(m_PlatformTopRightY->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_TOP_RIGHT_Y.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_PlatformBottomLeftX).c_str(),
to_string(m_PlatformBottomLeftX->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_LEFT_X.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_PlatformBottomLeftY).c_str(),
to_string(m_PlatformBottomLeftY->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_LEFT_Y.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_PlatformBottomRightX).c_str(),
to_string(m_PlatformBottomRightX->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_RIGHT_X.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_PlatformBottomRightY).c_str(),
to_string(m_PlatformBottomRightY->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_RIGHT_Y.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_BinaryThresholdOffset).c_str(),
to_string(m_BinaryThresholdOffset->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_BINARY_THRESHOLD_OFFSET.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_GrayRef).c_str(),
to_string(m_GrayRef->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_GRAY_REF.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_MagnifyScale).c_str(),
to_string(m_MagnifyScale->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_MAGNIFY_SCALE.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
to_string(m_MatchRatio).c_str(),
to_string(m_MatchRatio->GetValue()).c_str(),
strtail.c_str(), CameraCalibrationCfg::FIELD_MATCH_RATIO.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
m_BlackFace?"1":"0",
m_BlackFace->GetValue() ?"1":"0",
strtail.c_str(), CameraCalibrationCfg::FIELD_BLACK_FACE.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
m_ShowBinImage ? "1" : "0",
m_ShowBinImage->GetValue() ? "1" : "0",
strtail.c_str(), CameraCalibrationCfg::FIELD_SHOW_BIN_IMAGE.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
m_ShowCorners ? "1" : "0",
m_ShowCorners->GetValue() ? "1" : "0",
strtail.c_str(), CameraCalibrationCfg::FIELD_SHOW_CORNERS.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
m_ShowAssist ? "1" : "0",
m_ShowAssist->GetValue() ? "1" : "0",
strtail.c_str(), CameraCalibrationCfg::FIELD_SHOW_ASSIST.c_str());
ups.push_back(buffer);
sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
strhead.c_str(),
m_CoverImageJoin ? "1" : "0",
m_CoverImageJoin->GetValue() ? "1" : "0",
strtail.c_str(), CameraCalibrationCfg::FIELD_COVER_IMAGE_JOIN.c_str());
ups.push_back(buffer);
}

View File

@ -1,9 +1,12 @@
#pragma once
#pragma once
#include <string>
#include <vector>
#include "../Controller/Base.h"
using namespace std;
class CameraCalibrationCfg
#pragma pack(1)
class CameraCalibrationCfg : public Base
{
public:
CameraCalibrationCfg();
@ -11,58 +14,60 @@ public:
void GetUpdateSql(vector<string>& ups);
public:
bool m_HadCalibration;
char m_startFlag;
BoolData* m_HadCalibration;
unsigned int m_CalibrationHPoints; //标定横向角点数
unsigned int m_CalibrationVPoints; //标定纵向角点数
unsigned int m_CalibrationGridHSize; //标定方格横向尺寸
unsigned int m_CalibrationGridVSize; //标定方格纵向尺寸
UIntData* m_CalibrationHPoints; //标定横向角点数
UIntData* m_CalibrationVPoints; //标定纵向角点数
UIntData* m_CalibrationGridHSize; //标定方格横向尺寸
UIntData* m_CalibrationGridVSize; //标定方格纵向尺寸
double m_CameraMatrix00;
double m_CameraMatrix01;
double m_CameraMatrix02;
double m_CameraMatrix10;
double m_CameraMatrix11;
double m_CameraMatrix12;
double m_CameraMatrix20;
double m_CameraMatrix21;
double m_CameraMatrix22;
DoubleData* m_CameraMatrix00;
DoubleData* m_CameraMatrix01;
DoubleData* m_CameraMatrix02;
DoubleData* m_CameraMatrix10;
DoubleData* m_CameraMatrix11;
DoubleData* m_CameraMatrix12;
DoubleData* m_CameraMatrix20;
DoubleData* m_CameraMatrix21;
DoubleData* m_CameraMatrix22;
double m_DistCoeffs0;
double m_DistCoeffs1;
double m_DistCoeffs2;
double m_DistCoeffs3;
double m_DistCoeffs4;
DoubleData* m_DistCoeffs0;
DoubleData* m_DistCoeffs1;
DoubleData* m_DistCoeffs2;
DoubleData* m_DistCoeffs3;
DoubleData* m_DistCoeffs4;
unsigned int m_FittingMagX; //放大倍数
UIntData* m_FittingMagX; //放大倍数
int m_ImageTopLeftX;
int m_ImageTopLeftY;
int m_ImageTopRightX;
int m_ImageTopRightY;
int m_ImageBottomLeftX;
int m_ImageBottomLeftY;
int m_ImageBottomRightX;
int m_ImageBottomRightY;
IntData* m_ImageTopLeftX;
IntData* m_ImageTopLeftY;
IntData* m_ImageTopRightX;
IntData* m_ImageTopRightY;
IntData* m_ImageBottomLeftX;
IntData* m_ImageBottomLeftY;
IntData* m_ImageBottomRightX;
IntData* m_ImageBottomRightY;
int m_PlatformTopLeftX;
int m_PlatformTopLeftY;
int m_PlatformTopRightX;
int m_PlatformTopRightY;
int m_PlatformBottomLeftX;
int m_PlatformBottomLeftY;
int m_PlatformBottomRightX;
int m_PlatformBottomRightY;
IntData* m_PlatformTopLeftX;
IntData* m_PlatformTopLeftY;
IntData* m_PlatformTopRightX;
IntData* m_PlatformTopRightY;
IntData* m_PlatformBottomLeftX;
IntData* m_PlatformBottomLeftY;
IntData* m_PlatformBottomRightX;
IntData* m_PlatformBottomRightY;
int m_BinaryThresholdOffset;
int m_GrayRef;
unsigned int m_MagnifyScale;
float m_MatchRatio;
bool m_BlackFace;
bool m_ShowBinImage;
bool m_ShowCorners;
bool m_ShowAssist;
bool m_CoverImageJoin;
IntData* m_BinaryThresholdOffset;
IntData* m_GrayRef;
UIntData* m_MagnifyScale;
FloatData* m_MatchRatio;
BoolData* m_BlackFace;
BoolData* m_ShowBinImage;
BoolData* m_ShowCorners;
BoolData* m_ShowAssist;
BoolData* m_CoverImageJoin;
char m_endFlag;
public:
static string CONFIG_NAME;
static string FIELD_HAD_CALIBRATION;
@ -113,4 +118,4 @@ public:
static string FIELD_SHOW_ASSIST;
static string FIELD_COVER_IMAGE_JOIN;
};
#pragma pack()

View File

@ -2537,361 +2537,361 @@ void BaseConfigDao::FindCameraCalibrationCfg(CameraCalibrationCfg& cfg)
vector<string> needins;
if (valuemap.find(CameraCalibrationCfg::FIELD_HAD_CALIBRATION) != valuemap.end()) {
cfg.m_HadCalibration = stoi(valuemap[CameraCalibrationCfg::FIELD_HAD_CALIBRATION]) > 0 ? true : false;
cfg.m_HadCalibration ->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_HAD_CALIBRATION]) > 0 ? true : false);
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_HAD_CALIBRATION.c_str(), cfg.m_HadCalibration ? "1" : "0");
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_HAD_CALIBRATION.c_str(), cfg.m_HadCalibration->GetValue() ? "1" : "0");
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_CALIBRATION_H_POINTS) != valuemap.end()) {
cfg.m_CalibrationHPoints = stoul(valuemap[CameraCalibrationCfg::FIELD_CALIBRATION_H_POINTS]);
cfg.m_CalibrationHPoints->SetValue(stoul(valuemap[CameraCalibrationCfg::FIELD_CALIBRATION_H_POINTS]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CALIBRATION_H_POINTS.c_str(), to_string(cfg.m_CalibrationHPoints).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CALIBRATION_H_POINTS.c_str(), to_string(cfg.m_CalibrationHPoints->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_CALIBRATION_V_POINTS) != valuemap.end()) {
cfg.m_CalibrationVPoints = stoul(valuemap[CameraCalibrationCfg::FIELD_CALIBRATION_V_POINTS]);
cfg.m_CalibrationVPoints->SetValue(stoul(valuemap[CameraCalibrationCfg::FIELD_CALIBRATION_V_POINTS]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CALIBRATION_V_POINTS.c_str(), to_string(cfg.m_CalibrationVPoints).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CALIBRATION_V_POINTS.c_str(), to_string(cfg.m_CalibrationVPoints->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_CALIBRATION_GRID_H_SIZE) != valuemap.end()) {
cfg.m_CalibrationGridHSize = stoul(valuemap[CameraCalibrationCfg::FIELD_CALIBRATION_GRID_H_SIZE]);
cfg.m_CalibrationGridHSize->SetValue(stoul(valuemap[CameraCalibrationCfg::FIELD_CALIBRATION_GRID_H_SIZE]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CALIBRATION_GRID_H_SIZE.c_str(), to_string(cfg.m_CalibrationGridHSize).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CALIBRATION_GRID_H_SIZE.c_str(), to_string(cfg.m_CalibrationGridHSize->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_CALIBRATION_GRID_V_SIZE) != valuemap.end()) {
cfg.m_CalibrationGridVSize = stoul(valuemap[CameraCalibrationCfg::FIELD_CALIBRATION_GRID_V_SIZE]);
cfg.m_CalibrationGridVSize->SetValue(stoul(valuemap[CameraCalibrationCfg::FIELD_CALIBRATION_GRID_V_SIZE]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CALIBRATION_GRID_V_SIZE.c_str(), to_string(cfg.m_CalibrationGridVSize).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CALIBRATION_GRID_V_SIZE.c_str(), to_string(cfg.m_CalibrationGridVSize->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_CAMERA_MATRIX_00) != valuemap.end()) {
cfg.m_CameraMatrix00 = stod(valuemap[CameraCalibrationCfg::FIELD_CAMERA_MATRIX_00]);
cfg.m_CameraMatrix00->SetValue(stod(valuemap[CameraCalibrationCfg::FIELD_CAMERA_MATRIX_00]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_00.c_str(), to_string(cfg.m_CameraMatrix00).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_00.c_str(), to_string(cfg.m_CameraMatrix00->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_CAMERA_MATRIX_01) != valuemap.end()) {
cfg.m_CameraMatrix01 = stod(valuemap[CameraCalibrationCfg::FIELD_CAMERA_MATRIX_01]);
cfg.m_CameraMatrix01->SetValue(stod(valuemap[CameraCalibrationCfg::FIELD_CAMERA_MATRIX_01]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_01.c_str(), to_string(cfg.m_CameraMatrix01).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_01.c_str(), to_string(cfg.m_CameraMatrix01->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_CAMERA_MATRIX_02) != valuemap.end()) {
cfg.m_CameraMatrix02 = stod(valuemap[CameraCalibrationCfg::FIELD_CAMERA_MATRIX_02]);
cfg.m_CameraMatrix02->SetValue(stod(valuemap[CameraCalibrationCfg::FIELD_CAMERA_MATRIX_02]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_02.c_str(), to_string(cfg.m_CameraMatrix02).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_02.c_str(), to_string(cfg.m_CameraMatrix02->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_CAMERA_MATRIX_10) != valuemap.end()) {
cfg.m_CameraMatrix10 = stod(valuemap[CameraCalibrationCfg::FIELD_CAMERA_MATRIX_10]);
cfg.m_CameraMatrix10->SetValue(stod(valuemap[CameraCalibrationCfg::FIELD_CAMERA_MATRIX_10]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_10.c_str(), to_string(cfg.m_CameraMatrix10).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_10.c_str(), to_string(cfg.m_CameraMatrix10->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_CAMERA_MATRIX_11) != valuemap.end()) {
cfg.m_CameraMatrix11 = stod(valuemap[CameraCalibrationCfg::FIELD_CAMERA_MATRIX_11]);
cfg.m_CameraMatrix11->SetValue(stod(valuemap[CameraCalibrationCfg::FIELD_CAMERA_MATRIX_11]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_11.c_str(), to_string(cfg.m_CameraMatrix11).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_11.c_str(), to_string(cfg.m_CameraMatrix11->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_CAMERA_MATRIX_12) != valuemap.end()) {
cfg.m_CameraMatrix12 = stod(valuemap[CameraCalibrationCfg::FIELD_CAMERA_MATRIX_12]);
cfg.m_CameraMatrix12->SetValue(stod(valuemap[CameraCalibrationCfg::FIELD_CAMERA_MATRIX_12]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_12.c_str(), to_string(cfg.m_CameraMatrix12).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_12.c_str(), to_string(cfg.m_CameraMatrix12->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_CAMERA_MATRIX_20) != valuemap.end()) {
cfg.m_CameraMatrix20 = stod(valuemap[CameraCalibrationCfg::FIELD_CAMERA_MATRIX_20]);
cfg.m_CameraMatrix20->SetValue(stod(valuemap[CameraCalibrationCfg::FIELD_CAMERA_MATRIX_20]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_20.c_str(), to_string(cfg.m_CameraMatrix20).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_20.c_str(), to_string(cfg.m_CameraMatrix20->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_CAMERA_MATRIX_21) != valuemap.end()) {
cfg.m_CameraMatrix21 = stod(valuemap[CameraCalibrationCfg::FIELD_CAMERA_MATRIX_21]);
cfg.m_CameraMatrix21->SetValue(stod(valuemap[CameraCalibrationCfg::FIELD_CAMERA_MATRIX_21]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_21.c_str(), to_string(cfg.m_CameraMatrix21).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_21.c_str(), to_string(cfg.m_CameraMatrix21->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_CAMERA_MATRIX_22) != valuemap.end()) {
cfg.m_CameraMatrix22 = stod(valuemap[CameraCalibrationCfg::FIELD_CAMERA_MATRIX_22]);
cfg.m_CameraMatrix22->SetValue(stod(valuemap[CameraCalibrationCfg::FIELD_CAMERA_MATRIX_22]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_22.c_str(), to_string(cfg.m_CameraMatrix22).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_CAMERA_MATRIX_22.c_str(), to_string(cfg.m_CameraMatrix22->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_DIST_COEFFS_0) != valuemap.end()) {
cfg.m_DistCoeffs0 = stod(valuemap[CameraCalibrationCfg::FIELD_DIST_COEFFS_0]);
cfg.m_DistCoeffs0->SetValue(stod(valuemap[CameraCalibrationCfg::FIELD_DIST_COEFFS_0]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_DIST_COEFFS_0.c_str(), to_string(cfg.m_DistCoeffs0).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_DIST_COEFFS_0.c_str(), to_string(cfg.m_DistCoeffs0->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_DIST_COEFFS_1) != valuemap.end()) {
cfg.m_DistCoeffs1 = stod(valuemap[CameraCalibrationCfg::FIELD_DIST_COEFFS_1]);
cfg.m_DistCoeffs1->SetValue(stod(valuemap[CameraCalibrationCfg::FIELD_DIST_COEFFS_1]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_DIST_COEFFS_1.c_str(), to_string(cfg.m_DistCoeffs1).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_DIST_COEFFS_1.c_str(), to_string(cfg.m_DistCoeffs1->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_DIST_COEFFS_2) != valuemap.end()) {
cfg.m_DistCoeffs2 = stod(valuemap[CameraCalibrationCfg::FIELD_DIST_COEFFS_2]);
cfg.m_DistCoeffs2->SetValue(stod(valuemap[CameraCalibrationCfg::FIELD_DIST_COEFFS_2]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_DIST_COEFFS_2.c_str(), to_string(cfg.m_DistCoeffs2).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_DIST_COEFFS_2.c_str(), to_string(cfg.m_DistCoeffs2->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_DIST_COEFFS_3) != valuemap.end()) {
cfg.m_DistCoeffs3 = stod(valuemap[CameraCalibrationCfg::FIELD_DIST_COEFFS_3]);
cfg.m_DistCoeffs3->SetValue(stod(valuemap[CameraCalibrationCfg::FIELD_DIST_COEFFS_3]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_DIST_COEFFS_3.c_str(), to_string(cfg.m_DistCoeffs3).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_DIST_COEFFS_3.c_str(), to_string(cfg.m_DistCoeffs3->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_DIST_COEFFS_4) != valuemap.end()) {
cfg.m_DistCoeffs4 = stod(valuemap[CameraCalibrationCfg::FIELD_DIST_COEFFS_4]);
cfg.m_DistCoeffs4->SetValue(stod(valuemap[CameraCalibrationCfg::FIELD_DIST_COEFFS_4]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_DIST_COEFFS_4.c_str(), to_string(cfg.m_DistCoeffs4).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_DIST_COEFFS_4.c_str(), to_string(cfg.m_DistCoeffs4->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_FITTING_MAG_X) != valuemap.end()) {
cfg.m_FittingMagX = stoul(valuemap[CameraCalibrationCfg::FIELD_FITTING_MAG_X]);
cfg.m_FittingMagX->SetValue(stoul(valuemap[CameraCalibrationCfg::FIELD_FITTING_MAG_X]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_FITTING_MAG_X.c_str(), to_string(cfg.m_FittingMagX).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_FITTING_MAG_X.c_str(), to_string(cfg.m_FittingMagX->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_IMAGE_TOP_LEFT_X) != valuemap.end()) {
cfg.m_ImageTopLeftX = stoi(valuemap[CameraCalibrationCfg::FIELD_IMAGE_TOP_LEFT_X]);
cfg.m_ImageTopLeftX->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_IMAGE_TOP_LEFT_X]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_IMAGE_TOP_LEFT_X.c_str(), to_string(cfg.m_ImageTopLeftX).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_IMAGE_TOP_LEFT_X.c_str(), to_string(cfg.m_ImageTopLeftX->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_IMAGE_TOP_LEFT_Y) != valuemap.end()) {
cfg.m_ImageTopLeftY = stoi(valuemap[CameraCalibrationCfg::FIELD_IMAGE_TOP_LEFT_Y]);
cfg.m_ImageTopLeftY->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_IMAGE_TOP_LEFT_Y]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_IMAGE_TOP_LEFT_Y.c_str(), to_string(cfg.m_ImageTopLeftY).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_IMAGE_TOP_LEFT_Y.c_str(), to_string(cfg.m_ImageTopLeftY->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_IMAGE_TOP_RIGHT_X) != valuemap.end()) {
cfg.m_ImageTopRightX = stoi(valuemap[CameraCalibrationCfg::FIELD_IMAGE_TOP_RIGHT_X]);
cfg.m_ImageTopRightX->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_IMAGE_TOP_RIGHT_X]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_IMAGE_TOP_RIGHT_X.c_str(), to_string(cfg.m_ImageTopRightX).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_IMAGE_TOP_RIGHT_X.c_str(), to_string(cfg.m_ImageTopRightX->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_IMAGE_TOP_RIGHT_Y) != valuemap.end()) {
cfg.m_ImageTopRightY = stoi(valuemap[CameraCalibrationCfg::FIELD_IMAGE_TOP_RIGHT_Y]);
cfg.m_ImageTopRightY->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_IMAGE_TOP_RIGHT_Y]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_IMAGE_TOP_RIGHT_Y.c_str(), to_string(cfg.m_ImageTopRightY).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_IMAGE_TOP_RIGHT_Y.c_str(), to_string(cfg.m_ImageTopRightY->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_LEFT_X) != valuemap.end()) {
cfg.m_ImageBottomLeftX = stoi(valuemap[CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_LEFT_X]);
cfg.m_ImageBottomLeftX->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_LEFT_X]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_LEFT_X.c_str(), to_string(cfg.m_ImageBottomLeftX).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_LEFT_X.c_str(), to_string(cfg.m_ImageBottomLeftX->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_LEFT_Y) != valuemap.end()) {
cfg.m_ImageBottomLeftY = stoi(valuemap[CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_LEFT_Y]);
cfg.m_ImageBottomLeftY->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_LEFT_Y]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_LEFT_Y.c_str(), to_string(cfg.m_ImageBottomLeftY).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_LEFT_Y.c_str(), to_string(cfg.m_ImageBottomLeftY->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_RIGHT_X) != valuemap.end()) {
cfg.m_ImageBottomRightX = stoi(valuemap[CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_RIGHT_X]);
cfg.m_ImageBottomRightX->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_RIGHT_X]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_RIGHT_X.c_str(), to_string(cfg.m_ImageBottomRightX).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_RIGHT_X.c_str(), to_string(cfg.m_ImageBottomRightX->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_RIGHT_Y) != valuemap.end()) {
cfg.m_ImageBottomRightY = stoi(valuemap[CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_RIGHT_Y]);
cfg.m_ImageBottomRightY->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_RIGHT_Y]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_RIGHT_Y.c_str(), to_string(cfg.m_ImageBottomRightY).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_IMAGE_BOTTOM_RIGHT_Y.c_str(), to_string(cfg.m_ImageBottomRightY->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_PLATFORM_TOP_LEFT_X) != valuemap.end()) {
cfg.m_PlatformTopLeftX = stoi(valuemap[CameraCalibrationCfg::FIELD_PLATFORM_TOP_LEFT_X]);
cfg.m_PlatformTopLeftX->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_PLATFORM_TOP_LEFT_X]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_TOP_LEFT_X.c_str(), to_string(cfg.m_PlatformTopLeftX).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_TOP_LEFT_X.c_str(), to_string(cfg.m_PlatformTopLeftX->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_PLATFORM_TOP_LEFT_Y) != valuemap.end()) {
cfg.m_PlatformTopLeftY = stoi(valuemap[CameraCalibrationCfg::FIELD_PLATFORM_TOP_LEFT_Y]);
cfg.m_PlatformTopLeftY->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_PLATFORM_TOP_LEFT_Y]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_TOP_LEFT_Y.c_str(), to_string(cfg.m_PlatformTopLeftY).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_TOP_LEFT_Y.c_str(), to_string(cfg.m_PlatformTopLeftY->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_PLATFORM_TOP_RIGHT_X) != valuemap.end()) {
cfg.m_PlatformTopRightX = stoi(valuemap[CameraCalibrationCfg::FIELD_PLATFORM_TOP_RIGHT_X]);
cfg.m_PlatformTopRightX->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_PLATFORM_TOP_RIGHT_X]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_TOP_RIGHT_X.c_str(), to_string(cfg.m_PlatformTopRightX).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_TOP_RIGHT_X.c_str(), to_string(cfg.m_PlatformTopRightX->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_PLATFORM_TOP_RIGHT_Y) != valuemap.end()) {
cfg.m_PlatformTopRightY = stoi(valuemap[CameraCalibrationCfg::FIELD_PLATFORM_TOP_RIGHT_Y]);
cfg.m_PlatformTopRightY->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_PLATFORM_TOP_RIGHT_Y]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_TOP_RIGHT_Y.c_str(), to_string(cfg.m_PlatformTopRightY).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_TOP_RIGHT_Y.c_str(), to_string(cfg.m_PlatformTopRightY->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_LEFT_X) != valuemap.end()) {
cfg.m_PlatformBottomLeftX = stoi(valuemap[CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_LEFT_X]);
cfg.m_PlatformBottomLeftX->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_LEFT_X]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_LEFT_X.c_str(), to_string(cfg.m_PlatformBottomLeftX).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_LEFT_X.c_str(), to_string(cfg.m_PlatformBottomLeftX->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_LEFT_Y) != valuemap.end()) {
cfg.m_PlatformBottomLeftY = stoi(valuemap[CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_LEFT_Y]);
cfg.m_PlatformBottomLeftY->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_LEFT_Y]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_LEFT_Y.c_str(), to_string(cfg.m_PlatformBottomLeftY).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_LEFT_Y.c_str(), to_string(cfg.m_PlatformBottomLeftY->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_RIGHT_X) != valuemap.end()) {
cfg.m_PlatformBottomRightX = stoi(valuemap[CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_RIGHT_X]);
cfg.m_PlatformBottomRightX->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_RIGHT_X]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_RIGHT_X.c_str(), to_string(cfg.m_PlatformBottomRightX).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_RIGHT_X.c_str(), to_string(cfg.m_PlatformBottomRightX->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_RIGHT_Y) != valuemap.end()) {
cfg.m_PlatformBottomRightY = stoi(valuemap[CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_RIGHT_Y]);
cfg.m_PlatformBottomRightY->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_RIGHT_Y]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_RIGHT_Y.c_str(), to_string(cfg.m_PlatformBottomRightY).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_PLATFORM_BOTTOM_RIGHT_Y.c_str(), to_string(cfg.m_PlatformBottomRightY->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_BINARY_THRESHOLD_OFFSET) != valuemap.end()) {
cfg.m_BinaryThresholdOffset = stoi(valuemap[CameraCalibrationCfg::FIELD_BINARY_THRESHOLD_OFFSET]);
cfg.m_BinaryThresholdOffset->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_BINARY_THRESHOLD_OFFSET]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_BINARY_THRESHOLD_OFFSET.c_str(), to_string(cfg.m_BinaryThresholdOffset).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_BINARY_THRESHOLD_OFFSET.c_str(), to_string(cfg.m_BinaryThresholdOffset->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_GRAY_REF) != valuemap.end()) {
cfg.m_GrayRef = stoi(valuemap[CameraCalibrationCfg::FIELD_GRAY_REF]);
cfg.m_GrayRef->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_GRAY_REF]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_GRAY_REF.c_str(), to_string(cfg.m_GrayRef).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_GRAY_REF.c_str(), to_string(cfg.m_GrayRef->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_MAGNIFY_SCALE) != valuemap.end()) {
cfg.m_MagnifyScale = stoul(valuemap[CameraCalibrationCfg::FIELD_MAGNIFY_SCALE]);
cfg.m_MagnifyScale->SetValue(stoul(valuemap[CameraCalibrationCfg::FIELD_MAGNIFY_SCALE]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_MAGNIFY_SCALE.c_str(), to_string(cfg.m_MagnifyScale).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_MAGNIFY_SCALE.c_str(), to_string(cfg.m_MagnifyScale->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_MATCH_RATIO) != valuemap.end()) {
cfg.m_MatchRatio = stof(valuemap[CameraCalibrationCfg::FIELD_MATCH_RATIO]);
cfg.m_MatchRatio->SetValue(stof(valuemap[CameraCalibrationCfg::FIELD_MATCH_RATIO]));
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_MATCH_RATIO.c_str(), to_string(cfg.m_MatchRatio).c_str());
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_MATCH_RATIO.c_str(), to_string(cfg.m_MatchRatio->GetValue()).c_str());
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_BLACK_FACE) != valuemap.end()) {
cfg.m_BlackFace = (stoi(valuemap[CameraCalibrationCfg::FIELD_BLACK_FACE]) > 0 ? true : false);
cfg.m_BlackFace->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_BLACK_FACE]) > 0 ? true : false);
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_BLACK_FACE.c_str(), cfg.m_BlackFace ? "1" : "0");
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_BLACK_FACE.c_str(), cfg.m_BlackFace->GetValue() ? "1" : "0");
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_SHOW_BIN_IMAGE) != valuemap.end()) {
cfg.m_ShowBinImage = (stoi(valuemap[CameraCalibrationCfg::FIELD_SHOW_BIN_IMAGE]) > 0 ? true : false);
cfg.m_ShowBinImage->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_SHOW_BIN_IMAGE]) > 0 ? true : false);
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_SHOW_BIN_IMAGE.c_str(), cfg.m_ShowBinImage ? "1" : "0");
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_SHOW_BIN_IMAGE.c_str(), cfg.m_ShowBinImage->GetValue() ? "1" : "0");
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_SHOW_CORNERS) != valuemap.end()) {
cfg.m_ShowCorners = (stoi(valuemap[CameraCalibrationCfg::FIELD_SHOW_CORNERS]) > 0 ? true : false);
cfg.m_ShowCorners->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_SHOW_CORNERS]) > 0 ? true : false);
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_SHOW_CORNERS.c_str(), cfg.m_ShowCorners ? "1" : "0");
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_SHOW_CORNERS.c_str(), cfg.m_ShowCorners->GetValue() ? "1" : "0");
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_SHOW_ASSIST) != valuemap.end()) {
cfg.m_ShowAssist = (stoi(valuemap[CameraCalibrationCfg::FIELD_SHOW_ASSIST]) > 0 ? true : false);
cfg.m_ShowAssist->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_SHOW_ASSIST]) > 0 ? true : false);
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_SHOW_ASSIST.c_str(), cfg.m_ShowAssist ? "1" : "0");
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_SHOW_ASSIST.c_str(), cfg.m_ShowAssist->GetValue() ? "1" : "0");
needins.push_back(buffer);
}
if (valuemap.find(CameraCalibrationCfg::FIELD_COVER_IMAGE_JOIN) != valuemap.end()) {
cfg.m_CoverImageJoin = (stoi(valuemap[CameraCalibrationCfg::FIELD_COVER_IMAGE_JOIN]) > 0 ? true : false);
cfg.m_CoverImageJoin->SetValue(stoi(valuemap[CameraCalibrationCfg::FIELD_COVER_IMAGE_JOIN]) > 0 ? true : false);
}
else {
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_COVER_IMAGE_JOIN.c_str(), cfg.m_CoverImageJoin ? "1" : "0");
sprintf_s(buffer, sizeof(buffer), strsql.c_str(), CameraCalibrationCfg::FIELD_COVER_IMAGE_JOIN.c_str(), cfg.m_CoverImageJoin->GetValue() ? "1" : "0");
needins.push_back(buffer);
}

View File

@ -120,20 +120,17 @@ void DataHandle::DataCallBackHandle(const ReadData& msg) {
m_controller->m_Camera->Update(msg); break;
case PURIFIERFUNC:
m_controller->m_Purifier->CallFunc(msg); break;
case PARAMLIMITCFG:
case EXTCFG:
case RUNCFG:
ConfigManager::GetInstance()->GetRunCfg()->Update(msg, RUNCFGPARAM);
break;
case INFRAREDTEMPCFG:
ConfigManager::GetInstance()->GetInfraredTempCfg()->Update(msg, INFRAREDTEMPCFGPARAM);
break;
case MACHINECFG:
ConfigManager::GetInstance()->GetMachineCfg()->Update(msg, MACHINECFGPARAM);
break;
case FAVORITECFG:
ConfigManager::GetInstance()->GetFavoriteCfg()->UpdateSub(msg);
case CAMERACALIBRATIONCFG:
ConfigManager::GetInstance()->UpdateCfg(msg);
break;
case REQUEST:
if (ConverType::TryToI( msg.nameKey) == XYSCANSTATE) {
if (!msg.nameKey.empty() && ConverType::TryToI( msg.nameKey) == XYSCANSTATE) {
printf("error,40 需要释放ScannerCtrl::Init()内部代码块...\n");
for (int i = 0; i < 4; ++i) { //需要先打开ScannerCtrl::Init()代码块
Scanner* p = (m_controller->m_ScannerCtrl->GetScanners())->at(i);

View File

@ -27,6 +27,7 @@ enum READTYPE {
INFRAREDTEMPCFG,
MACHINECFG,
FAVORITECFG,
CAMERACALIBRATIONCFG,
LOADPARAM, //装载参数
@ -107,6 +108,7 @@ enum WRITETYPE {
INFRAREDTEMPCFGPARAM, //InfraredTempCfg 参数
MACHINECFGPARAM, //MachineCfg 参数
FAVORITECFGPARAM, //FavoriteCfg 参数
CAMERACALIBRATIONCFGPARAM, //CameracalibrationCfg 参数
MOLDCFGPARAM,
LOADCFGPARAM,

View File

@ -1122,7 +1122,7 @@ bool RecoatCheck::CheckWP2(MetaData* metadata, unsigned int layer)
MachineCfg* mcfg = ConfigManager::GetInstance()->GetMachineCfg();
RecoatCheckCfg* rcc = ConfigManager::GetInstance()->GetRecoatCheckCfg();
if (!rcc->m_Enable)return true;
if (m_CameraCalibrationCfg->m_CameraMatrix00 == 0.0 || !Calibration::m_CoverImage) {
if (m_CameraCalibrationCfg->m_CameraMatrix00->GetValue() == 0.0 || !Calibration::m_CoverImage) {
return true;
}
@ -1172,33 +1172,33 @@ bool RecoatCheck::CheckWP2(MetaData* metadata, unsigned int layer)
cv::Mat cameraMatrix = cv::Mat(3, 3, CV_64FC1, cv::Scalar::all(0)); //摄像机内参数矩阵
cv::Mat distCoeffs = cv::Mat(1, 5, CV_64FC1, cv::Scalar::all(0)); //摄像机的5个畸变系数k1,k2,p1,p2,k3
cameraMatrix.at<double>(0, 0) = m_CameraCalibrationCfg->m_CameraMatrix00;
cameraMatrix.at<double>(0, 1) = m_CameraCalibrationCfg->m_CameraMatrix01;
cameraMatrix.at<double>(0, 2) = m_CameraCalibrationCfg->m_CameraMatrix02;
cameraMatrix.at<double>(1, 0) = m_CameraCalibrationCfg->m_CameraMatrix10;
cameraMatrix.at<double>(1, 1) = m_CameraCalibrationCfg->m_CameraMatrix11;
cameraMatrix.at<double>(1, 2) = m_CameraCalibrationCfg->m_CameraMatrix12;
cameraMatrix.at<double>(2, 0) = m_CameraCalibrationCfg->m_CameraMatrix20;
cameraMatrix.at<double>(2, 1) = m_CameraCalibrationCfg->m_CameraMatrix21;
cameraMatrix.at<double>(2, 2) = m_CameraCalibrationCfg->m_CameraMatrix22;
distCoeffs.at<double>(0, 0) = m_CameraCalibrationCfg->m_DistCoeffs0;
distCoeffs.at<double>(0, 1) = m_CameraCalibrationCfg->m_DistCoeffs1;
distCoeffs.at<double>(0, 2) = m_CameraCalibrationCfg->m_DistCoeffs2;
distCoeffs.at<double>(0, 3) = m_CameraCalibrationCfg->m_DistCoeffs3;
distCoeffs.at<double>(0, 4) = m_CameraCalibrationCfg->m_DistCoeffs4;
cameraMatrix.at<double>(0, 0) = m_CameraCalibrationCfg->m_CameraMatrix00->GetValue();
cameraMatrix.at<double>(0, 1) = m_CameraCalibrationCfg->m_CameraMatrix01->GetValue();
cameraMatrix.at<double>(0, 2) = m_CameraCalibrationCfg->m_CameraMatrix02->GetValue();
cameraMatrix.at<double>(1, 0) = m_CameraCalibrationCfg->m_CameraMatrix10->GetValue();
cameraMatrix.at<double>(1, 1) = m_CameraCalibrationCfg->m_CameraMatrix11->GetValue();
cameraMatrix.at<double>(1, 2) = m_CameraCalibrationCfg->m_CameraMatrix12->GetValue();
cameraMatrix.at<double>(2, 0) = m_CameraCalibrationCfg->m_CameraMatrix20->GetValue();
cameraMatrix.at<double>(2, 1) = m_CameraCalibrationCfg->m_CameraMatrix21->GetValue();
cameraMatrix.at<double>(2, 2) = m_CameraCalibrationCfg->m_CameraMatrix22->GetValue();
distCoeffs.at<double>(0, 0) = m_CameraCalibrationCfg->m_DistCoeffs0->GetValue();
distCoeffs.at<double>(0, 1) = m_CameraCalibrationCfg->m_DistCoeffs1->GetValue();
distCoeffs.at<double>(0, 2) = m_CameraCalibrationCfg->m_DistCoeffs2->GetValue();
distCoeffs.at<double>(0, 3) = m_CameraCalibrationCfg->m_DistCoeffs3->GetValue();
distCoeffs.at<double>(0, 4) = m_CameraCalibrationCfg->m_DistCoeffs4->GetValue();
cv::Mat calImage;
undistort(divImage, calImage, cameraMatrix, distCoeffs);
//g_log->TraceInfo("undistort");
//cv::imwrite("g:/testimage/cal.bmp", calImage);
cv::Point2f srcTri[4];
srcTri[0] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageTopLeftX, (float)m_CameraCalibrationCfg->m_ImageTopLeftY);
srcTri[1] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageTopRightX, (float)m_CameraCalibrationCfg->m_ImageTopRightY);
srcTri[2] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageBottomRightX, (float)m_CameraCalibrationCfg->m_ImageBottomRightY);
srcTri[3] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageBottomLeftX, (float)m_CameraCalibrationCfg->m_ImageBottomLeftY);
srcTri[0] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageTopLeftX->GetValue(), (float)m_CameraCalibrationCfg->m_ImageTopLeftY->GetValue());
srcTri[1] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageTopRightX->GetValue(), (float)m_CameraCalibrationCfg->m_ImageTopRightY->GetValue());
srcTri[2] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageBottomRightX->GetValue(), (float)m_CameraCalibrationCfg->m_ImageBottomRightY->GetValue());
srcTri[3] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageBottomLeftX->GetValue(), (float)m_CameraCalibrationCfg->m_ImageBottomLeftY->GetValue());
cv::Point2f tempTri[4];
int tx = (m_CameraCalibrationCfg->m_PlatformTopRightX - m_CameraCalibrationCfg->m_PlatformTopLeftX) * rcc->m_ImageScale;
int ty = (m_CameraCalibrationCfg->m_PlatformTopRightY - m_CameraCalibrationCfg->m_PlatformBottomRightY) * rcc->m_ImageScale;
int tx = (m_CameraCalibrationCfg->m_PlatformTopRightX->GetValue() - m_CameraCalibrationCfg->m_PlatformTopLeftX->GetValue()) * rcc->m_ImageScale;
int ty = (m_CameraCalibrationCfg->m_PlatformTopRightY->GetValue() - m_CameraCalibrationCfg->m_PlatformBottomRightY->GetValue()) * rcc->m_ImageScale;
tempTri[0] = cv::Point2f(0.0f, 0.0f);
tempTri[1] = cv::Point2f((float)tx, 0.0f);
@ -1269,8 +1269,8 @@ bool RecoatCheck::CheckWP2(MetaData* metadata, unsigned int layer)
}
float halfWidth = (float)(m_CameraCalibrationCfg->m_PlatformTopRightX - m_CameraCalibrationCfg->m_PlatformTopLeftX) * rcc->m_ImageScale / 2.0f;
float halfHigh = (float)(m_CameraCalibrationCfg->m_PlatformTopRightY - m_CameraCalibrationCfg->m_PlatformBottomRightY) * rcc->m_ImageScale / 2.0f;
float halfWidth = (float)(m_CameraCalibrationCfg->m_PlatformTopRightX->GetValue() - m_CameraCalibrationCfg->m_PlatformTopLeftX->GetValue()) * rcc->m_ImageScale / 2.0f;
float halfHigh = (float)(m_CameraCalibrationCfg->m_PlatformTopRightY->GetValue() - m_CameraCalibrationCfg->m_PlatformBottomRightY->GetValue()) * rcc->m_ImageScale / 2.0f;
map<int, RecoatCheckInfo*> infos;
metadata->LockMainDB();
@ -1486,7 +1486,7 @@ void RecoatCheck::TestCheck()
MachineCfg* mcfg = ConfigManager::GetInstance()->GetMachineCfg();
RecoatCheckCfg* rcc = ConfigManager::GetInstance()->GetRecoatCheckCfg();
if (!rcc->m_Enable)return;
if (m_CameraCalibrationCfg->m_CameraMatrix00 == 0.0 || !Calibration::m_CoverImage) {
if (m_CameraCalibrationCfg->m_CameraMatrix00->GetValue() == 0.0 || !Calibration::m_CoverImage) {
return;
}
@ -1525,32 +1525,32 @@ void RecoatCheck::TestCheck()
cv::Mat cameraMatrix = cv::Mat(3, 3, CV_64FC1, cv::Scalar::all(0)); //摄像机内参数矩阵
cv::Mat distCoeffs = cv::Mat(1, 5, CV_64FC1, cv::Scalar::all(0)); //摄像机的5个畸变系数k1,k2,p1,p2,k3
cameraMatrix.at<double>(0, 0) = m_CameraCalibrationCfg->m_CameraMatrix00;
cameraMatrix.at<double>(0, 1) = m_CameraCalibrationCfg->m_CameraMatrix01;
cameraMatrix.at<double>(0, 2) = m_CameraCalibrationCfg->m_CameraMatrix02;
cameraMatrix.at<double>(1, 0) = m_CameraCalibrationCfg->m_CameraMatrix10;
cameraMatrix.at<double>(1, 1) = m_CameraCalibrationCfg->m_CameraMatrix11;
cameraMatrix.at<double>(1, 2) = m_CameraCalibrationCfg->m_CameraMatrix12;
cameraMatrix.at<double>(2, 0) = m_CameraCalibrationCfg->m_CameraMatrix20;
cameraMatrix.at<double>(2, 1) = m_CameraCalibrationCfg->m_CameraMatrix21;
cameraMatrix.at<double>(2, 2) = m_CameraCalibrationCfg->m_CameraMatrix22;
distCoeffs.at<double>(0, 0) = m_CameraCalibrationCfg->m_DistCoeffs0;
distCoeffs.at<double>(0, 1) = m_CameraCalibrationCfg->m_DistCoeffs1;
distCoeffs.at<double>(0, 2) = m_CameraCalibrationCfg->m_DistCoeffs2;
distCoeffs.at<double>(0, 3) = m_CameraCalibrationCfg->m_DistCoeffs3;
distCoeffs.at<double>(0, 4) = m_CameraCalibrationCfg->m_DistCoeffs4;
cameraMatrix.at<double>(0, 0) = m_CameraCalibrationCfg->m_CameraMatrix00->GetValue();
cameraMatrix.at<double>(0, 1) = m_CameraCalibrationCfg->m_CameraMatrix01->GetValue();
cameraMatrix.at<double>(0, 2) = m_CameraCalibrationCfg->m_CameraMatrix02->GetValue();
cameraMatrix.at<double>(1, 0) = m_CameraCalibrationCfg->m_CameraMatrix10->GetValue();
cameraMatrix.at<double>(1, 1) = m_CameraCalibrationCfg->m_CameraMatrix11->GetValue();
cameraMatrix.at<double>(1, 2) = m_CameraCalibrationCfg->m_CameraMatrix12->GetValue();
cameraMatrix.at<double>(2, 0) = m_CameraCalibrationCfg->m_CameraMatrix20->GetValue();
cameraMatrix.at<double>(2, 1) = m_CameraCalibrationCfg->m_CameraMatrix21->GetValue();
cameraMatrix.at<double>(2, 2) = m_CameraCalibrationCfg->m_CameraMatrix22->GetValue();
distCoeffs.at<double>(0, 0) = m_CameraCalibrationCfg->m_DistCoeffs0->GetValue();
distCoeffs.at<double>(0, 1) = m_CameraCalibrationCfg->m_DistCoeffs1->GetValue();
distCoeffs.at<double>(0, 2) = m_CameraCalibrationCfg->m_DistCoeffs2->GetValue();
distCoeffs.at<double>(0, 3) = m_CameraCalibrationCfg->m_DistCoeffs3->GetValue();
distCoeffs.at<double>(0, 4) = m_CameraCalibrationCfg->m_DistCoeffs4->GetValue();
cv::Mat calImage;
undistort(divImage, calImage, cameraMatrix, distCoeffs);
//cv::imwrite("g:/testimage/cal.bmp", calImage);
cv::Point2f srcTri[4];
srcTri[0] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageTopLeftX, (float)m_CameraCalibrationCfg->m_ImageTopLeftY);
srcTri[1] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageTopRightX, (float)m_CameraCalibrationCfg->m_ImageTopRightY);
srcTri[2] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageBottomRightX, (float)m_CameraCalibrationCfg->m_ImageBottomRightY);
srcTri[3] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageBottomLeftX, (float)m_CameraCalibrationCfg->m_ImageBottomLeftY);
srcTri[0] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageTopLeftX->GetValue(), (float)m_CameraCalibrationCfg->m_ImageTopLeftY->GetValue());
srcTri[1] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageTopRightX->GetValue(), (float)m_CameraCalibrationCfg->m_ImageTopRightY->GetValue());
srcTri[2] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageBottomRightX->GetValue(), (float)m_CameraCalibrationCfg->m_ImageBottomRightY->GetValue());
srcTri[3] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageBottomLeftX->GetValue(), (float)m_CameraCalibrationCfg->m_ImageBottomLeftY->GetValue());
cv::Point2f tempTri[4];
int tx = (m_CameraCalibrationCfg->m_PlatformTopRightX - m_CameraCalibrationCfg->m_PlatformTopLeftX) * rcc->m_ImageScale;
int ty = (m_CameraCalibrationCfg->m_PlatformTopRightY - m_CameraCalibrationCfg->m_PlatformBottomRightY) * rcc->m_ImageScale;
int tx = (m_CameraCalibrationCfg->m_PlatformTopRightX->GetValue() - m_CameraCalibrationCfg->m_PlatformTopLeftX->GetValue()) * rcc->m_ImageScale;
int ty = (m_CameraCalibrationCfg->m_PlatformTopRightY->GetValue() - m_CameraCalibrationCfg->m_PlatformBottomRightY->GetValue()) * rcc->m_ImageScale;
tempTri[0] = cv::Point2f(0.0f, 0.0f);
tempTri[1] = cv::Point2f((float)tx, 0.0f);
@ -1571,7 +1571,7 @@ void RecoatCheck::TestCheck()
cv::Mat dst;
cv::boxFilter(wm, dst, -1, cv::Size(3, 3));
if (m_CameraCalibrationCfg->m_BlackFace) {
if (m_CameraCalibrationCfg->m_BlackFace->GetValue()) {
cv::threshold(dst, dst, bgGrayAvg - 20, 255, cv::ThresholdTypes::THRESH_BINARY_INV);
}
else {

View File

@ -182,8 +182,8 @@ void Calibration::UpdateData(MetaData* metaData) {
cv::cvtColor(m_GraftShowImage->m_ImageMat, m_GraftShowImage->m_ImageMat, cv::COLOR_GRAY2RGB);
m_GraftShowImage->m_IsColor = true;
if (m_Jc->GetJob()) {
int xLength = (m_CameraCalibrationCfg->m_PlatformTopRightX - m_CameraCalibrationCfg->m_PlatformTopLeftX)*m_CameraCalibrationCfg->m_MagnifyScale;
int yLength = (m_CameraCalibrationCfg->m_PlatformTopRightY - m_CameraCalibrationCfg->m_PlatformBottomRightY)*m_CameraCalibrationCfg->m_MagnifyScale;
int xLength = (m_CameraCalibrationCfg->m_PlatformTopRightX->GetValue() - m_CameraCalibrationCfg->m_PlatformTopLeftX->GetValue())*m_CameraCalibrationCfg->m_MagnifyScale->GetValue();
int yLength = (m_CameraCalibrationCfg->m_PlatformTopRightY->GetValue() - m_CameraCalibrationCfg->m_PlatformBottomRightY->GetValue())*m_CameraCalibrationCfg->m_MagnifyScale->GetValue();
int centerx = xLength / 2;
int centery = yLength / 2;
FileProcessor *jfp = m_Jc->GetJob();
@ -210,14 +210,14 @@ void Calibration::UpdateData(MetaData* metaData) {
real_x = (mov_x1 - cpart->partPosBean.m_PartCenterX)*cos(cpart->partPosBean.m_Radians) - (mov_y1 - cpart->partPosBean.m_PartCenterY)*sin(cpart->partPosBean.m_Radians) + cpart->partPosBean.m_PartCenterX;
real_y = (mov_x1 - cpart->partPosBean.m_PartCenterX)*sin(cpart->partPosBean.m_Radians) + (mov_y1 - cpart->partPosBean.m_PartCenterY)*cos(cpart->partPosBean.m_Radians) + cpart->partPosBean.m_PartCenterY;
float tempx = real_x * m_CameraCalibrationCfg->m_MagnifyScale + centerx;
float tempy = centery - real_y * m_CameraCalibrationCfg->m_MagnifyScale;
float tempx = real_x * m_CameraCalibrationCfg->m_MagnifyScale->GetValue() + centerx;
float tempy = centery - real_y * m_CameraCalibrationCfg->m_MagnifyScale->GetValue();
cv::Point2f p(tempx, tempy);
line.push_back(p);
}
int cc = j % 10;
if (!line.empty()) {
if (m_CameraCalibrationCfg->m_ShowAssist) {
if (m_CameraCalibrationCfg->m_ShowAssist->GetValue()) {
cv::RotatedRect re = cv::minAreaRect(line);
cv::Point2f P[4];
re.points(P);
@ -227,8 +227,8 @@ void Calibration::UpdateData(MetaData* metaData) {
cv::circle(m_GraftShowImage->m_ImageMat, re.center, 1, m_ColorMap[cc]);
}
}
int pcx = cpart->partPosBean.m_PartCenterX*m_CameraCalibrationCfg->m_MagnifyScale + centerx + 0.5;
int pcy = centery - cpart->partPosBean.m_PartCenterY * m_CameraCalibrationCfg->m_MagnifyScale + 0.5;
int pcx = cpart->partPosBean.m_PartCenterX*m_CameraCalibrationCfg->m_MagnifyScale->GetValue() + centerx + 0.5;
int pcy = centery - cpart->partPosBean.m_PartCenterY * m_CameraCalibrationCfg->m_MagnifyScale->GetValue() + 0.5;
for (size_t lindex = 0; lindex < line.size() - 1; lindex++) {
if (m_ManualGraftSelectPart == cpart->id) {
cv::line(m_GraftShowImage->m_ImageMat, line[lindex], line[lindex + 1], cv::Scalar(0, 255, 0), 1);
@ -319,7 +319,7 @@ void Calibration::GraftRunV2()
while (it != end)
{
double gray = *it;
if (gray > bgGrayAvg + m_CameraCalibrationCfg->m_BinaryThresholdOffset || gray < bgGrayAvg - m_CameraCalibrationCfg->m_BinaryThresholdOffset) {
if (gray > bgGrayAvg + m_CameraCalibrationCfg->m_BinaryThresholdOffset->GetValue() || gray < bgGrayAvg - m_CameraCalibrationCfg->m_BinaryThresholdOffset->GetValue()) {
*it = 255;
}
else {
@ -786,11 +786,11 @@ void Calibration::GraftRun()
//sprintf_s(buffer, sizeof(buffer), "%sclose.bmp", m_ImgPath.c_str());
if (m_CameraCalibrationCfg->m_BlackFace) {
cv::threshold(fix, fix, m_CameraCalibrationCfg->m_GrayRef - m_CameraCalibrationCfg->m_BinaryThresholdOffset, 255, cv::ThresholdTypes::THRESH_BINARY_INV);
if (m_CameraCalibrationCfg->m_BlackFace->GetValue()) {
cv::threshold(fix, fix, m_CameraCalibrationCfg->m_GrayRef->GetValue() - m_CameraCalibrationCfg->m_BinaryThresholdOffset->GetValue(), 255, cv::ThresholdTypes::THRESH_BINARY_INV);
}
else {
cv::threshold(fix, fix, m_CameraCalibrationCfg->m_GrayRef + m_CameraCalibrationCfg->m_BinaryThresholdOffset, 255, cv::ThresholdTypes::THRESH_BINARY);
cv::threshold(fix, fix, m_CameraCalibrationCfg->m_GrayRef->GetValue() + m_CameraCalibrationCfg->m_BinaryThresholdOffset->GetValue(), 255, cv::ThresholdTypes::THRESH_BINARY);
}
sprintf_s(buffer, sizeof(buffer), "%sClose.bmp", m_ImgPath.c_str());
cv::imwrite(buffer, fix);
@ -811,8 +811,8 @@ void Calibration::GraftRun()
MetaData::Layer* layer = m_MetaData->GetLayer(0);
vector<MetaData::Part*> &partVec = m_MetaData->GetPartVec();
map<int, MatchInfo*> matchInfos;
int xLength = (m_CameraCalibrationCfg->m_PlatformTopRightX - m_CameraCalibrationCfg->m_PlatformTopLeftX)*m_CameraCalibrationCfg->m_MagnifyScale;
int yLength = (m_CameraCalibrationCfg->m_PlatformTopRightY - m_CameraCalibrationCfg->m_PlatformBottomRightY)*m_CameraCalibrationCfg->m_MagnifyScale;
int xLength = (m_CameraCalibrationCfg->m_PlatformTopRightX->GetValue() - m_CameraCalibrationCfg->m_PlatformTopLeftX->GetValue())*m_CameraCalibrationCfg->m_MagnifyScale->GetValue();
int yLength = (m_CameraCalibrationCfg->m_PlatformTopRightY->GetValue() - m_CameraCalibrationCfg->m_PlatformBottomRightY->GetValue())*m_CameraCalibrationCfg->m_MagnifyScale->GetValue();
int centerx = xLength / 2;
int centery = yLength / 2;
@ -836,10 +836,10 @@ void Calibration::GraftRun()
if (pdb->type == BIN_VECTOR) {
for (unsigned int j = 0; j < pdb->point_indexs.size(); ++j) {
BPBinary::VectorPoint* pvp = (BPBinary::VectorPoint*)pdb->point_indexs[j];
float tempx1 = pvp->x1 * m_CameraCalibrationCfg->m_MagnifyScale + centerx;
float tempy1 = centery - pvp->y1 * m_CameraCalibrationCfg->m_MagnifyScale;
float tempx2 = pvp->x2 * m_CameraCalibrationCfg->m_MagnifyScale + centerx;
float tempy2 = centery - pvp->y2 * m_CameraCalibrationCfg->m_MagnifyScale;
float tempx1 = pvp->x1 * m_CameraCalibrationCfg->m_MagnifyScale->GetValue() + centerx;
float tempy1 = centery - pvp->y1 * m_CameraCalibrationCfg->m_MagnifyScale->GetValue();
float tempx2 = pvp->x2 * m_CameraCalibrationCfg->m_MagnifyScale->GetValue() + centerx;
float tempy2 = centery - pvp->y2 * m_CameraCalibrationCfg->m_MagnifyScale->GetValue();
cv::Point2f p1(tempx1, tempy1);
cv::Point2f p2(tempx2, tempy2);
cv::line(imageTemp3, p1, p2, cv::Scalar(255), 1);
@ -851,8 +851,8 @@ void Calibration::GraftRun()
std::vector<cv::Point> line;
BPBinary::ChainPoint* point = (BPBinary::ChainPoint*)pdb->point_indexs[j];
for (unsigned int k = 0; k < point->points.size(); ++k) {
float tempx = point->points[k]->x * m_CameraCalibrationCfg->m_MagnifyScale + centerx;
float tempy = centery - point->points[k]->y * m_CameraCalibrationCfg->m_MagnifyScale;
float tempx = point->points[k]->x * m_CameraCalibrationCfg->m_MagnifyScale->GetValue() + centerx;
float tempy = centery - point->points[k]->y * m_CameraCalibrationCfg->m_MagnifyScale->GetValue();
cv::Point2f p(tempx, tempy);
line.push_back(p);
}
@ -949,10 +949,10 @@ void Calibration::GraftRun()
cv::Rect rt2 = cv::boundingRect(mat.second->m_TplContours);
int matchLaser = -1;
for (size_t lindex = 0; lindex < cfgs->size(); lindex++) {
float lminx = (*cfgs)[lindex]->m_ScanCfgWrapper.m_CorrectParamCfg.m_xmeasure_min*m_CameraCalibrationCfg->m_MagnifyScale + centerx;
float lmaxx = (*cfgs)[lindex]->m_ScanCfgWrapper.m_CorrectParamCfg.m_xmeasure_max*m_CameraCalibrationCfg->m_MagnifyScale + centerx;
float lmaxy = centery - (*cfgs)[lindex]->m_ScanCfgWrapper.m_CorrectParamCfg.m_ymeasure_min*m_CameraCalibrationCfg->m_MagnifyScale;
float lminy = centery - (*cfgs)[lindex]->m_ScanCfgWrapper.m_CorrectParamCfg.m_ymeasure_max*m_CameraCalibrationCfg->m_MagnifyScale;
float lminx = (*cfgs)[lindex]->m_ScanCfgWrapper.m_CorrectParamCfg.m_xmeasure_min*m_CameraCalibrationCfg->m_MagnifyScale->GetValue() + centerx;
float lmaxx = (*cfgs)[lindex]->m_ScanCfgWrapper.m_CorrectParamCfg.m_xmeasure_max*m_CameraCalibrationCfg->m_MagnifyScale->GetValue() + centerx;
float lmaxy = centery - (*cfgs)[lindex]->m_ScanCfgWrapper.m_CorrectParamCfg.m_ymeasure_min*m_CameraCalibrationCfg->m_MagnifyScale->GetValue();
float lminy = centery - (*cfgs)[lindex]->m_ScanCfgWrapper.m_CorrectParamCfg.m_ymeasure_max*m_CameraCalibrationCfg->m_MagnifyScale->GetValue();
float mminx = rt.x;
float mmaxx = rt.x + rt.width;
@ -966,10 +966,10 @@ void Calibration::GraftRun()
int dataLaser = -1;
for (size_t lindex = 0; lindex < cfgs->size(); lindex++) {
float lminx = (*cfgs)[lindex]->m_ScanCfgWrapper.m_CorrectParamCfg.m_xmeasure_min*m_CameraCalibrationCfg->m_MagnifyScale + centerx;
float lmaxx = (*cfgs)[lindex]->m_ScanCfgWrapper.m_CorrectParamCfg.m_xmeasure_max*m_CameraCalibrationCfg->m_MagnifyScale + centerx;
float lmaxy = centery - (*cfgs)[lindex]->m_ScanCfgWrapper.m_CorrectParamCfg.m_ymeasure_min*m_CameraCalibrationCfg->m_MagnifyScale;
float lminy = centery - (*cfgs)[lindex]->m_ScanCfgWrapper.m_CorrectParamCfg.m_ymeasure_max*m_CameraCalibrationCfg->m_MagnifyScale;
float lminx = (*cfgs)[lindex]->m_ScanCfgWrapper.m_CorrectParamCfg.m_xmeasure_min*m_CameraCalibrationCfg->m_MagnifyScale->GetValue() + centerx;
float lmaxx = (*cfgs)[lindex]->m_ScanCfgWrapper.m_CorrectParamCfg.m_xmeasure_max*m_CameraCalibrationCfg->m_MagnifyScale->GetValue() + centerx;
float lmaxy = centery - (*cfgs)[lindex]->m_ScanCfgWrapper.m_CorrectParamCfg.m_ymeasure_min*m_CameraCalibrationCfg->m_MagnifyScale->GetValue();
float lminy = centery - (*cfgs)[lindex]->m_ScanCfgWrapper.m_CorrectParamCfg.m_ymeasure_max*m_CameraCalibrationCfg->m_MagnifyScale->GetValue();
float mminx = rt2.x;
float mmaxx = rt2.x + rt2.width;
@ -1099,7 +1099,7 @@ void Calibration::GraftRun()
distMax = matchePoints[i].distance;
}
}
distMax = distMax*m_CameraCalibrationCfg->m_MatchRatio;
distMax = distMax*m_CameraCalibrationCfg->m_MatchRatio->GetValue();
for (size_t i = 0; i < matchePoints.size(); i++) {
if (matchePoints[i].distance < distMax) {
GoodMatchePoints.push_back(matchePoints[i]);
@ -1145,8 +1145,8 @@ void Calibration::GraftRun()
float partCenterX = part->partPosBean.m_SrcPartCenterX;
float partCenterY = part->partPosBean.m_SrcPartCenterY;
float tempx = partCenterX * m_CameraCalibrationCfg->m_MagnifyScale + centerx;
float tempy = (float)centery - partCenterY * m_CameraCalibrationCfg->m_MagnifyScale;
float tempx = partCenterX * m_CameraCalibrationCfg->m_MagnifyScale->GetValue() + centerx;
float tempy = (float)centery - partCenterY * m_CameraCalibrationCfg->m_MagnifyScale->GetValue();
cv::Mat rot_mat = cv::getRotationMatrix2D(cv::Point2f(tempx, tempy), avg, 1.0);
cv::Mat tplr(mat.second->m_TplImage.size(), CV_8U);
cv::warpAffine(mat.second->m_TplImage, tplr, rot_mat, mat.second->m_TplImage.size(), cv::INTER_LINEAR, cv::BORDER_CONSTANT);
@ -1201,8 +1201,8 @@ void Calibration::GraftRun()
for (auto mat : matchInfos) {
MetaData::Part* part = m_MetaData->GetPart(mat.first);
if (part) {
part->partPosBean.m_XOffset = mat.second->m_XOffset / m_CameraCalibrationCfg->m_MagnifyScale;
part->partPosBean.m_YOffset = -mat.second->m_YOffset / m_CameraCalibrationCfg->m_MagnifyScale;
part->partPosBean.m_XOffset = mat.second->m_XOffset / m_CameraCalibrationCfg->m_MagnifyScale->GetValue();
part->partPosBean.m_YOffset = -mat.second->m_YOffset / m_CameraCalibrationCfg->m_MagnifyScale->GetValue();
part->partPosBean.m_RotateAngle = mat.second->m_AimAngle;
part->partPosBean.m_Radians = (float)MathHelper::DegreesToRadians(part->partPosBean.m_RotateAngle);
part->partPosBean.m_PartCenterX = part->partPosBean.m_XOffset + part->partPosBean.m_SrcPartCenterX;
@ -1247,8 +1247,8 @@ void Calibration::GraftRun()
real_x = (mov_x1 - part->partPosBean.m_PartCenterX)*cos(part->partPosBean.m_Radians) - (mov_y1 - part->partPosBean.m_PartCenterY)*sin(part->partPosBean.m_Radians) + part->partPosBean.m_PartCenterX;
real_y = (mov_x1 - part->partPosBean.m_PartCenterX)*sin(part->partPosBean.m_Radians) + (mov_y1 - part->partPosBean.m_PartCenterY)*cos(part->partPosBean.m_Radians) + part->partPosBean.m_PartCenterY;
float tempx = real_x * m_CameraCalibrationCfg->m_MagnifyScale + centerx;
float tempy = centery - real_y * m_CameraCalibrationCfg->m_MagnifyScale;
float tempx = real_x * m_CameraCalibrationCfg->m_MagnifyScale->GetValue() + centerx;
float tempy = centery - real_y * m_CameraCalibrationCfg->m_MagnifyScale->GetValue();
cv::Point2f p(tempx, tempy);
line.push_back(p);
@ -1296,20 +1296,20 @@ cv::Mat Calibration::CalibrationImage(cv::Mat image)
cv::Mat cameraMatrix = cv::Mat(3, 3, CV_64FC1, cv::Scalar::all(0)); //摄像机内参数矩阵
cv::Mat distCoeffs = cv::Mat(1, 5, CV_64FC1, cv::Scalar::all(0)); //摄像机的5个畸变系数k1,k2,p1,p2,k3
cameraMatrix.at<double>(0, 0) = m_CameraCalibrationCfg->m_CameraMatrix00;
cameraMatrix.at<double>(0, 1) = m_CameraCalibrationCfg->m_CameraMatrix01;
cameraMatrix.at<double>(0, 2) = m_CameraCalibrationCfg->m_CameraMatrix02;
cameraMatrix.at<double>(1, 0) = m_CameraCalibrationCfg->m_CameraMatrix10;
cameraMatrix.at<double>(1, 1) = m_CameraCalibrationCfg->m_CameraMatrix11;
cameraMatrix.at<double>(1, 2) = m_CameraCalibrationCfg->m_CameraMatrix12;
cameraMatrix.at<double>(2, 0) = m_CameraCalibrationCfg->m_CameraMatrix20;
cameraMatrix.at<double>(2, 1) = m_CameraCalibrationCfg->m_CameraMatrix21;
cameraMatrix.at<double>(2, 2) = m_CameraCalibrationCfg->m_CameraMatrix22;
distCoeffs.at<double>(0, 0) = m_CameraCalibrationCfg->m_DistCoeffs0;
distCoeffs.at<double>(0, 1) = m_CameraCalibrationCfg->m_DistCoeffs1;
distCoeffs.at<double>(0, 2) = m_CameraCalibrationCfg->m_DistCoeffs2;
distCoeffs.at<double>(0, 3) = m_CameraCalibrationCfg->m_DistCoeffs3;
distCoeffs.at<double>(0, 4) = m_CameraCalibrationCfg->m_DistCoeffs4;
cameraMatrix.at<double>(0, 0) = m_CameraCalibrationCfg->m_CameraMatrix00->GetValue();
cameraMatrix.at<double>(0, 1) = m_CameraCalibrationCfg->m_CameraMatrix01->GetValue();
cameraMatrix.at<double>(0, 2) = m_CameraCalibrationCfg->m_CameraMatrix02->GetValue();
cameraMatrix.at<double>(1, 0) = m_CameraCalibrationCfg->m_CameraMatrix10->GetValue();
cameraMatrix.at<double>(1, 1) = m_CameraCalibrationCfg->m_CameraMatrix11->GetValue();
cameraMatrix.at<double>(1, 2) = m_CameraCalibrationCfg->m_CameraMatrix12->GetValue();
cameraMatrix.at<double>(2, 0) = m_CameraCalibrationCfg->m_CameraMatrix20->GetValue();
cameraMatrix.at<double>(2, 1) = m_CameraCalibrationCfg->m_CameraMatrix21->GetValue();
cameraMatrix.at<double>(2, 2) = m_CameraCalibrationCfg->m_CameraMatrix22->GetValue();
distCoeffs.at<double>(0, 0) = m_CameraCalibrationCfg->m_DistCoeffs0->GetValue();
distCoeffs.at<double>(0, 1) = m_CameraCalibrationCfg->m_DistCoeffs1->GetValue();
distCoeffs.at<double>(0, 2) = m_CameraCalibrationCfg->m_DistCoeffs2->GetValue();
distCoeffs.at<double>(0, 3) = m_CameraCalibrationCfg->m_DistCoeffs3->GetValue();
distCoeffs.at<double>(0, 4) = m_CameraCalibrationCfg->m_DistCoeffs4->GetValue();
@ -1348,33 +1348,33 @@ cv::Mat Calibration::CalibrationWithCfg(cv::Mat image)
cv::Mat distCoeffs = cv::Mat(1, 5, CV_64FC1, cv::Scalar::all(0)); //摄像机的5个畸变系数k1,k2,p1,p2,k3
cameraMatrix.at<double>(0, 0) = m_CameraCalibrationCfg->m_CameraMatrix00;
cameraMatrix.at<double>(0, 1) = m_CameraCalibrationCfg->m_CameraMatrix01;
cameraMatrix.at<double>(0, 2) = m_CameraCalibrationCfg->m_CameraMatrix02;
cameraMatrix.at<double>(1, 0) = m_CameraCalibrationCfg->m_CameraMatrix10;
cameraMatrix.at<double>(1, 1) = m_CameraCalibrationCfg->m_CameraMatrix11;
cameraMatrix.at<double>(1, 2) = m_CameraCalibrationCfg->m_CameraMatrix12;
cameraMatrix.at<double>(2, 0) = m_CameraCalibrationCfg->m_CameraMatrix20;
cameraMatrix.at<double>(2, 1) = m_CameraCalibrationCfg->m_CameraMatrix21;
cameraMatrix.at<double>(2, 2) = m_CameraCalibrationCfg->m_CameraMatrix22;
distCoeffs.at<double>(0, 0) = m_CameraCalibrationCfg->m_DistCoeffs0;
distCoeffs.at<double>(0, 1) = m_CameraCalibrationCfg->m_DistCoeffs1;
distCoeffs.at<double>(0, 2) = m_CameraCalibrationCfg->m_DistCoeffs2;
distCoeffs.at<double>(0, 3) = m_CameraCalibrationCfg->m_DistCoeffs3;
distCoeffs.at<double>(0, 4) = m_CameraCalibrationCfg->m_DistCoeffs4;
cameraMatrix.at<double>(0, 0) = m_CameraCalibrationCfg->m_CameraMatrix00->GetValue();
cameraMatrix.at<double>(0, 1) = m_CameraCalibrationCfg->m_CameraMatrix01->GetValue();
cameraMatrix.at<double>(0, 2) = m_CameraCalibrationCfg->m_CameraMatrix02->GetValue();
cameraMatrix.at<double>(1, 0) = m_CameraCalibrationCfg->m_CameraMatrix10->GetValue();
cameraMatrix.at<double>(1, 1) = m_CameraCalibrationCfg->m_CameraMatrix11->GetValue();
cameraMatrix.at<double>(1, 2) = m_CameraCalibrationCfg->m_CameraMatrix12->GetValue();
cameraMatrix.at<double>(2, 0) = m_CameraCalibrationCfg->m_CameraMatrix20->GetValue();
cameraMatrix.at<double>(2, 1) = m_CameraCalibrationCfg->m_CameraMatrix21->GetValue();
cameraMatrix.at<double>(2, 2) = m_CameraCalibrationCfg->m_CameraMatrix22->GetValue();
distCoeffs.at<double>(0, 0) = m_CameraCalibrationCfg->m_DistCoeffs0->GetValue();
distCoeffs.at<double>(0, 1) = m_CameraCalibrationCfg->m_DistCoeffs1->GetValue();
distCoeffs.at<double>(0, 2) = m_CameraCalibrationCfg->m_DistCoeffs2->GetValue();
distCoeffs.at<double>(0, 3) = m_CameraCalibrationCfg->m_DistCoeffs3->GetValue();
distCoeffs.at<double>(0, 4) = m_CameraCalibrationCfg->m_DistCoeffs4->GetValue();
cv::Mat calImage;
undistort(image, calImage, cameraMatrix, distCoeffs);
cv::Point2f srcTri[4];
srcTri[0] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageTopLeftX, (float)m_CameraCalibrationCfg->m_ImageTopLeftY);
srcTri[1] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageTopRightX, (float)m_CameraCalibrationCfg->m_ImageTopRightY);
srcTri[2] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageBottomRightX, (float)m_CameraCalibrationCfg->m_ImageBottomRightY);
srcTri[3] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageBottomLeftX, (float)m_CameraCalibrationCfg->m_ImageBottomLeftY);
srcTri[0] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageTopLeftX->GetValue(), (float)m_CameraCalibrationCfg->m_ImageTopLeftY->GetValue());
srcTri[1] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageTopRightX->GetValue(), (float)m_CameraCalibrationCfg->m_ImageTopRightY->GetValue());
srcTri[2] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageBottomRightX->GetValue(), (float)m_CameraCalibrationCfg->m_ImageBottomRightY->GetValue());
srcTri[3] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageBottomLeftX->GetValue(), (float)m_CameraCalibrationCfg->m_ImageBottomLeftY->GetValue());
cv::Point2f tempTri[4];
int tx = (m_CameraCalibrationCfg->m_PlatformTopRightX - m_CameraCalibrationCfg->m_PlatformTopLeftX) * m_CameraCalibrationCfg->m_MagnifyScale;
int ty = (m_CameraCalibrationCfg->m_PlatformTopRightY - m_CameraCalibrationCfg->m_PlatformBottomRightY) * m_CameraCalibrationCfg->m_MagnifyScale;
int tx = (m_CameraCalibrationCfg->m_PlatformTopRightX->GetValue() - m_CameraCalibrationCfg->m_PlatformTopLeftX->GetValue()) * m_CameraCalibrationCfg->m_MagnifyScale->GetValue();
int ty = (m_CameraCalibrationCfg->m_PlatformTopRightY->GetValue() - m_CameraCalibrationCfg->m_PlatformBottomRightY->GetValue()) * m_CameraCalibrationCfg->m_MagnifyScale->GetValue();
tempTri[0] = cv::Point2f(0.0f, 0.0f);
tempTri[1] = cv::Point2f((float)tx, 0.0f);
@ -1407,33 +1407,33 @@ cv::Mat Calibration::CalibrationWithCfgBin(cv::Mat image)
cv::Mat distCoeffs = cv::Mat(1, 5, CV_64FC1, cv::Scalar::all(0)); //摄像机的5个畸变系数k1,k2,p1,p2,k3
cameraMatrix.at<double>(0, 0) = m_CameraCalibrationCfg->m_CameraMatrix00;
cameraMatrix.at<double>(0, 1) = m_CameraCalibrationCfg->m_CameraMatrix01;
cameraMatrix.at<double>(0, 2) = m_CameraCalibrationCfg->m_CameraMatrix02;
cameraMatrix.at<double>(1, 0) = m_CameraCalibrationCfg->m_CameraMatrix10;
cameraMatrix.at<double>(1, 1) = m_CameraCalibrationCfg->m_CameraMatrix11;
cameraMatrix.at<double>(1, 2) = m_CameraCalibrationCfg->m_CameraMatrix12;
cameraMatrix.at<double>(2, 0) = m_CameraCalibrationCfg->m_CameraMatrix20;
cameraMatrix.at<double>(2, 1) = m_CameraCalibrationCfg->m_CameraMatrix21;
cameraMatrix.at<double>(2, 2) = m_CameraCalibrationCfg->m_CameraMatrix22;
distCoeffs.at<double>(0, 0) = m_CameraCalibrationCfg->m_DistCoeffs0;
distCoeffs.at<double>(0, 1) = m_CameraCalibrationCfg->m_DistCoeffs1;
distCoeffs.at<double>(0, 2) = m_CameraCalibrationCfg->m_DistCoeffs2;
distCoeffs.at<double>(0, 3) = m_CameraCalibrationCfg->m_DistCoeffs3;
distCoeffs.at<double>(0, 4) = m_CameraCalibrationCfg->m_DistCoeffs4;
cameraMatrix.at<double>(0, 0) = m_CameraCalibrationCfg->m_CameraMatrix00->GetValue();
cameraMatrix.at<double>(0, 1) = m_CameraCalibrationCfg->m_CameraMatrix01->GetValue();
cameraMatrix.at<double>(0, 2) = m_CameraCalibrationCfg->m_CameraMatrix02->GetValue();
cameraMatrix.at<double>(1, 0) = m_CameraCalibrationCfg->m_CameraMatrix10->GetValue();
cameraMatrix.at<double>(1, 1) = m_CameraCalibrationCfg->m_CameraMatrix11->GetValue();
cameraMatrix.at<double>(1, 2) = m_CameraCalibrationCfg->m_CameraMatrix12->GetValue();
cameraMatrix.at<double>(2, 0) = m_CameraCalibrationCfg->m_CameraMatrix20->GetValue();
cameraMatrix.at<double>(2, 1) = m_CameraCalibrationCfg->m_CameraMatrix21->GetValue();
cameraMatrix.at<double>(2, 2) = m_CameraCalibrationCfg->m_CameraMatrix22->GetValue();
distCoeffs.at<double>(0, 0) = m_CameraCalibrationCfg->m_DistCoeffs0->GetValue();
distCoeffs.at<double>(0, 1) = m_CameraCalibrationCfg->m_DistCoeffs1->GetValue();
distCoeffs.at<double>(0, 2) = m_CameraCalibrationCfg->m_DistCoeffs2->GetValue();
distCoeffs.at<double>(0, 3) = m_CameraCalibrationCfg->m_DistCoeffs3->GetValue();
distCoeffs.at<double>(0, 4) = m_CameraCalibrationCfg->m_DistCoeffs4->GetValue();
cv::Mat calImage;
undistort(image, calImage, cameraMatrix, distCoeffs);
cv::Point2f srcTri[4];
srcTri[0] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageTopLeftX, (float)m_CameraCalibrationCfg->m_ImageTopLeftY);
srcTri[1] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageTopRightX, (float)m_CameraCalibrationCfg->m_ImageTopRightY);
srcTri[2] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageBottomRightX, (float)m_CameraCalibrationCfg->m_ImageBottomRightY);
srcTri[3] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageBottomLeftX, (float)m_CameraCalibrationCfg->m_ImageBottomLeftY);
srcTri[0] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageTopLeftX->GetValue(), (float)m_CameraCalibrationCfg->m_ImageTopLeftY->GetValue());
srcTri[1] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageTopRightX->GetValue(), (float)m_CameraCalibrationCfg->m_ImageTopRightY->GetValue());
srcTri[2] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageBottomRightX->GetValue(), (float)m_CameraCalibrationCfg->m_ImageBottomRightY->GetValue());
srcTri[3] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageBottomLeftX->GetValue(), (float)m_CameraCalibrationCfg->m_ImageBottomLeftY->GetValue());
cv::Point2f tempTri[4];
int tx = (m_CameraCalibrationCfg->m_PlatformTopRightX - m_CameraCalibrationCfg->m_PlatformTopLeftX) * m_CameraCalibrationCfg->m_MagnifyScale;
int ty = (m_CameraCalibrationCfg->m_PlatformTopRightY - m_CameraCalibrationCfg->m_PlatformBottomRightY) * m_CameraCalibrationCfg->m_MagnifyScale;
int tx = (m_CameraCalibrationCfg->m_PlatformTopRightX->GetValue() - m_CameraCalibrationCfg->m_PlatformTopLeftX->GetValue()) * m_CameraCalibrationCfg->m_MagnifyScale->GetValue();
int ty = (m_CameraCalibrationCfg->m_PlatformTopRightY->GetValue() - m_CameraCalibrationCfg->m_PlatformBottomRightY->GetValue()) * m_CameraCalibrationCfg->m_MagnifyScale->GetValue();
tempTri[0] = cv::Point2f(0.0f, 0.0f);
tempTri[1] = cv::Point2f((float)tx, 0.0f);
@ -1445,11 +1445,11 @@ cv::Mat Calibration::CalibrationWithCfgBin(cv::Mat image)
//cv::boxFilter(tempImage, tempImage, -1, cv::Size(3, 3));
cv::blur(tempImage, tempImage, cv::Size(3, 3));
if (m_CameraCalibrationCfg->m_BlackFace) {
cv::threshold(tempImage, tempImage, m_CameraCalibrationCfg->m_GrayRef - m_CameraCalibrationCfg->m_BinaryThresholdOffset, 255, cv::ThresholdTypes::THRESH_BINARY_INV);
if (m_CameraCalibrationCfg->m_BlackFace->GetValue()) {
cv::threshold(tempImage, tempImage, m_CameraCalibrationCfg->m_GrayRef->GetValue() - m_CameraCalibrationCfg->m_BinaryThresholdOffset->GetValue(), 255, cv::ThresholdTypes::THRESH_BINARY_INV);
}
else {
cv::threshold(tempImage, tempImage, m_CameraCalibrationCfg->m_GrayRef + m_CameraCalibrationCfg->m_BinaryThresholdOffset, 255, cv::ThresholdTypes::THRESH_BINARY);
cv::threshold(tempImage, tempImage, m_CameraCalibrationCfg->m_GrayRef->GetValue() + m_CameraCalibrationCfg->m_BinaryThresholdOffset->GetValue(), 255, cv::ThresholdTypes::THRESH_BINARY);
}
//cv::Mat element = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(4, 4));
//morphologyEx(tempImage, tempImage, cv::MORPH_CLOSE, element);
@ -1461,33 +1461,33 @@ cv::Mat Calibration::CalibrationWithAssist(cv::Mat image)
cv::Mat cameraMatrix = cv::Mat(3, 3, CV_64FC1, cv::Scalar::all(0)); //摄像机内参数矩阵
cv::Mat distCoeffs = cv::Mat(1, 5, CV_64FC1, cv::Scalar::all(0)); //摄像机的5个畸变系数k1,k2,p1,p2,k3
cameraMatrix.at<double>(0, 0) = m_CameraCalibrationCfg->m_CameraMatrix00;
cameraMatrix.at<double>(0, 1) = m_CameraCalibrationCfg->m_CameraMatrix01;
cameraMatrix.at<double>(0, 2) = m_CameraCalibrationCfg->m_CameraMatrix02;
cameraMatrix.at<double>(1, 0) = m_CameraCalibrationCfg->m_CameraMatrix10;
cameraMatrix.at<double>(1, 1) = m_CameraCalibrationCfg->m_CameraMatrix11;
cameraMatrix.at<double>(1, 2) = m_CameraCalibrationCfg->m_CameraMatrix12;
cameraMatrix.at<double>(2, 0) = m_CameraCalibrationCfg->m_CameraMatrix20;
cameraMatrix.at<double>(2, 1) = m_CameraCalibrationCfg->m_CameraMatrix21;
cameraMatrix.at<double>(2, 2) = m_CameraCalibrationCfg->m_CameraMatrix22;
distCoeffs.at<double>(0, 0) = m_CameraCalibrationCfg->m_DistCoeffs0;
distCoeffs.at<double>(0, 1) = m_CameraCalibrationCfg->m_DistCoeffs1;
distCoeffs.at<double>(0, 2) = m_CameraCalibrationCfg->m_DistCoeffs2;
distCoeffs.at<double>(0, 3) = m_CameraCalibrationCfg->m_DistCoeffs3;
distCoeffs.at<double>(0, 4) = m_CameraCalibrationCfg->m_DistCoeffs4;
cameraMatrix.at<double>(0, 0) = m_CameraCalibrationCfg->m_CameraMatrix00->GetValue();
cameraMatrix.at<double>(0, 1) = m_CameraCalibrationCfg->m_CameraMatrix01->GetValue();
cameraMatrix.at<double>(0, 2) = m_CameraCalibrationCfg->m_CameraMatrix02->GetValue();
cameraMatrix.at<double>(1, 0) = m_CameraCalibrationCfg->m_CameraMatrix10->GetValue();
cameraMatrix.at<double>(1, 1) = m_CameraCalibrationCfg->m_CameraMatrix11->GetValue();
cameraMatrix.at<double>(1, 2) = m_CameraCalibrationCfg->m_CameraMatrix12->GetValue();
cameraMatrix.at<double>(2, 0) = m_CameraCalibrationCfg->m_CameraMatrix20->GetValue();
cameraMatrix.at<double>(2, 1) = m_CameraCalibrationCfg->m_CameraMatrix21->GetValue();
cameraMatrix.at<double>(2, 2) = m_CameraCalibrationCfg->m_CameraMatrix22->GetValue();
distCoeffs.at<double>(0, 0) = m_CameraCalibrationCfg->m_DistCoeffs0->GetValue();
distCoeffs.at<double>(0, 1) = m_CameraCalibrationCfg->m_DistCoeffs1->GetValue();
distCoeffs.at<double>(0, 2) = m_CameraCalibrationCfg->m_DistCoeffs2->GetValue();
distCoeffs.at<double>(0, 3) = m_CameraCalibrationCfg->m_DistCoeffs3->GetValue();
distCoeffs.at<double>(0, 4) = m_CameraCalibrationCfg->m_DistCoeffs4->GetValue();
cv::Mat calImage;
undistort(image, calImage, cameraMatrix, distCoeffs);
cv::Point2f srcTri[4];
srcTri[0] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageTopLeftX, (float)m_CameraCalibrationCfg->m_ImageTopLeftY);
srcTri[1] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageTopRightX, (float)m_CameraCalibrationCfg->m_ImageTopRightY);
srcTri[2] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageBottomRightX, (float)m_CameraCalibrationCfg->m_ImageBottomRightY);
srcTri[3] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageBottomLeftX, (float)m_CameraCalibrationCfg->m_ImageBottomLeftY);
srcTri[0] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageTopLeftX->GetValue(), (float)m_CameraCalibrationCfg->m_ImageTopLeftY->GetValue());
srcTri[1] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageTopRightX->GetValue(), (float)m_CameraCalibrationCfg->m_ImageTopRightY->GetValue());
srcTri[2] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageBottomRightX->GetValue(), (float)m_CameraCalibrationCfg->m_ImageBottomRightY->GetValue());
srcTri[3] = cv::Point2f((float)m_CameraCalibrationCfg->m_ImageBottomLeftX->GetValue(), (float)m_CameraCalibrationCfg->m_ImageBottomLeftY->GetValue());
cv::Point2f tempTri[4];
int tx = (m_CameraCalibrationCfg->m_PlatformTopRightX - m_CameraCalibrationCfg->m_PlatformTopLeftX) * m_CameraCalibrationCfg->m_MagnifyScale;
int ty = (m_CameraCalibrationCfg->m_PlatformTopRightY - m_CameraCalibrationCfg->m_PlatformBottomRightY) * m_CameraCalibrationCfg->m_MagnifyScale;
int tx = (m_CameraCalibrationCfg->m_PlatformTopRightX->GetValue() - m_CameraCalibrationCfg->m_PlatformTopLeftX->GetValue()) * m_CameraCalibrationCfg->m_MagnifyScale->GetValue();
int ty = (m_CameraCalibrationCfg->m_PlatformTopRightY->GetValue() - m_CameraCalibrationCfg->m_PlatformBottomRightY->GetValue()) * m_CameraCalibrationCfg->m_MagnifyScale->GetValue();
tempTri[0] = cv::Point2f(0.0f, 0.0f);
tempTri[1] = cv::Point2f((float)tx, 0.0f);
@ -1500,16 +1500,16 @@ cv::Mat Calibration::CalibrationWithAssist(cv::Mat image)
cv::Mat tempImage;
cv::blur(wm, tempImage, cv::Size(3, 3));
if (m_CameraCalibrationCfg->m_ShowBinImage) {
if (m_CameraCalibrationCfg->m_BlackFace) {
cv::threshold(tempImage, tempImage, m_CameraCalibrationCfg->m_GrayRef - m_CameraCalibrationCfg->m_BinaryThresholdOffset, 255, cv::ThresholdTypes::THRESH_BINARY_INV);
if (m_CameraCalibrationCfg->m_ShowBinImage->GetValue()) {
if (m_CameraCalibrationCfg->m_BlackFace->GetValue()) {
cv::threshold(tempImage, tempImage, m_CameraCalibrationCfg->m_GrayRef->GetValue() - m_CameraCalibrationCfg->m_BinaryThresholdOffset->GetValue(), 255, cv::ThresholdTypes::THRESH_BINARY_INV);
}
else {
cv::threshold(tempImage, tempImage, m_CameraCalibrationCfg->m_GrayRef + m_CameraCalibrationCfg->m_BinaryThresholdOffset, 255, cv::ThresholdTypes::THRESH_BINARY);
cv::threshold(tempImage, tempImage, m_CameraCalibrationCfg->m_GrayRef->GetValue() + m_CameraCalibrationCfg->m_BinaryThresholdOffset->GetValue(), 255, cv::ThresholdTypes::THRESH_BINARY);
}
}
else {
cv::Canny(tempImage, tempImage, m_CameraCalibrationCfg->m_GrayRef, m_CameraCalibrationCfg->m_GrayRef * 2, 3, true);
cv::Canny(tempImage, tempImage, m_CameraCalibrationCfg->m_GrayRef->GetValue(), m_CameraCalibrationCfg->m_GrayRef->GetValue() * 2, 3, true);
}
vector<vector<cv::Point>> contours;
@ -1597,7 +1597,7 @@ bool Calibration::CalibrationCameraRun()
image_size.width = m_CalibrationImages.front()->m_ImageMat.cols;
image_size.height = m_CalibrationImages.front()->m_ImageMat.rows;
float prostep = 0.9f / m_CalibrationImages.size();
cv::Size board_size = cv::Size(m_CameraCalibrationCfg->m_CalibrationHPoints, m_CameraCalibrationCfg->m_CalibrationVPoints);
cv::Size board_size = cv::Size(m_CameraCalibrationCfg->m_CalibrationHPoints->GetValue(), m_CameraCalibrationCfg->m_CalibrationVPoints->GetValue());
std::vector<std::vector<cv::Point2f>> image_points_seq; //保存检测到的所有角点
int calIndex = 0;
float prog = 0.0f;
@ -1630,7 +1630,7 @@ bool Calibration::CalibrationCameraRun()
}
}
cv::Size square_size = cv::Size(m_CameraCalibrationCfg->m_CalibrationGridHSize, m_CameraCalibrationCfg->m_CalibrationGridVSize);
cv::Size square_size = cv::Size(m_CameraCalibrationCfg->m_CalibrationGridHSize->GetValue(), m_CameraCalibrationCfg->m_CalibrationGridVSize->GetValue());
std::vector<std::vector<cv::Point3f>> object_points; //保存标定板上角点的三维坐标
cv::Mat cameraMatrix = cv::Mat(3, 3, CV_64FC1, cv::Scalar::all(0)); //摄像机内参数矩阵
cv::Mat distCoeffs = cv::Mat(1, 5, CV_64FC1, cv::Scalar::all(0)); //摄像机的5个畸变系数k1,k2,p1,p2,k3
@ -1659,20 +1659,20 @@ bool Calibration::CalibrationCameraRun()
double rel = cv::calibrateCamera(object_points, image_points_seq, image_size, cameraMatrix, distCoeffs, rvecsMat, tvecsMat, cv::CALIB_FIX_K3);
if (rel)
{
m_CameraCalibrationCfg->m_CameraMatrix00 = cameraMatrix.at<double>(0, 0);
m_CameraCalibrationCfg->m_CameraMatrix01 = cameraMatrix.at<double>(0, 1);
m_CameraCalibrationCfg->m_CameraMatrix02 = cameraMatrix.at<double>(0, 2);
m_CameraCalibrationCfg->m_CameraMatrix10 = cameraMatrix.at<double>(1, 0);
m_CameraCalibrationCfg->m_CameraMatrix11 = cameraMatrix.at<double>(1, 1);
m_CameraCalibrationCfg->m_CameraMatrix12 = cameraMatrix.at<double>(1, 2);
m_CameraCalibrationCfg->m_CameraMatrix20 = cameraMatrix.at<double>(2, 0);
m_CameraCalibrationCfg->m_CameraMatrix21 = cameraMatrix.at<double>(2, 1);
m_CameraCalibrationCfg->m_CameraMatrix22 = cameraMatrix.at<double>(2, 2);
m_CameraCalibrationCfg->m_DistCoeffs0 = distCoeffs.at<double>(0, 0);
m_CameraCalibrationCfg->m_DistCoeffs1 = distCoeffs.at<double>(0, 1);
m_CameraCalibrationCfg->m_DistCoeffs2 = distCoeffs.at<double>(0, 2);
m_CameraCalibrationCfg->m_DistCoeffs3 = distCoeffs.at<double>(0, 3);
m_CameraCalibrationCfg->m_DistCoeffs4 = distCoeffs.at<double>(0, 4);
m_CameraCalibrationCfg->m_CameraMatrix00->SetValue( cameraMatrix.at<double>(0, 0));
m_CameraCalibrationCfg->m_CameraMatrix01->SetValue(cameraMatrix.at<double>(0, 1));
m_CameraCalibrationCfg->m_CameraMatrix02->SetValue(cameraMatrix.at<double>(0, 2));
m_CameraCalibrationCfg->m_CameraMatrix10->SetValue(cameraMatrix.at<double>(1, 0));
m_CameraCalibrationCfg->m_CameraMatrix11->SetValue(cameraMatrix.at<double>(1, 1));
m_CameraCalibrationCfg->m_CameraMatrix12->SetValue(cameraMatrix.at<double>(1, 2));
m_CameraCalibrationCfg->m_CameraMatrix20->SetValue(cameraMatrix.at<double>(2, 0));
m_CameraCalibrationCfg->m_CameraMatrix21->SetValue(cameraMatrix.at<double>(2, 1));
m_CameraCalibrationCfg->m_CameraMatrix22->SetValue(cameraMatrix.at<double>(2, 2));
m_CameraCalibrationCfg->m_DistCoeffs0->SetValue(distCoeffs.at<double>(0, 0));
m_CameraCalibrationCfg->m_DistCoeffs1->SetValue(distCoeffs.at<double>(0, 1));
m_CameraCalibrationCfg->m_DistCoeffs2->SetValue(distCoeffs.at<double>(0, 2));
m_CameraCalibrationCfg->m_DistCoeffs3->SetValue(distCoeffs.at<double>(0, 3));
m_CameraCalibrationCfg->m_DistCoeffs4->SetValue(distCoeffs.at<double>(0, 4));
ConfigManager::GetInstance()->SaveCameraCalibrationCfg();
string cfilePath = m_ImgPath + "Calibration.txt";
@ -1757,7 +1757,7 @@ bool Calibration::CalibrationTest()
}
}
}
cv::Size board_size = cv::Size(m_CameraCalibrationCfg->m_CalibrationHPoints, m_CameraCalibrationCfg->m_CalibrationVPoints);
cv::Size board_size = cv::Size(m_CameraCalibrationCfg->m_CalibrationHPoints->GetValue(), m_CameraCalibrationCfg->m_CalibrationVPoints->GetValue());
std::vector<std::vector<cv::Point2f>> image_points_seq; //保存检测到的所有角点
for (size_t imageInxex = 0; imageInxex < imageInput.size(); imageInxex++) {
std::vector<cv::Point2f> image_points;
@ -1812,20 +1812,20 @@ bool Calibration::CalibrationTest()
double rel = cv::calibrateCamera(object_points, image_points_seq, image_size, cameraMatrix, distCoeffs, rvecsMat, tvecsMat, cv::CALIB_FIX_K3);
if (rel)
{
m_CameraCalibrationCfg->m_CameraMatrix00 = cameraMatrix.at<double>(0, 0);
m_CameraCalibrationCfg->m_CameraMatrix01 = cameraMatrix.at<double>(0, 1);
m_CameraCalibrationCfg->m_CameraMatrix02 = cameraMatrix.at<double>(0, 2);
m_CameraCalibrationCfg->m_CameraMatrix10 = cameraMatrix.at<double>(1, 0);
m_CameraCalibrationCfg->m_CameraMatrix11 = cameraMatrix.at<double>(1, 1);
m_CameraCalibrationCfg->m_CameraMatrix12 = cameraMatrix.at<double>(1, 2);
m_CameraCalibrationCfg->m_CameraMatrix20 = cameraMatrix.at<double>(2, 0);
m_CameraCalibrationCfg->m_CameraMatrix21 = cameraMatrix.at<double>(2, 1);
m_CameraCalibrationCfg->m_CameraMatrix22 = cameraMatrix.at<double>(2, 2);
m_CameraCalibrationCfg->m_DistCoeffs0 = distCoeffs.at<double>(0, 0);
m_CameraCalibrationCfg->m_DistCoeffs1 = distCoeffs.at<double>(0, 1);
m_CameraCalibrationCfg->m_DistCoeffs2 = distCoeffs.at<double>(0, 2);
m_CameraCalibrationCfg->m_DistCoeffs3 = distCoeffs.at<double>(0, 3);
m_CameraCalibrationCfg->m_DistCoeffs4 = distCoeffs.at<double>(0, 4);
m_CameraCalibrationCfg->m_CameraMatrix00->SetValue(cameraMatrix.at<double>(0, 0));
m_CameraCalibrationCfg->m_CameraMatrix01->SetValue(cameraMatrix.at<double>(0, 1));
m_CameraCalibrationCfg->m_CameraMatrix02->SetValue(cameraMatrix.at<double>(0, 2));
m_CameraCalibrationCfg->m_CameraMatrix10->SetValue(cameraMatrix.at<double>(1, 0));
m_CameraCalibrationCfg->m_CameraMatrix11->SetValue(cameraMatrix.at<double>(1, 1));
m_CameraCalibrationCfg->m_CameraMatrix12->SetValue(cameraMatrix.at<double>(1, 2));
m_CameraCalibrationCfg->m_CameraMatrix20->SetValue(cameraMatrix.at<double>(2, 0));
m_CameraCalibrationCfg->m_CameraMatrix21->SetValue(cameraMatrix.at<double>(2, 1));
m_CameraCalibrationCfg->m_CameraMatrix22->SetValue(cameraMatrix.at<double>(2, 2));
m_CameraCalibrationCfg->m_DistCoeffs0->SetValue(distCoeffs.at<double>(0, 0));
m_CameraCalibrationCfg->m_DistCoeffs1->SetValue(distCoeffs.at<double>(0, 1));
m_CameraCalibrationCfg->m_DistCoeffs2->SetValue(distCoeffs.at<double>(0, 2));
m_CameraCalibrationCfg->m_DistCoeffs3->SetValue(distCoeffs.at<double>(0, 3));
m_CameraCalibrationCfg->m_DistCoeffs4->SetValue(distCoeffs.at<double>(0, 4));
ConfigManager::GetInstance()->SaveCameraCalibrationCfg();
ofstream fout("g:/Calibration3/Calibration.txt");
@ -1855,10 +1855,10 @@ bool Calibration::CalibrationTest()
void Calibration::Test()
{
cv::Point2f srcTri[4];
srcTri[0] = cv::Point2f(m_CameraCalibrationCfg->m_ImageTopLeftX, m_CameraCalibrationCfg->m_ImageTopLeftY);
srcTri[1] = cv::Point2f(m_CameraCalibrationCfg->m_ImageTopRightX, m_CameraCalibrationCfg->m_ImageTopRightY);
srcTri[2] = cv::Point2f(m_CameraCalibrationCfg->m_ImageBottomRightX, m_CameraCalibrationCfg->m_ImageBottomRightY);
srcTri[3] = cv::Point2f(m_CameraCalibrationCfg->m_ImageBottomLeftX, m_CameraCalibrationCfg->m_ImageBottomLeftY);
srcTri[0] = cv::Point2f(m_CameraCalibrationCfg->m_ImageTopLeftX->GetValue(), m_CameraCalibrationCfg->m_ImageTopLeftY->GetValue());
srcTri[1] = cv::Point2f(m_CameraCalibrationCfg->m_ImageTopRightX->GetValue(), m_CameraCalibrationCfg->m_ImageTopRightY->GetValue());
srcTri[2] = cv::Point2f(m_CameraCalibrationCfg->m_ImageBottomRightX->GetValue(), m_CameraCalibrationCfg->m_ImageBottomRightY->GetValue());
srcTri[3] = cv::Point2f(m_CameraCalibrationCfg->m_ImageBottomLeftX->GetValue(), m_CameraCalibrationCfg->m_ImageBottomLeftY->GetValue());
cv::Point2f tempTri[4];
// Mat warp_mat = getPerspectiveTransform(srcTri, dstTri);
@ -1867,8 +1867,8 @@ void Calibration::Test()
tempTri[2] = cv::Point2f(m_CameraCalibrationCfg->m_PlatformBottomRightX, m_CameraCalibrationCfg->m_PlatformBottomRightY);
tempTri[3] = cv::Point2f(m_CameraCalibrationCfg->m_PlatformBottomLeftX, m_CameraCalibrationCfg->m_PlatformBottomLeftY);*/
int tlx = 0, tly = 0;
int tx = (m_CameraCalibrationCfg->m_PlatformTopRightX - m_CameraCalibrationCfg->m_PlatformTopLeftX) * 10;
int ty = (m_CameraCalibrationCfg->m_PlatformTopRightY - m_CameraCalibrationCfg->m_PlatformBottomRightY) * 10;
int tx = (m_CameraCalibrationCfg->m_PlatformTopRightX->GetValue() - m_CameraCalibrationCfg->m_PlatformTopLeftX->GetValue()) * 10;
int ty = (m_CameraCalibrationCfg->m_PlatformTopRightY->GetValue() - m_CameraCalibrationCfg->m_PlatformBottomRightY->GetValue()) * 10;
tempTri[0] = cv::Point2f(0, 0);
tempTri[1] = cv::Point2f(tx, 0);
tempTri[2] = cv::Point2f(tx, ty);
@ -1884,20 +1884,20 @@ void Calibration::Test()
cv::Mat cameraMatrix = cv::Mat(3, 3, CV_64FC1, cv::Scalar::all(0)); //摄像机内参数矩阵
cv::Mat distCoeffs = cv::Mat(1, 5, CV_64FC1, cv::Scalar::all(0)); //摄像机的5个畸变系数k1,k2,p1,p2,k3
try {
cameraMatrix.at<double>(0, 0) = m_CameraCalibrationCfg->m_CameraMatrix00;
cameraMatrix.at<double>(0, 1) = m_CameraCalibrationCfg->m_CameraMatrix01;
cameraMatrix.at<double>(0, 2) = m_CameraCalibrationCfg->m_CameraMatrix02;
cameraMatrix.at<double>(1, 0) = m_CameraCalibrationCfg->m_CameraMatrix10;
cameraMatrix.at<double>(1, 1) = m_CameraCalibrationCfg->m_CameraMatrix11;
cameraMatrix.at<double>(1, 2) = m_CameraCalibrationCfg->m_CameraMatrix12;
cameraMatrix.at<double>(2, 0) = m_CameraCalibrationCfg->m_CameraMatrix20;
cameraMatrix.at<double>(2, 1) = m_CameraCalibrationCfg->m_CameraMatrix21;
cameraMatrix.at<double>(2, 2) = m_CameraCalibrationCfg->m_CameraMatrix22;
distCoeffs.at<double>(0, 0) = m_CameraCalibrationCfg->m_DistCoeffs0;
distCoeffs.at<double>(0, 1) = m_CameraCalibrationCfg->m_DistCoeffs1;
distCoeffs.at<double>(0, 2) = m_CameraCalibrationCfg->m_DistCoeffs2;
distCoeffs.at<double>(0, 3) = m_CameraCalibrationCfg->m_DistCoeffs3;
distCoeffs.at<double>(0, 4) = m_CameraCalibrationCfg->m_DistCoeffs4;
cameraMatrix.at<double>(0, 0) = m_CameraCalibrationCfg->m_CameraMatrix00->GetValue();
cameraMatrix.at<double>(0, 1) = m_CameraCalibrationCfg->m_CameraMatrix01->GetValue();
cameraMatrix.at<double>(0, 2) = m_CameraCalibrationCfg->m_CameraMatrix02->GetValue();
cameraMatrix.at<double>(1, 0) = m_CameraCalibrationCfg->m_CameraMatrix10->GetValue();
cameraMatrix.at<double>(1, 1) = m_CameraCalibrationCfg->m_CameraMatrix11->GetValue();
cameraMatrix.at<double>(1, 2) = m_CameraCalibrationCfg->m_CameraMatrix12->GetValue();
cameraMatrix.at<double>(2, 0) = m_CameraCalibrationCfg->m_CameraMatrix20->GetValue();
cameraMatrix.at<double>(2, 1) = m_CameraCalibrationCfg->m_CameraMatrix21->GetValue();
cameraMatrix.at<double>(2, 2) = m_CameraCalibrationCfg->m_CameraMatrix22->GetValue();
distCoeffs.at<double>(0, 0) = m_CameraCalibrationCfg->m_DistCoeffs0->GetValue();
distCoeffs.at<double>(0, 1) = m_CameraCalibrationCfg->m_DistCoeffs1->GetValue();
distCoeffs.at<double>(0, 2) = m_CameraCalibrationCfg->m_DistCoeffs2->GetValue();
distCoeffs.at<double>(0, 3) = m_CameraCalibrationCfg->m_DistCoeffs3->GetValue();
distCoeffs.at<double>(0, 4) = m_CameraCalibrationCfg->m_DistCoeffs4->GetValue();
}
catch (cv::Exception& e) {
OutputDebugString(e.msg.c_str());
@ -1974,33 +1974,33 @@ void Calibration::Assist()
cv::Mat cameraMatrix = cv::Mat(3, 3, CV_64FC1, cv::Scalar::all(0)); //摄像机内参数矩阵
cv::Mat distCoeffs = cv::Mat(1, 5, CV_64FC1, cv::Scalar::all(0)); //摄像机的5个畸变系数k1,k2,p1,p2,k3
cameraMatrix.at<double>(0, 0) = m_CameraCalibrationCfg->m_CameraMatrix00;
cameraMatrix.at<double>(0, 1) = m_CameraCalibrationCfg->m_CameraMatrix01;
cameraMatrix.at<double>(0, 2) = m_CameraCalibrationCfg->m_CameraMatrix02;
cameraMatrix.at<double>(1, 0) = m_CameraCalibrationCfg->m_CameraMatrix10;
cameraMatrix.at<double>(1, 1) = m_CameraCalibrationCfg->m_CameraMatrix11;
cameraMatrix.at<double>(1, 2) = m_CameraCalibrationCfg->m_CameraMatrix12;
cameraMatrix.at<double>(2, 0) = m_CameraCalibrationCfg->m_CameraMatrix20;
cameraMatrix.at<double>(2, 1) = m_CameraCalibrationCfg->m_CameraMatrix21;
cameraMatrix.at<double>(2, 2) = m_CameraCalibrationCfg->m_CameraMatrix22;
distCoeffs.at<double>(0, 0) = m_CameraCalibrationCfg->m_DistCoeffs0;
distCoeffs.at<double>(0, 1) = m_CameraCalibrationCfg->m_DistCoeffs1;
distCoeffs.at<double>(0, 2) = m_CameraCalibrationCfg->m_DistCoeffs2;
distCoeffs.at<double>(0, 3) = m_CameraCalibrationCfg->m_DistCoeffs3;
distCoeffs.at<double>(0, 4) = m_CameraCalibrationCfg->m_DistCoeffs4;
cameraMatrix.at<double>(0, 0) = m_CameraCalibrationCfg->m_CameraMatrix00->GetValue();
cameraMatrix.at<double>(0, 1) = m_CameraCalibrationCfg->m_CameraMatrix01->GetValue();
cameraMatrix.at<double>(0, 2) = m_CameraCalibrationCfg->m_CameraMatrix02->GetValue();
cameraMatrix.at<double>(1, 0) = m_CameraCalibrationCfg->m_CameraMatrix10->GetValue();
cameraMatrix.at<double>(1, 1) = m_CameraCalibrationCfg->m_CameraMatrix11->GetValue();
cameraMatrix.at<double>(1, 2) = m_CameraCalibrationCfg->m_CameraMatrix12->GetValue();
cameraMatrix.at<double>(2, 0) = m_CameraCalibrationCfg->m_CameraMatrix20->GetValue();
cameraMatrix.at<double>(2, 1) = m_CameraCalibrationCfg->m_CameraMatrix21->GetValue();
cameraMatrix.at<double>(2, 2) = m_CameraCalibrationCfg->m_CameraMatrix22->GetValue();
distCoeffs.at<double>(0, 0) = m_CameraCalibrationCfg->m_DistCoeffs0->GetValue();
distCoeffs.at<double>(0, 1) = m_CameraCalibrationCfg->m_DistCoeffs1->GetValue();
distCoeffs.at<double>(0, 2) = m_CameraCalibrationCfg->m_DistCoeffs2->GetValue();
distCoeffs.at<double>(0, 3) = m_CameraCalibrationCfg->m_DistCoeffs3->GetValue();
distCoeffs.at<double>(0, 4) = m_CameraCalibrationCfg->m_DistCoeffs4->GetValue();
cv::Mat cb_final;
undistort(srcTemp, cb_final, cameraMatrix, distCoeffs);
cv::imwrite("g:/Calibration3/test_und.png", cb_final);
cv::Point2f srcTri[4];
srcTri[0] = cv::Point2f(m_CameraCalibrationCfg->m_ImageTopLeftX, m_CameraCalibrationCfg->m_ImageTopLeftY);
srcTri[1] = cv::Point2f(m_CameraCalibrationCfg->m_ImageTopRightX, m_CameraCalibrationCfg->m_ImageTopRightY);
srcTri[2] = cv::Point2f(m_CameraCalibrationCfg->m_ImageBottomRightX, m_CameraCalibrationCfg->m_ImageBottomRightY);
srcTri[3] = cv::Point2f(m_CameraCalibrationCfg->m_ImageBottomLeftX, m_CameraCalibrationCfg->m_ImageBottomLeftY);
srcTri[0] = cv::Point2f(m_CameraCalibrationCfg->m_ImageTopLeftX->GetValue(), m_CameraCalibrationCfg->m_ImageTopLeftY->GetValue());
srcTri[1] = cv::Point2f(m_CameraCalibrationCfg->m_ImageTopRightX->GetValue(), m_CameraCalibrationCfg->m_ImageTopRightY->GetValue());
srcTri[2] = cv::Point2f(m_CameraCalibrationCfg->m_ImageBottomRightX->GetValue(), m_CameraCalibrationCfg->m_ImageBottomRightY->GetValue());
srcTri[3] = cv::Point2f(m_CameraCalibrationCfg->m_ImageBottomLeftX->GetValue(), m_CameraCalibrationCfg->m_ImageBottomLeftY->GetValue());
cv::Point2f tempTri[4];
int tlx = 0, tly = 0;
int tx = (m_CameraCalibrationCfg->m_PlatformTopRightX - m_CameraCalibrationCfg->m_PlatformTopLeftX) * 10;
int ty = (m_CameraCalibrationCfg->m_PlatformTopRightY - m_CameraCalibrationCfg->m_PlatformBottomRightY) * 10;
int tx = (m_CameraCalibrationCfg->m_PlatformTopRightX->GetValue() - m_CameraCalibrationCfg->m_PlatformTopLeftX->GetValue()) * 10;
int ty = (m_CameraCalibrationCfg->m_PlatformTopRightY->GetValue() - m_CameraCalibrationCfg->m_PlatformBottomRightY->GetValue()) * 10;
tempTri[0] = cv::Point2f(0, 0);
tempTri[1] = cv::Point2f(tx, 0);
tempTri[2] = cv::Point2f(tx, ty);

View File

@ -470,15 +470,15 @@ public:
void UnLockPart() { LeaveCriticalSection(&partCs); }
string GetJobTitle(void) { return general_info->job_name; }
unsigned int GetLayerCount(void) { return layers->vector_layers.size(); }
unsigned int GetComponentCount(void) { return partsMap.size(); }
unsigned int GetLayerCount(void) { return (unsigned int)layers->vector_layers.size(); }
unsigned int GetComponentCount(void) { return (unsigned int)partsMap.size(); }
Layer* GetLayer(unsigned int id);
string GetJobUid(void) { return job_id; }
void GetPartId(int layerIndex, set<int>& partIds);
// float GetProgress(void) { return m_ProgressValue; }
//string GetProgressInfo();
float PowderRequiretment(void);
unsigned int GetNumOfScanField() { return machine_type->scanFields.size(); }
unsigned int GetNumOfScanField() { return (unsigned int)machine_type->scanFields.size(); }
vector<ScanField*>* GetScanFields() {
return &machine_type->scanFields;
}

Binary file not shown.

View File

@ -3,8 +3,7 @@
#include "../utils/ConverType.h"
#define DELP(p) if(p){delete p; p = nullptr;}
// 假设你的系统支持ANSI颜色代码
#define COLOR_RESET "\033[0m"
#define COLOR_RESET "\033[0m" // 假设你的系统支持ANSI颜色代码
#define COLOR_GREEN "\033[32m"
#define COLOR_YELLOW "\033[33m"
@ -100,7 +99,6 @@ void DataHandle::DataCallBackHandle(const ReadData& msg) {
m_printIndex = -1;
}
else {
if (msg.dataType == 40) printf("recv 40 data...\n");
PrintValue(msg);
}
@ -154,18 +152,19 @@ void DataHandle::ParamReadUsage() {
printf(" 28: " COLOR_YELLOW "print infraredtemp cfg param data...\n" COLOR_RESET);
printf(" 29: " COLOR_YELLOW "print machine cfg param data...\n" COLOR_RESET);
printf(" 30: " COLOR_YELLOW "print favorite cfg param data...\n" COLOR_RESET);
printf(" 31: " COLOR_YELLOW "print cameracalibration cfg param data...\n" COLOR_RESET);
printf(" 31: " COLOR_YELLOW "print moldcfg param data...\n" COLOR_RESET);
printf(" 32: " COLOR_YELLOW "print loadcfg param data...\n" COLOR_RESET);
printf(" 33: " COLOR_YELLOW "print armcfgparam data...\n" COLOR_RESET);
printf(" 34: " COLOR_YELLOW "print supplycfgparam data...\n" COLOR_RESET);
printf(" 35: " COLOR_YELLOW "print cleancfgparam data...\n" COLOR_RESET);
printf(" 36: " COLOR_YELLOW "print elecfgparam data...\n" COLOR_RESET);
printf(" 37: " COLOR_YELLOW "print loadparamrsp data...\n" COLOR_RESET);
printf(" 38: " COLOR_YELLOW "print scan ctrl state data...\n" COLOR_RESET);
printf(" 39: " COLOR_YELLOW "print scan ctrl Param data...\n" COLOR_RESET);
printf(" 40: " COLOR_YELLOW "print xy scan state data...\n" COLOR_RESET);
printf(" 41: " COLOR_YELLOW "print camera param data...\n" COLOR_RESET);
printf(" 32: " COLOR_YELLOW "print moldcfg param data...\n" COLOR_RESET);
printf(" 33: " COLOR_YELLOW "print loadcfg param data...\n" COLOR_RESET);
printf(" 34: " COLOR_YELLOW "print armcfgparam data...\n" COLOR_RESET);
printf(" 35: " COLOR_YELLOW "print supplycfgparam data...\n" COLOR_RESET);
printf(" 36: " COLOR_YELLOW "print cleancfgparam data...\n" COLOR_RESET);
printf(" 37: " COLOR_YELLOW "print elecfgparam data...\n" COLOR_RESET);
printf(" 38: " COLOR_YELLOW "print loadparamrsp data...\n" COLOR_RESET);
printf(" 39: " COLOR_YELLOW "print scan ctrl state data...\n" COLOR_RESET);
printf(" 40: " COLOR_YELLOW "print scan ctrl Param data...\n" COLOR_RESET);
printf(" 41: " COLOR_YELLOW "print xy scan state data...\n" COLOR_RESET);
printf(" 42: " COLOR_YELLOW "print camera param data...\n" COLOR_RESET);
}
int DataHandle::Request(int index) {
@ -273,7 +272,10 @@ void DataHandle::UpdateParam(const string& input) {
PushMsg(MACHINECFG, "lastStartTime", to_string(time(nullptr)), iTIMET); //machinecfg test
break;
case FAVORITECFGPARAM:
PushMsg(FAVORITECFG, "lastStartTime", to_string(time(nullptr)), iSTRING,ADD); //machinecfg test
PushMsg(FAVORITECFG, "lastStartTime", to_string(time(nullptr)), iSTRING,ADD); //FavoriteCfg test
break;
case CAMERACALIBRATIONCFGPARAM:
PushMsg(CAMERACALIBRATIONCFG, "ShowCorners", to_string(true), iBOOL); //CameracalibrationCfg test
break;
case ELECFGPARAM:
break;

View File

@ -2,7 +2,6 @@
#include <string>
#include <list>
//#define DELP(p) if(p){delete p; p = nullptr;}
enum READTYPE {
ALARM = 0, //报警
@ -43,6 +42,7 @@ enum READTYPE {
INFRAREDTEMPCFGPARAM, //InfraredTempCfg 参数
MACHINECFGPARAM, //MachineCfg 参数
FAVORITECFGPARAM, //FavoriteCfg 参数
CAMERACALIBRATIONCFGPARAM,
MOLDCFGPARAM,
LOADCFGPARAM,
@ -119,6 +119,7 @@ enum WRITETYPE {
INFRAREDTEMPCFG,
MACHINECFG,
FAVORITECFG,
CAMERACALIBRATIONCFG,
LOADPARAM, //装载参数