routine. Note that it is not the "real" sharpen which should be built on top of a gaussian kernel. git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@2662 92316355-f0b4-4df1-b90c-862c8a59935fremotes/tiles
@@ -14,6 +14,7 @@ examples/blur | |||||
examples/dither | examples/dither | ||||
examples/edd | examples/edd | ||||
examples/img2rubik | examples/img2rubik | ||||
examples/sharpen | |||||
test/u8tof32tou8 | test/u8tof32tou8 | ||||
stamp-h1 | stamp-h1 | ||||
.auto | .auto | ||||
@@ -2,7 +2,7 @@ | |||||
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/pipi | AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/pipi | ||||
bin_PROGRAMS = blur dither edd img2rubik | |||||
bin_PROGRAMS = blur dither edd img2rubik sharpen | |||||
blur_SOURCES = blur.c | blur_SOURCES = blur.c | ||||
blur_LDADD = ../pipi/libpipi.la | blur_LDADD = ../pipi/libpipi.la | ||||
@@ -16,3 +16,6 @@ edd_LDADD = ../pipi/libpipi.la | |||||
img2rubik_SOURCES = img2rubik.c | img2rubik_SOURCES = img2rubik.c | ||||
img2rubik_LDADD = ../pipi/libpipi.la | img2rubik_LDADD = ../pipi/libpipi.la | ||||
sharpen_SOURCES = sharpen.c | |||||
sharpen_LDADD = ../pipi/libpipi.la | |||||
@@ -0,0 +1,43 @@ | |||||
#include "config.h" | |||||
#include "common.h" | |||||
#include <stdio.h> | |||||
#include <stdlib.h> | |||||
#include <string.h> | |||||
#include <pipi.h> | |||||
double kern[] = | |||||
{ | |||||
0., -.0625, -.125, -.0625, 0., | |||||
-.0625, -.125, -.25, -.125, -.0625, | |||||
-.125, -.25, 3.5, -.25, -.125, | |||||
-.0625, -.125, -.25, -.125, -.0625, | |||||
0., -.0625, -.125, -.0625, 0., | |||||
}; | |||||
int main(int argc, char *argv[]) | |||||
{ | |||||
char *srcname = NULL, *dstname = NULL; | |||||
pipi_image_t *img, *newimg; | |||||
if(argc < 3) | |||||
{ | |||||
fprintf(stderr, "%s: too few arguments\n", argv[0]); | |||||
fprintf(stderr, "Usage: %s <src> <dest>\n", argv[0]); | |||||
return EXIT_FAILURE; | |||||
} | |||||
srcname = argv[1]; | |||||
dstname = argv[2]; | |||||
img = pipi_load(srcname); | |||||
newimg = pipi_convolution(img, 5, 5, kern); | |||||
pipi_free(img); | |||||
pipi_save(newimg, dstname); | |||||
pipi_free(newimg); | |||||
return 0; | |||||
} | |||||