• 大小: 2.68M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-11-15
  • 语言: 其他
  • 标签: 其他  

资源简介

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 recognition\AA.CPP

     文件      33265  1998-06-25 17:18  bill recognition\ADJUST.CPP

     文件        119  1998-05-28 20:39  bill recognition\ADJUST.H

     文件      26539  1998-06-21 10:52  bill recognition\ADJUST2.CPP

     文件      24421  1998-06-21 10:52  bill recognition\ADJUST3.CPP

     文件       4031  1998-05-15 16:32  bill recognition\calHSB.cpp

     文件         93  1998-05-15 16:32  bill recognition\calHSB.h

     文件      15462  1998-06-20 23:07  bill recognition\DIBAPI.CPP

     文件       1726  1998-06-16 16:08  bill recognition\DIBAPI.H

     文件       5019  1998-06-18 09:30  bill recognition\DIBDOC.CPP

     文件       1464  1998-04-20 11:24  bill recognition\DIBDOC.H

     文件        766  1998-06-08 12:15  bill recognition\DIBDOC.ICO

     文件       5317  1998-05-15 16:22  bill recognition\diblook.001

     文件       4257  1998-05-14 14:22  bill recognition\DIBLOOK.CPP

     文件       5354  2008-07-03 21:49  bill recognition\diblook.dsp

     文件        539  2008-07-03 21:38  bill recognition\DIBLOOK.DSW

     文件     192584  2008-07-03 21:50  bill recognition\diblook.exe

     文件       1215  1998-04-20 16:20  bill recognition\DIBLOOK.H

     文件        766  1998-06-08 12:15  bill recognition\DIBLOOK.ICO

     文件      28560  1998-04-20 11:24  bill recognition\DIBLOOK.MAK

     文件     238592  2009-11-11 06:11  bill recognition\DIBLOOK.ncb

     文件      56832  2009-11-11 06:11  bill recognition\DIBLOOK.OPT

     文件       2395  2009-11-08 16:56  bill recognition\diblook.plg

     文件      17586  1998-06-08 12:15  bill recognition\DibLook.rc

     文件      19020  2008-07-08 16:36  bill recognition\DIBVIEW.CPP

     文件       2006  1998-05-15 17:59  bill recognition\DIBVIEW.H

     文件        971  1998-06-24 15:09  bill recognition\Feature.h

     文件         12  1998-05-14 14:35  bill recognition\FET.CPP

     文件      24697  1998-06-21 10:52  bill recognition\fetprocess.cpp

     文件       2483  1998-05-15 18:29  bill recognition\InputDialog.cpp

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

评论

共有 条评论