// RcutSetDLg.cpp : ʵÏÖÎļþ // #include "stdafx.h" #include "BlVisionPro.h" #include "RcutSetDLg.h" #include "afxdialogex.h" #include "VisionSetDlg.h" #include "VisionBufferPro.h" #include "VisionRecipe.h" #include "SoftVisionApp.h" // CRcutSetDLg ¶Ô»°¿ò IMPLEMENT_DYNAMIC(CRcutSetDLg, CDialogEx) CRcutSetDLg::CRcutSetDLg(CWnd* pParent /*=NULL*/) : CDialogEx(IDD_DIALOG_RCUT_SET, pParent) { /* code */ m_dotTop = NULL; m_dotBot = NULL; } CRcutSetDLg::~CRcutSetDLg() { } void CRcutSetDLg::DoDataExchange(CDataExchange* pDX) { CDialogEx::DoDataExchange(pDX); DDX_Control(pDX, IDC_PANEL_KDIST_INFO, m_PanelRcut); } BEGIN_MESSAGE_MAP(CRcutSetDLg, CDialogEx) ON_WM_CLOSE() ON_BN_CLICKED(IDC_BUTTON_PROCESS_RCUT, &CRcutSetDLg::OnBnClickedButtonProcessRcut) ON_COMMAND(ID_EDITROI_IMAGEROI, &CRcutSetDLg::OnEditroiImageroi) ON_BN_CLICKED(IDC_BUTTON_SET_IMAGE_RCUT, &CRcutSetDLg::OnBnClickedButtonSetImageRcut) ON_BN_CLICKED(IDC_BUTTON_SAVE_RCUT, &CRcutSetDLg::OnBnClickedButtonSaveRcut) ON_BN_CLICKED(IDC_BUTTON_SET_IMAGE_RCUT2, &CRcutSetDLg::OnBnClickedButtonSetImageRcut2) ON_BN_CLICKED(IDC_BUTTON_TOP_TRAIN, &CRcutSetDLg::OnBnClickedButtonTopTrain) ON_BN_CLICKED(IDC_BUTTON_TOP_TRAIN2, &CRcutSetDLg::OnBnClickedButtonTopTrain2) END_MESSAGE_MAP() // CRcutSetDLg ÏûÏ¢´¦Àí³ÌÐò void CRcutSetDLg::OnClose() { // TODO: ÔÚ´ËÌí¼ÓÏûÏ¢´¦Àí³ÌÐò´úÂëºÍ/»òµ÷ÓÃĬÈÏÖµ if (NULL != m_displayTop1) { ClsDisplay_Free(m_displayTop1); m_displayTop1 = NULL; } if (NULL != m_displayTop2) { ClsDisplay_Free(m_displayTop2); m_displayTop2 = NULL; } if (NULL != m_displayBot1) { ClsDisplay_Free(m_displayBot1); m_displayBot1 = NULL; } if (NULL != m_displayBot2) { ClsDisplay_Free(m_displayBot2); m_displayBot2 = NULL; } CDialogEx::OnClose(); } int CRcutSetDLg::setDimensionDir(DimensionDir eDir) { /* code */ ChangeVisionType(eDir); return 0; } BOOL CRcutSetDLg::OnInitDialog() { CDialogEx::OnInitDialog(); // TODO: ÔÚ´ËÌí¼Ó¶îÍâµÄ³õʼ»¯ InitDisplay(); InitMenu(); InitPanel(); m_eDir = DIMENSION_NONE; return TRUE; // return TRUE unless you set the focus to a control // Òì³£: OCX ÊôÐÔÒ³Ó¦·µ»Ø FALSE } void CRcutSetDLg::InitDisplay(void) { /* code */ m_displayTop1 = ClsDisplay_Create(); if (nullptr != m_displayTop1) { CRect rect; CWnd * pDispWnd = GetDlgItem(IDC_STATIC_TOP_RCUT); pDispWnd->GetWindowRect(rect); m_displayTop1->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height()); m_displayTop1->SetOperFlag(SELECT_OPER_FLAG); m_displayTop1->SetDraw("fill", DISP_OBJECT); m_displayTop1->SetColor("red", DISP_OBJECT); m_displayTop1->SetDraw("fill", DISP_REGION); m_displayTop1->SetColor("red", DISP_REGION); m_displayTop1->SetDraw("fill", DISP_CROSS); m_displayTop1->SetColor("green", DISP_CROSS); m_displayTop1->SetDraw("fill", DISP_SELECT); m_displayTop1->SetColor("red", DISP_SELECT); std::string color = ClsVision::Rgb2Color(0, 0, 100); m_displayTop1->SetBackgroundColor(color); } m_displayTop2 = ClsDisplay_Create(); if (nullptr != m_displayTop2) { CRect rect; CWnd * pDispWnd = GetDlgItem(IDC_STATIC_TOP_RCUT_CHIP); pDispWnd->GetWindowRect(rect); m_displayTop2->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height()); m_displayTop2->SetOperFlag(SELECT_OPER_FLAG); m_displayTop2->SetDraw("fill", DISP_OBJECT); m_displayTop2->SetColor("red", DISP_OBJECT); m_displayTop2->SetDraw("fill", DISP_REGION); m_displayTop2->SetColor("red", DISP_REGION); m_displayTop2->SetDraw("fill", DISP_CROSS); m_displayTop2->SetColor("green", DISP_CROSS); m_displayTop2->SetDraw("fill", DISP_SELECT); m_displayTop2->SetColor("red", DISP_SELECT); std::string color = ClsVision::Rgb2Color(0, 0, 100); m_displayTop2->SetBackgroundColor(color); } m_displayBot1 = ClsDisplay_Create(); if (nullptr != m_displayBot1) { CRect rect; CWnd * pDispWnd = GetDlgItem(IDC_STATIC_BOT_RCUT2); pDispWnd->GetWindowRect(rect); m_displayBot1->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height()); m_displayBot1->SetOperFlag(SELECT_OPER_FLAG); m_displayBot1->SetDraw("fill", DISP_OBJECT); m_displayBot1->SetColor("red", DISP_OBJECT); m_displayBot1->SetDraw("fill", DISP_REGION); m_displayBot1->SetColor("red", DISP_REGION); m_displayBot1->SetDraw("fill", DISP_CROSS); m_displayBot1->SetColor("green", DISP_CROSS); m_displayBot1->SetDraw("fill", DISP_SELECT); m_displayBot1->SetColor("red", DISP_SELECT); std::string color = ClsVision::Rgb2Color(0, 0, 100); m_displayBot1->SetBackgroundColor(color); } m_displayBot2 = ClsDisplay_Create(); if (nullptr != m_displayBot2) { CRect rect; CWnd * pDispWnd = GetDlgItem(IDC_STATIC_BOT_RCUT_CHIP); pDispWnd->GetWindowRect(rect); m_displayBot2->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height()); m_displayBot2->SetOperFlag(SELECT_OPER_FLAG); m_displayBot2->SetDraw("fill", DISP_OBJECT); m_displayBot2->SetColor("red", DISP_OBJECT); m_displayBot2->SetDraw("fill", DISP_REGION); m_displayBot2->SetColor("red", DISP_REGION); m_displayBot2->SetDraw("fill", DISP_CROSS); m_displayBot2->SetColor("green", DISP_CROSS); m_displayBot2->SetDraw("fill", DISP_SELECT); m_displayBot2->SetColor("red", DISP_SELECT); std::string color = ClsVision::Rgb2Color(0, 0, 100); m_displayBot2->SetBackgroundColor(color); } } void CRcutSetDLg::InitMenu(void) { /* code */ m_visionMenu.LoadMenu(IDR_MENU1); } BOOL CRcutSetDLg::PreTranslateMessage(MSG* pMsg) { // TODO: ÔÚ´ËÌí¼ÓרÓôúÂëºÍ/»òµ÷ÓûùÀà if (pMsg->message == WM_KEYDOWN) { if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) { return TRUE; } } return CDialogEx::PreTranslateMessage(pMsg); } void CRcutSetDLg::OnBnClickedButtonProcessRcut() { // TODO: ÔÚ´ËÌí¼Ó¿Ø¼þ֪ͨ´¦Àí³ÌÐò´úÂë CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir); if (nullptr != pSideData) { pSideData->m_vDispVisionResult.clear(); } SaveRcutParam(); if (NULL == m_dot) return; // Log_GetDebug()->TraceInfo("Start: %d", __LINE__); m_dot->execute(m_eDir); // Log_GetDebug()->TraceInfo("End: %d", __LINE__); ShowRcutImage(); DispResult(); } void CRcutSetDLg::DispResult(void) { /* code */ CSoftVisionApp::getInstance()->sendMessage(2, m_eDir); DispAllResult(); } void CRcutSetDLg::DispAllResult(void) { /* code */ int nCount = 2; for (int i = 0; i < nCount; i++) { CRcutDotProcess *dot = m_dot->m_dots[i]; if (NULL == dot) continue; bool isDo = true; if (1 != dot->m_nUse) isDo = false; if (!isDo) { int id = dot->getID(); m_PanelRcut.SetItemText(id, 12, _T("NAN")); } else { //ÏÔʾ½á¹û CString strResult; strResult.Format(_T("%d"), (int)dot->m_nNgInfo.size()); int id = dot->getID(); m_PanelRcut.SetItemText(id, 12, strResult); } } m_PanelRcut.Invalidate(FALSE); } void CRcutSetDLg::InitPanel(void) { /* code */ m_vParams.clear(); CString strText; //1. ID strText = _T("ID."); m_vParams.push_back(strText); //2. name strText = _T("Name"); m_vParams.push_back(strText); //3. use strText = _T("use"); m_vParams.push_back(strText); //4. Chamfer Size strText = _T("Chamber Size"); m_vParams.push_back(strText); //5. Bin Thres strText = _T("Edge Thres"); m_vParams.push_back(strText); //6. Chip Range strText = _T("Chip Range"); m_vParams.push_back(strText); //7. Chip Thres strText = _T("Chip Thres"); m_vParams.push_back(strText); //8. Chip Smooth strText = _T("Chip Smooth"); m_vParams.push_back(strText); //9. Start Da strText = _T("Start Da"); m_vParams.push_back(strText); //10.End Da strText = _T("End Da"); m_vParams.push_back(strText); // 11.Dx strText = _T("Dx(um)"); m_vParams.push_back(strText); // 12.Dy strText = _T("Dy(um)"); m_vParams.push_back(strText); // 13.Result strText = _T("Result"); m_vParams.push_back(strText); int nRows = 3; int nCols = (int)(m_vParams.size()); int nFixRows = 1; int nFixCols = 0; int nRowIdx = 0; int nColIdx = 0; m_PanelRcut.DeleteAllItems(); m_PanelRcut.SetVirtualMode(FALSE); m_PanelRcut.GetDefaultCell(TRUE, FALSE)->SetBackClr(_gGridFixCellColor); m_PanelRcut.GetDefaultCell(FALSE, TRUE)->SetBackClr(_gGridFixCellColor); m_PanelRcut.GetDefaultCell(FALSE, FALSE)->SetBackClr(_gGridCellColor); m_PanelRcut.SetFixedTextColor(_gGridFixFontColor); m_PanelRcut.SetRowCount(nRows); m_PanelRcut.SetColumnCount(nCols); m_PanelRcut.SetFixedRowCount(nFixRows); m_PanelRcut.SetFixedColumnCount(1); m_PanelRcut.SetFixedColumnCount(nFixCols); CFont *pFont = m_PanelRcut.GetFont(); if (pFont) { LOGFONT lf; pFont->GetLogFont(&lf); lf.lfItalic = 0; lf.lfHeight = 14; lf.lfWeight = FW_BOLD; _tcscpy_s(lf.lfFaceName, _T("Malgun Gothic")); m_PanelRcut.GetDefaultCell(FALSE, TRUE)->SetFont(&lf); m_PanelRcut.GetDefaultCell(TRUE, FALSE)->SetFont(&lf); m_PanelRcut.GetDefaultCell(FALSE, FALSE)->SetFont(&lf); m_PanelRcut.GetDefaultCell(TRUE, TRUE)->SetFont(&lf); } // Col for (int i = 0; i < nCols; i++) { if (1 == i) { m_PanelRcut.SetColumnWidth(nColIdx, 115); } else if (0 == i) { m_PanelRcut.SetColumnWidth(nColIdx, 50); } else if (2 == i) { m_PanelRcut.SetColumnWidth(nColIdx, 60); } else { m_PanelRcut.SetColumnWidth(nColIdx, 75); } strText = m_vParams[i]; m_PanelRcut.SetItemText(nRowIdx, nColIdx++, strText); } for (int i = 1; i < nRows; i++) { m_PanelRcut.GetCell(i, 0)->SetState(GVIS_READONLY); } } void CRcutSetDLg::ChangeVisionType(DimensionDir eDir) { /* code */ SaveRcutParam(); //m_dotRCUT = NULL; m_eDir = eDir; m_dot = CVisionRecipe::getInstance()->getCornerRcutProcess(eDir); m_dotTop = m_dot->m_dots[0]; m_dotBot = m_dot->m_dots[1]; ShowRcutParam(); ShowRcutImage(); } void CRcutSetDLg::SaveRcutParam(void) { /* code */ if (DIMENSION_NONE == m_eDir) return; if (NULL == m_dot) return; UpdateData(TRUE); CString strText; for (int i = 0; i < 2; i++) { CRcutDotProcess *dot = m_dot->m_dots[i]; if (NULL == dot) continue; //1. ID int idRow = dot->getID(); int idx = 0; strText = m_PanelRcut.GetItemText(idRow, idx); idx += 1; //2. Name strText = m_PanelRcut.GetItemText(idRow, idx); dot->m_strName = strText; idx += 1; //3. USE strText = m_PanelRcut.GetItemText(idRow, idx); dot->m_nUse = _wtoi(strText); idx += 1; //4. Chamfer Size strText = m_PanelRcut.GetItemText(idRow, idx); dot->m_nChamferSize = _wtoi(strText); idx += 1; //5. bin Thres strText = m_PanelRcut.GetItemText(idRow, idx); dot->m_nBinThres = _wtoi(strText); idx += 1; //6. Chip Range strText = m_PanelRcut.GetItemText(idRow, idx); dot->m_nChipRange = _wtoi(strText); idx += 1; //7. Chip Thres strText = m_PanelRcut.GetItemText(idRow, idx); dot->m_nChipThres = _wtoi(strText); idx += 1; //8. Smooth strText = m_PanelRcut.GetItemText(idRow, idx); dot->m_nEdgeSmooth = _wtoi(strText); idx += 1; //9.Start Da strText = m_PanelRcut.GetItemText(idRow, idx); dot->m_nStartAngle = _wtoi(strText); idx += 1; //10.End Da strText = m_PanelRcut.GetItemText(idRow, idx); dot->m_nEndAngle = _wtoi(strText); idx += 1; //11. Dx strText = m_PanelRcut.GetItemText(idRow, idx); dot->m_nDx = _wtoi(strText); idx += 1; //12. Dy strText = m_PanelRcut.GetItemText(idRow, idx); dot->m_nDy = _wtoi(strText); idx += 1; } } void CRcutSetDLg::ShowRcutParam(void) { /* code */ if (DIMENSION_NONE == m_eDir) return; if (NULL == m_dot) return; CString strText; for (int i = 0; i < 2; i++) { CRcutDotProcess *dot = m_dot->m_dots[i]; if (NULL == dot) continue; //1. ID int idRow = dot->getID(); int idx = 0; strText.Format(_T("%d"), dot->getID()); m_PanelRcut.SetItemText(idRow, idx, strText); idx += 1; //2. Name strText = dot->m_strName; m_PanelRcut.SetItemText(idRow, idx, strText); idx += 1; //3. USE strText.Format(_T("%d"), dot->m_nUse); m_PanelRcut.SetItemText(idRow, idx, strText); idx += 1; //4. Chamfer Size strText.Format(_T("%d"), dot->m_nChamferSize); m_PanelRcut.SetItemText(idRow, idx, strText); idx += 1; //5. Edge Thres strText.Format(_T("%d"), dot->m_nBinThres); m_PanelRcut.SetItemText(idRow, idx, strText); idx += 1; //6. Chip Range strText.Format(_T("%d"), dot->m_nChipRange); m_PanelRcut.SetItemText(idRow, idx, strText); idx += 1; //7. Chip Thres strText.Format(_T("%d"), dot->m_nChipThres); m_PanelRcut.SetItemText(idRow, idx, strText); idx += 1; //8. Chip Smooth strText.Format(_T("%d"), dot->m_nEdgeSmooth); m_PanelRcut.SetItemText(idRow, idx, strText); idx += 1; //9. Start Da strText.Format(_T("%d"), dot->m_nStartAngle); m_PanelRcut.SetItemText(idRow, idx, strText); idx += 1; //10. End Da strText.Format(_T("%d"), dot->m_nEndAngle); m_PanelRcut.SetItemText(idRow, idx, strText); idx += 1; //11. Dx strText.Format(_T("%d"), dot->m_nDx); m_PanelRcut.SetItemText(idRow, idx, strText); idx += 1; //12. Dy strText.Format(_T("%d"), dot->m_nDy); m_PanelRcut.SetItemText(idRow, idx, strText); idx += 1; //13. Result strText.Format(_T("%d"), (int)(dot->m_nNgInfo.size())); m_PanelRcut.SetItemText(idRow, idx, strText); idx += 1; } UpdateData(FALSE); } void CRcutSetDLg::OnEditroiImageroi() { // TODO: ÔÚ´ËÌí¼ÓÃüÁî´¦Àí³ÌÐò´úÂë CVisionSetDlg *pMainDlg = (CVisionSetDlg *)(CVisionRecipe::getInstance()->GetMainDlg()); if (NULL == pMainDlg) return; } void CRcutSetDLg::ShowRcutImage(void) { /* code */ if (NULL != m_dotTop) { int width = 0; int height = 0; ClsVision::GetImageSize(m_dotTop->getImage(), width, height); if (NULL != m_displayTop1 && width > 1 && height > 1) { HalconCpp::GenEmptyObj(&m_displayTop1->GetImage()); HalconCpp::GenEmptyObj(&m_displayTop1->GetRegion()); HalconCpp::GenEmptyObj(&m_displayTop1->GetCross()); HalconCpp::GenEmptyObj(&m_displayTop1->GetSelect()); m_displayTop1->UnableFlush(); m_displayTop1->ClearWindow(); m_displayTop1->AutoWindowSize(width, height); m_displayTop1->SetImage(m_dotTop->getImage()); m_displayTop1->SetRegion(m_dotTop->getRoiRegion()); m_displayTop1->DispImage(); m_displayTop1->DispRegion(); m_displayTop1->AbleFlush(); } else { if (NULL != m_displayTop1) { m_displayTop1->UnableFlush(); m_displayTop1->ClearWindow(); m_displayTop1->DispImage(); m_displayTop1->DispRegion();; m_displayTop1->AbleFlush(); } } if (NULL != m_displayTop2 && width > 1 && height > 1) { HalconCpp::GenEmptyObj(&m_displayTop2->GetImage()); HalconCpp::GenEmptyObj(&m_displayTop2->GetRegion()); HalconCpp::GenEmptyObj(&m_displayTop2->GetCross()); HalconCpp::GenEmptyObj(&m_displayTop2->GetSelect()); m_displayTop2->UnableFlush(); m_displayTop2->ClearWindow(); m_displayTop2->AutoWindowSize(width, height); m_displayTop2->SetImage(m_dotTop->getImage()); m_displayTop2->SetRegion(m_dotTop->getChipRegion()); m_displayTop2->DispImage(); m_displayTop2->DispRegion(); m_displayTop2->AbleFlush(); } else { if (NULL != m_displayTop2) { m_displayTop2->UnableFlush(); m_displayTop2->ClearWindow(); m_displayTop2->DispImage(); m_displayTop2->DispRegion();; m_displayTop2->AbleFlush(); } } CString strChamber; strChamber.Format(_T("Chamber: (%.0f, %.0f)"), m_dotTop->m_fMinChamber, m_dotTop->m_fMaxChamber); GetDlgItem(IDC_STATIC_TOP_CHAMBER_RCUT)->SetWindowText(strChamber); } if (NULL != m_dotBot) { int width = 0; int height = 0; ClsVision::GetImageSize(m_dotBot->getImage(), width, height); if (NULL != m_displayBot1 && width > 1 && height > 1) { HalconCpp::GenEmptyObj(&m_displayBot1->GetImage()); HalconCpp::GenEmptyObj(&m_displayBot1->GetRegion()); HalconCpp::GenEmptyObj(&m_displayBot1->GetCross()); HalconCpp::GenEmptyObj(&m_displayBot1->GetSelect()); m_displayBot1->UnableFlush(); m_displayBot1->ClearWindow(); m_displayBot1->AutoWindowSize(width, height); m_displayBot1->SetImage(m_dotBot->getImage()); m_displayBot1->SetRegion(m_dotBot->getRoiRegion()); m_displayBot1->DispImage(); m_displayBot1->DispRegion(); m_displayBot1->AbleFlush(); } else { if (NULL != m_displayBot1) { m_displayBot1->UnableFlush(); m_displayBot1->ClearWindow(); m_displayBot1->DispImage(); m_displayBot1->DispRegion();; m_displayBot1->AbleFlush(); } } if (NULL != m_displayBot2 && width > 1 && height > 1) { HalconCpp::GenEmptyObj(&m_displayBot2->GetImage()); HalconCpp::GenEmptyObj(&m_displayBot2->GetRegion()); HalconCpp::GenEmptyObj(&m_displayBot2->GetCross()); HalconCpp::GenEmptyObj(&m_displayBot2->GetSelect()); m_displayBot2->UnableFlush(); m_displayBot2->ClearWindow(); m_displayBot2->AutoWindowSize(width, height); m_displayBot2->SetImage(m_dotBot->getImage()); m_displayBot2->SetRegion(m_dotBot->getChipRegion()); m_displayBot2->DispImage(); m_displayBot2->DispRegion(); m_displayBot2->AbleFlush(); } else { if (NULL != m_displayBot2) { m_displayBot2->UnableFlush(); m_displayBot2->ClearWindow(); m_displayBot2->DispImage(); m_displayBot2->DispRegion();; m_displayBot2->AbleFlush(); } } CString strChamber; strChamber.Format(_T("Chamber: (%.0f, %.0f)"), m_dotBot->m_fMinChamber, m_dotBot->m_fMaxChamber); GetDlgItem(IDC_STATIC_BOT_CHAMBER_RCUT)->SetWindowText(strChamber); } } void CRcutSetDLg::OnBnClickedButtonSetImageRcut() { // TODO: ÔÚ´ËÌí¼Ó¿Ø¼þ֪ͨ´¦Àí³ÌÐò´úÂë SaveRcutParam(); if (NULL == m_dot) return; if (NULL == m_dotTop) return; //1. ·¢ËÍÐÅÏ¢ CSoftVisionApp::getInstance()->sendMessage(1, m_eDir); //2. »ñȡλÖÃÐÅÏ¢ int x1 = 0; int y1 = 0; int x2 = 0; int y2 = 0; if (!CVisionRecipe::getInstance()->getFrame(x1, y1, x2, y2)) return; m_dotTop->setRegion(x1, y1, x2 - x1 + 1, y2 - y1 + 1); m_dotTop->TechImage(); ShowRcutImage(); } void CRcutSetDLg::OnBnClickedButtonSaveRcut() { // TODO: ÔÚ´ËÌí¼Ó¿Ø¼þ֪ͨ´¦Àí³ÌÐò´úÂë SaveRcutParam(); } void CRcutSetDLg::OnBnClickedButtonSetImageRcut2() { // TODO: ÔÚ´ËÌí¼Ó¿Ø¼þ֪ͨ´¦Àí³ÌÐò´úÂë SaveRcutParam(); if (NULL == m_dot) return; if (NULL == m_dotBot) return; //1. ·¢ËÍÐÅÏ¢ CSoftVisionApp::getInstance()->sendMessage(1, m_eDir); //2. »ñȡλÖÃÐÅÏ¢ int x1 = 0; int y1 = 0; int x2 = 0; int y2 = 0; if (!CVisionRecipe::getInstance()->getFrame(x1, y1, x2, y2)) return; m_dotBot->setRegion(x1, y1, x2 - x1 + 1, y2 - y1 + 1); m_dotBot->TechImage(); ShowRcutImage(); #if 0 int nPosX = (int)(0.5 * (x1 + x2)); int nPosY = (int)(0.5 * (y1 + y2)); Point2I pose; pose.x = nPosX; pose.y = nPosY; Point2I ptResult, ptTop, ptBot; CSoftVisionApp::getInstance()->transformToStandard(m_eDir, pose, ptResult, ptTop, ptBot); Point2I point = ptBot; int width = x2 - x1 + 1; int height = y2 - y1 + 1; m_dotBot->setRegion(point.x, point.y, width, height); m_dotBot->TechImage(); ShowRcutImage(); #endif } void CRcutSetDLg::OnBnClickedButtonTopTrain() { // TODO: ÔÚ´ËÌí¼Ó¿Ø¼þ֪ͨ´¦Àí³ÌÐò´úÂë SaveRcutParam(); if (NULL == m_dot) return; if (NULL == m_dotTop) return; Point2I offset; offset.x = 0; offset.y = 0; // Log_GetDebug()->TraceInfo("Start Inspect: %d", __LINE__); m_dotTop->Execute(m_eDir, offset); // Log_GetDebug()->TraceInfo("End Inspect: %d", __LINE__); ShowRcutImage(); DispResult(); } void CRcutSetDLg::OnBnClickedButtonTopTrain2() { // TODO: ÔÚ´ËÌí¼Ó¿Ø¼þ֪ͨ´¦Àí³ÌÐò´úÂë SaveRcutParam(); if (NULL == m_dot) return; if (NULL == m_dotBot) return; Point2I offset; offset.x = 0; offset.y = 0; m_dotBot->Execute(m_eDir, offset); ShowRcutImage(); DispResult(); }