Home | Trees | Indices | Help |
---|
|
1 # PyVision License 2 # 3 # Copyright (c) 2006-2008 David S. Bolme 4 # All rights reserved. 5 # 6 # Redistribution and use in source and binary forms, with or without 7 # modification, are permitted provided that the following conditions 8 # are met: 9 # 10 # 1. Redistributions of source code must retain the above copyright 11 # notice, this list of conditions and the following disclaimer. 12 # 13 # 2. Redistributions in binary form must reproduce the above copyright 14 # notice, this list of conditions and the following disclaimer in the 15 # documentation and/or other materials provided with the distribution. 16 # 17 # 3. Neither name of copyright holders nor the names of its contributors 18 # may be used to endorse or promote products derived from this software 19 # without specific prior written permission. 20 # 21 # 22 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR 26 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 34 import numpy as np 3537 ''' 38 Windowing function from: 39 http://en.wikipedia.org/wiki/Window_function 40 ''' 41 w,h = size 42 X = np.arange(w).reshape(w,1) 43 Y = np.arange(h).reshape(1,h) 44 X = X*np.ones((1,h),'d') 45 Y = Y*np.ones((w,1),'d') 46 47 window = (5.3836-0.46164*np.cos(2*np.pi*X/(w-1.0)))*(5.3836-0.46164*np.cos(2*np.pi*Y/(h-1.0))) 48 return window49 5052 ''' 53 Windowing function from: 54 http://en.wikipedia.org/wiki/Window_function 55 ''' 56 w,h = size 57 X = np.arange(w).reshape(w,1) 58 Y = np.arange(h).reshape(1,h) 59 X = X*np.ones((1,h),'d') 60 Y = Y*np.ones((w,1),'d') 61 62 window = (0.5*(1-np.cos(2*np.pi*X/(w-1.0))))*(0.5*(1-np.cos(2*np.pi*Y/(h-1.0)))) 63 return window6466 ''' 67 Windowing function from: 68 http://en.wikipedia.org/wiki/Window_function 69 ''' 70 w,h = size 71 X = np.arange(w).reshape(w,1) 72 Y = np.arange(h).reshape(1,h) 73 X = X*np.ones((1,h),'d') 74 Y = Y*np.ones((w,1),'d') 75 76 window = (np.sin(np.pi*X/(w-1.0)))*(np.sin(np.pi*Y/(h-1.0))) 77 return window78
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Tue Apr 21 14:32:03 2015 | http://epydoc.sourceforge.net |