Quellcode durchsuchen

* sharpen.c: add a sharpen filter example, using our generic convolution

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-862c8a59935f
remotes/tiles
sam vor 16 Jahren
Ursprung
Commit
bf31390d1e
3 geänderte Dateien mit 48 neuen und 1 gelöschten Zeilen
  1. +1
    -0
      .gitignore
  2. +4
    -1
      examples/Makefile.am
  3. +43
    -0
      examples/sharpen.c

+ 1
- 0
.gitignore Datei anzeigen

@@ -14,6 +14,7 @@ examples/blur
examples/dither
examples/edd
examples/img2rubik
examples/sharpen
test/u8tof32tou8
stamp-h1
.auto


+ 4
- 1
examples/Makefile.am Datei anzeigen

@@ -2,7 +2,7 @@

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_LDADD = ../pipi/libpipi.la
@@ -16,3 +16,6 @@ edd_LDADD = ../pipi/libpipi.la
img2rubik_SOURCES = img2rubik.c
img2rubik_LDADD = ../pipi/libpipi.la

sharpen_SOURCES = sharpen.c
sharpen_LDADD = ../pipi/libpipi.la


+ 43
- 0
examples/sharpen.c Datei anzeigen

@@ -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;
}


Laden…
Abbrechen
Speichern