66409758bill-recognition.rar


66409758bill-recognition.rar
资源截图
代码片段和文件信息
#include “stdafx.h“
#include 
#include 
#include 
#include 
#include 
#include “feature.h“
#include “calHSB.h“


typedef struct
{
unsigned char red;
unsigned char green;
unsigned char blue;
} rgb_color;

typedef struct
{
int hue;
int saturat;
int bright;
} hsb_color;

int *Gauss;

#define Pi 3.1415926
#define SUM_WIDTH 10
#define DIST_DELTA 15
#define A 3
#define COUNTERR 200

void CalGauss(int *data int length)
{
int i;
double result x;

for(i=-length; i<=length; i++){
x = (double)i;
result = 1.0/(A*sqrt(2.0*3.1415926));
result *= (exp(-x*x/(2.0*A*A)));
result *= 1000;
data[i] = (int)(result);
}
}


void rgb2hsb( rgb_color *pRgb  hsb_color *pHsb )
{
double  x  y  r angle;
int max = 0; 
int min = 255;

if( pRgb->red   < min ) min = pRgb->red;
if( pRgb->green < min ) min = pRgb->green;
if( pRgb->blue  < min ) min = pRgb->blue;
if( pRgb->red   > max ) max = pRgb->red;
if( pRgb->green > max ) max = pRgb->green;
if( pRgb->blue  > max ) max = pRgb->blue;

if(max == 0){
pHsb->hue     = 0;
pHsb->saturat = 0;
pHsb->bright  = 0;
return;
}

x = pRgb->red - 0.5000 * (pRgb->green + pRgb->blue );
y = 0.8660254037844 *( pRgb->green - pRgb->blue );

if((r = sqrt(x*x + y*y)) <= 0.01){
pHsb->hue     = -1;
pHsb->saturat = ((max -min)*100/max);
pHsb->bright  = (int) ((max + 1 )*100/ 256);
return;
}else{
angle = asin(fabs(y)/r);
}

if( x >= 0.0 ){
if( y >= 0.0) angle = angle;
else angle = 2*Pi - angle;
}else{
if( y >= 0.0) angle = Pi - angle;
else angle = Pi + angle;
}

pHsb->hue     = (int) (angle * 180 / Pi);
pHsb->saturat = (int) ((max -min)*100/max);
    pHsb->bright  = (int) ((max + 1 )*100/ 256);
return;
}

void CalHSB2(unsigned char *ImagePtr[] int height int width 
FeatureSetHeader *FSH)
{
unsigned char * pBuf;
hsb_color Hsb ;
rgb_color Rgb ;
int i j count row  col;
int s e sum max1 max1index max2 max2index;
int HistOnHue[360];
int HistVolut[360];
int HistVolut1[360];
int SatTh = 10 tempindex;

// Init Hue Histogram of Hue
for( i = 0; i < 360; i++) HistOnHue[i] = 0;
//calculate Gauss
Gauss = (int *)malloc((2*SUM_WIDTH+1)*sizeof(int));
Gauss += SUM_WIDTH;
CalGauss(Gauss SUM_WIDTH);

// Form Saturate Threshold.


// Form Saturate Threshold.
for( row = 0; row < height;  row++ ){
pBuf = ImagePtr[row];
for( col = 0; col < width; col++ ){
Rgb.blue   = *pBuf++;
Rgb.green = *pBuf++;
Rgb.red  = *pBuf++;
rgb2hsb( &Rgb  &Hsb );
if(Hsb.saturat > SatTh && Hsb.bright > 20)
HistOnHue[Hsb.hue]++;
}
}

/* Calculate the s e sum and convolution*/
s = 360 - SUM_WIDTH; e = SUM_WIDTH; 
sum = 0;
for( s = 360 - SUM_WIDTH count = 0; count<360 ;s++ count++){
sum = 0;
for( i = -SUM_WIDTH j = s ; i <=SUM_WIDTH; i++ j++){
sum += HistOnHue[j%360]*Ga

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      33199  1998-06-21 10:53  bill recognitionAA.CPP

     文件      33265  1998-06-25 17:18  bill recognitionADJUST.CPP

     文件        119  1998-05-28 20:39  bill recognitionADJUST.H

     文件      26539  1998-06-21 10:52  bill recognitionADJUST2.CPP

     文件      24421  1998-06-21 10:52  bill recognitionADJUST3.CPP

     文件       4031  1998-05-15 16:32  bill recognitioncalHSB.cpp

     文件         93  1998-05-15 16:32  bill recognitioncalHSB.h

     文件      15462  1998-06-20 23:07  bill recognitionDIBAPI.CPP

     文件       1726  1998-06-16 16:08  bill recognitionDIBAPI.H

     文件       5019  1998-06-18 09:30  bill recognitionDIBDOC.CPP

     文件       1464  1998-04-20 11:24  bill recognitionDIBDOC.H

     文件        766  1998-06-08 12:15  bill recognitionDIBDOC.ICO

     文件       5317  1998-05-15 16:22  bill recognitiondiblook.001

     文件       4257  1998-05-14 14:22  bill recognitionDIBLOOK.CPP

     文件       5354  2008-07-03 21:49  bill recognitiondiblook.dsp

     文件        539  2008-07-03 21:38  bill recognitionDIBLOOK.DSW

     文件     192584  2008-07-03 21:50  bill recognitiondiblook.exe

     文件       1215  1998-04-20 16:20  bill recognitionDIBLOOK.H

     文件        766  1998-06-08 12:15  bill recognitionDIBLOOK.ICO

     文件      28560  1998-04-20 11:24  bill recognitionDIBLOOK.MAK

     文件     238592  2009-11-11 06:11  bill recognitionDIBLOOK.ncb

     文件      56832  2009-11-11 06:11  bill recognitionDIBLOOK.OPT

     文件       2395  2009-11-08 16:56  bill recognitiondiblook.plg

     文件      17586  1998-06-08 12:15  bill recognitionDibLook.rc

     文件      19020  2008-07-08 16:36  bill recognitionDIBVIEW.CPP

     文件       2006  1998-05-15 17:59  bill recognitionDIBVIEW.H

     文件        971  1998-06-24 15:09  bill recognitionFeature.h

     文件         12  1998-05-14 14:35  bill recognitionFET.CPP

     文件      24697  1998-06-21 10:52  bill recognitionfetprocess.cpp

     文件       2483  1998-05-15 18:29  bill recognitionInputDialog.cpp

............此处省略147个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)