Changeset 2705 for libpipi


Ignore:
Timestamp:
Aug 12, 2008, 7:18:25 PM (12 years ago)
Author:
Sam Hocevar
Message:
  • mean.c: implement pipi_mean() to compute a mean image.
Location:
libpipi/trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • libpipi/trunk/pipi/Makefile.am

    r2701 r2705  
    2626        fill/floodfill.c \
    2727        $(codec_sources) \
     28        $(combine_sources) \
    2829        $(filter_sources) \
    2930        $(dither_sources) \
     
    3940
    4041# Submodules
     42combine_sources = \
     43        combine/mean.c
     44
    4145filter_sources = \
    4246        filter/autocontrast.c \
  • libpipi/trunk/pipi/context.c

    r2704 r2705  
    132132        ctx->images[ctx->nimages - 1] = dst;
    133133    }
     134    else if(!strcmp(cmd, "mean"))
     135    {
     136        pipi_image_t *dst;
     137
     138        if(ctx->nimages < 2)
     139            return -1;
     140        dst = pipi_mean(ctx->images[ctx->nimages - 2],
     141                        ctx->images[ctx->nimages - 1]);
     142        if(dst == NULL)
     143            return -1;
     144        pipi_free(ctx->images[ctx->nimages - 2]);
     145        pipi_free(ctx->images[ctx->nimages - 1]);
     146        ctx->images[ctx->nimages - 2] = dst;
     147        ctx->nimages--;
     148    }
    134149    else if(!strcmp(cmd, "wrap"))
    135150    {
  • libpipi/trunk/pipi/pipi.h

    r2700 r2705  
    8686extern pipi_image_t *pipi_resize(pipi_image_t *, int, int);
    8787
     88extern pipi_image_t *pipi_mean(pipi_image_t *, pipi_image_t *);
     89
    8890extern pipi_image_t *pipi_convolution(pipi_image_t *, int, int, double[]);
    8991extern pipi_image_t *pipi_gaussian_blur(pipi_image_t *, float);
  • libpipi/trunk/src/pipi.c

    r2704 r2705  
    5252                return EXIT_FAILURE;
    5353        }
     54        else if(!strcmp(argv[0], "--mean"))
     55        {
     56            if(pipi_command(ctx, "mean") != 0)
     57                return EXIT_FAILURE;
     58        }
    5459        else if(!strcmp(argv[0], "--output") || !strcmp(argv[0], "-o"))
    5560        {
Note: See TracChangeset for help on using the changeset viewer.