Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tomrunia committed Dec 11, 2018
1 parent a1b0dfa commit 72169ac
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 1 deletion.
64 changes: 64 additions & 0 deletions examples/example_lena.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# MIT License
#
# Copyright (c) 2018 Tom Runia
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to conditions.
#
# Author: Tom Runia
# Date Created: 2018-12-04

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import argparse
import cv2

from steerable.SCFpyr_NumPy import SCFpyr_NumPy
import steerable.utils as utils

################################################################################
################################################################################

if __name__ == "__main__":

parser = argparse.ArgumentParser()
parser.add_argument('--image_file', type=str, default='./assets/patagonia.jpg')
parser.add_argument('--batch_size', type=int, default='1')
parser.add_argument('--image_size', type=int, default='200')
parser.add_argument('--pyr_nlevels', type=int, default='5')
parser.add_argument('--pyr_nbands', type=int, default='4')
parser.add_argument('--pyr_scale_factor', type=int, default='2')
parser.add_argument('--visualize', type=bool, default=True)
config = parser.parse_args()

############################################################################
# Build the complex steerable pyramid

pyr = SCFpyr_NumPy(
height=config.pyr_nlevels,
nbands=config.pyr_nbands,
scale_factor=config.pyr_scale_factor,
)

############################################################################
# Create a batch and feed-forward

image = cv2.imread('./assets/lena.jpg', cv2.IMREAD_GRAYSCALE)
image = cv2.resize(image, dsize=(200,200))

coeff = pyr.build(image)

grid = utils.make_grid_coeff(coeff, normalize=True)

cv2.imwrite('./assets/coeff.png', grid)
cv2.imshow('image', image)
cv2.imshow('coeff', grid)
cv2.waitKey(0)


2 changes: 1 addition & 1 deletion steerable/SCFpyr_PyTorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def _reconstruct_levels(self, coeff, log_rad, Xrcos, Yrcos, angle):
dims = np.array(coeff[0][0].shape)

lostart = (np.ceil((dims+0.5)/2) -
np.ceil((np.ceil((dims-0.5)/2)+0.5)/2)).astype(np.int32)
np.ceil((np.ceil((dims-0.5)/2)+0.5)/2)).astype(np.int32)
loend = lostart + np.ceil((dims-0.5)/2).astype(np.int32)

nlog_rad = log_rad[lostart[0]:loend[0], lostart[1]:loend[1]]
Expand Down

0 comments on commit 72169ac

Please sign in to comment.