You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

44 regels
864 B

  1. #include "config.h"
  2. #include "common.h"
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <pipi.h>
  7. double kern[] =
  8. {
  9. 0., -.0625, -.125, -.0625, 0.,
  10. -.0625, -.125, -.25, -.125, -.0625,
  11. -.125, -.25, 3.5, -.25, -.125,
  12. -.0625, -.125, -.25, -.125, -.0625,
  13. 0., -.0625, -.125, -.0625, 0.,
  14. };
  15. int main(int argc, char *argv[])
  16. {
  17. char *srcname = NULL, *dstname = NULL;
  18. pipi_image_t *img, *newimg;
  19. if(argc < 3)
  20. {
  21. fprintf(stderr, "%s: too few arguments\n", argv[0]);
  22. fprintf(stderr, "Usage: %s <src> <dest>\n", argv[0]);
  23. return EXIT_FAILURE;
  24. }
  25. srcname = argv[1];
  26. dstname = argv[2];
  27. img = pipi_load(srcname);
  28. newimg = pipi_convolution(img, 5, 5, kern);
  29. pipi_free(img);
  30. pipi_save(newimg, dstname);
  31. pipi_free(newimg);
  32. return 0;
  33. }