#ifndef ISOFT_VISION_APP_H #define ISOFT_VISION_APP_H #include #include enum DefectNgType { DefectNg_OK = 0, //OK DefectNg_Chip, //Chip DefectNg_Broken, //ÆÆËð DefectNg_Grind, //ÑÐÄ¥ DefectNg_Dist_Cut, //Çи¶È DefectNg_Corner_Dist, //½Ç¾«¶È DefectNg_Unknown //Ö¸´íÎó }; #define NG_INF_TOTAL 1000 typedef struct _NgInfo { int eDir; //¼ì²âÃæ int id; //¼ì²âID CString strName; //Ãû³Æ int xPosPxl; //XλÖà int yPosPxl; //YλÖà double result; //½á¹û Measure double xResult; //½á¹û Chip double yResult; //½á¹û Chip double minValue; //ÏÂÏÞ double maxValue; //ÏÞÖÆ int ngType; //ȱÏÝÀàÐÍ bool isRes; //¼ì²â½á¹û int x1; //ȱÏݵÄ×îС¾ØÐÎ int y1; //ȱÏݵÄ×îС¾ØÐÎ int x2; //ȱÏݵÄ×îС¾ØÐÎ int y2; //ȱÏݵÄ×îС¾ØÐÎ int eVision; //ÊÓ¾õËã·¨ }NgInfo; //typedef std::function ImageVisionEvent; //typedef std::function ImageVisionEvent; class IVisionEvent { public: //1. ½ÓÊÕµ½Êý¾Ýʼþ using MsgReceivedEvent = void(*)(int code, int eDir); //2. ÈÕÖ¾ÐÅÏ¢ using MsgLogEvent = void(*)(int level, std::string strText); public: IVisionEvent(MsgReceivedEvent msgRcvCb = nullptr, MsgLogEvent msgLogEvent = nullptr) { /* code */ m_msgRcvCb = msgRcvCb; m_msgLogCb = msgLogEvent; }; void clear() { /* code */ m_msgRcvCb = NULL; m_msgLogCb = NULL; } public: MsgReceivedEvent m_msgRcvCb = NULL; MsgLogEvent m_msgLogCb = NULL; }; class ISoftVisionApp { public: virtual ~ISoftVisionApp() {}; public: //1. ´ò¿ªÊÓ¾õ´°Ìå virtual int OpenVisionWindow(void) = 0; virtual CDialogEx* CreateVisionWindow(void) = 0; virtual int ReleaseWindow(CDialogEx *pDlg) = 0; virtual void ChangeDimension(CDialogEx *pDlg, int nDir) = 0; virtual void SetVisionOpen(BOOL isOpen) = 0; //2. ÉèÖÃÆÁ±Î virtual void OpenKeySetWindow(void) = 0; //3. ×ø±êת»» virtual Point2I getPose(int eDir, int xPoxPxl, int yPosPxl) = 0; //4. Ö´ÐÐÊÓ¾õ´¦Àí virtual int Execute(int eDir, NgInfo *ngArray) = 0; //5. ÉèÖûص÷ʱ¼ä virtual void setImageEventSignal(IVisionEvent *pEvent) = 0; //6. ×ø±êת»»£¬Í³Ò»×ø±êϵͳ virtual bool transformToStandard(int eDir, Point2I point, Point2I &result, Point2I &topResult, Point2I &botResult) = 0; //7. ¼ì²âCutÏß virtual bool findCutLine(int eDir, int toTopY, int toLineDist, int nEndThres, Point2I &result) = 0; virtual double DistancePL(Point2D pose, Line2D line) = 0; //8. ¼ì²âNorchȱÏÝ virtual int findNorchDefect(int eDir, std::vector vPoints, CRect roiRect, int nThres, int nOffset, int nBinThres, int szType, int xFzSize, int yFzSize, CRect* aryResult) = 0; }; #endif