新增G300/G400速率可配,处理G300/G400图片保存问题
This commit is contained in:
parent
f1f2c4ccd3
commit
9eae141ee4
|
@ -8,6 +8,10 @@
|
||||||
2021年7月31日
|
2021年7月31日
|
||||||
1.增加3399 板子g100 g200 校正及配置功能
|
1.增加3399 板子g100 g200 校正及配置功能
|
||||||
|
|
||||||
|
2021年9月14日
|
||||||
|
1、增加G300/G400速率可配置
|
||||||
|
2、处理G300/G400不能出图问题
|
||||||
|
|
||||||
2021年8月17日
|
2021年8月17日
|
||||||
1. 界面增加速度模式配置功能;
|
1. 界面增加速度模式配置功能;
|
||||||
2. 增加明场暗场校正最大明场值配置;
|
2. 增加明场暗场校正最大明场值配置;
|
||||||
|
|
|
@ -60,6 +60,13 @@ BOOL CA3::OnInitDialog()
|
||||||
{
|
{
|
||||||
m_cmbSpeedmode.InsertString(i, speedmodeMapString[i]);
|
m_cmbSpeedmode.InsertString(i, speedmodeMapString[i]);
|
||||||
}
|
}
|
||||||
|
speedemodelen = speedmodeMap.size() + G300G400speedmodeMapString.size();
|
||||||
|
size_t j = 1;
|
||||||
|
for (size_t i = speedmodeMap.size(); i < speedemodelen; i++)
|
||||||
|
{
|
||||||
|
m_cmbSpeedmode.InsertString(i, G300G400speedmodeMapString[j]);
|
||||||
|
++j;
|
||||||
|
}
|
||||||
return TRUE; // return TRUE unless you set the focus to a control
|
return TRUE; // return TRUE unless you set the focus to a control
|
||||||
// 异常: OCX 属性页应返回 FALSE
|
// 异常: OCX 属性页应返回 FALSE
|
||||||
}
|
}
|
||||||
|
@ -288,12 +295,20 @@ void CA3::updatespeedmode(bool get)
|
||||||
auto parent = (CHuaGoCorrectDlg*)GetParent();
|
auto parent = (CHuaGoCorrectDlg*)GetParent();
|
||||||
if (parent != NULL)
|
if (parent != NULL)
|
||||||
{
|
{
|
||||||
if (parent->m_drv.get() && parent->m_drv->IsConnected()) {
|
if (parent->m_drv.get() && parent->m_drv->IsConnected())
|
||||||
|
{
|
||||||
int speedmode;
|
int speedmode;
|
||||||
|
std::string ver = parent->m_drv->GetFWVersion();
|
||||||
|
if (!ver.empty())
|
||||||
|
{
|
||||||
|
ver = ver.substr(0, 2);
|
||||||
|
}
|
||||||
if (get)
|
if (get)
|
||||||
{
|
{
|
||||||
parent->m_drv->GetSpeedMode(speedmode, true);
|
parent->m_drv->GetSpeedMode(speedmode, true);
|
||||||
bool bfound = false;
|
bool bfound = false;
|
||||||
|
if (ver != "G3" && ver != "G4")
|
||||||
|
{
|
||||||
for (size_t i = 0; i < speedmodeMap.size(); i++)
|
for (size_t i = 0; i < speedmodeMap.size(); i++)
|
||||||
{
|
{
|
||||||
if (speedmodeMap[i].Speedmode == speedmode)
|
if (speedmodeMap[i].Speedmode == speedmode)
|
||||||
|
@ -305,18 +320,51 @@ void CA3::updatespeedmode(bool get)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
size_t j = 1;
|
||||||
|
for (size_t i = speedmodeMap.size(); i < speedemodelen; i++)
|
||||||
|
{
|
||||||
|
if (j == speedmode)
|
||||||
|
{
|
||||||
|
m_cmbSpeedmode.SetCurSel(i);
|
||||||
|
bfound = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!bfound)
|
if (!bfound)
|
||||||
MessageBox(L"未找到对应的速度模式!", L"提示", MB_OK | MB_ICONINFORMATION);
|
MessageBox(L"未找到对应的速度模式!", L"提示", MB_OK | MB_ICONINFORMATION);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int cmbindex = m_cmbSpeedmode.GetCurSel();
|
int cmbindex = m_cmbSpeedmode.GetCurSel();
|
||||||
if (cmbindex != -1)
|
if (cmbindex != -1 && cmbindex < speedmodeMap.size())
|
||||||
{
|
{
|
||||||
|
if (ver == "G3" || ver == "G4")
|
||||||
|
{
|
||||||
|
MessageBox(L"设备序列号前两位为G3/G4,请确认设备!", L"速率选择错误", MB_OK | MB_ICONINFORMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto t_speedmode = speedmodeMap[cmbindex];
|
auto t_speedmode = speedmodeMap[cmbindex];
|
||||||
parent->m_drv->GetSpeedMode(t_speedmode.Speedmode, false);
|
parent->m_drv->GetSpeedMode(t_speedmode.Speedmode, false);
|
||||||
parent->m_drv->SetSptime(0, t_speedmode.GraySp);
|
parent->m_drv->SetSptime(0, t_speedmode.GraySp);
|
||||||
parent->m_drv->SetSptime(1, t_speedmode.ColorSp);
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ver != "G3" && ver != "G4")
|
||||||
|
{
|
||||||
|
MessageBox(L"设备序列号前两位不为G3/G4,请确认设备!", L"速率选择错误", MB_OK | MB_ICONINFORMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cmbindex = cmbindex - speedmodeMap.size() + 1;
|
||||||
|
parent->m_drv->GetSpeedMode(cmbindex, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ private:
|
||||||
unsigned int ColorSp;
|
unsigned int ColorSp;
|
||||||
unsigned int GraySp;
|
unsigned int GraySp;
|
||||||
};
|
};
|
||||||
|
int speedemodelen;
|
||||||
std::map<int, speedmodeparam> speedmodeMap = {
|
std::map<int, speedmodeparam> speedmodeMap = {
|
||||||
{0,{70,0x42d,0xc88}},
|
{0,{70,0x42d,0xc88}},
|
||||||
{1,{80,0x37f,0xa7f}},
|
{1,{80,0x37f,0xa7f}},
|
||||||
|
@ -70,5 +71,13 @@ private:
|
||||||
{5,L"G200_120PPM"},
|
{5,L"G200_120PPM"},
|
||||||
{6,L"G200_130PPM"}
|
{6,L"G200_130PPM"}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::map<int, CString> G300G400speedmodeMapString = {
|
||||||
|
{1,L"G300/G400_40PPM"},
|
||||||
|
{2,L"G300/G400_50PPM"},
|
||||||
|
{3,L"G300/G400_60PPM"},
|
||||||
|
{4,L"G300/G400_70PPM"},
|
||||||
|
{5,L"G400_80PPM"},
|
||||||
|
};
|
||||||
CComboBox m_cmbSpeedmode;
|
CComboBox m_cmbSpeedmode;
|
||||||
};
|
};
|
||||||
|
|
|
@ -400,12 +400,20 @@ void CA4::OnBnClickedBtnbdown()
|
||||||
void CA4::UpdateGains(int id, bool increase)
|
void CA4::UpdateGains(int id, bool increase)
|
||||||
{
|
{
|
||||||
UpdateData(TRUE);
|
UpdateData(TRUE);
|
||||||
|
int offect;
|
||||||
|
CString offectstr;
|
||||||
|
GetDlgItemText(IDC_tbxOffect, offectstr);
|
||||||
|
USES_CONVERSION;
|
||||||
|
std::string str_b(W2A(offectstr));
|
||||||
|
offect = atoi(str_b.c_str());
|
||||||
|
if (offect <= 0)
|
||||||
|
offect = 1;
|
||||||
if ((id == IDC_BTNAUP || id == IDC_BTNBUP) && increase)
|
if ((id == IDC_BTNAUP || id == IDC_BTNBUP) && increase)
|
||||||
{
|
{
|
||||||
int startindex = id == IDC_BTNAUP ? 0 : 6;
|
int startindex = id == IDC_BTNAUP ? 0 : 6;
|
||||||
for (size_t i = startindex; i < (6+ startindex); i++)
|
for (size_t i = startindex; i < (6+ startindex); i++)
|
||||||
{
|
{
|
||||||
params.Gain[i] = params.Gain[i]++;
|
params.Gain[i] += offect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if((id==IDC_BTNADOWN||id==IDC_BTNBDOWN)&&!increase)
|
else if((id==IDC_BTNADOWN||id==IDC_BTNBDOWN)&&!increase)
|
||||||
|
@ -413,7 +421,7 @@ void CA4::UpdateGains(int id, bool increase)
|
||||||
int startindex = id == IDC_BTNADOWN ? 0 : 6;
|
int startindex = id == IDC_BTNADOWN ? 0 : 6;
|
||||||
for (size_t i = startindex; i < (6 + startindex); i++)
|
for (size_t i = startindex; i < (6 + startindex); i++)
|
||||||
{
|
{
|
||||||
params.Gain[i] = params.Gain[i]--;
|
params.Gain[i] -= offect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UpdateData(FALSE);
|
UpdateData(FALSE);
|
||||||
|
|
Binary file not shown.
|
@ -4,6 +4,8 @@
|
||||||
#include "filetools.h"
|
#include "filetools.h"
|
||||||
#include "imageprocess.h"
|
#include "imageprocess.h"
|
||||||
#include <atlconv.h>
|
#include <atlconv.h>
|
||||||
|
#include<iostream>
|
||||||
|
using namespace std;
|
||||||
static int imgindex = 0;
|
static int imgindex = 0;
|
||||||
ImageMatQueue::ImageMatQueue(void)
|
ImageMatQueue::ImageMatQueue(void)
|
||||||
{
|
{
|
||||||
|
@ -111,11 +113,13 @@ void ImageMatQueue::proc()
|
||||||
{
|
{
|
||||||
if (pixType != -1)
|
if (pixType != -1)
|
||||||
{
|
{
|
||||||
std::string csName;
|
//string csName;
|
||||||
SYSTEMTIME st = { 0 };
|
SYSTEMTIME st = { 0 };
|
||||||
GetLocalTime(&st); //»ñÈ¡µ±Ç°Ê±¼ä ¿É¾«È·µ½ms
|
GetLocalTime(&st); //»ñÈ¡µ±Ç°Ê±¼ä ¿É¾«È·µ½ms
|
||||||
//csName.Format("%02d%02d%02d-%d.bmp", st.wHour, st.wMinute, st.wSecond,++imgindex);
|
//csName.Format(_T("%02d%02d%02d-%d.bmp"), st.wHour, st.wMinute, st.wSecond,++imgindex);
|
||||||
|
char szDateTime[20] = { 0 };
|
||||||
|
sprintf(szDateTime,"%02d%02d%02d-%d.bmp", st.wHour, st.wMinute, st.wSecond, ++imgindex);
|
||||||
|
string csName(szDateTime);
|
||||||
cv::Mat matPicImage;
|
cv::Mat matPicImage;
|
||||||
cv::Mat matFront, matBack;
|
cv::Mat matFront, matBack;
|
||||||
//vector<cv::Mat> mats;
|
//vector<cv::Mat> mats;
|
||||||
|
@ -139,12 +143,15 @@ void ImageMatQueue::proc()
|
||||||
{
|
{
|
||||||
std::string csImage;
|
std::string csImage;
|
||||||
csImage = csPath + "\\G300"+ csName;
|
csImage = csPath + "\\G300"+ csName;
|
||||||
|
|
||||||
//cv::Mat mat = m_pImages.Take().getMat(pixType);
|
//cv::Mat mat = m_pImages.Take().getMat(pixType);
|
||||||
//matPicImage = mat(cv::Rect(0, 0, mat.cols, mat.rows));
|
//matPicImage = mat(cv::Rect(0, 0, mat.cols, mat.rows));
|
||||||
////mats.push_back(matPicImage);
|
////mats.push_back(matPicImage);
|
||||||
//IplImage qqImg;
|
//IplImage qqImg;
|
||||||
//qqImg = IplImage(matPicImage); // cv::Mat -> IplImage
|
//qqImg = IplImage(matPicImage); // cv::Mat -> IplImage
|
||||||
//cvSaveImage(csImage, &qqImg);
|
//cvSaveImage(csImage, &qqImg);
|
||||||
|
cv::Mat mat = m_pImages.Take().getMat(pixType);//1 color 6 gray
|
||||||
|
cv::imwrite(csImage, mat);
|
||||||
m_images.Put(csImage);
|
m_images.Put(csImage);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Binary file not shown.
|
@ -238,6 +238,23 @@ void GScn_Drv::SetFlatCallback(std::function<void(std::string)> func)
|
||||||
|
|
||||||
void GScn_Drv::GetSpeedMode(int& speedmode, bool get)
|
void GScn_Drv::GetSpeedMode(int& speedmode, bool get)
|
||||||
{
|
{
|
||||||
|
if (m_usb.get() && m_usb->is_connected())
|
||||||
|
{
|
||||||
|
if (get)
|
||||||
|
{
|
||||||
|
|
||||||
|
USBCB usb = { GET_SPEED_MODE ,speedmode,0 };
|
||||||
|
m_usb->write_bulk(&usb, sizeof(usb));
|
||||||
|
m_usb->read_bulk(&usb, sizeof(usb));
|
||||||
|
speedmode = usb.u32_Data;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
USBCB usb = { SET_SPEED_MODE,speedmode,0 };
|
||||||
|
m_usb->write_bulk(&usb, sizeof(usb));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GScn_Drv::reset()
|
void GScn_Drv::reset()
|
||||||
|
|
Loading…
Reference in New Issue