#pragma once #include "Global_Define.h" #include "GlassRecipe.h" #define DEFECTIMAGE_WIDTH 1024 #define DEFECTIMAGE_HEIGHT 500 enum DefectLocation { DefectLoc_Crack, DefectLoc_Broken, DefectLoc_Chip, DefectLoc_Chamfer, DefectLoc_Burr, DefectLoc_Thin, DefectLoc_Air, DefectLoc_Notch, DefectLoc_Hole, DefectLoc_Profile, DefectLoc_KDist, DefectLoc_RCUTChip }; enum SplineLocation { Spline_BotRight=0,Spline_BotLeft,Spline_TopRight,Spline_TopLeft,Spline_None }; class CBlobStorage; class CSISBuffer; class CConvParam; class CAssemControl; class CGrabberControl; class CGlass_Data; class CHardwareSettings; class CDefect { public: int m_nIndex; int m_iFrameIdx; int m_nCamID; int m_nScanIdx; int m_nGlassStartLine; SplineLocation m_nSplineLoc; CDefectBlob m_Defect; DefectLocation m_DefectLoc; int m_nSideLoc; int m_nCamDir; BYTE m_Image[DEFECTIMAGE_WIDTH * DEFECTIMAGE_HEIGHT + 1]; BOOL m_bRemoved; BOOL m_bThinCrackDefect; int m_nReduceSize; int m_nProfileIndex; CDefect() { Reset(); } virtual ~CDefect() { } void Reset() { m_nProfileIndex = -1; m_bThinCrackDefect = FALSE; m_bRemoved = FALSE; m_nIndex = -1; m_nScanIdx = -1; m_nGlassStartLine = -1; m_nCamID = -1; m_nSplineLoc = Spline_None; m_Defect.Reset(); m_DefectLoc = DefectLoc_Crack; m_nReduceSize = 0; m_nSideLoc = 0; m_nCamDir = -1; ZeroMemory(m_Image, DEFECTIMAGE_WIDTH * DEFECTIMAGE_HEIGHT + 1); } }; class CDefectStorage { protected: CCriticalSection m_csDefect; protected: int m_nDefect; CDefect *m_pDefect; int m_maxDefect; int m_nDefectSpace; public: int InitDefectStorage(int maxDefect= 1000); int IncreaseDefectCount(){++m_nDefect; return m_nDefect;} void ResetDefectStorage() ; int GetDefectCount() {return m_nDefect;} CDefect* GetDefect(int i= 0){return m_pDefect+ i;} public: CDefectStorage(void); virtual ~CDefectStorage(void); void CheckDefectRect(CPoint* pVertex, CRect* pRect, int nX, int nY); int StopInspection(CAssemControl *pAssemControl); void SetBlobDefect(int i); }; class CDefectControl : public CDefectStorage { public:// Defect Àü¼ÛºÎ Ãß°¡. CDefectControl(); virtual ~CDefectControl(); void SetGrabber(CGrabberControl *pGrabber){m_pGrabber=pGrabber;} void SetGlassData(CGlass_Data *pGlassData){m_pGlassData=pGlassData;} void SetHWRecipe(CHardwareSettings *pHW){m_pHWRecipe=pHW;} int ExtractDefect_SpNew(DimensionDir emDim,int iCam,int iScan,DefectLocation eDefect,CvPoint2D32f ptDefect,int nSplineType,BOOL bFlip,int nDefectArea); int ExtractDefect_Chip(DimensionDir emDim,int iCam,int iScan,CChipBlob *pCBlob,int nDefect,DefectLocation eDefect,int iFrameV); int ExtractDefect_SplineChip(DimensionDir emDim,int iCam,int iScan,CChipBlob *pBlobStorage,int nDefectCnt,DefectLocation nDefectLoc,CPoint basePos,int nSplineType,BOOL bFlip,int nChipW,int nChipH,EM_CHIPPING_COMP eComp); int ExtractDefect_NotchChip(DimensionDir emDim,int iCam,int iScan,CChipBlob *pBlobStorage,int nDefectCount,DefectLocation nDefectLoc,CRect rectIns); int ExtractDefect_Hole(DimensionDir emDim,int iCam,int iScan,std::vector &vecList,int nDefectCount,DefectLocation nDefectLoc,CRect rectIns); int ExtractDefect_ProfileChamfer(DimensionDir emDim,int iCam,int iScan,DefectLocation nDefectLoc,CvPoint2D32f ptDefect,int nProfileIndex); int ExtractDefect_KDist(DimensionDir emDim, int iCam, int iScan, DefectLocation eDefect, CvPoint2D32f ptDefect, CRect rectDefect, int nProfileIndex); //2024.6.12 void ResetDefectControl(); int CheckDefectCount(); int IncreaseDefectCount(){++m_nDefect; return m_nDefect;} protected: void CopyChipToBlob(CChipBlob *pChip,CDefectBlob *pBlob); protected: CGrabberControl *m_pGrabber; CGlass_Data *m_pGlassData; CHardwareSettings *m_pHWRecipe; };