Commit 69057bd5 authored by Andrey Filippov's avatar Andrey Filippov
Browse files

fixed 2d correlation for negative values

parent 22872131
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -1152,6 +1152,8 @@ public class Correlation2d {
    				if (offset >= 0.0) {
    				if (offset >= 0.0) {
    					if ((fc0 > -offset) && (fc1 > -offset)) {
    					if ((fc0 > -offset) && (fc1 > -offset)) {
    						cc = Math.sqrt((fc0 + offset) * (fc1 + offset)) - offset;
    						cc = Math.sqrt((fc0 + offset) * (fc1 + offset)) - offset;
    					} else {
    						cc = -offset; // smallest value
    					}
    					}
    				} else {
    				} else {
    					cc =  0.5*(fc0+fc1);
    					cc =  0.5*(fc0+fc1);