getting ready to rewrite hist stuff

This commit is contained in:
John Cupitt 2013-07-01 13:45:36 +01:00
parent 3b6bcef700
commit 8259da2b9c
26 changed files with 219 additions and 9 deletions

View File

@ -1,3 +1,5 @@
1/7/13 started 7.35.0
28/6/13 started 7.34.1
- fix morphological operators on non-uchar images
- remove any ICC profile when we use vips to go to srgb

View File

@ -2,7 +2,7 @@
# also update the version number in the m4 macros below
AC_INIT([vips], [7.34.1], [vipsip@jiscmail.ac.uk])
AC_INIT([vips], [7.35.0], [vipsip@jiscmail.ac.uk])
# required for gobject-introspection
AC_PREREQ(2.62)
@ -16,8 +16,8 @@ AC_CONFIG_MACRO_DIR([m4])
# user-visible library versioning
m4_define([vips_major_version], [7])
m4_define([vips_minor_version], [34])
m4_define([vips_micro_version], [1])
m4_define([vips_minor_version], [35])
m4_define([vips_micro_version], [0])
m4_define([vips_version],
[vips_major_version.vips_minor_version.vips_micro_version])
@ -37,7 +37,7 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date`
# binary interface changes not backwards compatible?: reset age to 0
LIBRARY_CURRENT=34
LIBRARY_REVISION=4
LIBRARY_REVISION=5
LIBRARY_AGE=3
# patched into include/vips/version.h
@ -710,7 +710,7 @@ AC_OUTPUT([
libvips/deprecated/Makefile
libvips/foreign/Makefile
libvips/freq_filt/Makefile
libvips/histograms_lut/Makefile
libvips/histogram/Makefile
libvips/inplace/Makefile
libvips/iofuncs/Makefile
libvips/morphology/Makefile

View File

@ -20,7 +20,7 @@ SUBDIRS = \
convolution \
$(C_COMPILE_DIR) \
freq_filt \
histograms_lut \
histogram \
inplace \
iofuncs \
morphology \
@ -53,7 +53,7 @@ libvips_la_LIBADD = \
$(C_LIB) \
foreign/libforeign.la \
freq_filt/libfreq_filt.la \
histograms_lut/libhistograms_lut.la \
histogram/libhistogram.la \
inplace/libinplace.la \
iofuncs/libiofuncs.la \
morphology/libmorphology.la \

View File

@ -1,6 +1,6 @@
noinst_LTLIBRARIES = libhistograms_lut.la
noinst_LTLIBRARIES = libhistogram.la
libhistograms_lut_la_SOURCES = \
libhistogram_la_SOURCES = \
hist_dispatch.c \
im_gammacorrect.c \
im_heq.c \

View File

@ -0,0 +1,131 @@
/* base class for all histogram operations
*
* properties:
* - single output image
*/
/*
Copyright (C) 1991-2005 The National Gallery
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
/*
#define DEBUG
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <vips/vips.h>
#include <vips/internal.h>
#include "phistogram.h"
/**
* SECTION: histogram
* @short_description: find, manipulate and apply histograms and lookup tables
* @stability: Stable
* @see_also: <link linkend="libvips-image">image</link>
* @include: vips/vips.h
*
* Histograms and look-up tables are 1xn or nx1 images, where n is less than
* 256 or less than 65536, corresponding to 8- and 16-bit unsigned int images.
* They are
* tagged with a #VipsType of IM_TYPE_HISTOGRAM and usually displayed by
* user-interfaces such as nip2 as plots rather than images.
*
* These functions can be broadly grouped as things to find or build
* histograms (im_histgr(), im_buildlut(), in_identity()), operations that
* manipulate histograms in some way (im_histcum(), im_histnorm()), operations
* to apply histograms (im_maplut()), and a variety of utility
* operations.
*
* A final group of operations build tone curves. These are useful in
* pre-press work for adjusting the appearance of images. They are designed
* for CIELAB images, but might be useful elsewhere.
*/
G_DEFINE_ABSTRACT_TYPE( VipsHistogram, vips_histogram, VIPS_TYPE_OPERATION );
static int
vips_histogram_build( VipsObject *object )
{
VipsHistogram *histogram = VIPS_HISTOGRAM( object );
#ifdef DEBUG
printf( "vips_histogram_build: " );
vips_object_print_name( object );
printf( "\n" );
#endif /*DEBUG*/
g_object_set( histogram, "out", vips_image_new(), NULL );
if( VIPS_OBJECT_CLASS( vips_histogram_parent_class )->build( object ) )
return( -1 );
return( 0 );
}
static void
vips_histogram_class_init( VipsHistogramClass *class )
{
GObjectClass *gobject_class = G_OBJECT_CLASS( class );
VipsObjectClass *vobject_class = VIPS_OBJECT_CLASS( class );
gobject_class->set_property = vips_object_set_property;
gobject_class->get_property = vips_object_get_property;
vobject_class->nickname = "histogram";
vobject_class->description = _( "histogram operations" );
vobject_class->build = vips_histogram_build;
VIPS_ARG_IMAGE( class, "out", 1,
_( "Output" ),
_( "Output image" ),
VIPS_ARGUMENT_REQUIRED_OUTPUT,
G_STRUCT_OFFSET( VipsHistogram, out ) );
}
static void
vips_histogram_init( VipsHistogram *histogram )
{
}
/* Called from iofuncs to init all operations in this dir. Use a plugin system
* instead?
*/
void
vips_histogram_operation_init( void )
{
extern GType vips_xyz_get_type( void );
vips_xyz_get_type();
}

View File

@ -0,0 +1,77 @@
/* base class for all histogram operations
*/
/*
Copyright (C) 1991-2005 The National Gallery
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_PHISTOGRAM_H
#define VIPS_PHISTOGRAM_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
#include <vips/vector.h>
#define VIPS_TYPE_HISTOGRAM (vips_histogram_get_type())
#define VIPS_HISTOGRAM( obj ) \
(G_TYPE_CHECK_INSTANCE_CAST( (obj), \
VIPS_TYPE_HISTOGRAM, VipsHistogram ))
#define VIPS_HISTOGRAM_CLASS( klass ) \
(G_TYPE_CHECK_CLASS_CAST( (klass), \
VIPS_TYPE_HISTOGRAM, VipsHistogramClass))
#define VIPS_IS_HISTOGRAM( obj ) \
(G_TYPE_CHECK_INSTANCE_TYPE( (obj), VIPS_TYPE_HISTOGRAM ))
#define VIPS_IS_HISTOGRAM_CLASS( klass ) \
(G_TYPE_CHECK_CLASS_TYPE( (klass), VIPS_TYPE_HISTOGRAM ))
#define VIPS_HISTOGRAM_GET_CLASS( obj ) \
(G_TYPE_INSTANCE_GET_CLASS( (obj), \
VIPS_TYPE_HISTOGRAM, VipsHistogramClass ))
typedef struct _VipsHistogram {
VipsOperation parent_instance;
/* All have an output image.
*/
VipsImage *out;
} VipsHistogram;
typedef struct _VipsHistogramClass {
VipsOperationClass parent_class;
} VipsHistogramClass;
GType vips_histogram_get_type( void );
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_PHISTOGRAM_H*/