Skip to content

Commit

Permalink
'updates'
Browse files Browse the repository at this point in the history
  • Loading branch information
jgrss committed Feb 8, 2017
1 parent f4f66f9 commit e79a395
Show file tree
Hide file tree
Showing 10 changed files with 1,957 additions and 1,926 deletions.
436 changes: 218 additions & 218 deletions spfeas/helpers/_moving_window.c

Large diffs are not rendered by default.

Binary file modified spfeas/helpers/_moving_window.pyd
Binary file not shown.
5 changes: 2 additions & 3 deletions spfeas/spfeas.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ def _options():

colorama.init()

text_lines = [Fore.GREEN + Style.BRIGHT + 'ctr' + Style.RESET_ALL + ' -- Copy scale centers',
Fore.GREEN + Style.BRIGHT + 'dmp' + Style.RESET_ALL + ' -- Differential morphological profiles (2 x n scales)',
text_lines = [Fore.GREEN + Style.BRIGHT + 'dmp' + Style.RESET_ALL + ' -- Differential morphological profiles (2 x n scales)',
Fore.GREEN + Style.BRIGHT + 'evi2' + Style.RESET_ALL + ' -- EVI2 mean (2 x n scales)',
Fore.GREEN + Style.BRIGHT + 'fourier' + Style.RESET_ALL + ' -- Fourier transform (2 x n scales)',
Fore.GREEN + Style.BRIGHT + 'gabor' + Style.RESET_ALL + ' -- Gabor filter bank (n scales x 2 x kernels(Default=24))',
Expand All @@ -159,7 +158,7 @@ def _options():
Fore.GREEN + Style.BRIGHT + 'mean' + Style.RESET_ALL + ' -- Local inverse distance weighted mean and variance (2 x n scales)',
Fore.GREEN + Style.BRIGHT + 'ndvi' + Style.RESET_ALL + ' -- NDVI mean (2 x n scales)',
Fore.GREEN + Style.BRIGHT + 'pantex' + Style.RESET_ALL + ' -- Built-up presence index (n scales)',
Fore.GREEN + Style.BRIGHT + 'orb' + Style.RESET_ALL + ' -- Oriented BRIEF key point pyramid histogram (7 (max,m1,m2,m3,m4,skew,kurtosis) x n scales)',
Fore.RED + Style.BRIGHT + 'orb' + Style.RESET_ALL + ' -- Oriented BRIEF key point pyramid histogram (7 (max,m1,m2,m3,m4,skew,kurtosis) x n scales)' + Fore.RED + ' **Currently out of order**',
Fore.GREEN + Style.BRIGHT + 'saliency' + Style.RESET_ALL + '-- Saliency features (2 x n scales)',
Fore.GREEN + Style.BRIGHT + 'sfs' + Style.RESET_ALL + ' -- Structural Feature Sets (5 (max,min,mean,w-mean,std) x n scales)',
Fore.RED + Style.BRIGHT + 'surf' + Style.RESET_ALL + ' -- SURF key point descriptors (4 x n scales)' + Fore.RED + ' **Currently out of order**']
Expand Down
53 changes: 38 additions & 15 deletions spfeas/spfunctions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from joblib import Parallel, delayed

from .sphelpers import lsr

from skimage.exposure import rescale_intensity
Expand Down Expand Up @@ -226,6 +228,10 @@ def feature_fourier(chBd, blk, scs, end_scale):
return out_list


def call_lsr(edoim_s, edmim_s, dx_s, dy_s):
return lsr.feature_lsr(edoim_s, edmim_s, dx_s, dy_s)


def feature_lsr(ch_bd, blk, scs, end_scale):

rows, cols = ch_bd.shape
Expand All @@ -238,24 +244,41 @@ def feature_lsr(ch_bd, blk, scs, end_scale):
for j in xrange(0, cols-(end_scale-blk), blk):
for k in scs:

k_half = k / 2

edoim_s = edge_ori[i+scales_half-k_half:i+scales_half-k_half+k,
j+scales_half-k_half:j+scales_half-k_half+k]

edmim_s = edge_mag[i+scales_half-k_half:i+scales_half-k_half+k,
j+scales_half-k_half:j+scales_half-k_half+k]

dx_s = deriv_x[i+scales_half-k_half:i+scales_half-k_half+k,
j+scales_half-k_half:j+scales_half-k_half+k]

dy_s = deriv_y[i+scales_half-k_half:i+scales_half-k_half+k,
j+scales_half-k_half:j+scales_half-k_half+k]
# k_half = k / 2
#
# ifst = i + scales_half - int(k/2)
# isnd = i + scales_half - int(k/2) + k
# jfst = j + scales_half - int(k/2)
# jsnd = j + scales_half - int(k/2) + k

# edoim_s = edge_ori[i+scales_half-k_half:i+scales_half-k_half+k,
# j+scales_half-k_half:j+scales_half-k_half+k]
#
# edmim_s = edge_mag[i+scales_half-k_half:i+scales_half-k_half+k,
# j+scales_half-k_half:j+scales_half-k_half+k]
#
# dx_s = deriv_x[i+scales_half-k_half:i+scales_half-k_half+k,
# j+scales_half-k_half:j+scales_half-k_half+k]
#
# dy_s = deriv_y[i+scales_half-k_half:i+scales_half-k_half+k,
# j+scales_half-k_half:j+scales_half-k_half+k]

sts = lsr.feature_lsr(edoim_s, edmim_s, dx_s, dy_s)
# sts = lsr.feature_lsr(edoim_s, edmim_s, dx_s, dy_s)

sts = Parallel(n_jobs=-1,
max_nbytes=None)(delayed(call_lsr)(edge_ori[i+scales_half-int(k/2):i+scales_half-int(k/2)+k,
j+scales_half-int(k/2):j+scales_half-int(k/2)+k],
edge_mag[i+scales_half-int(k/2):i+scales_half-int(k/2)+k,
j+scales_half-int(k/2):j+scales_half-int(k/2)+k],
deriv_x[i+scales_half-int(k/2):i+scales_half-int(k/2)+k,
j+scales_half-int(k/2):j+scales_half-int(k/2)+k],
deriv_y[i+scales_half-int(k/2):i+scales_half-int(k/2)+k,
j+scales_half-int(k/2):j+scales_half-int(k/2)+k])
for k in scs)

for st in sts:
out_list.append(st)
for st_ in st:
out_list.append(st_)

return out_list

Expand Down
Loading

0 comments on commit e79a395

Please sign in to comment.