I'm quite sure now, it's a bug in ImageStatistics module when High Rejection Limit is enabled and set.
After adding some debug code for a test picture where row 370 gets overcorrected:
rejectionHigh = 2558
row = 367, rGBGlobalMedian = 2532, rGBRowMedian = 2528, fixFactor = 3
row = 368, rGBGlobalMedian = 2532, rGBRowMedian = 2527, fixFactor = 4
row = 369, rGBGlobalMedian = 2532, rGBRowMedian = 2527, fixFactor = 4
row = 370, rGBGlobalMedian = 2532, rGBRowMedian = 2509, fixFactor = 22
row = 371, rGBGlobalMedian = 2532, rGBRowMedian = 2528, fixFactor = 3
row = 372, rGBGlobalMedian = 2532, rGBRowMedian = 2527, fixFactor = 4
I converted all values to [0..65535] range for better visibility. So you see, there is a discontinuity in "fixFactor" for row 370 (fixFactor is the difference of global and row median)
But when I compute the median myself with the following code:
if ( row == 370 ) {
var ca = new Array();
var rej = 0;
for ( var col = 0; col < targetWidth; col++ ) {
var pv = targetImage.sample( col, row );
if ( pv < aStatistic.rejectionHigh ) {
ca.push( Math.floor( pv * 65535.0 ) );
}
else {
rej++;
}
}
ca.sort();
console.writeln( 'reject = ' + rej );
console.writeln( 'median = ' + ca[ Math.floor( ca.length / 2 ) ] );
}
I get the following result for row 370:
reject = 857
median = 2528
And with this median value of 2528, the line will get fixFactor = 3 and not overcorrected (i.e. hairline).
So in essence: I could easily fix the script by replacing the ImageStatistic computation with my own code, but someone of the PTeam member should have a look in the ImageStatistic code.
If test data is needed, please tell me.
Rüdiger