#pragma once #include #include #include #include "cv.h" typedef struct STU_PROFILE_POSITION_ { int iSide; int iScan; int iIndex; int nMin; int nMax; CPoint point; BOOL bFindPos; public: STU_PROFILE_POSITION_() { iSide = iScan = iIndex = 0; nMin = nMax = 0; point = CPoint(-1,-1); bFindPos = FALSE; } }STU_PROFILE_POSITION, *pSTU_PROFILE_POSITION; using namespace std; class AFX_EXT_CLASS CProfileCADProc { public: CProfileCADProc(void); virtual ~CProfileCADProc(void); public: void SetProfileData(std::multimap *pmapProfile,std::multimap *pmapAlignProfile); void SetProfileOrigin(CPoint ptOrigin); int MakeProfileCAD(int iSide,CString strFile); BOOL WriteProfileData(CString strFile,CString strImg=_T("")); BOOL ReadProfileData(CString strFile); BOOL RotateProfileData(CvPoint2D32f ptFirst,CvPoint2D32f ptSecond,CvPoint2D32f ptOffset); BOOL GetProfilePosition(std::vector< pair > &vecProfile); CPoint GetProfileOrigin(){return m_pointMasterMin;} CPoint GetProfileMax(){return m_pointMasterMax;} CPoint FindCADPoint(CvPoint2D32f ptCenter,double dTheta,int nRange); CPoint FindCADPoint(CvPoint2D32f ptCenter,double dTheta,int nRange,LPBYTE lpImg,int nWidth,int nHeight,CPoint &ptGlass,CPoint &ptChamfer,int nGlassthres,int nChamferThres); CPoint FindCADPointY(int nX,BOOL bStart); CPoint FindCADPointY(int nX,BOOL bStart,LPBYTE lpImg,int nWidth,int nHeight,CPoint &ptGlass,CPoint &ptChamfer,int nGlassthres,int nChamferThres); BOOL FindGlassLine(CPoint ptOrigin,int nRange,double dTheta,LPBYTE lpImg,int nWidth,int nHeight,int nGlassThres,int nChamferThres,CPoint &ptGlass,CPoint &ptChamfer); void Reset(); protected: int FindProfileLine(CSISBuffer &BufCad); BOOL SaveImageJPG(CString strFile,CSISBuffer &buffer); protected: BOOL m_bLoadMaster; std::multimap *m_pmapProfile; std::multimap *m_pmapAlignProfile; CPoint m_ptOrigin; CPoint m_pointMasterMax; CPoint m_pointMasterMin; double m_dTheta; CPoint m_ptOffset; CPoint m_ptAlign; CPoint m_ptOriginOffset; };