Skip to content

Commit 2c31d16

Browse files
committed
Change to private methods
1 parent 3b142e9 commit 2c31d16

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

pysteps/optflow/lucaskanade.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,16 @@ def dense_lucaskanade(R, **kwargs):
136136
next = np.ndarray.astype(next,"uint8")
137137

138138
# remove small noise with a morphological operator (opening)
139-
prvs = clean_image(prvs, n=size_opening)
140-
next = clean_image(next, n=size_opening)
139+
prvs = _clean_image(prvs, n=size_opening)
140+
next = _clean_image(next, n=size_opening)
141141

142142
# Shi-Tomasi good features to track
143143
# TODO: implement different feature detection algorithms (e.g. Harris)
144-
p0 = ShiTomasi_features_to_track(prvs, max_corners_ST, quality_level_ST,
144+
p0 = _ShiTomasi_features_to_track(prvs, max_corners_ST, quality_level_ST,
145145
min_distance_ST, block_size_ST)
146146

147147
# get sparse u, v vectors with Lucas-Kanade tracking
148-
x0, y0, u, v = LucasKanade_features_tracking(prvs, next, p0, winsize_LK,
148+
x0, y0, u, v = _LucasKanade_features_tracking(prvs, next, p0, winsize_LK,
149149
nr_levels_LK)
150150

151151
# exclude outlier vectors
@@ -173,7 +173,7 @@ def dense_lucaskanade(R, **kwargs):
173173
v = np.vstack(vStack)
174174

175175
# decluster sparse motion vectors
176-
x, y, u, v = declustering(x0, y0, u, v, decl_grid, min_nr_samples)
176+
x, y, u, v = _declustering(x0, y0, u, v, decl_grid, min_nr_samples)
177177

178178
# append extra vectors if provided
179179
if extra_vectors is not None:
@@ -183,15 +183,15 @@ def dense_lucaskanade(R, **kwargs):
183183
v = np.concatenate((v, extra_vectors[:, 3]))
184184

185185
# kernel interpolation
186-
X, Y, UV = interpolate_sparse_vectors(x, y, u, v, domain_size, function=function,
186+
X, Y, UV = _interpolate_sparse_vectors(x, y, u, v, domain_size, function=function,
187187
k=k, epsilon=epsilon, nchunks=nchunks)
188188

189189
if verbose:
190190
print("--- %s seconds ---" % (time.time() - t0))
191191

192192
return UV
193193

194-
def ShiTomasi_features_to_track(R, max_corners_ST, quality_level_ST,
194+
def _ShiTomasi_features_to_track(R, max_corners_ST, quality_level_ST,
195195
min_distance_ST, block_size_ST):
196196
"""Call the Shi-Tomasi corner detection algorithm.
197197
@@ -234,7 +234,7 @@ def ShiTomasi_features_to_track(R, max_corners_ST, quality_level_ST,
234234

235235
return p0
236236

237-
def LucasKanade_features_tracking(prvs, next, p0, winsize_LK, nr_levels_LK):
237+
def _LucasKanade_features_tracking(prvs, next, p0, winsize_LK, nr_levels_LK):
238238
"""Call the Lucas-Kanade features tracking algorithm.
239239
240240
Parameters
@@ -287,7 +287,7 @@ def LucasKanade_features_tracking(prvs, next, p0, winsize_LK, nr_levels_LK):
287287

288288
return x0, y0, u, v
289289

290-
def clean_image(R, n=3, thr=0):
290+
def _clean_image(R, n=3, thr=0):
291291
"""Apply a binary morphological opening to filter small isolated echoes.
292292
293293
Parameters
@@ -322,7 +322,7 @@ def clean_image(R, n=3, thr=0):
322322

323323
return R
324324

325-
def declustering(x, y, u, v, decl_grid, min_nr_samples):
325+
def _declustering(x, y, u, v, decl_grid, min_nr_samples):
326326
"""Filter out outliers in a sparse motion field and get more representative
327327
data points. The method assigns data points to a (RxR) declustering grid
328328
and then take the median of all values within one cell.
@@ -389,7 +389,7 @@ def declustering(x, y, u, v, decl_grid, min_nr_samples):
389389

390390
return x, y, u, v
391391

392-
def interpolate_sparse_vectors(x, y, u, v, domain_size, function="inverse",
392+
def _interpolate_sparse_vectors(x, y, u, v, domain_size, function="inverse",
393393
k=20, epsilon=None, nchunks=5):
394394

395395
"""Interpolation of sparse motion vectors to produce a dense field of motion

0 commit comments

Comments
 (0)