Donnerstag, 29. September 2011

EE5806 image processing project- vertical histogram


/* add_vert.c */
// vertical histogram

#include
#include
#include

int main(int argc, char *argv[])
{

int ima[] = { 1,1,0, 0,1,1, 1,1,0, 0,0,1 ,0,0,0, 0,0,0, 1,1,1};
int v_hist[100];



int i,j , n_col=3, n_row=6;
int num_v_pixel=0;

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

}
printf("\n");
v_hist[j] =num_v_pixel;
num_v_pixel=0; /* reset the counter */
printf (" col: %3d pixels :%2d", j , v_hist[j]);


}


return 0;

} // end main



Keine Kommentare: