📄 canny.h
字号:
//////////////////////////////////////////////////////////////////
// Canny.h
// Original Code from:
// Algorithms for Image Processing and Computer Vision
// By J.R. Parker
// Modified for VisSDK by: Travis A Udd 11/30/00
//////////////////////////////////////////////////////////////////
#ifndef CANNY_H
#define CANNY_H
/* The image header data structure */
struct header {
int nr, nc; /* Rows and columns in the image */
int oi, oj; /* Origin */
};
/* The IMAGE data structure */
struct image {
struct header *info; /* Pointer to header */
unsigned char **data; /* Pixel values */
};
#define SQRT2 1.414213562
#define BLACK 0
#define WHITE 1
typedef struct image * IMAGE;
struct imagec {
struct header *info; /* Pointer to header */
unsigned char **data; /* Pixel values */
};
//void CannyFilter(imagec *im);
void CannyFilter(imagec *im,int low,int high,double gaussian);
struct imagec *newimagec (int nr, int nc);
void freeimagec (struct imagec *z);
class Canny
{
public:
Canny( CDefaultImage *imageSrc);
// ~Canny();
//////////////////////////////////////////////////////////////////
// CannyEdgeDetect()
// Travis A Udd 11/30/00
// Function: Fills 2D buffer with image
// and runs canny filter function on it.
// result is edges of found in image.
//////////////////////////////////////////////////////////////////
void CannyEdgeDetect(CVisRGBAByteImage *featureImage);
void SetHighTreshold(int th){HighTh=th;}
void SetLowerTreshold(int th){LowTh=th;}
void SetGaussianDeviation(double gau){Gaussian=gau;}
private:
/* Fraction of pixels that should be above the HIGH threshold */
float ratio; // = 0.1f;
int WIDTH; // = 0;
int trace (int i, int j, int low, imagec* im,imagec* mag, imagec* ori);
float gauss(float x, float sigma);
float dGauss (float x, float sigma);
float meanGauss (float x, float sigma);
void hysteresis (int high, int low, imagec* im, imagec* mag, imagec* oriim);
void canny (float s, imagec* im, imagec* mag, imagec* ori);
void seperable_convolution (imagec* im, float *gau, int width,
float **smx, float **smy);
void dxy_seperable_convolution (float** im, int nr, int nc, float *gau,
int width, float **sm, int which);
void nonmax_suppress (float **dx, float **dy, int nr, int nc,
imagec* mag, imagec* ori);
void estimate_thresh (imagec* mag, int *low, int *hi);
float ** f2d (int nr, int nc);
struct imagec * newimagec (int nr, int nc);
void freeimagec (struct imagec *z);
void CannyFilter(imagec *im,int low,int high,double gaussian);
float norm (float x, float y);
int range (imagec* im, int i, int j);
// CVisImage<CVisRGBAUCharPixel> m_workingImage;
CDefaultImage *m_pImage;
int HighTh;
int LowTh;
double Gaussian;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -