直方圖,不知哪裡錯了
int n,N,A;
BYTE *ImgLineS,*ImgLineS1,max,Z,a;
float newp[256];
float count[256];
float p[256];
for(int y=0;y<ImgHeight;y++)
{
ImgLineS=(BYTE *)imgShow->Picture->Bitmap->ScanLine[y];
ImgLineS1=(BYTE *)imgEdge->Picture->Bitmap->ScanLine[y];
for(int x=0;x<ImgWidth;x++){
for(int j=0;j<256;j++){
if(ImgLineS[x]==j){
count[j]=count[j]+1;
}
int v = ImgHeight * ImgWidth;
p[j] = count[j] / v;
ImgLineS1[j]=(256/count[j])* p[j];
}
[解决办法]
int n,N,A;
BYTE *ImgLineS,*ImgLineS1,max,Z,a;
float newp[256];
float count[256];
float p[256];
for(int y=0;y<ImgHeight;y++)
{
ImgLineS=(BYTE *)imgShow->Picture->Bitmap->ScanLine[y];
ImgLineS1=(BYTE *)imgEdge->Picture->Bitmap->ScanLine[y];
for(int x=0;x<ImgWidth;x++){
for(int j=0;j<256;j++){
if(ImgLineS[x]==j){
count[j]=count[j]+1;
}
int v = ImgHeight * ImgWidth;
p[j] = count[j] / v;
ImgLineS1[j]=(256/count[j])* p[j];
}