Hi, im doing histogram equalization on 8-bit images of sizes 512*512 and 256*256..

Here is my code below:

Im sure that step 1 is correct..

however when i toggle a breakpoint on cdf[i] in step 2 and when i wanted to check the values inside it and make sure its cumulative frequency compared to array1[i] which is just frequency.. When i got the values, i get random flow of number ie: '02ex47810'..

Any ideas why is this so? Thanks

Here is my code below:

Code:

void CLEO_MedivisionView::OnUpdateToolsHistogramequalization(CCmdUI *pCmdUI) { // TODO: Add your command update UI handler code here if (fileopen) { pCmdUI->Enable(true); } else { pCmdUI->Enable(false); } } void CLEO_MedivisionView::OnToolsHistogramequalization() { int i; unsigned int array1[256]; unsigned int cdf[256]; unsigned int arrayhe[256]; //** Step 1 **\\ for (i=0;i<256;i++) { array1[i]=0; } if (no_of_rows == 512 && no_of_cols == 512) { for (i=0; i<262144; i++) { array1[image[i]]++; } } else if (no_of_rows == 256 && no_of_cols == 256) { for (i=0; i<65536; i++) { array1[image256[i]]++; } } //** Step 2 **\\ cdf[0] = array1[i]; // finding cumulative distribution for (i=1; i<256; i++) { cdf[i] = array1[i] + cdf[i-1]; } for (i=0;i<256;i++) // zeros out all the element in the array { arrayhe[i]=0; } for (i=0; i<256; i++) // applying the HE algorithm { arrayhe[i] = (cdf[i]*255/262144)+0.5; } }

however when i toggle a breakpoint on cdf[i] in step 2 and when i wanted to check the values inside it and make sure its cumulative frequency compared to array1[i] which is just frequency.. When i got the values, i get random flow of number ie: '02ex47810'..

Any ideas why is this so? Thanks