| | |
| | | #include "StdAfx.h" |
| | | #include "StdAfx.h" |
| | | #include "InterfaceManager.h" |
| | | #include "MulticamControl.h" |
| | | #include "RadientControl.h" |
| | |
| | | return 0; |
| | | } |
| | | |
| | | // End Signal阑 PLC俊辑 肋 给罐酒辑 Retry 持菌澜 |
| | | // End Signal阑 PLC俊辑 肋 给罐酒辑 Retry 持菌澜 |
| | | void CInterfaceManager::PLCSignalRetry(SEND_MESSAGE_SECTION emSection,InspectToControlSignal emSendSignal,enInterface_Send_Control emControlSignal) |
| | | { |
| | | if(m_HardwareRecipe.m_nPLCSignalRetry <= 0) |
| | |
| | | m_PostProcess.SetView((void*) m_pView); |
| | | m_PostProcess.RunPostProcessing(); |
| | | |
| | | // 馆靛矫 Scan End 脚龋 焊郴扁 傈俊 秦拎具茄促... Scan End 脚龋 焊尘锭 Loading捞 肯丰 救登搁 救焊郴瘤霸 阜囚乐澜.. |
| | | // 馆靛矫 Scan End 脚龋 焊郴扁 傈俊 秦拎具茄促... Scan End 脚龋 焊尘锭 Loading捞 肯丰 救登搁 救焊郴瘤霸 阜囚乐澜.. |
| | | m_bGlassLoadingEnd = FALSE; |
| | | m_bPLCGlassLoading = FALSE; |
| | | |
| | |
| | | if(!m_strReserveRecipe.IsEmpty()) |
| | | { |
| | | g_pLog->DisplayMessage(_T("Apply reserve Recipe Loading - [%s]"), m_strReserveRecipe); |
| | | if (LoadGlassRecipe(m_strReserveRecipe,TRUE)) // 鞍篮 Recipe扼档 利侩 抗距登绢 乐栏搁 促矫 肺爹茄促. |
| | | if (LoadGlassRecipe(m_strReserveRecipe,TRUE)) // 鞍篮 Recipe扼档 利侩 抗距登绢 乐栏搁 促矫 肺爹茄促. |
| | | { |
| | | g_pLog->DisplayMessage(_T("Apply reserve Recipe Loading - [%s] : Success"), m_strReserveRecipe); |
| | | } |
| | |
| | | return FALSE; |
| | | } |
| | | |
| | | if (strRcp.CompareNoCase(m_GlassRecipe.GetRecipeName()) != 0) // strRecipeName 官差搁 肺爹茄促. |
| | | if (strRcp.CompareNoCase(m_GlassRecipe.GetRecipeName()) != 0) // strRecipeName 官差搁 肺爹茄促. |
| | | { |
| | | if (LoadGlassRecipe(strRcp,TRUE) == FALSE) |
| | | { |
| | |
| | | BlVision_GetVisionRecipe()->setRecipeType(EI_VISION_RECIPE); |
| | | BlVision_GetVisionRecipe()->init(); |
| | | |
| | | for (int i = 0; i < nCount; i++) { //设置分辨率 |
| | | for (int i = 0; i < nCount; i++) { //设置分辨率 |
| | | DimensionDir eDir = (DimensionDir)(i); |
| | | CBlSideData *pSide = BlVision_GetVisionRecipe()->getSideData(eDir); |
| | | |
| | |
| | | g_pLog->DisplayMessage( _T("CreateCamera Start!")); |
| | | |
| | | ////////////////////////////////////////////////////////////////////////// |
| | | // Camera Handle 积己. |
| | | // Camera Handle 积己. |
| | | int iCam; |
| | | BOOL bRet = TRUE; |
| | | |
| | |
| | | int nErrorCode; |
| | | int nBoardId = iCam; |
| | | |
| | | // B5 4龋扁 悸泼 |
| | | // B5 4龋扁 悸泼 |
| | | g_pBase->m_strSBKLine = m_HardwareRecipe.GetLineID(); |
| | | g_pBase->m_strSBKLine.Append(_T("#")); |
| | | |
| | |
| | | { |
| | | g_pStatus->CheckDirectory(strPath); |
| | | |
| | | BYTE* pBitBuffer; |
| | | FIBITMAP *bitmap = NULL; |
| | | |
| | | CString strSavePath = strPath; |
| | | strSavePath += _T(".jpg"); |
| | | |
| | | bitmap = FreeImage_Allocate(IMAGE_WIDTH, nLineCnt,8); |
| | | pBitBuffer = FreeImage_GetBits(bitmap); |
| | | if(pBitBuffer == NULL) { |
| | | FreeImage_Unload(bitmap); |
| | | return FALSE; |
| | | } |
| | | Lock(); |
| | | FIBITMAP* bitmap = nullptr; |
| | | int nImageWidth = IMAGE_WIDTH; |
| | | if (iSide > DIMENSION_D_DN) { |
| | | nImageWidth = IMAGE_WIDTH / 2; |
| | | } |
| | | bitmap = FreeImage_Allocate(nImageWidth, nLineCnt, 8); |
| | | |
| | | LPBYTE lpImg = GetGrabBuffer((DimensionDir)iSide,ptStart.y); |
| | | if (lpImg == NULL) { |
| | | if (bitmap == NULL) { |
| | | Unlock(); |
| | | return FALSE; |
| | | } |
| | | |
| | | CopyMemory(pBitBuffer, lpImg, IMAGE_WIDTH * nLineCnt); |
| | | BYTE* pBitBuffer = FreeImage_GetBits(bitmap); |
| | | if (pBitBuffer == NULL) { |
| | | FreeImage_Unload(bitmap); |
| | | Unlock(); |
| | | return FALSE; |
| | | } |
| | | |
| | | LPBYTE lpImg = GetGrabBuffer((DimensionDir)iSide, ptStart.y); |
| | | if (lpImg == NULL) { |
| | | Unlock(); |
| | | return FALSE; |
| | | } |
| | | |
| | | CopyMemory(pBitBuffer, lpImg, nImageWidth * nLineCnt); |
| | | |
| | | USES_CONVERSION; |
| | | char str_filename[1024]; |
| | | sprintf_s(str_filename, "%s", W2A(strSavePath)); |
| | | |
| | | FreeImage_FlipVertical(bitmap); |
| | | FreeImage_Save(FIF_JPEG, bitmap, str_filename,JPEG_FULLIMAGE_RATE); |
| | | FreeImage_Unload(bitmap); |
| | | FreeImage_Save(FIF_JPEG, bitmap, str_filename, JPEG_FULLIMAGE_RATE); |
| | | FreeImage_Unload(bitmap); |
| | | |
| | | Unlock(); |
| | | |
| | | return TRUE; |
| | | } |
| | |
| | | cvReleaseImage(&pImgNew); |
| | | cvReleaseImageHeader(&pImg); |
| | | #else |
| | | // 原始图像数据转 cv::Mat |
| | | Lock(); |
| | | // 原始图像数据转 cv::Mat |
| | | cv::Mat origin(nImgHeight, nImgWidth, CV_8UC1, lpOrigin + (nImgWidth * nStartY)); |
| | | |
| | | // 缩放图像 |
| | | // 缩放图像 |
| | | cv::Size szNew(static_cast<int>(nImgWidth * dRatio), static_cast<int>(nImgHeight * dRatio)); |
| | | cv::Mat resized; |
| | | cv::resize(origin, resized, szNew, 0, 0, cv::INTER_LINEAR); |
| | | |
| | | // 设置 JPEG 压缩参数 |
| | | // 设置 JPEG 压缩参数 |
| | | std::vector<int> params = { |
| | | cv::IMWRITE_JPEG_QUALITY, |
| | | nQuality |
| | |
| | | std::string strFilename = W2A(strPath); |
| | | |
| | | if (!cv::imwrite(strFilename, resized, params)) { |
| | | Unlock(); |
| | | g_pLog->DisplayMessage(_T("Save Full Image Fail(%s, %s, %d), imwrite failed"), strPath, PANEL_SIDE[iSide], nStartY); |
| | | return FALSE; |
| | | } |
| | | |
| | | Unlock(); |
| | | #endif |
| | | |
| | | g_pLog->DisplayMessage(_T("Save Full Image Success(%s, %s, %d, %d, %d)"), strPath, PANEL_SIDE[iSide], nStartY, nImgHeight, nQuality); |
| | |
| | | strPath.Append(_T("_NG")); |
| | | } |
| | | #else |
| | | // 加载灰度图像 |
| | | // 加载灰度图像 |
| | | std::string strFilename = CT2A(strPath); |
| | | cv::Mat img = cv::imread(strFilename, cv::IMREAD_GRAYSCALE); |
| | | |
| | |
| | | nHeight = img.rows; |
| | | } |
| | | else { |
| | | // 按比例缩放 |
| | | // 按比例缩放 |
| | | const double dRatio = 1.0 - static_cast<double>(IMAGE_COMPRESSRATIO) / 100.0; |
| | | int newWidth = static_cast<int>(img.cols / dRatio); |
| | | int newHeight = static_cast<int>(img.rows / dRatio); |