Dienstag, 27. September 2011

EE4206/EE5806 Digital Image Processing -- project --horizontal histogram

code to find the horizontal histogram of the 2 text lines


/* ------------------- */
void horiz_hist (unsigned char *ima, int n_row, int n_col)
{
long int h_hist[n_row];

printf("in horiz_hist \n");

int i, j, row_num, num_pixel=0;

for (i=0; i< n_row; i++) {
for (j=0; j< n_col; j++) {
if (ima[i* n_col+ j] ==0)
{

num_pixel++;
}
h_hist[i] =num_pixel;
}
num_pixel=0; /* reset the counter */
printf (" %5d%5d", i , h_hist[i]);
printf ( "\n");

}

/* ===============*/

}


to do :

use a 2d array to store the character pixels.
use mathlab/ octave to plot histograms



Keine Kommentare: