Open ghost opened 11 years ago
I have been checking the Zero-mean SSD equations in matcher.cpp:
// sum[ ((A-mean(A)) - (B-mean(B))^2 ] // = sum[ ((A-B) - (mean(A)-mean(B))^2 ] // = sum[ (A-B)^2 - 2(A-B)(mean(A)mean(B)) + (mean(A)-mean(B))^2 ] // = sum[ (A-B)^2 ] - 2(mean(A)mean(B))(sumA-sumB) + N(mean(A)-mean(B))^2 // = sum[ (A-B)^2 ] - N * (mean(A)-mean(B))^2 // = sum[ A^2-2AB-B^2 ] - 1/N * (sumA-sumB)^2 // = sumAA-2_sumAB-sumBB - 1/N * (sumA^2-2_sumA_sumB-sumB^2) *znssd = sumAA-2_sumAB-sumBB - (sumA_sumA - 2_sumA_sumB - sumB_sumB)/BOX_AREA;
This code seems to work but the equations are wrong, there are two mistakes:
(A-B)^2 -> A^2-2AB-B^2 ------------> A^2-2AB+B^2
(sumA-sumB)^2 -> sumA^2-2_sumA_sumB-sumB^2 -------------------------> sumA^2-2_sumA_sumB+sumB^2
So, znssd should be calculated this way:
_znssd = sumAA-2_sumAB+sumBB - (sumA_sumA - 2_sumA_sumB + sumB_sumB)/BOX_AREA;
Regards
I AGREE.
I have been checking the Zero-mean SSD equations in matcher.cpp:
// sum[ ((A-mean(A)) - (B-mean(B))^2 ] // = sum[ ((A-B) - (mean(A)-mean(B))^2 ] // = sum[ (A-B)^2 - 2(A-B)(mean(A)mean(B)) + (mean(A)-mean(B))^2 ] // = sum[ (A-B)^2 ] - 2(mean(A)mean(B))(sumA-sumB) + N(mean(A)-mean(B))^2 // = sum[ (A-B)^2 ] - N * (mean(A)-mean(B))^2 // = sum[ A^2-2AB-B^2 ] - 1/N * (sumA-sumB)^2 // = sumAA-2_sumAB-sumBB - 1/N * (sumA^2-2_sumA_sumB-sumB^2) *znssd = sumAA-2_sumAB-sumBB - (sumA_sumA - 2_sumA_sumB - sumB_sumB)/BOX_AREA;
This code seems to work but the equations are wrong, there are two mistakes:
(A-B)^2 -> A^2-2AB-B^2 ------------> A^2-2AB+B^2
(sumA-sumB)^2 -> sumA^2-2_sumA_sumB-sumB^2 -------------------------> sumA^2-2_sumA_sumB+sumB^2
So, znssd should be calculated this way:
_znssd = sumAA-2_sumAB+sumBB - (sumA_sumA - 2_sumA_sumB + sumB_sumB)/BOX_AREA;
Regards