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