im_histplot() -> vips_hist_plot()
This commit is contained in:
parent
13cf12f0df
commit
81ee98fca7
@ -5,6 +5,7 @@
|
|||||||
- rewrite im_buildlut(), im_identity*(), im_maplut(), im_falsecolour(),
|
- rewrite im_buildlut(), im_identity*(), im_maplut(), im_falsecolour(),
|
||||||
im_gammacorrect(), im_histgr(), im_histcum(), im_histnorm(), im_heq(),
|
im_gammacorrect(), im_histgr(), im_histcum(), im_histnorm(), im_heq(),
|
||||||
im_histnD(), im_histindexed() as classes
|
im_histnD(), im_histindexed() as classes
|
||||||
|
- thin vips8 wrapper for im_histplot()
|
||||||
- added vips_error_freeze() / vips_error_thaw()
|
- added vips_error_freeze() / vips_error_thaw()
|
||||||
- used freeze() / thaw() to stop file format sniffers logging spurious errors
|
- used freeze() / thaw() to stop file format sniffers logging spurious errors
|
||||||
- vipsthumbnail uses embedded jpg thumbnails if it can
|
- vipsthumbnail uses embedded jpg thumbnails if it can
|
||||||
|
@ -9,9 +9,9 @@ libhistogram_la_SOURCES = \
|
|||||||
hist_cum.c \
|
hist_cum.c \
|
||||||
hist_norm.c \
|
hist_norm.c \
|
||||||
hist_equal.c \
|
hist_equal.c \
|
||||||
|
hist_plot.c \
|
||||||
\
|
\
|
||||||
hist_dispatch.c \
|
hist_dispatch.c \
|
||||||
im_histplot.c \
|
|
||||||
im_histspec.c \
|
im_histspec.c \
|
||||||
im_hsp.c \
|
im_hsp.c \
|
||||||
im_mpercent.c \
|
im_mpercent.c \
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
* - gtkdoc
|
* - gtkdoc
|
||||||
* - small cleanups
|
* - small cleanups
|
||||||
* - oop, would fail for signed int histograms
|
* - oop, would fail for signed int histograms
|
||||||
|
* 19/8/13
|
||||||
|
* - wrap as a class, left a rewrite for now
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -66,10 +68,10 @@
|
|||||||
|
|
||||||
#include <vips/vips.h>
|
#include <vips/vips.h>
|
||||||
|
|
||||||
/* Normalise an image using the rules noted above.
|
#include "phistogram.h"
|
||||||
*/
|
|
||||||
static int
|
static int
|
||||||
normalise( IMAGE *in, IMAGE *out )
|
plotalise( IMAGE *in, IMAGE *out )
|
||||||
{
|
{
|
||||||
if( im_check_uncoded( "im_histplot", in ) ||
|
if( im_check_uncoded( "im_histplot", in ) ||
|
||||||
im_check_noncomplex( "im_histplot", in ) )
|
im_check_noncomplex( "im_histplot", in ) )
|
||||||
@ -280,8 +282,58 @@ plot( IMAGE *in, IMAGE *out )
|
|||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
im_histplot( IMAGE *in, IMAGE *out )
|
||||||
|
{
|
||||||
|
IMAGE *t1;
|
||||||
|
|
||||||
|
if( im_check_hist( "im_histplot", in ) )
|
||||||
|
return( -1 );
|
||||||
|
|
||||||
|
if( !(t1 = im_open_local( out, "im_histplot:1", "p" )) ||
|
||||||
|
plotalise( in, t1 ) ||
|
||||||
|
plot( t1, out ) )
|
||||||
|
return( -1 );
|
||||||
|
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef VipsHistogram VipsHistPlot;
|
||||||
|
typedef VipsHistogramClass VipsHistPlotClass;
|
||||||
|
|
||||||
|
G_DEFINE_TYPE( VipsHistPlot, vips_hist_plot, VIPS_TYPE_HISTOGRAM );
|
||||||
|
|
||||||
|
static int
|
||||||
|
vips_hist_plot_build( VipsObject *object )
|
||||||
|
{
|
||||||
|
VipsHistogram *histogram = VIPS_HISTOGRAM( object );
|
||||||
|
|
||||||
|
if( VIPS_OBJECT_CLASS( vips_hist_plot_parent_class )->build( object ) )
|
||||||
|
return( -1 );
|
||||||
|
|
||||||
|
if( im_histplot( histogram->in, histogram->out ) )
|
||||||
|
return( -1 );
|
||||||
|
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
vips_hist_plot_class_init( VipsHistPlotClass *class )
|
||||||
|
{
|
||||||
|
VipsObjectClass *object_class = (VipsObjectClass *) class;
|
||||||
|
|
||||||
|
object_class->nickname = "hist_plot";
|
||||||
|
object_class->description = _( "plot histogram" );
|
||||||
|
object_class->build = vips_hist_plot_build;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
vips_hist_plot_init( VipsHistPlot *hist_plot )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* im_histplot:
|
* vips_hist_plot:
|
||||||
* @in: input image
|
* @in: input image
|
||||||
* @out: output image
|
* @out: output image
|
||||||
*
|
*
|
||||||
@ -298,22 +350,19 @@ plot( IMAGE *in, IMAGE *out )
|
|||||||
* <emphasis>float types</emphasis> min moved to 0, max moved to any
|
* <emphasis>float types</emphasis> min moved to 0, max moved to any
|
||||||
* (square output)
|
* (square output)
|
||||||
*
|
*
|
||||||
* See also: im_hist_indexed(), im_histeq().
|
|
||||||
*
|
|
||||||
* Returns: 0 on success, -1 on error
|
* Returns: 0 on success, -1 on error
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
im_histplot( IMAGE *in, IMAGE *out )
|
vips_hist_plot( VipsImage *in, VipsImage **out, ... )
|
||||||
{
|
{
|
||||||
IMAGE *t1;
|
va_list ap;
|
||||||
|
int result;
|
||||||
|
|
||||||
if( im_check_hist( "im_histplot", in ) )
|
va_start( ap, out );
|
||||||
return( -1 );
|
result = vips_call_split( "hist_plot", ap, in, out );
|
||||||
|
va_end( ap );
|
||||||
|
|
||||||
if( !(t1 = im_open_local( out, "im_histplot:1", "p" )) ||
|
return( result );
|
||||||
normalise( in, t1 ) ||
|
|
||||||
plot( t1, out ) )
|
|
||||||
return( -1 );
|
|
||||||
|
|
||||||
return( 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -137,9 +137,11 @@ vips_histogram_operation_init( void )
|
|||||||
extern GType vips_hist_cum_get_type( void );
|
extern GType vips_hist_cum_get_type( void );
|
||||||
extern GType vips_hist_norm_get_type( void );
|
extern GType vips_hist_norm_get_type( void );
|
||||||
extern GType vips_hist_equal_get_type( void );
|
extern GType vips_hist_equal_get_type( void );
|
||||||
|
extern GType vips_hist_plot_get_type( void );
|
||||||
|
|
||||||
vips_maplut_get_type();
|
vips_maplut_get_type();
|
||||||
vips_hist_cum_get_type();
|
vips_hist_cum_get_type();
|
||||||
vips_hist_norm_get_type();
|
vips_hist_norm_get_type();
|
||||||
vips_hist_equal_get_type();
|
vips_hist_equal_get_type();
|
||||||
|
vips_hist_plot_get_type();
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,8 @@ int vips_hist_norm( VipsImage *in, VipsImage **out, ... )
|
|||||||
__attribute__((sentinel));
|
__attribute__((sentinel));
|
||||||
int vips_hist_equal( VipsImage *in, VipsImage **out, ... )
|
int vips_hist_equal( VipsImage *in, VipsImage **out, ... )
|
||||||
__attribute__((sentinel));
|
__attribute__((sentinel));
|
||||||
|
int vips_hist_plot( VipsImage *in, VipsImage **out, ... )
|
||||||
|
__attribute__((sentinel));
|
||||||
|
|
||||||
|
|
||||||
int im_invertlut( DOUBLEMASK *input, VipsImage *output, int lut_size );
|
int im_invertlut( DOUBLEMASK *input, VipsImage *output, int lut_size );
|
||||||
@ -53,7 +55,6 @@ int im_project( VipsImage *in, VipsImage *hout, VipsImage *vout );
|
|||||||
|
|
||||||
int im_histspec( VipsImage *in, VipsImage *ref, VipsImage *out );
|
int im_histspec( VipsImage *in, VipsImage *ref, VipsImage *out );
|
||||||
int im_ismonotonic( VipsImage *lut, int *out );
|
int im_ismonotonic( VipsImage *lut, int *out );
|
||||||
int im_histplot( VipsImage *in, VipsImage *out );
|
|
||||||
|
|
||||||
int im_hsp( VipsImage *in, VipsImage *ref, VipsImage *out );
|
int im_hsp( VipsImage *in, VipsImage *ref, VipsImage *out );
|
||||||
int im_mpercent( VipsImage *in, double percent, int *out );
|
int im_mpercent( VipsImage *in, double percent, int *out );
|
||||||
|
@ -858,6 +858,7 @@ int im_histeq( VipsImage *in, VipsImage *out );
|
|||||||
int im_heq( VipsImage *in, VipsImage *out, int bandno );
|
int im_heq( VipsImage *in, VipsImage *out, int bandno );
|
||||||
int im_histnD( VipsImage *in, VipsImage *out, int bins );
|
int im_histnD( VipsImage *in, VipsImage *out, int bins );
|
||||||
int im_hist_indexed( VipsImage *index, VipsImage *value, VipsImage *out );
|
int im_hist_indexed( VipsImage *index, VipsImage *value, VipsImage *out );
|
||||||
|
int im_histplot( VipsImage *in, VipsImage *out );
|
||||||
|
|
||||||
/* ruby-vips uses this
|
/* ruby-vips uses this
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user