可以幫我看一下NCC程式碼,為什麼每次跑出來的數據都不一樣呢? |
|
Solaris2005
一般會員 發表:7 回覆:13 積分:4 註冊:2003-05-19 發送簡訊給我 |
int nTemplate[33][33];
for (int x=0; x<33; x ) { for (int y=0; y<33; y ) { nTemplate[x][y] = GetRValue(Image1->Picture->Bitmap->Canvas->Pixels[x][y]); } } double nTemplateAvg = 0; for (int x=0; x<33; x ) { for (int y=0; y<33; y ) { nTemplateAvg = nTemplate[x][y]; } } nTemplateAvg /= (33*33); double nSearchAvg = 0; double nC1 = 0; double nC2 = 0; double nC3 = 0; double nCorrelation = 0; double nMax = -2; int nX = 0; int nY = 0; for (int x=16; x<=250; x ) { for (int y=16; y<=250; y ) { nC1 = 0; nC2 = 0; nC3 = 0; nSearchAvg = 0; for (int m=-16; m<=16; m ) { for (int n=-16; n<=16; n ) { nSearchAvg = GetRValue(Image2->Picture->Bitmap->Canvas->Pixels[m x][n y]); } } nSearchAvg /= 1089; for(int m=-16; m<=16; m ) { for(int n=-16; n<=16; n ) { nC1 = ((double)GetRValue(Image2->Picture->Bitmap->Canvas->Pixels[x m][y n])-nSearchAvg)*((double)nTemplate[m 16][n 16]-nTemplateAvg); nC2 = ((double)GetRValue(Image2->Picture->Bitmap->Canvas->Pixels[x m][y n])-nSearchAvg)*((double)GetRValue(Image2->Picture->Bitmap->Canvas->Pixels[x m][y n])-nSearchAvg); nC3 = ((double)nTemplate[m 16][n 16]-nTemplateAvg)*((double)nTemplate[m][n]-nTemplateAvg); } } nCorrelation = nC1/sqrt(nC2*nC3); } } |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |