1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
int main(int argc, char *argv[])
{
sequence *seq; /* pointer to input sequence data structure */
image **imgs; /* pointer to input sequence array of images */
image *out; /* pointer the output image */
char seq_in[100], /* input sequence name */
seq_out[100], /* output sequence name */
file_out[100], /* output file name */
file_in[100]; /*input image to read*/
int length; /* length of the sequence */
int i=0; /* loop index */
/* Process input arguments */
if(argc != 3)
{
fprintf(stderr,"Usage: %s [input PGM sequence name] [output PGM sequence name]\n", argv[0]);
exit(0);
}
else
{
strcpy(seq_in, argv[1]);
strcpy(seq_out, argv[2]);
}
/* Load the input sequence */
seq = load_sequence(seq_in);
/* Get a pointer to the sequence images */
imgs = get_sequence_images(seq);
/* Get sequence length */
length = get_sequence_length(seq);
/* Check if sequence is long enough */
if(length < 2) {
fprintf(stderr, "sequence is too short\n");
exit(1)
pgm_read_image("mad000.pgm",imgs[0]);
out = clone_image(imgs[0]);
//
while(i!=length-1)
{
/*read the n image */
double x;
sprintf(file_in, "%s%03d.pgm", seq_in, i);
pgm_read_image(file_in,imgs[i]);
/*Idiff=In-In-1 */
create_diff_image(imgs[i],imgs[i+1],out);
x=calc_entropy_image(out,1);
printf(" entropy value : %lg ",x);
i++;
imgs[i-1]=imgs[i];
/* Now write out the diff image */
/*sprintf(file_out, "%s%03d.pgm", seq_out, i);
printf("Writing out %s\n",file_out);
pgm_write_image(out, file_out);
*/
printf("diff a la %d eme valeur\n",i);
} |
Partager