hist hacking
This commit is contained in:
parent
63742489e2
commit
4306b402ee
@ -2,7 +2,8 @@
|
|||||||
- added progress feedback to threadpool
|
- added progress feedback to threadpool
|
||||||
- --vips-wbuffer2 switch does all wbuffer use now
|
- --vips-wbuffer2 switch does all wbuffer use now
|
||||||
- im_wbuffer2() renamed as vips_discsink(), some cleanups
|
- 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
|
16/1/10 started 7.21.2
|
||||||
- "invalidate" is careful to keep images alive, so invalidate callbacks can do
|
- "invalidate" is careful to keep images alive, so invalidate callbacks can do
|
||||||
|
@ -219,11 +219,11 @@ im_histnorm( IMAGE *in, IMAGE *out )
|
|||||||
int
|
int
|
||||||
im_histeq( IMAGE *in, IMAGE *out )
|
im_histeq( IMAGE *in, IMAGE *out )
|
||||||
{
|
{
|
||||||
IMAGE *t1 = im_open_local( out, "im_histeq:1", "p" );
|
IMAGE *t1;
|
||||||
|
|
||||||
/* Normalised cumulative.
|
/* 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_histcum( in, t1 ) ||
|
||||||
im_histnorm( t1, out ) )
|
im_histnorm( t1, out ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
@ -169,7 +169,7 @@ match( IMAGE *in, IMAGE *ref, IMAGE *out )
|
|||||||
* formed, will produce an image whose PDF matches that of the image from
|
* formed, will produce an image whose PDF matches that of the image from
|
||||||
* which @ref was formed.
|
* 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
|
* Returns: 0 on success, -1 on error
|
||||||
*/
|
*/
|
||||||
|
@ -1,13 +1,4 @@
|
|||||||
/* @(#) Maps imagein to imageout with histogram specified by imageref
|
/* match histograms
|
||||||
* @(#) 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
|
|
||||||
*
|
*
|
||||||
* Copyright: 1990, N. Dessipris.
|
* Copyright: 1990, N. Dessipris.
|
||||||
*
|
*
|
||||||
@ -18,6 +9,8 @@
|
|||||||
* - im_ioflag() call changed to im_iocheck()
|
* - im_ioflag() call changed to im_iocheck()
|
||||||
* 25/5/95 JC
|
* 25/5/95 JC
|
||||||
* - revised
|
* - revised
|
||||||
|
* 24/3/10
|
||||||
|
* - gtkdoc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -59,18 +52,29 @@
|
|||||||
#include <dmalloc.h>
|
#include <dmalloc.h>
|
||||||
#endif /*WITH_DMALLOC*/
|
#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
|
int
|
||||||
im_hsp( IMAGE *in, IMAGE *ref, IMAGE *out )
|
im_hsp( IMAGE *in, IMAGE *ref, IMAGE *out )
|
||||||
{
|
{
|
||||||
IMAGE *histin = im_open_local( out, "im_hsp:#1", "p" );
|
IMAGE *t[3];
|
||||||
IMAGE *histref = im_open_local( out, "im_hsp:#2", "p" );
|
|
||||||
IMAGE *lut = im_open_local( out, "im_hsp:#3", "p" );
|
|
||||||
|
|
||||||
if( !histin || !histref || !lut ||
|
if( im_open_local_array( out, t, 3, "im_hsp", "p" ) ||
|
||||||
im_histgr( in, histin, -1 ) ||
|
im_histgr( in, t[0], -1 ) ||
|
||||||
im_histgr( ref, histref, -1 ) ||
|
im_histgr( ref, t[1], -1 ) ||
|
||||||
im_histspec( histin, histref, lut ) ||
|
im_histspec( t[0], t[1], t[2] ) ||
|
||||||
im_maplut( in, out, lut ) )
|
im_maplut( in, out, t[2] ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
|
Loading…
Reference in New Issue
Block a user