hist hacking

This commit is contained in:
John Cupitt 2010-03-24 16:20:09 +00:00
parent 63742489e2
commit 4306b402ee
4 changed files with 27 additions and 22 deletions

View File

@ -2,7 +2,8 @@
- added progress feedback to threadpool
- --vips-wbuffer2 switch does all wbuffer use now
- im_wbuffer2() renamed as vips_discsink(), some cleanups
- im_gammacorrect() can do 16-bit iamges too
- im_gammacorrect() can do 16-bit images too
- im_histplot() could fail for signed int histograms
16/1/10 started 7.21.2
- "invalidate" is careful to keep images alive, so invalidate callbacks can do

View File

@ -219,11 +219,11 @@ im_histnorm( IMAGE *in, IMAGE *out )
int
im_histeq( IMAGE *in, IMAGE *out )
{
IMAGE *t1 = im_open_local( out, "im_histeq:1", "p" );
IMAGE *t1;
/* Normalised cumulative.
*/
if( !(t1 = im_open_local( out, "im_histeq:1", "p" )) ||
if( !(t1 = im_open_local( out, "im_histeq", "p" )) ||
im_histcum( in, t1 ) ||
im_histnorm( t1, out ) )
return( -1 );

View File

@ -169,7 +169,7 @@ match( IMAGE *in, IMAGE *ref, IMAGE *out )
* formed, will produce an image whose PDF matches that of the image from
* which @ref was formed.
*
* See also: im_histgr(), im_maplut().
* See also: im_hsp(), im_histgr(), im_maplut().
*
* Returns: 0 on success, -1 on error
*/

View File

@ -1,13 +1,4 @@
/* @(#) Maps imagein to imageout with histogram specified by imageref
* @(#) Both images should have the same number of bands
* @(#) Each band of the output image is specified according to the distribution
* @(#) of grey levels of the reference image
* @(#)
* @(#) Usage:
* @(#) int im_hsp(in, ref, out)
* @(#) IMAGE *in, *ref, *out;
* @(#)
* @(#) Return 0 on success and -1 on error
/* match histograms
*
* Copyright: 1990, N. Dessipris.
*
@ -18,6 +9,8 @@
* - im_ioflag() call changed to im_iocheck()
* 25/5/95 JC
* - revised
* 24/3/10
* - gtkdoc
*/
/*
@ -59,18 +52,29 @@
#include <dmalloc.h>
#endif /*WITH_DMALLOC*/
/**
* im_hsp:
* @in: input image
* @ref: reference histogram
* @out: output image
*
* Maps image @in to image @out, adjusting the histogram to match image @ref.
* Both images should have the same number of bands.
*
* See also: im_histspec(), im_histgr().
*
* Returns: 0 on success, -1 on error
*/
int
im_hsp( IMAGE *in, IMAGE *ref, IMAGE *out )
{
IMAGE *histin = im_open_local( out, "im_hsp:#1", "p" );
IMAGE *histref = im_open_local( out, "im_hsp:#2", "p" );
IMAGE *lut = im_open_local( out, "im_hsp:#3", "p" );
IMAGE *t[3];
if( !histin || !histref || !lut ||
im_histgr( in, histin, -1 ) ||
im_histgr( ref, histref, -1 ) ||
im_histspec( histin, histref, lut ) ||
im_maplut( in, out, lut ) )
if( im_open_local_array( out, t, 3, "im_hsp", "p" ) ||
im_histgr( in, t[0], -1 ) ||
im_histgr( ref, t[1], -1 ) ||
im_histspec( t[0], t[1], t[2] ) ||
im_maplut( in, out, t[2] ) )
return( -1 );
return( 0 );