You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
127 lines
4.7 KiB
127 lines
4.7 KiB
#pragma once
|
|
|
|
enum ERR_DOT_TYPE_ENUM
|
|
{
|
|
ERR_TYPE_1,
|
|
ERR_TYPE_2,
|
|
ERR_TYPE_COUNT,
|
|
};
|
|
#define Value_ERR_TYPE_1 64
|
|
#define Value_ERR_TYPE_2 128
|
|
|
|
//-----------------------sxg added
|
|
#define _MAX_ERROR_SCAN_LINE_PER_ROW 300
|
|
#define _MAX_ERROR_DOT_BLOB 500
|
|
#define _MAX_MACRO_COUNT 4
|
|
|
|
#define _MAX_ERR_CLASS ERR_TYPE_COUNT
|
|
// #define _CAM_WIDTH 640
|
|
#define _MAX_MIN_VALUE_NUM 10
|
|
typedef struct ERROR_DOTS_SCAN_DATA
|
|
{
|
|
unsigned short x, count;
|
|
unsigned short minx, miny;
|
|
unsigned short maxx, maxy;
|
|
int area, energy;
|
|
int xposSum, yposSum;
|
|
int macro;
|
|
int type;
|
|
int ErrClass[_MAX_ERR_CLASS];
|
|
} ERROR_DOTS_SCAN_DATA;
|
|
|
|
typedef struct ERROR_DOTS_SCAN_ROW
|
|
{
|
|
int scanCount;
|
|
ERROR_DOTS_SCAN_DATA errorScanLineTab[_MAX_ERROR_SCAN_LINE_PER_ROW];
|
|
int macro[_MAX_MACRO_COUNT];
|
|
int ErrClass[_MAX_ERR_CLASS];
|
|
int minValue[_MAX_MIN_VALUE_NUM];
|
|
} ERROR_DOTS_SCAN_ROW;
|
|
|
|
typedef struct ERROR_DOTS_BLOB_DATA
|
|
{
|
|
unsigned short x, y;
|
|
unsigned short minx, miny;
|
|
unsigned short maxx, maxy;
|
|
int area;
|
|
int energy;
|
|
float JudgArea;
|
|
float len;
|
|
int macro[_MAX_MACRO_COUNT];
|
|
int ErrClass[_MAX_ERR_CLASS];
|
|
int whiteOrblack;
|
|
int ErrType;
|
|
int UserErrorType;
|
|
int maxValue;
|
|
float grayDis;
|
|
int AIclasstype;
|
|
float density;
|
|
unsigned short badd;
|
|
} ERROR_DOTS_BLOB_DATA;
|
|
|
|
typedef struct ERROR_DOTS_BLOBS
|
|
{
|
|
int blobCount;
|
|
int srcBlobCount;
|
|
int totalArea;
|
|
int totalEnergy;
|
|
ERROR_DOTS_BLOB_DATA blobTab[_MAX_ERROR_DOT_BLOB];
|
|
int ErrClass[_MAX_ERR_CLASS];
|
|
} ERROR_DOTS_BLOBS;
|
|
|
|
typedef struct ERROR_DOTS_BLOB_PARAM
|
|
{
|
|
int minArea; // ²ÐµãÇøÓòÃæ»ý×îСֵ£¬µ¥Î»ÎªÏñËØµã£¬Èç¹ûСÓÚ´ËÖµ£¬ÔòºöÂÔ
|
|
int minEnergy; // ²ÐµãÇøÓòÄÜÁ¿×îСֵ£¬Èç¹ûСÓÚ´ËÖµ£¬ÔòºöÂÔ
|
|
|
|
int maxErrorBlobCount; // ×î´óÔÊÐíµÄÂú×ãÉÏÊöÌõ¼þºóµÄ²ÐµãÇøÓòÊýÁ¿£¬Èç¹û´óÓÚ´ËÖµ£¬ Ôò±¨´í
|
|
int maxTotalArea; // ×î´óÔÊÐíµÄÂú×ãÉÏÊöÌõ¼þºóµÄ²ÐµãÇøÓò×ÜÃæ»ý£¬Èç¹û´óÓÚ´ËÖµ£¬ Ôò±¨´í
|
|
int maxTotalEnergy; // ×î´óÔÊÐíµÄÂú×ãÉÏÊöÌõ¼þºóµÄ²ÐµãÇøÓò×ÜÄÜÁ¿£¬Èç¹û´óÓÚ´ËÖµ£¬ Ôò±¨´í
|
|
|
|
int maxRegionArea; // ×î´óÔÊÐíµÄµ¥¸ö²ÐµãÇøÓòÃæ»ý£¬Èç¹û´óÓÚ´ËÖµ£¬ Ôò±¨´í
|
|
int maxRegionEnergy; // ×î´óÔÊÐíµÄµ¥¸ö²ÐµãÇøÓòÄÜÁ¿£¬Èç¹û´óÓÚ´ËÖµ£¬ Ôò±¨´í
|
|
int Hthold[4]; // ѧϰģ°æºóµÄÀ©Õ¹ãÐÖµ
|
|
int Lthold[4]; // ѧϰģ°æºóµÄÀ©Õ¹ãÐÖµ
|
|
int Level[2]; // ÑÏÖØµÈ¼¶
|
|
int mergeDistance; // ²ÐµãºÏ²¢×îС¾àÀë £¬¡¡ÈôÁ½¸ö²Ðµã¾àÀëСÓÚ´ËÖµÔòºÏ²¢ÎªÒ»¸ö
|
|
int isUseMacro;
|
|
} ERROR_DOTS_BLOB_PARAM;
|
|
|
|
typedef struct ERROR_BLOBS_PARAM
|
|
{
|
|
int id;
|
|
unsigned char *pb;
|
|
unsigned char *pr;
|
|
unsigned char *pc;
|
|
int width;
|
|
int height;
|
|
int obj;
|
|
ERROR_DOTS_BLOBS *blobs;
|
|
|
|
} ERROR_BLOBS_PARAM;
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
void pretest(double x);
|
|
extern void AddErrorScan(ERROR_DOTS_SCAN_ROW *curRow, ERROR_DOTS_SCAN_ROW *prevRow, int x, int len, int y, int difSum, int minArea, int minEng, int mdx, int *pErrClass);
|
|
extern void LinkScanLineToBlob(ERROR_DOTS_BLOBS *blobs, ERROR_DOTS_SCAN_ROW *prevRow, int sx, int sy, int minArea, int minEnergy, int mergeDistanceX, int mergeDistanceY, int width);
|
|
extern void SortBlob(ERROR_DOTS_BLOBS *blobs);
|
|
extern void MergeBlob(ERROR_DOTS_BLOBS *blobs, ERROR_DOTS_BLOB_PARAM *param);
|
|
extern void AddErrorScan_New(ERROR_DOTS_SCAN_ROW *curRow, ERROR_DOTS_SCAN_ROW *prevRow, int x, int len, int y, int difSum, int minArea, int minEng, int errorType);
|
|
extern void LinkScanLineToBlob_New(ERROR_DOTS_BLOBS *blobs, ERROR_DOTS_SCAN_ROW *prevRow, int sx, int sy, int minArea, int minEnergy, int mergeDistanceX, int mergeDistanceY, int width);
|
|
|
|
extern int GetBlobs_V2(ERROR_DOTS_BLOBS *blobs, unsigned char *pImgdata, unsigned char *pErrordata, int width, int height, int basev, int minArea);
|
|
extern int GetBlobs_V3(ERROR_DOTS_BLOBS *blobs, unsigned char *pErrordata, int width, int height, int minArea);
|
|
extern int GetBlobs_V3_CA(ERROR_DOTS_BLOBS *blobs, unsigned char *pErrordata, int width, int height, int minArea, int err_1_value, int err_2_value);
|
|
extern int GetBlobs_ALL_New(ERROR_DOTS_BLOBS *blobs, unsigned char *pErrordata, unsigned char *pHdata, int width, int height, int minArea);
|
|
extern int GetBlobs_oneLabe(ERROR_DOTS_BLOBS *blobs, unsigned char *pErrordata, unsigned char *pHdata, int width, int height, int minArea);
|
|
|
|
extern int PushBlob(ERROR_DOTS_BLOBS *blobs, ERROR_DOTS_BLOBS *addblobs);
|
|
|
|
//逐像素计算灰阶
|
|
extern int CalHJ_Pixel(unsigned char *pErrordata,unsigned char *pMaskdata, int width, int height,int bkvalue,float ratio );
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif |