mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
fix missing 0.5 factor in anisotropic segmentation tutorial
This commit is contained in:
+6
-4
@@ -74,8 +74,8 @@ void calcGST(const Mat& inputImg, Mat& imgCoherencyOut, Mat& imgOrientationOut,
|
||||
// GST components calculation (stop)
|
||||
|
||||
// eigenvalue calculation (start)
|
||||
// lambda1 = J11 + J22 + sqrt((J11-J22)^2 + 4*J12^2)
|
||||
// lambda2 = J11 + J22 - sqrt((J11-J22)^2 + 4*J12^2)
|
||||
// lambda1 = 0.5*(J11 + J22 + sqrt((J11-J22)^2 + 4*J12^2))
|
||||
// lambda2 = 0.5*(J11 + J22 - sqrt((J11-J22)^2 + 4*J12^2))
|
||||
Mat tmp1, tmp2, tmp3, tmp4;
|
||||
tmp1 = J11 + J22;
|
||||
tmp2 = J11 - J22;
|
||||
@@ -84,8 +84,10 @@ void calcGST(const Mat& inputImg, Mat& imgCoherencyOut, Mat& imgOrientationOut,
|
||||
sqrt(tmp2 + 4.0 * tmp3, tmp4);
|
||||
|
||||
Mat lambda1, lambda2;
|
||||
lambda1 = tmp1 + tmp4; // biggest eigenvalue
|
||||
lambda2 = tmp1 - tmp4; // smallest eigenvalue
|
||||
lambda1 = tmp1 + tmp4;
|
||||
lambda1 = 0.5*lambda1; // biggest eigenvalue
|
||||
lambda2 = tmp1 - tmp4;
|
||||
lambda2 = 0.5*lambda2; // smallest eigenvalue
|
||||
// eigenvalue calculation (stop)
|
||||
|
||||
// Coherency calculation (start)
|
||||
|
||||
+4
-4
@@ -31,16 +31,16 @@ def calcGST(inputIMG, w):
|
||||
# GST components calculations (stop)
|
||||
|
||||
# eigenvalue calculation (start)
|
||||
# lambda1 = J11 + J22 + sqrt((J11-J22)^2 + 4*J12^2)
|
||||
# lambda2 = J11 + J22 - sqrt((J11-J22)^2 + 4*J12^2)
|
||||
# lambda1 = 0.5*(J11 + J22 + sqrt((J11-J22)^2 + 4*J12^2))
|
||||
# lambda2 = 0.5*(J11 + J22 - sqrt((J11-J22)^2 + 4*J12^2))
|
||||
tmp1 = J11 + J22
|
||||
tmp2 = J11 - J22
|
||||
tmp2 = cv.multiply(tmp2, tmp2)
|
||||
tmp3 = cv.multiply(J12, J12)
|
||||
tmp4 = np.sqrt(tmp2 + 4.0 * tmp3)
|
||||
|
||||
lambda1 = tmp1 + tmp4 # biggest eigenvalue
|
||||
lambda2 = tmp1 - tmp4 # smallest eigenvalue
|
||||
lambda1 = 0.5*(tmp1 + tmp4) # biggest eigenvalue
|
||||
lambda2 = 0.5*(tmp1 - tmp4) # smallest eigenvalue
|
||||
# eigenvalue calculation (stop)
|
||||
|
||||
# Coherency calculation (start)
|
||||
|
||||
Reference in New Issue
Block a user