Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Moving generation of image patch out of inner loop

  • Loading branch information...
commit 27628186639fe9b0e69063cb86f113af470a1022 1 parent 20d0eaa
Tim Sheerman-Chase authored
Showing with 7 additions and 14 deletions.
  1. +7 −14 trackFeaturesUtils.pyx
21 trackFeaturesUtils.pyx
View
@@ -102,26 +102,19 @@ def _computeGradientSum(np.ndarray[np.float32_t,ndim=2] gradx1, # gradient imag
gradx = []
img1GradxPatch = np.empty((height, width))
- #img1GradyPatch = np.empty((height, width))
for j in range(-hh, hh + 1):
for i in range(-hw, hw + 1):
img1GradxPatch[j+hh,i+hw] = interpolate(x1+i, y1+j, gradx1)
- #img1GradyPatch[j+hh,i+hw] = interpolate(x1+i, y1+j, grady1)
- # Compute values
+ img2Patch = np.empty((height, width))
for j in range(-hh, hh + 1):
for i in range(-hw, hw + 1):
- #g1a = interpolate(x1+i, y1+j, gradx1)
- g1 = img1GradxPatch[j+hh, i+hw]
- #print g1a, g1
- g2 = interpolate(x2+i, y2+j, gradx2)
- gradx.append(g1 + g2)
- #g1 = interpolate(x1+i, y1+j, grady1)
- #g1 = img1GradyPatch[j+hh, i+hw]
- #g2 = interpolate(x2+i, y2+j, grady2)
- #grady.append(g1 + g2)
-
- return gradx
+ img2Patch[j+hh,i+hw] = interpolate(x2+i, y2+j, gradx2)
+
+ sumImg = img1GradxPatch + img2Patch
+ sumImg = sumImg.reshape((sumImg.shape[0] * sumImg.shape[1]))
+
+ return sumImg
#*********************************************************************
#* _computeIntensityDifferenceLightingInsensitive
Please sign in to comment.
Something went wrong with that request. Please try again.