Skip to content
Snippets Groups Projects
Select Git revision
  • 069abfd19bdc9128d6822f6832d8331eafc02f8e
  • master default protected
2 results

pgm_main.c

Blame
  • pgm_main.c 1.80 KiB
    #include "pgm.h"
    
    int main(){
        pgm a;
        pgm neg;
        pgm sym_hori;
        pgm sym_vert;
        pgm sym_cent;
        pgm photomatonx4;
        pgm photomatonx16;
        pgm cropped;
        pgm zeroPgm;
        //pgm convolution;
        int conv[9] = {1,1,1,1,0,1,1,1,1};
        matrix convKernel;
        matrix_init_from_array(&convKernel, 3, 3, conv, 9);
    
    
    
        printf("%d", pgm_read_from_file(&a, "mandrill.pgm"));
        //printf("%d", pgm_write_to_file(&a, "newf.pgm"));
        printf("%d", pgm_negative(&neg, &a));
        printf("%d", pgm_symmetry_hori(&sym_hori, &a));
        //printf("%d", pgm_write_to_file(&sym_hori, "sym_hori.pgm"));
    
        printf("%d", pgm_symmetry_vert(&sym_vert, &a));
        //printf("%d", pgm_write_to_file(&sym_vert, "sym_vert.pgm"));
    
        printf("%d", pgm_symmetry_cent(&sym_cent, &a));
        //printf("%d", pgm_write_to_file(&sym_cent, "sym_cent.pgm"));
    
        printf("%d", pgm_photomaton(&photomatonx4, &a));
        //printf("%d", pgm_write_to_file(&photomatonx4, "photomatonx4.pgm"));
    
        printf("%d", pgm_photomaton(&photomatonx16, &photomatonx4));
        //printf("%d", pgm_write_to_file(&photomatonx16, "photomatonx16.pgm"));
    
        printf("%d", pgm_crop(&cropped, &a, 100, 300, 100, 300));
        //printf("%d", pgm_write_to_file(&cropped, "cropped.pgm"));
    
        printf("%d", add_zeros_in_pgm(&zeroPgm, &a));
        printf("%d", pgm_write_to_file(&zeroPgm, "zero.pgm"));
    
        //printf("%d", pmg_conv(&convolution, &a, &convKernel));
        //printf("%d", pgm_write_to_file(&convolution, "convolution.pgm"));
    
        matrix_destroy(&a.pixels);
        matrix_destroy(&neg.pixels);
        matrix_destroy(&sym_hori.pixels);
        matrix_destroy(&sym_vert.pixels);
        matrix_destroy(&sym_cent.pixels);
        matrix_destroy(&photomatonx4.pixels);
        matrix_destroy(&photomatonx16.pixels);
        matrix_destroy(&cropped.pixels);
        matrix_destroy(&convKernel);
    
        return EXIT_SUCCESS;
    }