fix an off-by-one error in hist_local
an odd window width caused an off-by-one error in histogram construction
This commit is contained in:
parent
36761bcfd7
commit
c9ce8f70a1
@ -27,7 +27,7 @@
|
|||||||
aferrero2707
|
aferrero2707
|
||||||
- kick load operations from cache on read error, thanks gaillard
|
- kick load operations from cache on read error, thanks gaillard
|
||||||
- fix return from C++ assignment operator overloads (+=, -= etc)
|
- fix return from C++ assignment operator overloads (+=, -= etc)
|
||||||
- add @max_slope to vips_local_hist() to implement CLAHE, thanks hunter-87
|
- add @max_slope to vips_hist_local() to implement CLAHE, thanks hunter-87
|
||||||
- vips_gaussnoise() pixels are reproducible on recalc, thanks MvGulik
|
- vips_gaussnoise() pixels are reproducible on recalc, thanks MvGulik
|
||||||
|
|
||||||
8/12/16 started 8.4.5
|
8/12/16 started 8.4.5
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
* - sum to <= target, not < target, since cumulative hists include the
|
* - sum to <= target, not < target, since cumulative hists include the
|
||||||
* current value
|
* current value
|
||||||
* - scale result by 255, not 256, to avoid overflow
|
* - scale result by 255, not 256, to avoid overflow
|
||||||
|
* - off by 1 fix for odd window widths
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -150,7 +151,8 @@ vips_hist_local_generate( VipsRegion *or,
|
|||||||
VipsImage *in = (VipsImage *) a;
|
VipsImage *in = (VipsImage *) a;
|
||||||
const VipsHistLocal *local = (VipsHistLocal *) b;
|
const VipsHistLocal *local = (VipsHistLocal *) b;
|
||||||
VipsRect *r = &or->valid;
|
VipsRect *r = &or->valid;
|
||||||
int bands = in->Bands;
|
const int bands = in->Bands;
|
||||||
|
const int max_slope = local->max_slope;
|
||||||
|
|
||||||
VipsRect irect;
|
VipsRect irect;
|
||||||
int y;
|
int y;
|
||||||
@ -167,7 +169,7 @@ vips_hist_local_generate( VipsRegion *or,
|
|||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
lsk = VIPS_REGION_LSKIP( seq->ir );
|
lsk = VIPS_REGION_LSKIP( seq->ir );
|
||||||
centre = lsk * (local->height / 2) + bands * local->width / 2;
|
centre = lsk * (local->height / 2) + bands * (local->width / 2);
|
||||||
|
|
||||||
for( y = 0; y < r->height; y++ ) {
|
for( y = 0; y < r->height; y++ ) {
|
||||||
/* Get input and output pointers for this line.
|
/* Get input and output pointers for this line.
|
||||||
@ -201,7 +203,6 @@ vips_hist_local_generate( VipsRegion *or,
|
|||||||
*/
|
*/
|
||||||
unsigned int * restrict hist = seq->hist[b];
|
unsigned int * restrict hist = seq->hist[b];
|
||||||
const int target = p[centre + b];
|
const int target = p[centre + b];
|
||||||
const int max_slope = local->max_slope;
|
|
||||||
|
|
||||||
int sum;
|
int sum;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user