1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// EdgeProc.h: interface for the CEdgeProc class.
//
//////////////////////////////////////////////////////////////////////
 
#if !defined(AFX_EDGEPROC_H_INCLUDED_)
#define AFX_EDGEPROC_H_INCLUDED_
 
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
 
 
#include "EDGE_DIPM.h"
#include <vector>
 
class CSISBuffer;
 
 
class AFX_EXT_CLASS CEdgeProc
{
    int        m_nGX[3][3], m_nGY[3][3];
    BYTE    m_btBackground,m_btWhite;
 
public:
    CEdgeProc();
    virtual ~CEdgeProc();
 
public:
    BOOL                CannyEdgeProcessing(LPBYTE pImageBuf,CRect &rectIns,enGradientMask enMask,int nThres,CSISBuffer &ptgt);    
    float                catmullRomSpline(float x, float v0,float v1, float v2,float v3) ;    
    void                ThresholdProcessing(LPBYTE pImg,CSize szImg,int nThres,int nDir);
    unsigned char        OtsuoBinary(CSISBuffer &pOrg,CRect rect,int nOpt=1);
    float                AdaptiveThreshold(BYTE* pImageData, int nWidth, int nHeight, int nStep, int nThresValue);
    BOOL                HSobelBoundary(LPBYTE lpInImg, LPBYTE lpOutImg, int nWidth, int nBufWidth, int nHeight,int nThres);
    BOOL                VSobelBoundary(LPBYTE lpInImg, LPBYTE lpOutImg, int nWidth, int nBufWidth, int nHeight,int nThres);
    void                LocalHistogramEqualization(BYTE *image,int width,int height,int wsize,BYTE *out);
    void                Adaptive_Binarization(BYTE *gray,int width,int height,int datawidth,int w/*window Size=15*/,double k/*factor=0.2*/,BYTE *bimage,CRect rect);    
    void                ThresholdByIntegralImage(BYTE *image,int width,int height,int datawidth,int wsz,BYTE *matrix);
        
    
    BOOL                IMMovePoint(IMPOS2D iPos, IMPOS2D *oPos, IMPOS2D B_P);
    BOOL                IMGetRotImg(ROI aoi, CSISBuffer Org, CSISBuffer Tgt, IMPOS2D pCen, double sinRad, double cosRad);
    BOOL                IMRotatePoint(IMPOS2D iPos, IMPOS2D *oPos, IMPOS2D B_P, double sinRad, double cosRad);
    BOOL                IMRotatePoint(IMPOS2D iPos, IMPOS2D *oPos, double sinRad, double cosRad);
    int                    IMROICenX(ROI roi) { return    (int)(roi.u1 + (roi.u2 - roi.u1) / 2 + 0.5); }
    int                    IMROICenY(ROI roi) { return    (int)(roi.v1 + (roi.v2 - roi.v1) / 2 + 0.5); }
    int                    IMROIWidth(ROI roi) { return    (int)(roi.u2 - roi.u1 + 1); }
    int                    IMROIHeight(ROI roi) { return    (int)(roi.v2 - roi.v1 + 1); }
 
public:
    BOOL                CvFindMark(CSISBuffer lpOrg,IplImage *IpMark,CRect rcIns,TEMP_RESULT &result, double  dRate);
    TEMP_MATCH_DATA        Cv_TempleateMath(CvRect roi,IplImage* IpSrc    ,IplImage* IpTem);
 
public:
    BOOL                RotatePoint(CPoint iPos, CPoint *oPos, CPoint B_P, double sinRad, double cosRad);
    BOOL                RotatePoint(CPoint iPos, double &dXPos,double &dYPos, double sinRad, double cosRad);
    BOOL                RotatePoint(CPoint iPos, double &dXPos,double &dYPos, CPoint B_P, double sinRad, double cosRad);
    BOOL                RotatePoint(CvPoint2D32f  iPos, double &dXPos,double &dYPos, CvPoint2D32f  B_P, double sinRad, double cosRad);
    BOOL                RotatePoint(CvPoint2D32f iPos, double &dXPos,double &dYPos, double sinRad, double cosRad);
    BOOL                RotatePoint(CPoint iPos, CPoint *oPos, double sinRad, double cosRad);    
    BOOL                MovePoint(CPoint iPos, CPoint *oPos, CPoint B_P);
    double                GetTheta(sPoint *pLinedata,int nLineCnt,int nRange=20);
 
protected:
    int                    MaximizeDiscriminantFunction(double * p);
    void                imCalcHistogram(LPBYTE pOrg, int nWidth,int nHeight, unsigned long* histo, int cumulative,CRect rect);    
    float                GetThresholdValue(BYTE* pImageData, int nWidth, int nHeight, int nStep, int nThresValue);
    void                MakeIntegralImage(BYTE *image,int width,int height,int datawidth,int *intImage);    
 
protected:
    int                    m_subthick;            // sub-thickness
};
 
 
#endif // !defined(AFX_EDGEPROC_H_INCLUDED_)