├── .gitignore ├── LICENSE ├── README.md ├── pyPyrTools ├── Gpyr.py ├── JBhelpers.py ├── LB2idx.py ├── Lpyr.py ├── SCFpyr.py ├── SFpyr.py ├── Spyr.py ├── TESTS │ ├── matFiles │ │ ├── blur0.mat │ │ ├── blur1.mat │ │ ├── blur2.mat │ │ ├── blur3.mat │ │ ├── blur4.mat │ │ ├── blur5.mat │ │ ├── blurDn0.mat │ │ ├── blurDn1.mat │ │ ├── blurDn2.mat │ │ ├── blurDn3.mat │ │ ├── blurDn4.mat │ │ ├── blurDn5.mat │ │ ├── blurDn6.mat │ │ ├── blurDn7.mat │ │ ├── buildGpyr1.mat │ │ ├── buildGpyr2col.mat │ │ ├── buildGpyr2row.mat │ │ ├── buildGpyr3.mat │ │ ├── buildGpyr4.mat │ │ ├── buildGpyr5.mat │ │ ├── buildLpyr1.mat │ │ ├── buildLpyr10.mat │ │ ├── buildLpyr11.mat │ │ ├── buildLpyr12.mat │ │ ├── buildLpyr2.mat │ │ ├── buildLpyr3.mat │ │ ├── buildLpyr4.mat │ │ ├── buildLpyr5.mat │ │ ├── buildLpyr6.mat │ │ ├── buildLpyr7.mat │ │ ├── buildLpyr8.mat │ │ ├── buildLpyr9.mat │ │ ├── buildSCFpyr0.mat │ │ ├── buildSCFpyr1.mat │ │ ├── buildSCFpyr10.mat │ │ ├── buildSCFpyr11.mat │ │ ├── buildSCFpyr12.mat │ │ ├── buildSCFpyr2.mat │ │ ├── buildSCFpyr3.mat │ │ ├── buildSCFpyr4.mat │ │ ├── buildSCFpyr5.mat │ │ ├── buildSCFpyr6.mat │ │ ├── buildSCFpyr7.mat │ │ ├── buildSFpyr0.mat │ │ ├── buildSFpyr01.mat │ │ ├── buildSFpyr1.mat │ │ ├── buildSFpyr10.mat │ │ ├── buildSFpyr11.mat │ │ ├── buildSFpyr12.mat │ │ ├── buildSFpyr13.mat │ │ ├── buildSFpyr2.mat │ │ ├── buildSFpyr3.mat │ │ ├── buildSFpyr4.mat │ │ ├── buildSFpyr5.mat │ │ ├── buildSFpyr6.mat │ │ ├── buildSFpyr7.mat │ │ ├── buildSFpyr8.mat │ │ ├── buildSFpyr9.mat │ │ ├── buildSpyr0.mat │ │ ├── buildSpyr00.mat │ │ ├── buildSpyr1.mat │ │ ├── buildSpyr10.mat │ │ ├── buildSpyr11.mat │ │ ├── buildSpyr12.mat │ │ ├── buildSpyr13.mat │ │ ├── buildSpyr14.mat │ │ ├── buildSpyr15.mat │ │ ├── buildSpyr16.mat │ │ ├── buildSpyr17.mat │ │ ├── buildSpyr18.mat │ │ ├── buildSpyr19.mat │ │ ├── buildSpyr2.mat │ │ ├── buildSpyr20.mat │ │ ├── buildSpyr21.mat │ │ ├── buildSpyr22.mat │ │ ├── buildSpyr23.mat │ │ ├── buildSpyr24.mat │ │ ├── buildSpyr25.mat │ │ ├── buildSpyr26.mat │ │ ├── buildSpyr27.mat │ │ ├── buildSpyr28.mat │ │ ├── buildSpyr29.mat │ │ ├── buildSpyr3.mat │ │ ├── buildSpyr4.mat │ │ ├── buildSpyr5.mat │ │ ├── buildSpyr6.mat │ │ ├── buildSpyr7.mat │ │ ├── buildSpyr8.mat │ │ ├── buildSpyr9.mat │ │ ├── buildWpyr0.mat │ │ ├── buildWpyr1.mat │ │ ├── buildWpyr10.mat │ │ ├── buildWpyr11.mat │ │ ├── buildWpyr12.mat │ │ ├── buildWpyr13.mat │ │ ├── buildWpyr14.mat │ │ ├── buildWpyr15.mat │ │ ├── buildWpyr16.mat │ │ ├── buildWpyr17.mat │ │ ├── buildWpyr18.mat │ │ ├── buildWpyr2.mat │ │ ├── buildWpyr3.mat │ │ ├── buildWpyr4.mat │ │ ├── buildWpyr5.mat │ │ ├── buildWpyr6.mat │ │ ├── buildWpyr7.mat │ │ ├── buildWpyr8.mat │ │ ├── buildWpyr9.mat │ │ ├── cconv2_0.mat │ │ ├── cconv2_1.mat │ │ ├── cconv2_2.mat │ │ ├── cconv2_3.mat │ │ ├── cconv2_4.mat │ │ ├── cconv2_5.mat │ │ ├── cconv2_6.mat │ │ ├── cconv2_7.mat │ │ ├── clip0.mat │ │ ├── clip1.mat │ │ ├── clip2.mat │ │ ├── clip3.mat │ │ ├── corrDn1.mat │ │ ├── corrDn2.mat │ │ ├── corrDn3.mat │ │ ├── entropy2_0.mat │ │ ├── entropy2_1.mat │ │ ├── factorial0.mat │ │ ├── factorial1.mat │ │ ├── histo0.mat │ │ ├── histo1.mat │ │ ├── histo2.mat │ │ ├── histo3.mat │ │ ├── histoMatch0.mat │ │ ├── im04-1.mat │ │ ├── imGradient0.mat │ │ ├── imGradient1.mat │ │ ├── mkAngularSine0.mat │ │ ├── mkAngularSine1.mat │ │ ├── mkAngularSine2.mat │ │ ├── mkAngularSine3.mat │ │ ├── mkAngularSine4.mat │ │ ├── mkDisc0.mat │ │ ├── mkDisc1.mat │ │ ├── mkDisc2.mat │ │ ├── mkDisc3.mat │ │ ├── mkDisc4.mat │ │ ├── mkGaussian0.mat │ │ ├── mkGaussian1.mat │ │ ├── mkGaussian2.mat │ │ ├── mkGaussian3.mat │ │ ├── mkGaussian4.mat │ │ ├── mkRamp1.mat │ │ ├── mkRamp2.mat │ │ ├── mkRamp3.mat │ │ ├── mkSine0.mat │ │ ├── mkSine1.mat │ │ ├── mkSine2.mat │ │ ├── mkSine3.mat │ │ ├── mkSine4.mat │ │ ├── mkSine5.mat │ │ ├── mkSine6.mat │ │ ├── mkSine7.mat │ │ ├── mkSine8.mat │ │ ├── mkSquare0.mat │ │ ├── mkSquare1.mat │ │ ├── mkSquare10.mat │ │ ├── mkSquare2.mat │ │ ├── mkSquare3.mat │ │ ├── mkSquare4.mat │ │ ├── mkSquare5.mat │ │ ├── mkSquare6.mat │ │ ├── mkSquare7.mat │ │ ├── mkSquare8.mat │ │ ├── mkSquare9.mat │ │ ├── mkZonePlate0.mat │ │ ├── mkZonePlate1.mat │ │ ├── mkZonePlate2.mat │ │ ├── pointOp1.mat │ │ ├── skew2_0.mat │ │ ├── skew2_1.mat │ │ ├── skew2_2.mat │ │ ├── sp0Filters.mat │ │ ├── sp1Filters.mat │ │ ├── sp1Filters2.mat │ │ ├── sp3Filters.mat │ │ ├── sp5Filters.mat │ │ ├── upBlur0.mat │ │ ├── upBlur1.mat │ │ ├── upBlur10.mat │ │ ├── upBlur11.mat │ │ ├── upBlur12.mat │ │ ├── upBlur2.mat │ │ ├── upBlur3.mat │ │ ├── upBlur4.mat │ │ ├── upBlur5.mat │ │ ├── upBlur6.mat │ │ ├── upBlur8.mat │ │ ├── zconv2_0.mat │ │ ├── zconv2_1.mat │ │ ├── zconv2_2.mat │ │ ├── zconv2_3.mat │ │ ├── zconv2_4.mat │ │ └── zconv2_5.mat │ └── unitTests.py ├── TUTORIALS │ └── pyramids.ipynb ├── Wpyr.py ├── __init__.py ├── binomialFilter.py ├── blur.py ├── blurDn.py ├── cconv2.py ├── clip.py ├── comparePyr.py ├── compareRecon.py ├── convolve.c ├── convolve.h ├── corrDn.py ├── edges.c ├── einsteinCorrect.pgm ├── entropy2.py ├── factorial.py ├── histo.py ├── histoMatch.py ├── idx2LB.py ├── imGradient.py ├── imStats.py ├── internal_pointOp.c ├── internal_pointOp.h ├── kurt2.py ├── lenna-256x256.tif ├── makeChangelog.py ├── maxPyrHt.py ├── mkAngle.py ├── mkAngularSine.py ├── mkDisc.py ├── mkFract.py ├── mkGaussian.py ├── mkImpulse.py ├── mkR.py ├── mkRamp.py ├── mkSine.py ├── mkSquare.py ├── mkZonePlate.py ├── modulateFlip.py ├── namedFilter.py ├── nextSz.py ├── pointOp.py ├── pyPyrTools.py ├── pyPyrUtils.py ├── pyramid.py ├── range2.py ├── rconv2.py ├── rcosFn.py ├── round.py ├── roundVal.py ├── shift.py ├── showIm.py ├── skew2.py ├── sp0Filters.py ├── sp1Filters.py ├── sp3Filters.py ├── sp5Filters.py ├── steer.py ├── steer2HarmMtx.py ├── strictly_decreasing.py ├── upBlur.py ├── upConv.py ├── var2.py ├── wrap.c └── zconv2.py ├── requirements.txt ├── setup.cfg └── setup.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 LabForComputationalVision 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | NOTE: This code is unmaintained and unsupported. See 2 | [pyrtools](https://github.com/LabForComputationalVision/pyrtools) for a 3 | maintained python 3 version of the tools here. 4 | 5 | # pyPyrTools 6 | 7 | A Python 2.7 port of Eero Simoncelli's matlabPyrTools to Python. This port does 8 | not attept to recreate all of the matlab code from matlabPyrTools. 9 | The goal is to create a Python interface for the C code at the heart 10 | of matlabPyrTools, which implements flexible convolution with subsampling and 11 | multiple options for boundary-handling. 12 | 13 | All code should be considered a beta release. Unit tests are available in 14 | `TESTING/unitTests.py`. 15 | 16 | If you're using functions or parameters that do not have associated unit 17 | tests you should test this yourself to make sure the results are correct. 18 | You could then submit your test code, so that we can build more complete 19 | unit tests. 20 | 21 | # Authors 22 | 23 | Rob Young and Eero Simoncelli, 7/13 24 | William Broderick, 6/17 25 | 26 | # Installation 27 | 28 | It's recommended you install from pip: `pip install pyPyrTools`. The 29 | pip install only been tested on Linux, there is no guarantee that it 30 | will work on other systems. Installing from source (see below) should 31 | work on OSX as well, but Windows is NOT supported. 32 | 33 | NOTE: You will also need to install PyQt (either PyQt4 or PyQt5), but 34 | I have often been unable to install either from pip and so it is not 35 | listed as a required package for pip's setup.py. I would like 36 | eventually to remove this requirement, but for the time being you will 37 | have to install it on your 38 | own. See 39 | [here for PyQt4](http://pyqt.sourceforge.net/Docs/PyQt4/installation.html) and 40 | [here for PyQt5](http://pyqt.sourceforge.net/Docs/PyQt5/installation.html). 41 | 42 | But if you want to install from source or pip doesn't work, you'll 43 | need to compile the associated C code yourself: assuming your path to 44 | python libraries is `/usr/local/anaconda2`, you would type: 45 | 46 | ``` 47 | gcc -shared -L/usr/local/anaconda2/lib -I/usr/local/anaconda2/include/python2.7/ -lpython2.7 -o wrapConv.so -fPIC convolve.c edges.c wrap.c internal_pointOp.c 48 | ``` 49 | 50 | Other requirements: 51 | - numpy 52 | - scipy 53 | - matplotlib 54 | - Pillow 55 | 56 | # Usage: 57 | 58 | method parameters mimic the matlab function parameters except that there's no 59 | need to pass pyr or pind, since the pyPyrTools version pyr and pyrSize are 60 | properties of the class. 61 | 62 | - load modules (note that if you installed via pip, you can skip the 63 | first two lines): 64 | ``` 65 | >> import sys 66 | >> sys.path.append('path to pyPyrTools parent directory') 67 | >> import pyrPyrTools as ppt 68 | ``` 69 | 70 | - create pyramid: 71 | ``` 72 | >> myPyr = ppt.Lpyr(img) 73 | ``` 74 | 75 | - reconstruct image from pyramid: 76 | ``` 77 | >> reconImg = myPyr.reconLpyr() 78 | ``` 79 | 80 | Please see `TUTORIALS/pyramids.ipynb` for more examples. You can 81 | start this with: `jupyter notebook pyramids.ipynb` if you have iPython 82 | and Jupyter installed. 83 | 84 | # Testing 85 | 86 | To use the included test, navigate to `pyPyrTools/TESTS/` and run 87 | `python unitTests.py`. Note that a large amount of text will appear in 88 | your terminal window, *even if the tests are succeeding*, so don't 89 | freak out. 90 | 91 | # Function list 92 | 93 | + `showIm(image, range, label, colormap, colorbar)` 94 | 95 | display an image in a figure window 96 | - `image` - a 2D numpy array 97 | - `range` - a two element tuple. It specifies the values that map to 98 | the min and max colormap value. Passing a value of `'auto'` 99 | (default) sets `range=[min,max]`. `'auto2'` sets `range=[mean-2*stdev, 100 | mean+2*stdev]`. `'auto3'` sets `range=[p1-(p2-p1)/8, p2+(p2-p1)/8]`, 101 | where `p1` is the 10th percentile value of the sorted matrix 102 | samples, and `p2` is the 90th percentile value. 103 | - `label` - a string that is used as a figure title 104 | - `colormap` - either the string `'auto'` (grey colormap will be 105 | used) or a string that is the name of a colormap 106 | variable 107 | - `colorbar` - a boolean that specifies whether or not a colorbar is displayed 108 | 109 | + `maxPyrHt(imsz, filtsz)` 110 | 111 | return the maximum possible pyramid height from the given image and filter 112 | size 113 | - `imsz` - integer giving the image size 114 | - `filtsz` - integer giving the filter size 115 | 116 | + `binomialFilter(size)` 117 | 118 | returns a numpy array of binomial coefficients of order (size-1) 119 | - `size` - integer giving size of filter 120 | 121 | + `namedFilter(name)` 122 | 123 | returns numpy array of named filter. Supported names are: 124 | `binom ` (where is a number denoting the size of the 125 | filter), `'qmf5'`, `'qmf9'`, `'qmf13'`, `'qmf8'`, `'qmf12'`, 126 | `'qmf16'`, `'haar'`, `'daub2'`, `'daub3'`, `'daub4'`, `'gauss5'`, 127 | `'gauss3'`. 128 | 129 | + `mkRamp(size, direction, slope, intercept, origin)` 130 | 131 | Compute a matrix of dimension `size` (a (Y X) tuple, or a scalar 132 | (for square matrices)) containing samples of a ramp function, with a 133 | given gradient `direction` (radians, CW from X-axis, default=0), 134 | `slope` (per pixel, default = 1), and a value of `intercept` 135 | (default = 0) at the `origin` (default = `(size+1)/2`, (1 1) = upper 136 | left). All but the first argument are optional. 137 | 138 | + `sp0Filters` - steerable pyramid filters (see pyPyrUtils.py for references) 139 | 140 | + `sp1Filters` - steerable pyramid filters (see pyPyrUtils.py for references) 141 | 142 | + `mkImpulse(size, origin, amplitude)` 143 | 144 | Compute a matrix of dimension `size` (a (Y X) tuple, or a scalar 145 | (for square matrices)) containing a single non-zero entry, at 146 | position `origin` (defaults to `ceil(size/2)`), of value `amplitude` 147 | (defaults to 1). 148 | 149 | + `Lpyr(image, height, filter1, filter2, edges)` 150 | 151 | Laplacian pyramid: image parameter is required, others are optional 152 | - `image` - a 2D numpy array 153 | - `height` - an integer denoting number of pyramid levels 154 | desired. Defaults to `maxPyrHt` from pyPyrUtils. 155 | - `filter1` - can be a string namimg a standard filter (from 156 | pyPyrUtils.namedFilter()), or a numpy array which 157 | will be used for (separable) convolution. Default is 158 | 'binom5'. 159 | - `filter2` - specifies the "expansion" filter (default = filt1). 160 | - `edges` - specifies edge-handling. Options are: 161 | * `'circular'` - circular convolution 162 | * `'reflect1'` - reflect about the edge pixels 163 | * `'reflect2'` - reflect, doubling the edge pixels 164 | * `'repeat'` - repeat the edge pixels 165 | * `'zero'` - assume values of zero outside image boundary 166 | * `'extend'` - reflect and invert 167 | * `'dont-compute'` - zero output when filter overhangs imput 168 | boundaries. 169 | 170 | Methods: 171 | - `reconLpyr(levs, filt2, edges)`: Reconstruct image from Laplacian 172 | pyramid object 173 | - `levs` (optional) - numpy array of levels to include, or the 174 | string `'all'` (default). The finest scale is 0. 175 | - `filt2` (optional) - valid string name for 176 | `pyPyrUtils.namedFilter()` or a numpy array which will be used 177 | for (separable) convolution. Default = `'binom5'`. 178 | - `edges` (optional) - same as edges for constructor above. 179 | - `pyrLow()`: Returns the coarsest band. 180 | - `showPyr(range, gap, level_scale_factor)`: Show all bands of the pyramid in a figure window. 181 | - `range` - a two element tuple specifying the values that map to 182 | black and white respectively. These values are scaled by 183 | `level_scale_factor**(lev-1)` for bands at each level. Passing a 184 | value of `'auto1'` sets range to the min and max values of 185 | matrix. `'auto2'` sets range to 3 standard deviations below and 186 | above 0.0. In both of these cases, the lowpass band is 187 | independently scaled. A value of `'indep1'` sets the range of 188 | each subband independently, as in a call to 189 | `pyPyrUtils.showIm(subband, 'auto1')`. Similarly, `'indep2'` 190 | causes each subband to be scaled independently as if by 191 | `pyPyrUtils.showIm(subband, 'indep2')`. The default value for 192 | range is `'auto1'` for 1D images and `'auto2'` for 2D images. 193 | - `gap` - specifies the gap in pixels to leave between subbands 194 | (2D images only). default = 1. 195 | - `level_scale_factor` - indicates the relative scaling between 196 | pyramid levels. This should be set to the sum of the kernel 197 | taps of the lowpass filter used to construct the pyramid 198 | (default assumes L2-normalized filters, using a value of 2 for 199 | 2D images, sqrt(2) for 1D images). 200 | 201 | + `Gpyr(image, height, filter, edges)` 202 | 203 | Gaussian pyramid (subclass of Lpyr). image parameter is required, 204 | others are optional. 205 | 206 | - `image` - a 2D numpy array 207 | - `height` - an integer denoting number of pyramid levels desired. 208 | Defaults to `maxPyrHt` from pyPyrUtils. 209 | - `filter` - can be a string namimg a standard filter (from 210 | `pyPyrUtils.namedFilter()`), or a numpy array which will be used 211 | for (separable) convolution. Default is `'binom5'`. 212 | - `edges` - specifies edge-handling. Options are: 213 | * `'circular'` - circular convolution 214 | * `'reflect1'` - reflect about the edge pixels 215 | * `'reflect2'` - reflect, doubling the edge pixels 216 | * `'repeat'` - repeat the edge pixels 217 | * `'zero'` - assume values of zero outside image boundary 218 | * `'extend'` - reflect and invert 219 | * `'dont-compute'` - zero output when filter overhangs imput boundaries. 220 | 221 | + `Spyr(image, height, filter, edges)` 222 | 223 | Steerable pyramid. image parameter is required, others are optional 224 | 225 | - `image` - a 2D numpy array 226 | - `height` - an integer denoting number of pyramid levels 227 | desired. Defaults to maxPyrHt from 228 | pyPyrUtils. You can specify 'auto' to use 229 | this value. 230 | - `filter` - The name of one of the steerable pyramid filters in 231 | pyPyrUtils: `'sp0Filters'`, `'sp1Filters'`, `'sp3Filters'`, 232 | `'sp5Filters'`. Default is `'sp1Filters'`. 233 | - `edges` - specifies edge-handling. Options are: 234 | * `'circular'` - circular convolution 235 | * `'reflect1'` - reflect about the edge pixels 236 | * `'reflect2'` - reflect, doubling the edge pixels 237 | * `'repeat'` - repeat the edge pixels 238 | * `'zero'` - assume values of zero outside image boundary 239 | * `'extend'` - reflect and invert 240 | * `'dont-compute'` - zero output when filter overhangs input 241 | boundaries. 242 | 243 | - `spyrHt()` - return the height of the pyramid 244 | - `numBands()` - return the number of bands in the pyramid 245 | - `pyrLow()` - return the lowest band 246 | - `pyrHight()` - return the highest band 247 | - `reconSpyr(filter, edges, levs, bands)` - reconstruct image from pyramid 248 | - `filter` - (optional) same as for constructor above. Default is 'sp1Filters'. 249 | - `edges` - (optional) same as for constructor above. Default is 'reflect1'. 250 | - `levs` - (optional) should be a numpy array of levels to 251 | include, or the string `'all'` (default). 0 corresponds to the 252 | residual highpass subband. 1 corresponds to number `spyrHt()+1`. 253 | - `bands` - (optional) should be a list of bands to include, or 254 | the string `'all'` (default). 0 = vertical, rest proceeding 255 | anti-clockwise. 256 | 257 | 258 | -------------------------------------------------------------------------------- /pyPyrTools/Gpyr.py: -------------------------------------------------------------------------------- 1 | from Lpyr import Lpyr 2 | from namedFilter import namedFilter 3 | from maxPyrHt import maxPyrHt 4 | import numpy 5 | from corrDn import corrDn 6 | 7 | class Gpyr(Lpyr): 8 | filt = '' 9 | edges = '' 10 | height = '' 11 | 12 | # constructor 13 | def __init__(self, image, height='auto', filt='binom5', edges='reflect1'): 14 | self.pyrType = 'Gaussian' 15 | self.image = image 16 | 17 | if isinstance(filt, basestring): 18 | self.filt = namedFilter(filt) 19 | else: 20 | self.filt = filt 21 | if not (numpy.array(self.filt.shape) == 1).any(): 22 | raise Exception("filt should be a 1D filter (i.e., a vector)") 23 | 24 | # when the first dimension of the image is 1, we need the filter to have shape (1, x) 25 | # instead of the normal (x, 1) or we get a segfault during corrDn / upConv. That's because 26 | # we need to match the filter to the image dimensions 27 | if self.image.shape[0] == 1: 28 | self.filt = self.filt.reshape(1, max(self.filt.shape)) 29 | 30 | maxHeight = 1 + maxPyrHt(self.image.shape, self.filt.shape) 31 | 32 | if height == "auto": 33 | self.height = maxHeight 34 | else: 35 | self.height = height 36 | if self.height > maxHeight: 37 | raise Exception("Cannot build pyramid higher than %d levels" % (maxHeight)) 38 | 39 | self.edges = edges 40 | 41 | # make pyramid 42 | self.pyr = [] 43 | self.pyrSize = [] 44 | pyrCtr = 0 45 | im = numpy.array(self.image).astype(float) 46 | 47 | if len(im.shape) == 1: 48 | im = im.reshape(im.shape[0], 1) 49 | 50 | self.pyr.append(im.copy()) 51 | self.pyrSize.append(im.shape) 52 | pyrCtr += 1 53 | 54 | for ht in range(self.height-1,0,-1): 55 | im_sz = im.shape 56 | filt_sz = self.filt.shape 57 | if im_sz[0] == 1: 58 | lo2 = corrDn(image=im, filt=self.filt, step=(1, 2)) 59 | #lo2 = numpy.array(lo2) 60 | elif len(im_sz) == 1 or im_sz[1] == 1: 61 | lo2 = corrDn(image=im, filt=self.filt, step=(2, 1)) 62 | #lo2 = numpy.array(lo2) 63 | else: 64 | lo = corrDn(image=im, filt=self.filt.T, step=(1, 2), 65 | start=(0, 0)) 66 | #lo = numpy.array(lo) 67 | lo2 = corrDn(image=lo, filt=self.filt, step=(2, 1), 68 | start=(0, 0)) 69 | #lo2 = numpy.array(lo2) 70 | 71 | self.pyr.append(lo2.copy()) 72 | self.pyrSize.append(lo2.shape) 73 | 74 | pyrCtr += 1 75 | 76 | im = lo2 77 | -------------------------------------------------------------------------------- /pyPyrTools/LB2idx.py: -------------------------------------------------------------------------------- 1 | def LB2idx(lev, band, nlevs, nbands): 2 | ''' convert level and band to dictionary index ''' 3 | # reset band to match matlab version 4 | band += (nbands-1) 5 | if band > nbands-1: 6 | band = band - nbands 7 | 8 | if lev == 0: 9 | idx = 0 10 | elif lev == nlevs-1: 11 | # (Nlevels - ends)*Nbands + ends -1 (because zero indexed) 12 | idx = (((nlevs-2)*nbands)+2)-1 13 | else: 14 | # (level-first level) * nbands + first level + current band 15 | idx = (nbands*lev)-band - 1 16 | 17 | return idx 18 | -------------------------------------------------------------------------------- /pyPyrTools/SCFpyr.py: -------------------------------------------------------------------------------- 1 | from SFpyr import SFpyr 2 | import numpy 3 | from steer2HarmMtx import steer2HarmMtx 4 | from rcosFn import rcosFn 5 | from pointOp import pointOp 6 | import scipy 7 | from mkAngle import mkAngle 8 | import cmath 9 | 10 | class SCFpyr(SFpyr): 11 | filt = '' 12 | edges = '' 13 | 14 | #constructor 15 | def __init__(self, *args): # (image, height, order, twidth) 16 | self.pyrType = 'steerableFrequency' 17 | 18 | if len(args) > 0: 19 | self.image = args[0] 20 | else: 21 | print "First argument (image) is required." 22 | return 23 | 24 | #------------------------------------------------ 25 | # defaults: 26 | 27 | max_ht = numpy.floor( numpy.log2( min(self.image.shape) ) ) - 2 28 | if len(args) > 1: 29 | if(args[1] > max_ht): 30 | print "Error: cannot build pyramid higher than %d levels." % (max_ht) 31 | ht = args[1] 32 | else: 33 | ht = max_ht 34 | ht = int(ht) 35 | 36 | if len(args) > 2: 37 | if args[2] > 15 or args[2] < 0: 38 | print "Warning: order must be an integer in the range [0,15]. Truncating." 39 | order = min( max(args[2],0), 15 ) 40 | else: 41 | order = args[2] 42 | else: 43 | order = 3 44 | 45 | nbands = order+1 46 | 47 | if len(args) > 3: 48 | if args[3] <= 0: 49 | print "Warning: twidth must be positive. Setting to 1." 50 | twidth = 1 51 | else: 52 | twidth = args[3] 53 | else: 54 | twidth = 1 55 | 56 | #------------------------------------------------------ 57 | # steering stuff: 58 | 59 | if nbands % 2 == 0: 60 | harmonics = numpy.array(range(nbands/2)) * 2 + 1 61 | else: 62 | harmonics = numpy.array(range((nbands-1)/2)) * 2 63 | 64 | steermtx = steer2HarmMtx(harmonics, 65 | numpy.pi*numpy.array(range(nbands))/nbands, 66 | 'even') 67 | #------------------------------------------------------ 68 | 69 | dims = numpy.array(self.image.shape) 70 | ctr = numpy.ceil((numpy.array(dims)+0.5)/2).astype(int) 71 | 72 | (xramp, yramp) = numpy.meshgrid((numpy.array(range(1,dims[1]+1))-ctr[1])/ 73 | (dims[1]/2), 74 | (numpy.array(range(1,dims[0]+1))-ctr[0])/ 75 | (dims[0]/2)) 76 | angle = numpy.arctan2(yramp, xramp) 77 | log_rad = numpy.sqrt(xramp**2 + yramp**2) 78 | log_rad[ctr[0]-1, ctr[1]-1] = log_rad[ctr[0]-1, ctr[1]-2] 79 | log_rad = numpy.log2(log_rad); 80 | 81 | ## Radial transition function (a raised cosine in log-frequency): 82 | (Xrcos, Yrcos) = rcosFn(twidth, (-twidth/2.0), numpy.array([0,1])) 83 | Yrcos = numpy.sqrt(Yrcos) 84 | 85 | YIrcos = numpy.sqrt(1.0 - Yrcos**2) 86 | lo0mask = pointOp(log_rad, YIrcos, Xrcos[0], Xrcos[1]-Xrcos[0], 0) 87 | 88 | imdft = numpy.fft.fftshift(numpy.fft.fft2(self.image)) 89 | 90 | self.pyr = [] 91 | self.pyrSize = [] 92 | 93 | hi0mask = pointOp(log_rad, Yrcos, Xrcos[0], Xrcos[1]-Xrcos[0], 0) 94 | 95 | hi0dft = imdft * hi0mask.reshape(imdft.shape[0], imdft.shape[1]) 96 | hi0 = numpy.fft.ifft2(numpy.fft.ifftshift(hi0dft)) 97 | 98 | self.pyr.append(numpy.real(hi0.copy())) 99 | self.pyrSize.append(hi0.shape) 100 | 101 | lo0mask = lo0mask.reshape(imdft.shape[0], imdft.shape[1]) 102 | lodft = imdft * lo0mask 103 | 104 | for i in range(ht): 105 | bands = numpy.zeros((lodft.shape[0]*lodft.shape[1], nbands)) 106 | bind = numpy.zeros((nbands, 2)) 107 | 108 | Xrcos -= numpy.log2(2) 109 | 110 | lutsize = 1024 111 | Xcosn = numpy.pi * numpy.array(range(-(2*lutsize+1), (lutsize+2))) / lutsize 112 | 113 | order = nbands -1 114 | const = (2**(2*order))*(scipy.misc.factorial(order, exact=True)**2)/float(nbands*scipy.misc.factorial(2*order, exact=True)) 115 | 116 | alfa = ( (numpy.pi+Xcosn) % (2.0*numpy.pi) ) - numpy.pi 117 | Ycosn = ( 2.0*numpy.sqrt(const) * (numpy.cos(Xcosn)**order) * 118 | (numpy.abs(alfa) 0: 160 | levs = args[0] 161 | else: 162 | levs = 'all' 163 | 164 | if len(args) > 1: 165 | bands = args[1] 166 | else: 167 | bands = 'all' 168 | 169 | if len(args) > 2: 170 | if args[2] <= 0: 171 | print "Warning: twidth must be positive. Setting to 1." 172 | twidth = 1 173 | else: 174 | twidth = args[2] 175 | else: 176 | twidth = 1 177 | 178 | #----------------------------------------------------------------- 179 | 180 | pind = self.pyrSize 181 | Nsc = int(numpy.log2(pind[0][0] / pind[-1][0])) 182 | Nor = (len(pind)-2) / Nsc 183 | 184 | pyrIdx = 1 185 | for nsc in range(Nsc): 186 | firstBnum = nsc * Nor+2 187 | dims = pind[firstBnum][:] 188 | ctr = (numpy.ceil((dims[0]+0.5)/2.0).astype(int), numpy.ceil((dims[1]+0.5)/2.0).astype(int)) #-1? 189 | ang = mkAngle(dims, 0, ctr) 190 | ang[ctr[0]-1, ctr[1]-1] = -numpy.pi/2.0 191 | for nor in range(Nor): 192 | nband = nsc * Nor + nor + 1 193 | ch = self.pyr[nband] 194 | ang0 = numpy.pi * nor / Nor 195 | xang = ((ang-ang0+numpy.pi) % (2.0*numpy.pi)) - numpy.pi 196 | amask = 2 * (numpy.abs(xang) < (numpy.pi/2.0)).astype(int) + (numpy.abs(xang) == (numpy.pi/2.0)).astype(int) 197 | amask[ctr[0]-1, ctr[1]-1] = 1 198 | amask[:,0] = 1 199 | amask[0,:] = 1 200 | amask = numpy.fft.fftshift(amask) 201 | ch = numpy.fft.ifft2(amask * numpy.fft.fft2(ch)) # 'Analytic' version 202 | # f = 1.000008 # With this factor the reconstruction SNR 203 | # goes up around 6 dB! 204 | f = 1 205 | ch = f*0.5*numpy.real(ch) # real part 206 | self.pyr[pyrIdx] = ch 207 | pyrIdx += 1 208 | 209 | # we want to make sure to call SFpyr's special reconstruction method. when someone is using 210 | # SFpyr, they should call reconPyr, since that way everyone has the same method name. But 211 | # here if we call that we get stuck in an infinite recursion loop 212 | res = self._reconSFpyr(levs, bands, twidth) 213 | 214 | return res 215 | -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/blur0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/blur0.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/blur1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/blur1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/blur2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/blur2.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/blur3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/blur3.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/blur4.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/blur4.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/blur5.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/blur5.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/blurDn0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/blurDn0.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/blurDn1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/blurDn1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/blurDn2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/blurDn2.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/blurDn3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/blurDn3.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/blurDn4.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/blurDn4.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/blurDn5.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/blurDn5.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/blurDn6.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/blurDn6.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/blurDn7.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/blurDn7.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildGpyr1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildGpyr1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildGpyr2col.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildGpyr2col.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildGpyr2row.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildGpyr2row.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildGpyr3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildGpyr3.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildGpyr4.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildGpyr4.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildGpyr5.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildGpyr5.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildLpyr1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildLpyr1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildLpyr10.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildLpyr10.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildLpyr11.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildLpyr11.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildLpyr12.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildLpyr12.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildLpyr2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildLpyr2.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildLpyr3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildLpyr3.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildLpyr4.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildLpyr4.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildLpyr5.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildLpyr5.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildLpyr6.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildLpyr6.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildLpyr7.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildLpyr7.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildLpyr8.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildLpyr8.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildLpyr9.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildLpyr9.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSCFpyr0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSCFpyr0.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSCFpyr1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSCFpyr1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSCFpyr10.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSCFpyr10.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSCFpyr11.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSCFpyr11.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSCFpyr12.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSCFpyr12.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSCFpyr2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSCFpyr2.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSCFpyr3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSCFpyr3.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSCFpyr4.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSCFpyr4.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSCFpyr5.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSCFpyr5.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSCFpyr6.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSCFpyr6.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSCFpyr7.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSCFpyr7.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSFpyr0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSFpyr0.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSFpyr01.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSFpyr01.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSFpyr1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSFpyr1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSFpyr10.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSFpyr10.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSFpyr11.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSFpyr11.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSFpyr12.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSFpyr12.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSFpyr13.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSFpyr13.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSFpyr2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSFpyr2.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSFpyr3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSFpyr3.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSFpyr4.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSFpyr4.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSFpyr5.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSFpyr5.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSFpyr6.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSFpyr6.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSFpyr7.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSFpyr7.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSFpyr8.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSFpyr8.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSFpyr9.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSFpyr9.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr0.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr00.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr00.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr10.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr10.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr11.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr11.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr12.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr12.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr13.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr13.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr14.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr14.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr15.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr15.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr16.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr16.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr17.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr17.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr18.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr18.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr19.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr19.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr2.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr20.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr20.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr21.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr21.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr22.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr22.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr23.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr23.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr24.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr24.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr25.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr25.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr26.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr26.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr27.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr27.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr28.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr28.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr29.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr29.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr3.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr4.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr4.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr5.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr5.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr6.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr6.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr7.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr7.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr8.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr8.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildSpyr9.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildSpyr9.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildWpyr0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildWpyr0.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildWpyr1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildWpyr1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildWpyr10.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildWpyr10.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildWpyr11.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildWpyr11.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildWpyr12.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildWpyr12.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildWpyr13.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildWpyr13.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildWpyr14.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildWpyr14.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildWpyr15.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildWpyr15.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildWpyr16.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildWpyr16.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildWpyr17.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildWpyr17.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildWpyr18.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildWpyr18.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildWpyr2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildWpyr2.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildWpyr3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildWpyr3.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildWpyr4.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildWpyr4.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildWpyr5.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildWpyr5.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildWpyr6.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildWpyr6.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildWpyr7.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildWpyr7.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildWpyr8.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildWpyr8.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/buildWpyr9.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/buildWpyr9.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/cconv2_0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/cconv2_0.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/cconv2_1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/cconv2_1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/cconv2_2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/cconv2_2.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/cconv2_3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/cconv2_3.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/cconv2_4.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/cconv2_4.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/cconv2_5.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/cconv2_5.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/cconv2_6.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/cconv2_6.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/cconv2_7.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/cconv2_7.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/clip0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/clip0.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/clip1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/clip1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/clip2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/clip2.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/clip3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/clip3.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/corrDn1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/corrDn1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/corrDn2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/corrDn2.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/corrDn3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/corrDn3.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/entropy2_0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/entropy2_0.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/entropy2_1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/entropy2_1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/factorial0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/factorial0.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/factorial1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/factorial1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/histo0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/histo0.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/histo1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/histo1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/histo2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/histo2.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/histo3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/histo3.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/histoMatch0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/histoMatch0.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/im04-1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/im04-1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/imGradient0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/imGradient0.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/imGradient1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/imGradient1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkAngularSine0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkAngularSine0.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkAngularSine1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkAngularSine1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkAngularSine2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkAngularSine2.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkAngularSine3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkAngularSine3.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkAngularSine4.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkAngularSine4.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkDisc0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkDisc0.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkDisc1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkDisc1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkDisc2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkDisc2.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkDisc3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkDisc3.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkDisc4.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkDisc4.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkGaussian0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkGaussian0.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkGaussian1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkGaussian1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkGaussian2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkGaussian2.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkGaussian3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkGaussian3.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkGaussian4.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkGaussian4.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkRamp1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkRamp1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkRamp2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkRamp2.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkRamp3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkRamp3.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkSine0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkSine0.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkSine1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkSine1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkSine2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkSine2.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkSine3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkSine3.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkSine4.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkSine4.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkSine5.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkSine5.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkSine6.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkSine6.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkSine7.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkSine7.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkSine8.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkSine8.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkSquare0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkSquare0.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkSquare1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkSquare1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkSquare10.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkSquare10.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkSquare2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkSquare2.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkSquare3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkSquare3.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkSquare4.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkSquare4.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkSquare5.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkSquare5.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkSquare6.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkSquare6.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkSquare7.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkSquare7.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkSquare8.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkSquare8.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkSquare9.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkSquare9.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkZonePlate0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkZonePlate0.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkZonePlate1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkZonePlate1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/mkZonePlate2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/mkZonePlate2.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/pointOp1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/pointOp1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/skew2_0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/skew2_0.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/skew2_1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/skew2_1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/skew2_2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/skew2_2.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/sp0Filters.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/sp0Filters.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/sp1Filters.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/sp1Filters.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/sp1Filters2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/sp1Filters2.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/sp3Filters.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/sp3Filters.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/sp5Filters.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/sp5Filters.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/upBlur0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/upBlur0.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/upBlur1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/upBlur1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/upBlur10.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/upBlur10.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/upBlur11.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/upBlur11.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/upBlur12.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/upBlur12.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/upBlur2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/upBlur2.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/upBlur3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/upBlur3.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/upBlur4.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/upBlur4.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/upBlur5.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/upBlur5.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/upBlur6.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/upBlur6.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/upBlur8.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/upBlur8.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/zconv2_0.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/zconv2_0.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/zconv2_1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/zconv2_1.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/zconv2_2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/zconv2_2.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/zconv2_3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/zconv2_3.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/zconv2_4.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/zconv2_4.mat -------------------------------------------------------------------------------- /pyPyrTools/TESTS/matFiles/zconv2_5.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/TESTS/matFiles/zconv2_5.mat -------------------------------------------------------------------------------- /pyPyrTools/__init__.py: -------------------------------------------------------------------------------- 1 | from binomialFilter import binomialFilter 2 | from blurDn import blurDn 3 | from blur import blur 4 | from cconv2 import cconv2 5 | from clip import clip 6 | from comparePyr import comparePyr 7 | from compareRecon import compareRecon 8 | from corrDn import corrDn 9 | from entropy2 import entropy2 10 | from factorial import factorial 11 | from Gpyr import Gpyr 12 | from histoMatch import histoMatch 13 | from histo import histo 14 | from idx2LB import idx2LB 15 | from imGradient import imGradient 16 | from imStats import imStats 17 | from kurt2 import kurt2 18 | from LB2idx import LB2idx 19 | from Lpyr import Lpyr 20 | from maxPyrHt import maxPyrHt 21 | from mkAngle import mkAngle 22 | from mkAngularSine import mkAngularSine 23 | from mkDisc import mkDisc 24 | from mkFract import mkFract 25 | from mkGaussian import mkGaussian 26 | from mkImpulse import mkImpulse 27 | from mkRamp import mkRamp 28 | from mkR import mkR 29 | from mkSine import mkSine 30 | from mkSquare import mkSquare 31 | from mkZonePlate import mkZonePlate 32 | from modulateFlip import modulateFlip 33 | from namedFilter import namedFilter 34 | from nextSz import nextSz 35 | from pointOp import pointOp 36 | from pyramid import pyramid 37 | from range2 import range2 38 | from rconv2 import rconv2 39 | from rcosFn import rcosFn 40 | from round import round 41 | from roundVal import roundVal 42 | from SCFpyr import SCFpyr 43 | from SFpyr import SFpyr 44 | from shift import shift 45 | from showIm import showIm 46 | from skew2 import skew2 47 | from sp0Filters import sp0Filters 48 | from sp1Filters import sp1Filters 49 | from sp3Filters import sp3Filters 50 | from sp5Filters import sp5Filters 51 | from Spyr import Spyr 52 | from steer2HarmMtx import steer2HarmMtx 53 | from steer import steer 54 | from strictly_decreasing import strictly_decreasing 55 | from upBlur import upBlur 56 | from upConv import upConv 57 | from var2 import var2 58 | from Wpyr import Wpyr 59 | from zconv2 import zconv2 60 | import ctypes 61 | import os 62 | import JBhelpers 63 | 64 | libpath = os.path.dirname(os.path.realpath(__file__))+'/../wrapConv.so' 65 | # load the C library 66 | lib = ctypes.cdll.LoadLibrary(libpath) 67 | -------------------------------------------------------------------------------- /pyPyrTools/binomialFilter.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | import scipy.signal 3 | 4 | def binomialFilter(size): 5 | ''' returns a vector of binomial coefficients of order (size-1) ''' 6 | if size < 2: 7 | raise Exception("Error: size argument must be larger than 1") 8 | 9 | kernel = numpy.array([[0.5], [0.5]]) 10 | 11 | for i in range(0, size-2): 12 | kernel = scipy.signal.convolve(numpy.array([[0.5], [0.5]]), kernel) 13 | 14 | return numpy.asarray(kernel) 15 | -------------------------------------------------------------------------------- /pyPyrTools/blur.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | from namedFilter import namedFilter 3 | from corrDn import corrDn 4 | from upConv import upConv 5 | 6 | def blur(*args): 7 | ''' RES = blur(IM, LEVELS, FILT) 8 | 9 | Blur an image, by filtering and downsampling LEVELS times 10 | (default=1), followed by upsampling and filtering LEVELS times. The 11 | blurring is done with filter kernel specified by FILT (default = 12 | 'binom5'), which can be a string (to be passed to namedFilter), a 13 | vector (applied separably as a 1D convolution kernel in X and Y), or 14 | a matrix (applied as a 2D convolution kernel). The downsampling is 15 | always by 2 in each direction. 16 | 17 | Eero Simoncelli, 3/04. Python port by Rob Young, 10/15 ''' 18 | 19 | # REQUIRED ARG: 20 | if len(args) == 0: 21 | print "blur(IM, LEVELS, FILT)" 22 | print "first argument is required" 23 | exit(1) 24 | else: 25 | im = numpy.array(args[0]) 26 | 27 | # OPTIONAL ARGS: 28 | if len(args) > 1: 29 | nlevs = args[1] 30 | else: 31 | nlevs = 1 32 | 33 | if len(args) > 2: 34 | if isinstance(args[2], basestring): 35 | filt = namedFilter(args[2]) 36 | else: 37 | filt = numpy.array(args[2]) 38 | else: 39 | filt = namedFilter('binom5') 40 | 41 | #-------------------------------------------------------------------- 42 | 43 | if len(filt.shape) == 1 or filt.shape[0] == 1 or filt.shape[1] == 1: 44 | filt = filt / sum(filt) 45 | else: 46 | filt = filt / sum(sum(filt)) 47 | 48 | if nlevs > 0: 49 | if len(im.shape) == 1 or im.shape[0] == 1 or im.shape[1] == 1: 50 | # 1D image 51 | if len(filt) == 2 and (numpy.asarray(filt.shape) != 1).any(): 52 | print 'Error: can not apply 2D filter to 1D signal' 53 | return 54 | 55 | imIn = corrDn(im, filt, 'reflect1', len(im)) 56 | out = blur(imIn, nlevs-1, filt) 57 | res = upconv(out, filt, 'reflect1', len(im), [0,0], 58 | len(im)) 59 | return res 60 | elif len(filt.shape) == 1 or filt.shape[0] == 1 or filt.shape[1] == 1: 61 | # 2D image 1D filter 62 | imIn = corrDn(im, filt, 'reflect1', [2,1]) 63 | imIn = corrDn(imIn, filt.T, 'reflect1', [1,2]) 64 | out = blur(imIn, nlevs-1, filt) 65 | res = upConv(out, filt.T, 'reflect1', [1,2], [0,0], 66 | [out.shape[0], im.shape[1]]) 67 | res = upConv(res, filt, 'reflect1', [2,1], [0,0], 68 | im.shape) 69 | return res 70 | else: 71 | # 2D image 2D filter 72 | imIn = corrDn(im, filt, 'reflect1', [2,2]) 73 | out = blur(imIn, nlevs-1, filt) 74 | res = upConv(out, filt, 'reflect1', [2,2], [0,0], 75 | im.shape) 76 | return res 77 | else: 78 | return im 79 | -------------------------------------------------------------------------------- /pyPyrTools/blurDn.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | from namedFilter import namedFilter 3 | from corrDn import corrDn 4 | 5 | def blurDn(*args): 6 | ''' RES = blurDn(IM, LEVELS, FILT) 7 | Blur and downsample an image. The blurring is done with filter 8 | kernel specified by FILT (default = 'binom5'), which can be a string 9 | (to be passed to namedFilter), a vector (applied separably as a 1D 10 | convolution kernel in X and Y), or a matrix (applied as a 2D 11 | convolution kernel). The downsampling is always by 2 in each 12 | direction. 13 | The procedure is applied recursively LEVELS times (default=1). 14 | Eero Simoncelli, 3/97. Ported to python by Rob Young 4/14 15 | function res = blurDn(im, nlevs, filt) ''' 16 | 17 | if len(args) == 0: 18 | print "Error: image input parameter required." 19 | return 20 | 21 | im = numpy.array(args[0]) 22 | 23 | # optional args 24 | if len(args) > 1: 25 | nlevs = args[1] 26 | else: 27 | nlevs = 1 28 | 29 | if len(args) > 2: 30 | filt = args[2] 31 | if isinstance(filt, basestring): 32 | filt = namedFilter(filt) 33 | else: 34 | filt = namedFilter('binom5') 35 | 36 | if filt.shape[0] == 1 or filt.shape[1] == 1: 37 | filt = [x/sum(filt) for x in filt] 38 | else: 39 | filt = [x/sum(sum(filt)) for x in filt] 40 | 41 | filt = numpy.array(filt) 42 | 43 | if nlevs > 1: 44 | im = blurDn(im, nlevs-1, filt) 45 | 46 | if nlevs >= 1: 47 | if len(im.shape) == 1 or im.shape[0] == 1 or im.shape[1] == 1: 48 | # 1D image 49 | if len(filt.shape) > 1 and (filt.shape[1]!=1 and filt.shape[2]!=1): 50 | # >1D filter 51 | print 'Error: Cannot apply 2D filter to 1D signal' 52 | return 53 | # orient filter and image correctly 54 | if im.shape[0] == 1: 55 | if len(filt.shape) == 1 or filt.shape[1] == 1: 56 | filt = filt.T 57 | else: 58 | if filt.shape[0] == 1: 59 | filt = filt.T 60 | 61 | res = corrDn(image = im, filt = filt, step = (2, 2)) 62 | if len(im.shape) == 1 or im.shape[1] == 1: 63 | res = numpy.reshape(res, (numpy.ceil(im.shape[0]/2.0).astype(int), 1)) 64 | else: 65 | res = numpy.reshape(res, (1, numpy.ceil(im.shape[1]/2.0).astype(int))) 66 | elif len(filt.shape) == 1 or filt.shape[0] == 1 or filt.shape[1] == 1: 67 | # 2D image and 1D filter 68 | res = corrDn(image = im, filt = filt.T, step = (2, 1)) 69 | res = corrDn(image = res, filt = filt, step = (1, 2)) 70 | 71 | else: # 2D image and 2D filter 72 | res = corrDn(image = im, filt = filt, step = (2,2)) 73 | else: 74 | res = im 75 | 76 | return res 77 | -------------------------------------------------------------------------------- /pyPyrTools/cconv2.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | import scipy.signal 3 | 4 | def cconv2(*args): 5 | ''' RES = CCONV2(MTX1, MTX2, CTR) 6 | 7 | Circular convolution of two matrices. Result will be of size of 8 | LARGER vector. 9 | 10 | The origin of the smaller matrix is assumed to be its center. 11 | For even dimensions, the origin is determined by the CTR (optional) 12 | argument: 13 | CTR origin 14 | 0 DIM/2 (default) 15 | 1 (DIM/2)+1 16 | 17 | Eero Simoncelli, 6/96. Modified 2/97. 18 | Python port by Rob Young, 8/15 ''' 19 | 20 | if len(args) < 2: 21 | print 'Error: cconv2 requires two input matrices!' 22 | print 'Usage: cconv2(matrix1, matrix2, center)' 23 | print 'where center parameter is optional' 24 | return 25 | else: 26 | a = numpy.array(args[0]) 27 | b = numpy.array(args[1]) 28 | 29 | if len(args) == 3: 30 | ctr = args[2] 31 | else: 32 | ctr = 0 33 | 34 | if a.shape[0] >= b.shape[0] and a.shape[1] >= b.shape[1]: 35 | large = a 36 | small = b 37 | elif a.shape[0] <= b.shape[0] and a.shape[1] <= b.shape[1]: 38 | large = b 39 | small = a 40 | else: 41 | print 'Error: one matrix must be larger than the other in both dimensions!' 42 | return 43 | 44 | ly = large.shape[0] 45 | lx = large.shape[1] 46 | sy = small.shape[0] 47 | sx = small.shape[1] 48 | 49 | ## These values are the index of the small mtx that falls on the 50 | ## border pixel of the large matrix when computing the first 51 | ## convolution response sample: 52 | sy2 = numpy.floor((sy+ctr+1)/2.0).astype(int) 53 | sx2 = numpy.floor((sx+ctr+1)/2.0).astype(int) 54 | 55 | # pad 56 | nw = large[ly-sy+sy2:ly, lx-sx+sx2:lx] 57 | n = large[ly-sy+sy2:ly, :] 58 | ne = large[ly-sy+sy2:ly, :sx2-1] 59 | w = large[:, lx-sx+sx2:lx] 60 | c = large 61 | e = large[:, :sx2-1] 62 | sw = large[:sy2-1, lx-sx+sx2:lx] 63 | s = large[:sy2-1, :] 64 | se = large[:sy2-1, :sx2-1] 65 | 66 | n = numpy.column_stack((nw, n, ne)) 67 | c = numpy.column_stack((w,large,e)) 68 | s = numpy.column_stack((sw, s, se)) 69 | 70 | clarge = numpy.concatenate((n, c), axis=0) 71 | clarge = numpy.concatenate((clarge, s), axis=0) 72 | 73 | c = scipy.signal.convolve(clarge, small, 'valid') 74 | 75 | return c 76 | -------------------------------------------------------------------------------- /pyPyrTools/clip.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | def clip(*args): 4 | ''' [RES] = clip(IM, MINVALorRANGE, MAXVAL) 5 | 6 | Clip values of matrix IM to lie between minVal and maxVal: 7 | RES = max(min(IM,MAXVAL),MINVAL) 8 | The first argument can also specify both min and max, as a 2-vector. 9 | If only one argument is passed, the range defaults to [0,1]. 10 | ported to Python by Rob Young, 8/15 ''' 11 | 12 | if len(args) == 0 or len(args) > 3: 13 | print 'Usage: clip(im, minVal or Range, maxVal)' 14 | print 'first input parameter is required' 15 | return 16 | 17 | im = numpy.array(args[0]) 18 | 19 | if len(args) == 1: 20 | minVal = 0; 21 | maxVal = 1; 22 | elif len(args) == 2: 23 | if isinstance(args[1], (int, long, float)): 24 | minVal = args[1] 25 | maxVal = args[1]+1 26 | else: 27 | minVal = args[1][0] 28 | maxVal = args[1][1] 29 | elif len(args) == 3: 30 | minVal = args[1] 31 | maxVal = args[2] 32 | 33 | if maxVal < minVal: 34 | print 'Error: maxVal cannot be less than minVal!' 35 | return 36 | 37 | im[numpy.where(im < minVal)] = minVal 38 | im[numpy.where(im > maxVal)] = maxVal 39 | 40 | return im 41 | -------------------------------------------------------------------------------- /pyPyrTools/comparePyr.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | import math 3 | 4 | def comparePyr(matPyr, pyPyr): 5 | ''' compare two pyramids and return 1 if they are the same with in 6 | desired precision and 0 if not. 7 | written for unit testing code. ''' 8 | # FIX: make precision an input parameter 9 | prec = math.pow(10,-9) # desired precision 10 | # compare two pyramids - return 0 for !=, 1 for == 11 | # correct number of elements? 12 | matSz = sum(matPyr.shape) 13 | pySz = 1 14 | for idx in range(len(pyPyr.pyrSize)): 15 | sz = pyPyr.pyrSize[idx] 16 | if len(sz) == 1: 17 | pySz += sz[0] 18 | else: 19 | pySz += sz[0] * sz[1] 20 | 21 | if(matSz != pySz): 22 | print "size difference: %d != %d, returning 0" % (matSz, pySz) 23 | return 0 24 | 25 | # values are the same? 26 | matStart = 0 27 | for idx in range(len(pyPyr.pyrSize)): 28 | bandSz = pyPyr.pyrSize[idx] 29 | if len(bandSz) == 1: 30 | matLen = bandSz[0] 31 | else: 32 | matLen = bandSz[0] * bandSz[1] 33 | matTmp = matPyr[matStart:matStart + matLen] 34 | matTmp = numpy.reshape(matTmp, bandSz, order='F') 35 | matStart = matStart+matLen 36 | if (matTmp != pyPyr.pyr[idx]).any(): 37 | print "some pyramid elements not identical: checking..." 38 | for i in range(bandSz[0]): 39 | for j in range(bandSz[1]): 40 | if matTmp[i,j] != pyPyr.pyr[idx][i,j]: 41 | if ( math.fabs(matTmp[i,j] - pyPyr.pyr[idx][i,j]) > 42 | prec ): 43 | print "failed level:%d element:%d %d value:%.15f %.15f" % (idx, i, j, matTmp[i,j], pyPyr.pyr[idx][i,j]) 44 | return 0 45 | print "same to at least %f" % prec 46 | 47 | return 1 48 | -------------------------------------------------------------------------------- /pyPyrTools/compareRecon.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | import math 3 | 4 | def compareRecon(recon1, recon2): 5 | ''' compare two arrays and return 1 is they are the same within specified 6 | precision and 0 if not. 7 | function was made to accompany unit test code ''' 8 | ## FIX: make precision a input parameter 9 | prec = -11 # desired precision 10 | if recon1.shape != recon2.shape: 11 | print 'shape is different!' 12 | print recon1.shape 13 | print recon2.shape 14 | return 0 15 | 16 | for i in range(recon1.shape[0]): 17 | for j in range(recon2.shape[1]): 18 | if numpy.absolute(recon1[i,j].real - recon2[i,j].real) > math.pow(10,-11): 19 | print "real: i=%d j=%d %.15f %.15f diff=%.15f" % (i, j, recon1[i,j].real, recon2[i,j].real, numpy.absolute(recon1[i,j].real-recon2[i,j].real)) 20 | return 0 21 | ## FIX: need a better way to test 22 | # if we have many significant digits to the left of decimal we 23 | # need to be less stringent about digits to the right. 24 | # The code below works, but there must be a better way. 25 | if isinstance(recon1, complex): 26 | if int(math.log(numpy.abs(recon1[i,j].imag), 10)) > 1: 27 | prec = prec + int(math.log(numpy.abs(recon1[i,j].imag), 10)) 28 | if prec > 0: 29 | prec = -1 30 | print prec 31 | if numpy.absolute(recon1[i,j].imag - recon2[i,j].imag) > math.pow(10, prec): 32 | print "imag: i=%d j=%d %.15f %.15f diff=%.15f" % (i, j, recon1[i,j].imag, recon2[i,j].imag, numpy.absolute(recon1[i,j].imag-recon2[i,j].imag)) 33 | return 0 34 | 35 | return 1 36 | -------------------------------------------------------------------------------- /pyPyrTools/convolve.h: -------------------------------------------------------------------------------- 1 | /* 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3 | ;;; File: convolve.h 4 | ;;; Author: Simoncelli 5 | ;;; Description: Header file for convolve.c 6 | ;;; Creation Date: 7 | ;;; ---------------------------------------------------------------- 8 | ;;; Object-Based Vision and Image Understanding System (OBVIUS), 9 | ;;; Copyright 1988, Vision Science Group, Media Laboratory, 10 | ;;; Massachusetts Institute of Technology. 11 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 12 | */ 13 | 14 | #include 15 | #include 16 | 17 | #define ABS(x) (((x)>=0) ? (x) : (-(x))) 18 | #define ROOT2 1.4142135623730951 19 | #define REDUCE 0 20 | #define EXPAND 1 21 | #define IS == 22 | #define ISNT != 23 | #define AND && 24 | #define OR || 25 | 26 | typedef int (*fptr)(); 27 | 28 | typedef struct 29 | { 30 | char *name; 31 | fptr func; 32 | } EDGE_HANDLER; 33 | 34 | typedef double image_type; 35 | 36 | fptr edge_function(char *edges); 37 | int internal_reduce(image_type *image, int x_idim, int y_idim, 38 | image_type *filt, image_type *temp, int x_fdim, int y_fdim, 39 | int x_start, int x_step, int x_stop, 40 | int y_start, int y_step, int y_stop, 41 | image_type *result, char *edges); 42 | int internal_expand(image_type *image, 43 | image_type *filt, image_type *temp, int x_fdim, int y_fdim, 44 | int x_start, int x_step, int x_stop, 45 | int y_start, int y_step, int y_stop, 46 | image_type *result, int x_rdim, int y_rdim, char *edges); 47 | int internal_wrap_reduce(image_type *image, int x_idim, int y_idim, 48 | image_type *filt, int x_fdim, int y_fdim, 49 | int x_start, int x_step, int x_stop, 50 | int y_start, int y_step, int y_stop, 51 | image_type *result); 52 | int internal_wrap_expand(image_type *image, image_type *filt, int x_fdim, int y_fdim, 53 | int x_start, int x_step, int x_stop, 54 | int y_start, int y_step, int y_stop, 55 | image_type *result, int x_rdim, int y_rdim); 56 | -------------------------------------------------------------------------------- /pyPyrTools/corrDn.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | import ctypes 3 | import os 4 | 5 | libpath = os.path.dirname(os.path.realpath(__file__))+'/../wrapConv.so' 6 | # load the C library 7 | lib = ctypes.cdll.LoadLibrary(libpath) 8 | 9 | 10 | def corrDn(image, filt, edges='reflect1', step=(1, 1), start=(0, 0), stop=None, result=None): 11 | """Compute correlation of matrices image with `filt, followed by downsampling. 12 | 13 | These arguments should be 1D or 2D matrices, and image must be larger (in both dimensions) than 14 | filt. The origin of filt is assumed to be floor(size(filt)/2)+1. 15 | 16 | edges is a string determining boundary handling: 17 | 'circular' - Circular convolution 18 | 'reflect1' - Reflect about the edge pixels 19 | 'reflect2' - Reflect, doubling the edge pixels 20 | 'repeat' - Repeat the edge pixels 21 | 'zero' - Assume values of zero outside image boundary 22 | 'extend' - Reflect and invert (continuous values and derivs) 23 | 'dont-compute' - Zero output when filter overhangs input boundaries 24 | 25 | Downsampling factors are determined by step (optional, default=(1, 1)), which should be a 26 | 2-tuple (y, x). 27 | 28 | The window over which the convolution occurs is specfied by start (optional, default=(0,0), and 29 | stop (optional, default=size(image)). 30 | 31 | NOTE: this operation corresponds to multiplication of a signal vector by a matrix whose rows 32 | contain copies of the filt shifted by multiples of step. See `upConv` for the operation 33 | corresponding to the transpose of this matrix. 34 | 35 | WARNING: if both the image and filter are 1d, they must be 1d in the same dimension. E.g., if 36 | image.shape is (1, 36), then filt.shape must be (1, 5) and NOT (5, 1). If they're both 1d and 37 | 1d in different dimensions, then this may encounter a segfault. I've not been able to find a 38 | way to avoid that within this function (simply reshaping it does not work). 39 | """ 40 | image = image.copy() 41 | filt = filt.copy() 42 | 43 | if len(filt.shape) == 1: 44 | filt = numpy.reshape(filt, (1, len(filt))) 45 | 46 | if stop is None: 47 | stop = (image.shape[0], image.shape[1]) 48 | 49 | if result is None: 50 | rxsz = len(range(start[0], stop[0], step[0])) 51 | rysz = len(range(start[1], stop[1], step[1])) 52 | result = numpy.zeros((rxsz, rysz)) 53 | else: 54 | result = numpy.array(result.copy()) 55 | 56 | if edges == 'circular': 57 | lib.internal_wrap_reduce(image.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), 58 | image.shape[1], image.shape[0], 59 | filt.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), 60 | filt.shape[1], filt.shape[0], 61 | start[1], step[1], stop[1], start[0], step[0], 62 | stop[0], 63 | result.ctypes.data_as(ctypes.POINTER(ctypes.c_double))) 64 | else: 65 | tmp = numpy.zeros((filt.shape[0], filt.shape[1])) 66 | lib.internal_reduce(image.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), 67 | image.shape[1], image.shape[0], 68 | filt.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), 69 | tmp.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), 70 | filt.shape[1], filt.shape[0], 71 | start[1], step[1], stop[1], start[0], step[0], 72 | stop[0], 73 | result.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), 74 | edges) 75 | 76 | return result 77 | -------------------------------------------------------------------------------- /pyPyrTools/einsteinCorrect.pgm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LabForComputationalVision/pyPyrTools/8258b8d9b62492e34d00c0541b33a060cee78611/pyPyrTools/einsteinCorrect.pgm -------------------------------------------------------------------------------- /pyPyrTools/entropy2.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | def entropy2(*args): 4 | ''' E = ENTROPY2(MTX,BINSIZE) 5 | 6 | Compute the first-order sample entropy of MTX. Samples of VEC are 7 | first discretized. Optional argument BINSIZE controls the 8 | discretization, and defaults to 256/(max(VEC)-min(VEC)). 9 | 10 | NOTE: This is a heavily biased estimate of entropy when you 11 | don't have much data. 12 | 13 | Eero Simoncelli, 6/96. Ported to Python by Rob Young, 10/15. ''' 14 | 15 | vec = numpy.array(args[0]) 16 | # if 2D flatten to a vector 17 | if len(vec.shape) != 1 and (vec.shape[0] != 1 or vec.shape[1] != 1): 18 | vec = vec.flatten() 19 | 20 | (mn, mx) = range2(vec) 21 | 22 | if len(args) > 1: 23 | binsize = args[1] 24 | # FIX: why is this max in the Matlab code; it's just a float? 25 | # we insure that vec isn't 2D above, so this shouldn't be needed 26 | #nbins = max( float(mx-mn)/float(binsize) ) 27 | nbins = float(mx-mn) / float(binsize) 28 | else: 29 | nbins = 256 30 | 31 | [bincount, bins] = histo(vec, nbins) 32 | 33 | ## Collect non-zero bins: 34 | H = bincount[ numpy.where(bincount > 0) ] 35 | H = H / float(sum(H)) 36 | 37 | return -sum(H * numpy.log2(H)) 38 | -------------------------------------------------------------------------------- /pyPyrTools/factorial.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | def factorial(*args): 4 | ''' RES = factorial(NUM) 5 | 6 | Factorial function that works on matrices (matlab's does not). 7 | 8 | EPS, 11/02, Python port by Rob Young, 10/15 ''' 9 | 10 | # if scalar input make it a single element array 11 | if isinstance(args[0], (int, long, float)): 12 | num = numpy.array([args[0]]) 13 | else: 14 | num = numpy.array(args[0]) 15 | 16 | res = numpy.ones(num.shape) 17 | 18 | ind = numpy.where(num > 0) 19 | 20 | if num.shape[0] != 0: 21 | subNum = num[ numpy.where(num > 0) ] 22 | res[ind] = subNum * factorial(subNum-1) 23 | 24 | # if scalar input, return scalar 25 | if len(res.shape) == 1 and res.shape[0] == 1: 26 | return res[0] 27 | else: 28 | return res 29 | -------------------------------------------------------------------------------- /pyPyrTools/histo.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | from range2 import range2 3 | from round import round 4 | 5 | def histo(*args): 6 | ''' [N,X] = histo(MTX, nbinsOrBinsize, binCenter); 7 | 8 | Compute a histogram of (all) elements of MTX. N contains the histogram 9 | counts, X is a vector containg the centers of the histogram bins. 10 | 11 | nbinsOrBinsize (optional, default = 101) specifies either 12 | the number of histogram bins, or the negative of the binsize. 13 | 14 | binCenter (optional, default = mean2(MTX)) specifies a center position 15 | for (any one of) the histogram bins. 16 | 17 | How does this differ from MatLab's HIST function? This function: 18 | - allows uniformly spaced bins only. 19 | +/- operates on all elements of MTX, instead of columnwise. 20 | + is much faster (approximately a factor of 80 on my machine). 21 | + allows specification of number of bins OR binsize. 22 | Default=101 bins. 23 | + allows (optional) specification of binCenter. 24 | 25 | Eero Simoncelli, 3/97. ported to Python by Rob Young, 8/15. ''' 26 | 27 | if len(args) == 0 or len(args) > 3: 28 | print 'Usage: histo(mtx, nbins, binCtr)' 29 | print 'first argument is required' 30 | return 31 | else: 32 | mtx = args[0] 33 | mtx = numpy.array(mtx) 34 | 35 | (mn, mx) = range2(mtx) 36 | 37 | if len(args) > 2: 38 | binCtr = args[2] 39 | else: 40 | binCtr = mtx.mean() 41 | 42 | if len(args) > 1: 43 | if args[1] < 0: 44 | binSize = -args[1] 45 | else: 46 | binSize = ( float(mx-mn) / float(args[1]) ) 47 | tmpNbins = ( round(float(mx-binCtr) / float(binSize)) - 48 | round(float(mn-binCtr) / float(binSize)) ) 49 | if tmpNbins != args[1]: 50 | print 'Warning: Using %d bins instead of requested number (%d)' % (tmpNbins, args[1]) 51 | else: 52 | binSize = float(mx-mn) / 101.0 53 | 54 | firstBin = binCtr + binSize * round( (mn-binCtr)/float(binSize) ) 55 | firstEdge = firstBin - (binSize / 2.0) + (binSize * 0.01) 56 | 57 | tmpNbins = int( round( (mx-binCtr) / binSize ) - 58 | round( (mn-binCtr) / binSize ) ) 59 | 60 | # numpy.histogram uses bin edges, not centers like Matlab's hist 61 | #bins = firstBin + binSize * numpy.array(range(tmpNbins+1)) 62 | # compute bin edges 63 | binsE = firstEdge + binSize * numpy.array(range(tmpNbins+1)) 64 | 65 | [N, X] = numpy.histogram(mtx, binsE) 66 | 67 | # matlab version returns column vectors, so we will too. 68 | N = N.reshape(1, N.shape[0]) 69 | X = X.reshape(1, X.shape[0]) 70 | 71 | return (N, X) 72 | -------------------------------------------------------------------------------- /pyPyrTools/histoMatch.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | import scipy 3 | 4 | def histoMatch(*args): 5 | ''' RES = histoMatch(MTX, N, X, mode) 6 | 7 | Modify elements of MTX so that normalized histogram matches that 8 | specified by vectors X and N, where N contains the histogram counts 9 | and X the histogram bin positions (see histo). 10 | 11 | new input parameter 'mode' can be either 'centers' or 'edges' that tells 12 | the function if the input X values are bin centers or edges. 13 | 14 | Eero Simoncelli, 7/96. Ported to Python by Rob Young, 10/15. ''' 15 | 16 | mode = str(args[3]) 17 | mtx = numpy.array(args[0]) 18 | N = numpy.array(args[1]) 19 | X = numpy.array(args[2]) 20 | if mode == 'edges': # convert to centers 21 | correction = (X[0][1] - X[0][0]) / 2.0 22 | X = (X[0][:-1] + correction).reshape(1, X.shape[1]-1) 23 | 24 | [oN, oX] = histo(mtx.flatten(), X.flatten().shape[0]) 25 | if mode == 'edges': # convert to centers 26 | correction = (oX[0][1] - oX[0][0]) / 2.0 27 | oX = (oX[0][:-1] + correction).reshape(1, oX.shape[1]-1) 28 | 29 | # remember: histo returns a column vector, so the indexing is thus 30 | oStep = oX[0][1] - oX[0][0] 31 | oC = numpy.concatenate((numpy.array([0]), 32 | numpy.array(numpy.cumsum(oN) / 33 | float(sum(sum(oN)))))) 34 | oX = numpy.concatenate((numpy.array([oX[0][0]-oStep/2.0]), 35 | numpy.array(oX[0]+oStep/2.0))) 36 | 37 | N = N.flatten() 38 | X = X.flatten() 39 | N = N + N.mean() / 1e8 # HACK: no empty bins ensures nC strictly monotonic 40 | 41 | nStep = X[1] - X[0] 42 | nC = numpy.concatenate((numpy.array([0]), 43 | numpy.array(numpy.cumsum(N) / sum(N)))) 44 | nX = numpy.concatenate((numpy.array([X[0] - nStep / 2.0]), 45 | numpy.array(X+nStep / 2.0))) 46 | 47 | # unlike in matlab, interp1d returns a function 48 | func = scipy.interpolate.interp1d(nC, nX, 'linear') 49 | nnX = func(oC) 50 | 51 | return pointOp(mtx, nnX, oX[0], oStep, 0) 52 | -------------------------------------------------------------------------------- /pyPyrTools/idx2LB.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | def idx2LB(idx, nlevs, nbands): 4 | ''' given and index into dictionary return level and band ''' 5 | 6 | if idx == 0: 7 | return ('hi', -1) 8 | elif idx == ((nlevs-2)*nbands)+1: 9 | return ('lo', -1) 10 | else: 11 | lev = math.ceil(idx/nbands) 12 | band = (idx % nbands) + 1 13 | if band == nbands: 14 | band = 0 15 | return (lev, band) 16 | -------------------------------------------------------------------------------- /pyPyrTools/imGradient.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | from corrDn import corrDn 3 | 4 | def imGradient(*args): 5 | ''' [dx, dy] = imGradient(im, edges) 6 | 7 | Compute the gradient of the image using smooth derivative filters 8 | optimized for accurate direction estimation. Coordinate system 9 | corresponds to standard pixel indexing: X axis points rightward. Y 10 | axis points downward. EDGES specify boundary handling (see corrDn 11 | for options). 12 | 13 | EPS, 1997. 14 | original filters from Int'l Conf Image Processing, 1994. 15 | updated filters 10/2003: see Farid & Simoncelli, IEEE Trans Image 16 | Processing, 13(4):496-508, April 2004. 17 | Incorporated into matlabPyrTools 10/2004. 18 | Python port by Rob Young, 10/15 ''' 19 | 20 | if len(args) == 0 or len(args) > 2: 21 | print 'Usage: imGradient(image, edges)' 22 | print "'edges' argument is optional" 23 | elif len(args) == 1: 24 | edges = "dont-compute" 25 | elif len(args) == 2: 26 | edges = str(args[1]) 27 | 28 | im = numpy.array(args[0]) 29 | 30 | # kernels from Farid & Simoncelli, IEEE Trans Image Processing, 31 | # 13(4):496-508, April 2004. 32 | gp = numpy.array([0.037659, 0.249153, 0.426375, 0.249153, 0.037659]).reshape(5,1) 33 | gd = numpy.array([-0.109604, -0.276691, 0.000000, 0.276691, 0.109604]).reshape(5,1) 34 | 35 | dx = corrDn(corrDn(im, gp, edges), gd.T, edges) 36 | dy = corrDn(corrDn(im, gd, edges), gp.T, edges) 37 | 38 | return (dx,dy) 39 | -------------------------------------------------------------------------------- /pyPyrTools/imStats.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | from range2 import range2 3 | from var2 import var2 4 | from kurt2 import kurt2 5 | 6 | def imStats(*args): 7 | ''' Report image (matrix) statistics. 8 | When called on a single image IM1, report min, max, mean, stdev, 9 | and kurtosis. 10 | When called on two images (IM1 and IM2), report min, max, mean, 11 | stdev of the difference, and also SNR (relative to IM1). ''' 12 | 13 | if len(args) == 0: 14 | print 'Error: at least one input image is required' 15 | return 16 | elif len(args) == 1 and not numpy.isreal(args[0]).all(): 17 | print 'Error: input images must be real-valued matrices' 18 | return 19 | elif len(args) == 2 and ( not numpy.isreal(args[0]).all() or not numpy.isreal(args[1]).all()): 20 | print 'Error: input images must be real-valued matrices' 21 | return 22 | elif len(args) > 2: 23 | print 'Error: maximum of two input images allowed' 24 | return 25 | 26 | if len(args) == 2: 27 | difference = args[0] - args[1] 28 | (mn, mx) = range2(difference) 29 | mean = difference.mean() 30 | v = var2(difference) 31 | if v < numpy.finfo(numpy.double).tiny: 32 | snr = numpy.inf 33 | else: 34 | snr = 10 * numpy.log10(var2(args[0])/v) 35 | print 'Difference statistics:' 36 | print ' Range: [%d, %d]' % (mn, mx) 37 | print ' Mean: %f, Stdev (rmse): %f, SNR (dB): %f' % (mean, 38 | numpy.sqrt(v), 39 | snr) 40 | else: 41 | (mn, mx) = range2(args[0]) 42 | mean = args[0].mean() 43 | var = var2(args[0]) 44 | stdev = numpy.sqrt(var.real) + numpy.sqrt(var.imag) 45 | kurt = kurt2(args[0], mean, stdev**2) 46 | print 'Image statistics:' 47 | print ' Range: [%f, %f]' % (mn, mx) 48 | print ' Mean: %f, Stdev: %f, Kurtosis: %f' % (mean, stdev, kurt) 49 | -------------------------------------------------------------------------------- /pyPyrTools/internal_pointOp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | /* Use linear interpolation on a lookup table. 4 | Taken from OBVIUS. EPS, Spring, 1987. 5 | */ 6 | void internal_pointop (im, res, size, lut, lutsize, origin, increment, warnings) 7 | register double *im, *res, *lut; 8 | register double origin, increment; 9 | register int size, lutsize, warnings; 10 | { 11 | register int i, index; 12 | register double pos; 13 | register int l_unwarned = warnings; 14 | register int r_unwarned = warnings; 15 | 16 | lutsize = lutsize - 2; /* Maximum index value */ 17 | 18 | /* printf("size=%d origin=%f lutsize=%d increment=%f\n",size, origin, lutsize, 19 | increment); */ 20 | 21 | if (increment > 0) 22 | for (i=0; i lutsize) 36 | { 37 | index = lutsize; 38 | if (r_unwarned) 39 | { 40 | printf("Warning: Extrapolating to right of lookup table...\n"); 41 | r_unwarned = 0; 42 | } 43 | } 44 | res[i] = lut[index] + (lut[index+1] - lut[index]) * (pos - index); 45 | if(isnan(res[i])) 46 | printf("**NAN: lut[%d]=%f lut[%d]=%f pos=%f index=%d\n", index, 47 | lut[index], index+1, lut[index+1], pos, index); 48 | } 49 | else 50 | for (i=0; i CHANGELOG.txt 4 | 5 | import commands 6 | 7 | atags = commands.getoutput('git tag -n') 8 | atags = atags.split('\n'); 9 | tags = commands.getoutput('git tag -l') 10 | tags = tags.split('\n'); 11 | 12 | #for t in range(0, len(tags)-1): 13 | for t in range(len(tags)-1, -1, -1): 14 | if t == 0: 15 | #print "*** " + atags[t+1] 16 | print "*** " + atags[t] 17 | else: 18 | #print '\n\n*** ' + atags[t+1] 19 | print '\n\n*** ' + atags[t] 20 | #commandStr = 'git log %s..%s --pretty=%s' % (tags[t], tags[t+1], '%s') 21 | commandStr = 'git log %s..%s --pretty=%s' % (tags[t-1], tags[t], '%s') 22 | changes = commands.getoutput(commandStr) 23 | changes = changes.split('\n') 24 | #changes = changes[::-1] 25 | for line in changes: 26 | print ' + ' + line 27 | -------------------------------------------------------------------------------- /pyPyrTools/maxPyrHt.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | def maxPyrHt(imsz, filtsz): 4 | ''' Compute maximum pyramid height for given image and filter sizes. 5 | Specifically: the number of corrDn operations that can be sequentially 6 | performed when subsampling by a factor of 2. ''' 7 | 8 | if not isinstance(imsz, tuple) or not isinstance(filtsz, tuple): 9 | if imsz < filtsz: 10 | return 0 11 | else: 12 | if len(imsz) == 1: 13 | imsz = (imsz[0], 1) 14 | if len(filtsz) == 1: 15 | filtsz = (filtsz[0], 1) 16 | #if filtsz[1] == 1: # new 17 | # filtsz = (filtsz[1], filtsz[0]) 18 | #if imsz[0] < filtsz[0] or imsz[1] < filtsz[1]: 19 | # print 'flag 2' 20 | # return 0 21 | 22 | if not isinstance(imsz, tuple) and not isinstance(filtsz, tuple): 23 | imsz = imsz 24 | filtsz = filtsz 25 | if imsz < filtsz: 26 | return 0 27 | elif 1 in imsz: # 1D image 28 | imsz = imsz[0] * imsz[1] 29 | filtsz = filtsz[0] * filtsz[1] 30 | if imsz < filtsz: 31 | return 0 32 | #elif 1 in filtsz: # 2D image, 1D filter 33 | else: # 2D image 34 | #filtsz = (filtsz[0], filtsz[0]) 35 | #print filtsz 36 | if ( imsz[0] < filtsz[0] or imsz[0] < filtsz[1] or 37 | imsz[1] < filtsz[0] or imsz[1] < filtsz[1] ): 38 | return 0 39 | 40 | if ( not isinstance(imsz, tuple) and not isinstance(filtsz, tuple) and 41 | imsz < filtsz ) : 42 | height = 0 43 | elif not isinstance(imsz, tuple) and not isinstance(filtsz, tuple): 44 | height = 1 + maxPyrHt( numpy.floor(imsz/2.0), filtsz ) 45 | else: 46 | height = 1 + maxPyrHt( (numpy.floor(imsz[0]/2.0), 47 | numpy.floor(imsz[1]/2.0)), 48 | filtsz ) 49 | 50 | return height 51 | 52 | 53 | 54 | ''' new - probably not needed 55 | # if tuple and 1D, make column vector 56 | if isinstance(imsz, tuple): 57 | if 1 in imsz: 58 | imsz = (max(imsz), 1) 59 | if isinstance(filtsz, tuple): 60 | if 1 in filtsz: 61 | filtsz = (max(filtsz), 1) 62 | 63 | 64 | image1D = False 65 | if isinstance(imsz, tuple) and 1 in imsz: #1D image 66 | image1D = True 67 | imsz = max(imsz) 68 | elif isinstance(imsz, tuple) and len(imsz) == 1: # 1D image 69 | image1D = True 70 | imsz = imsz[0] 71 | elif isinstance(imsz, int): # 1D image 72 | image1D = True 73 | imsz = imsz 74 | 75 | if image1D: 76 | if isinstance(filtsz, tuple): 77 | prod = 1 78 | for t in filtsz: 79 | prod *= t 80 | filtsz = prod 81 | elif isinstance(filtsz, tuple) and 1 in filtsz: # 2D image, 1D filter 82 | filtsz = (filtsz[1], filtsz[1]) 83 | elif isinstance(filtsz, tuple) and len(filtsz) == 1: # 2D image, 1D filter 84 | filtsz = (filtsz[1], filtsz[1]) 85 | elif isinstance(filtsz, int): # 2D image, 1D filter 86 | filtsz = (filtsz, filtsz) 87 | 88 | 89 | print imsz 90 | print filtsz 91 | 92 | if isinstance(imsz, tuple) and isinstance(filtsz, tuple): 93 | if min(imsz) < max(filtsz): 94 | height = 0 95 | else: 96 | height = 1 + maxPyrHt( (numpy.floor(imsz[0]/2.0), 97 | numpy.floor(imsz[1]/2.0)), 98 | filtsz ) 99 | elif isinstance(imsz, tuple) and isinstance(filtsz, int): 100 | if min(imsz) < filtsz: 101 | height = 0 102 | else: 103 | height = 1 + maxPyrHt( (numpy.floor(imsz[0]/2.0), 104 | numpy.floor(imsz[1]/2.0)), 105 | filtsz ) 106 | elif isinstance(imsz, int) and isinstance(filtsz, tuple): 107 | if imsz < max(filtsz): 108 | height = 0 109 | else: 110 | height = 1 + maxPyrHt( (numpy.floor(imsz[0]/2.0), 111 | numpy.floor(imsz[1]/2.0)), 112 | filtsz ) 113 | elif isinstance(imsz, int) and isinstance(filtsz, int): 114 | if imsz < filtsz: 115 | height = 0 116 | else: 117 | height = 1 + maxPyrHt( (numpy.floor(imsz[0]/2.0), 118 | numpy.floor(imsz[1]/2.0)), 119 | filtsz ) 120 | 121 | return height 122 | ''' 123 | 124 | 125 | -------------------------------------------------------------------------------- /pyPyrTools/mkAngle.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | 4 | def mkAngle(size, phase=0, origin=None): 5 | '''make polar angle matrix (in radians) 6 | 7 | Compute a matrix of dimension SIZE (a [Y X] list/tuple, or a scalar) containing samples of the 8 | polar angle (in radians, CW from the X-axis, ranging from -pi to pi), relative to angle PHASE 9 | (default = 0), about ORIGIN pixel (default = (size+1)/2). 10 | ''' 11 | 12 | if not hasattr(size, '__iter__'): 13 | size = (size, size) 14 | 15 | if origin is None: 16 | origin = ((size[0]+1)/2., (size[1]+1)/2.) 17 | elif not hasattr(origin, '__iter__'): 18 | origin = (origin, origin) 19 | 20 | xramp, yramp = numpy.meshgrid(numpy.array(range(1, size[1]+1))-origin[1], 21 | numpy.array(range(1, size[0]+1))-origin[0]) 22 | xramp = numpy.array(xramp) 23 | yramp = numpy.array(yramp) 24 | 25 | res = numpy.arctan2(yramp, xramp) 26 | 27 | res = ((res+(numpy.pi-phase)) % (2*numpy.pi)) - numpy.pi 28 | 29 | return res 30 | -------------------------------------------------------------------------------- /pyPyrTools/mkAngularSine.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | from mkAngle import mkAngle 3 | 4 | def mkAngularSine(*args): 5 | ''' IM = mkAngularSine(SIZE, HARMONIC, AMPL, PHASE, ORIGIN) 6 | 7 | Make an angular sinusoidal image: 8 | AMPL * sin( HARMONIC*theta + PHASE), 9 | where theta is the angle about the origin. 10 | SIZE specifies the matrix size, as for zeros(). 11 | AMPL (default = 1) and PHASE (default = 0) are optional. 12 | 13 | Eero Simoncelli, 2/97. Python port by Rob Young, 7/15. ''' 14 | 15 | if len(args) == 0: 16 | print "mkAngularSine(SIZE, HARMONIC, AMPL, PHASE, ORIGIN)" 17 | print "first argument is required" 18 | exit(1) 19 | else: 20 | sz = args[0] 21 | if isinstance(sz, (int)): 22 | sz = (sz, sz) 23 | elif not isinstance(sz, (tuple)): 24 | print "first argument must be a two element tuple or an integer" 25 | exit(1) 26 | 27 | # OPTIONAL args: 28 | 29 | if len(args) > 1: 30 | harmonic = args[1] 31 | else: 32 | harmonic = 1 33 | 34 | if len(args) > 2: 35 | ampl = args[2] 36 | else: 37 | ampl = 1 38 | 39 | if len(args) > 3: 40 | ph = args[3] 41 | else: 42 | ph = 0 43 | 44 | if len(args) > 4: 45 | origin = args[4] 46 | else: 47 | origin = ( (sz[0]+1.0)/2.0, (sz[1]+1.0)/2.0 ) 48 | 49 | res = ampl * numpy.sin( harmonic * mkAngle(sz, ph, origin) + ph ) 50 | 51 | return res 52 | -------------------------------------------------------------------------------- /pyPyrTools/mkDisc.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | import sys 3 | from mkR import mkR 4 | from rcosFn import rcosFn 5 | from pointOp import pointOp 6 | 7 | def mkDisc(*args): 8 | ''' IM = mkDisc(SIZE, RADIUS, ORIGIN, TWIDTH, VALS) 9 | 10 | Make a "disk" image. SIZE specifies the matrix size, as for 11 | zeros(). RADIUS (default = min(size)/4) specifies the radius of 12 | the disk. ORIGIN (default = (size+1)/2) specifies the 13 | location of the disk center. TWIDTH (in pixels, default = 2) 14 | specifies the width over which a soft threshold transition is made. 15 | VALS (default = [0,1]) should be a 2-vector containing the 16 | intensity value inside and outside the disk. 17 | 18 | Eero Simoncelli, 6/96. Python port by Rob Young, 7/15. ''' 19 | 20 | if len(args) == 0: 21 | print "mkDisc(SIZE, RADIUS, ORIGIN, TWIDTH, VALS)" 22 | print "first argument is required" 23 | exit(1) 24 | else: 25 | sz = args[0] 26 | if isinstance(sz, (int)): 27 | sz = (sz, sz) 28 | elif not isinstance(sz, (tuple)): 29 | print "first argument must be a two element tuple or an integer" 30 | exit(1) 31 | 32 | # OPTIONAL args: 33 | 34 | if len(args) > 1: 35 | rad = args[1] 36 | else: 37 | rad = min(sz) / 4.0 38 | 39 | if len(args) > 2: 40 | origin = args[2] 41 | else: 42 | origin = ( (sz[0]+1.0)/2.0, (sz[1]+1.0)/2.0 ) 43 | 44 | if len(args) > 3: 45 | twidth = args[3] 46 | else: 47 | twidth = twidth = 2 48 | 49 | if len(args) > 4: 50 | vals = args[4] 51 | else: 52 | vals = (1,0) 53 | 54 | #-------------------------------------------------------------- 55 | 56 | res = mkR(sz, 1, origin) 57 | 58 | if abs(twidth) < sys.float_info.min: 59 | res = vals[1] + (vals[0] - vals[1]) * (res <= rad); 60 | else: 61 | [Xtbl, Ytbl] = rcosFn(twidth, rad, [vals[0], vals[1]]); 62 | res = pointOp(res, Ytbl, Xtbl[0], Xtbl[1]-Xtbl[0], 0); 63 | 64 | return numpy.array(res) 65 | -------------------------------------------------------------------------------- /pyPyrTools/mkFract.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | from mkR import mkR 3 | from var2 import var2 4 | 5 | def mkFract(*args): 6 | ''' Make a matrix of dimensions SIZE (a [Y X] 2-vector, or a scalar) 7 | containing fractal (pink) noise with power spectral density of the 8 | form: 1/f^(5-2*FRACT_DIM). Image variance is normalized to 1.0. 9 | FRACT_DIM defaults to 1.0 10 | Eero Simoncelli, 6/96. Ported to Python by Rob Young, 5/14. 11 | 12 | TODO: Verify that this matches Mandelbrot defn of fractal dimension. 13 | Make this more efficient! ''' 14 | 15 | if len(args) == 0: 16 | print 'Error: input parameter dims required' 17 | else: 18 | if isinstance(args[0], (int, long)) or len(args[0]) == 1: 19 | dims = (args[0], args[0]) 20 | elif args[0] == 1: 21 | dims = (args[1], args[1]) 22 | elif args[1] == 1: 23 | dims = (args[0], args[0]) 24 | else: 25 | dims = args[0] 26 | 27 | if len(args) < 2: 28 | fract_dim = 1.0 29 | else: 30 | fract_dim = args[1] 31 | 32 | res = numpy.random.randn(dims[0], dims[1]) 33 | fres = numpy.fft.fft2(res) 34 | 35 | sz = res.shape 36 | ctr = (int(numpy.ceil((sz[0]+1)/2.0)), int(numpy.ceil((sz[1]+1)/2.0))) 37 | 38 | sh = numpy.fft.ifftshift(mkR(sz, -(2.5-fract_dim), ctr)) 39 | sh[0,0] = 1; #DC term 40 | 41 | fres = sh * fres 42 | fres = numpy.fft.ifft2(fres) 43 | 44 | if abs(fres.imag).max() > 1e-10: 45 | print 'Symmetry error in creating fractal' 46 | else: 47 | res = numpy.real(fres) 48 | res = res / numpy.sqrt(var2(res)) 49 | 50 | return res 51 | -------------------------------------------------------------------------------- /pyPyrTools/mkGaussian.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | def mkGaussian(*args): 4 | ''' IM = mkGaussian(SIZE, COVARIANCE, MEAN, AMPLITUDE) 5 | 6 | Compute a matrix with dimensions SIZE (a [Y X] 2-vector, or a 7 | scalar) containing a Gaussian function, centered at pixel position 8 | specified by MEAN (default = (size+1)/2), with given COVARIANCE (can 9 | be a scalar, 2-vector, or 2x2 matrix. Default = (min(size)/6)^2), 10 | and AMPLITUDE. AMPLITUDE='norm' (default) will produce a 11 | probability-normalized function. All but the first argument are 12 | optional. 13 | 14 | Eero Simoncelli, 6/96. Python port by Rob Young, 7/15. ''' 15 | 16 | if len(args) == 0: 17 | print "mkRamp(SIZE, COVARIANCE, MEAN, AMPLITUDE)" 18 | print "first argument is required" 19 | exit(1) 20 | else: 21 | sz = args[0] 22 | if isinstance(sz, (int)): 23 | sz = (sz, sz) 24 | elif not isinstance(sz, (tuple)): 25 | print "first argument must be a two element tuple or an integer" 26 | exit(1) 27 | 28 | # OPTIONAL args: 29 | 30 | if len(args) > 1: 31 | cov = args[1] 32 | else: 33 | cov = (min([sz[0], sz[1]]) / 6.0) ** 2 34 | 35 | if len(args) > 2: 36 | mn = args[2] 37 | if isinstance(mn, int): 38 | mn = [mn, mn] 39 | else: 40 | mn = ( (sz[0]+1.0)/2.0, (sz[1]+1.0)/2.0 ) 41 | 42 | if len(args) > 3: 43 | ampl = args[3] 44 | else: 45 | ampl = 'norm' 46 | 47 | #--------------------------------------------------------------- 48 | 49 | (xramp, yramp) = numpy.meshgrid(numpy.array(range(1,sz[1]+1))-mn[1], 50 | numpy.array(range(1,sz[0]+1))-mn[0]) 51 | 52 | if isinstance(cov, (int, long, float)): 53 | if 'norm' == ampl: 54 | ampl = 1.0 / (2.0 * numpy.pi * cov) 55 | e = ( (xramp**2) + (yramp**2) ) / ( -2.0 * cov ) 56 | elif len(cov) == 2 and isinstance(cov[0], (int, long, float)): 57 | if 'norm' == ampl: 58 | if cov[0]*cov[1] < 0: 59 | ampl = 1.0 / (2.0 * numpy.pi * 60 | numpy.sqrt(complex(cov[0] * cov[1]))) 61 | else: 62 | ampl = 1.0 / (2.0 * numpy.pi * numpy.sqrt(cov[0] * cov[1])) 63 | e = ( (xramp**2) / (-2 * cov[1]) ) + ( (yramp**2) / (-2 * cov[0]) ) 64 | else: 65 | if 'norm' == ampl: 66 | detCov = numpy.linalg.det(cov) 67 | if (detCov < 0).any(): 68 | detCovComplex = numpy.empty(detCov.shape, dtype=complex) 69 | detCovComplex.real = detCov 70 | detCovComplex.imag = numpy.zeros(detCov.shape) 71 | ampl = 1.0 / ( 2.0 * numpy.pi * numpy.sqrt( detCovComplex ) ) 72 | else: 73 | ampl = 1.0 / (2.0 * numpy.pi * numpy.sqrt( numpy.linalg.det(cov) ) ) 74 | cov = - numpy.linalg.inv(cov) / 2.0 75 | e = (cov[1,1] * xramp**2) + ( 76 | (cov[0,1]+cov[1,0])*(xramp*yramp) ) + ( cov[0,0] * yramp**2) 77 | 78 | res = ampl * numpy.exp(e) 79 | 80 | return res 81 | -------------------------------------------------------------------------------- /pyPyrTools/mkImpulse.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | def mkImpulse(*args): 4 | ''' create an image that is all zeros except for an impulse ''' 5 | 6 | if(len(args) == 0): 7 | print "mkImpulse(size, origin, amplitude)" 8 | print "first input parameter is required" 9 | return 10 | 11 | if(isinstance(args[0], int)): 12 | sz = (args[0], args[0]) 13 | elif(isinstance(args[0], tuple)): 14 | sz = args[0] 15 | else: 16 | print "size parameter must be either an integer or a tuple" 17 | return 18 | 19 | if(len(args) > 1): 20 | origin = args[1] 21 | else: 22 | origin = ( numpy.ceil(sz[0]/2.0), numpy.ceil(sz[1]/2.0) ) 23 | 24 | if(len(args) > 2): 25 | amplitude = args[2] 26 | else: 27 | amplitude = 1 28 | 29 | res = numpy.zeros(sz); 30 | res[origin[0], origin[1]] = amplitude 31 | 32 | return res 33 | -------------------------------------------------------------------------------- /pyPyrTools/mkR.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | 4 | def mkR(size, expt=1, origin=None): 5 | '''make distance-from-origin (r) matrix 6 | 7 | Compute a matrix of dimension SIZE (a [Y X] list/tuple, or a scalar) containing samples of a 8 | radial ramp function, raised to power EXPT (default = 1), with given ORIGIN (default = 9 | (size+1)/2, (0, 0) = upper left). 10 | ''' 11 | 12 | if not hasattr(size, '__iter__'): 13 | size = (size, size) 14 | 15 | if origin is None: 16 | origin = ((size[0]+1)/2., (size[1]+1)/2.) 17 | elif not hasattr(origin, '__iter__'): 18 | origin = (origin, origin) 19 | 20 | # ----------------------------------------------------------------- 21 | 22 | xramp, yramp = numpy.meshgrid(numpy.array(range(1, size[1]+1))-origin[1], 23 | numpy.array(range(1, size[0]+1))-origin[0]) 24 | 25 | res = (xramp**2 + yramp**2)**(expt/2.0) 26 | 27 | return res 28 | -------------------------------------------------------------------------------- /pyPyrTools/mkRamp.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | import math 3 | 4 | def mkRamp(*args): 5 | ''' mkRamp(SIZE, DIRECTION, SLOPE, INTERCEPT, ORIGIN) 6 | Compute a matrix of dimension SIZE (a [Y X] 2-vector, or a scalar) 7 | containing samples of a ramp function, with given gradient DIRECTION 8 | (radians, CW from X-axis, default = 0), SLOPE (per pixel, default = 9 | 1), and a value of INTERCEPT (default = 0) at the ORIGIN (default = 10 | (size+1)/2, [1 1] = upper left). All but the first argument are 11 | optional ''' 12 | 13 | if len(args) == 0: 14 | print "mkRamp(SIZE, DIRECTION, SLOPE, INTERCEPT, ORIGIN)" 15 | print "first argument is required" 16 | exit(1) 17 | else: 18 | sz = args[0] 19 | if isinstance(sz, (int)): 20 | sz = (sz, sz) 21 | elif not isinstance(sz, (tuple)): 22 | print "first argument must be a two element tuple or an integer" 23 | exit(1) 24 | 25 | # OPTIONAL args: 26 | 27 | if len(args) > 1: 28 | direction = args[1] 29 | else: 30 | direction = 0 31 | 32 | if len(args) > 2: 33 | slope = args[2] 34 | else: 35 | slope = 1 36 | 37 | if len(args) > 3: 38 | intercept = args[3] 39 | else: 40 | intercept = 0 41 | 42 | if len(args) > 4: 43 | origin = args[4] 44 | else: 45 | origin = ( float(sz[0]-1)/2.0, float(sz[1]-1)/2.0 ) 46 | 47 | #-------------------------- 48 | 49 | xinc = slope * math.cos(direction) 50 | yinc = slope * math.sin(direction) 51 | 52 | [xramp, yramp] = numpy.meshgrid( xinc * (numpy.array(range(sz[1]))-origin[1]), 53 | yinc * (numpy.array(range(sz[0]))-origin[0]) ) 54 | 55 | res = intercept + xramp + yramp 56 | 57 | return res 58 | -------------------------------------------------------------------------------- /pyPyrTools/mkSine.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | import math 3 | from mkRamp import mkRamp 4 | 5 | def mkSine(*args): 6 | ''' IM = mkSine(SIZE, PERIOD, DIRECTION, AMPLITUDE, PHASE, ORIGIN) 7 | or 8 | IM = mkSine(SIZE, FREQ, AMPLITUDE, PHASE, ORIGIN) 9 | 10 | Compute a matrix of dimension SIZE (a [Y X] 2-vector, or a scalar) 11 | containing samples of a 2D sinusoid, with given PERIOD (in pixels), 12 | DIRECTION (radians, CW from X-axis, default = 0), AMPLITUDE (default 13 | = 1), and PHASE (radians, relative to ORIGIN, default = 0). ORIGIN 14 | defaults to the center of the image. 15 | 16 | In the second form, FREQ is a 2-vector of frequencies (radians/pixel). 17 | 18 | Eero Simoncelli, 6/96. Python version by Rob Young, 7/15. ''' 19 | 20 | # REQUIRED args: 21 | 22 | if len(args) < 2: 23 | print "mkSine(SIZE, PERIOD, DIRECTION, AMPLITUDE, PHASE, ORIGIN)" 24 | print " or" 25 | print "mkSine(SIZE, FREQ, AMPLITUDE, PHASE, ORIGIN)" 26 | print "first two arguments are required" 27 | exit(1) 28 | else: 29 | sz = args[0] 30 | if isinstance(sz, (int)): 31 | sz = (sz, sz) 32 | elif not isinstance(sz, (tuple)): 33 | print "first argument must be a two element tuple or an integer" 34 | exit(1) 35 | 36 | if isinstance(args[1], (int, float, long)): 37 | frequency = (2.0 * numpy.pi) / args[1] 38 | # OPTIONAL args: 39 | if len(args) > 2: 40 | direction = args[2] 41 | else: 42 | direction = 0 43 | if len(args) > 3: 44 | amplitude = args[3] 45 | else: 46 | amplitude = 1 47 | if len(args) > 4: 48 | phase = args[4] 49 | else: 50 | phase = 0 51 | if len(args) > 5: 52 | origin = args[5] 53 | else: 54 | origin = 'not set' 55 | else: 56 | frequency = numpy.linalg.norm(args[1]) 57 | direction = math.atan2(args[1][0], args[1][1]) 58 | # OPTIONAL args: 59 | if len(args) > 2: 60 | amplitude = args[2] 61 | else: 62 | amplitude = 1 63 | if len(args) > 3: 64 | phase = args[3] 65 | else: 66 | phase = 0 67 | if len(args) > 4: 68 | origin = args[4] 69 | else: 70 | origin = 'not set' 71 | 72 | #---------------------------------------------------------------- 73 | 74 | if origin == 'not set': 75 | res = amplitude * numpy.sin(mkRamp(sz, direction, frequency, phase)) 76 | else: 77 | res = amplitude * numpy.sin(mkRamp(sz, direction, frequency, phase, 78 | [origin[0]-1, origin[1]-1])) 79 | 80 | return res 81 | -------------------------------------------------------------------------------- /pyPyrTools/mkSquare.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | import math 3 | from mkRamp import mkRamp 4 | from rcosFn import rcosFn 5 | from pointOp import pointOp 6 | 7 | def mkSquare(*args): 8 | ''' IM = mkSquare(SIZE, PERIOD, DIRECTION, AMPLITUDE, PHASE, ORIGIN, TWIDTH) 9 | or 10 | IM = mkSquare(SIZE, FREQ, AMPLITUDE, PHASE, ORIGIN, TWIDTH) 11 | 12 | Compute a matrix of dimension SIZE (a [Y X] 2-vector, or a scalar) 13 | containing samples of a 2D square wave, with given PERIOD (in 14 | pixels), DIRECTION (radians, CW from X-axis, default = 0), AMPLITUDE 15 | (default = 1), and PHASE (radians, relative to ORIGIN, default = 0). 16 | ORIGIN defaults to the center of the image. TWIDTH specifies width 17 | of raised-cosine edges on the bars of the grating (default = 18 | min(2,period/3)). 19 | 20 | In the second form, FREQ is a 2-vector of frequencies (radians/pixel). 21 | 22 | Eero Simoncelli, 6/96. Python port by Rob Young, 7/15. 23 | 24 | TODO: Add duty cycle. ''' 25 | 26 | #REQUIRED ARGS: 27 | 28 | if len(args) < 2: 29 | print "mkSquare(SIZE, PERIOD, DIRECTION, AMPLITUDE, PHASE, ORIGIN, TWIDTH)" 30 | print " or" 31 | print "mkSquare(SIZE, FREQ, AMPLITUDE, PHASE, ORIGIN, TWIDTH)" 32 | print "first two arguments are required" 33 | exit(1) 34 | else: 35 | sz = args[0] 36 | if isinstance(sz, (int)): 37 | sz = (sz, sz) 38 | elif not isinstance(sz, (tuple)): 39 | print "first argument must be a two element tuple or an integer" 40 | exit(1) 41 | 42 | if isinstance(args[1], (int, float, long)): 43 | frequency = (2.0 * numpy.pi) / args[1] 44 | # OPTIONAL args: 45 | if len(args) > 2: 46 | direction = args[2] 47 | else: 48 | direction = 0 49 | if len(args) > 3: 50 | amplitude = args[3] 51 | else: 52 | amplitude = 1 53 | if len(args) > 4: 54 | phase = args[4] 55 | else: 56 | phase = 0 57 | if len(args) > 5: 58 | origin = args[5] 59 | else: 60 | origin = 'not set' 61 | if len(args) > 6: 62 | transition = args[6] 63 | else: 64 | transition = min(2, 2.0 * numpy.pi / (3.0*frequency)) 65 | else: 66 | frequency = numpy.linalg.norm(args[1]) 67 | direction = math.atan2(args[1][0], args[1][1]) 68 | # OPTIONAL args: 69 | if len(args) > 2: 70 | amplitude = args[2] 71 | else: 72 | amplitude = 1 73 | if len(args) > 3: 74 | phase = args[3] 75 | else: 76 | phase = 0 77 | if len(args) > 4: 78 | origin = args[4] 79 | else: 80 | origin = 'not set' 81 | if len(args) > 5: 82 | transition = args[5] 83 | else: 84 | transition = min(2, 2.0 * numpy.pi / (3.0*frequency)) 85 | 86 | #------------------------------------------------------------ 87 | 88 | if origin != 'not set': 89 | res = mkRamp(sz, direction, frequency, phase, 90 | (origin[0]-1, origin[1]-1)) - numpy.pi/2.0 91 | else: 92 | res = mkRamp(sz, direction, frequency, phase) - numpy.pi/2.0 93 | 94 | [Xtbl, Ytbl] = rcosFn(transition * frequency, numpy.pi/2.0, 95 | [-amplitude, amplitude]) 96 | 97 | res = pointOp(abs(((res+numpy.pi) % (2.0*numpy.pi))-numpy.pi), Ytbl, 98 | Xtbl[0], Xtbl[1]-Xtbl[0], 0) 99 | 100 | return res 101 | -------------------------------------------------------------------------------- /pyPyrTools/mkZonePlate.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | from mkR import mkR 3 | 4 | def mkZonePlate(*args): 5 | ''' IM = mkZonePlate(SIZE, AMPL, PHASE) 6 | 7 | Make a "zone plate" image: 8 | AMPL * cos( r^2 + PHASE) 9 | SIZE specifies the matrix size, as for zeros(). 10 | AMPL (default = 1) and PHASE (default = 0) are optional. 11 | 12 | Eero Simoncelli, 6/96. Python port by Rob Young, 7/15. ''' 13 | 14 | # REQUIRED ARGS: 15 | 16 | if len(args) == 0: 17 | print "mkZonePlate(SIZE, AMPL, PHASE)" 18 | print "first argument is required" 19 | exit(1) 20 | else: 21 | sz = args[0] 22 | if isinstance(sz, (int)): 23 | sz = (sz, sz) 24 | elif not isinstance(sz, (tuple)): 25 | print "first argument must be a two element tuple or an integer" 26 | exit(1) 27 | 28 | #--------------------------------------------------------------------- 29 | # OPTIONAL ARGS 30 | if len(args) > 1: 31 | ampl = args[1] 32 | else: 33 | ampl = 1 34 | if len(args) > 2: 35 | ph = args[2] 36 | else: 37 | ph = 0 38 | 39 | #--------------------------------------------------------------------- 40 | 41 | res = ampl * numpy.cos( (numpy.pi / max(sz)) * mkR(sz, 2) + ph ) 42 | 43 | return res 44 | -------------------------------------------------------------------------------- /pyPyrTools/modulateFlip.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | def modulateFlip(*args): 4 | ''' [HFILT] = modulateFlipShift(LFILT) 5 | QMF/Wavelet highpass filter construction: modulate by (-1)^n, 6 | reverse order (and shift by one, which is handled by the convolution 7 | routines). This is an extension of the original definition of QMF's 8 | (e.g., see Simoncelli90). ''' 9 | 10 | if len(args) == 0: 11 | print "Error: filter input parameter required." 12 | return 13 | 14 | lfilt = args[0] 15 | # reshape lfilt to column vector 16 | if len(lfilt.shape) == 1: 17 | lfilt = lfilt.reshape(len(lfilt), 1) 18 | elif lfilt.shape[0] == 1: 19 | lfilt = lfilt.reshape(lfilt.shape[1], 1) 20 | elif len(lfilt.shape) > 2 or lfilt.shape[1] != 1: 21 | print 'Error: only 1D input supported.' 22 | return 23 | 24 | sz = len(lfilt) 25 | sz2 = numpy.ceil(sz/2.0); 26 | 27 | ind = numpy.array(range(sz-1,-1,-1)) 28 | 29 | hfilt = lfilt[ind].T * (-1)**((ind+1)-sz2) 30 | 31 | # matlab version always returns a column vector 32 | if len(hfilt.shape) == 1: 33 | hfilt = hfilt.reshape(len(hfilt), 1) 34 | elif hfilt.shape[0] == 1: 35 | hfilt = hfilt.reshape(hfilt.shape[1], 1) 36 | 37 | return hfilt 38 | -------------------------------------------------------------------------------- /pyPyrTools/namedFilter.py: -------------------------------------------------------------------------------- 1 | from binomialFilter import binomialFilter 2 | import math 3 | import numpy 4 | 5 | def namedFilter(name): 6 | ''' Some standard 1D filter kernels. These are scaled such that their 7 | L2-norm is 1.0 8 | 9 | binomN - binomial coefficient filter of order N-1 10 | haar - Harr wavelet 11 | qmf8, qmf12, qmf16 - Symmetric Quadrature Mirror Filters [Johnston80] 12 | daub2, daub3, daub4 - Daubechies wavelet [Daubechies88] 13 | qmf5, qmf9, qmf13 - Symmetric Quadrature Mirror Filters 14 | [Simoncelli88, Simoncelli90] 15 | [Johnston80] - J D Johnston, "A filter family designed for use in 16 | quadrature mirror filter banks", Proc. ICASSP, 17 | pp 291-294, 1980. 18 | [Daubechies88] - I Daubechies, "Orthonormal bases of compactly 19 | supported wavelets", Commun. Pure Appl. Math, vol. 42, 20 | pp 909-996, 1988. 21 | [Simoncelli88] - E P Simoncelli, "Orthogonal sub-band image 22 | transforms", PhD Thesis, MIT Dept. of Elec. Eng. and 23 | Comp. Sci. May 1988. Also available as: MIT Media 24 | Laboratory Vision and Modeling Technical Report #100. 25 | [Simoncelli90] - E P Simoncelli and E H Adelson, "Subband image 26 | coding", Subband Transforms, chapter 4, ed. John W 27 | Woods, Kluwer Academic Publishers, Norwell, MA, 1990, 28 | pp 143--192. ''' 29 | 30 | if len(name) > 5 and name[:5] == "binom": 31 | kernel = math.sqrt(2) * binomialFilter(int(name[5:])) 32 | elif name is "qmf5": 33 | kernel = numpy.array([[-0.076103], [0.3535534], [0.8593118], [0.3535534], [-0.076103]]) 34 | elif name is "qmf9": 35 | kernel = numpy.array([[0.02807382], [-0.060944743], [-0.073386624], [0.41472545], [0.7973934], [0.41472545], [-0.073386624], [-0.060944743], [0.02807382]]) 36 | elif name is "qmf13": 37 | kernel = numpy.array([[-0.014556438], [0.021651438], [0.039045125], [-0.09800052], [-0.057827797], [0.42995453], [0.7737113], [0.42995453], [-0.057827797], [-0.09800052], [0.039045125], [0.021651438], [-0.014556438]]) 38 | elif name is "qmf8": 39 | kernel = math.sqrt(2) * numpy.array([[0.00938715], [-0.07065183], [0.06942827], [0.4899808], [0.4899808], [0.06942827], [-0.07065183], [0.00938715]]) 40 | elif name is "qmf12": 41 | kernel = math.sqrt(2) * numpy.array([[-0.003809699], [0.01885659], [-0.002710326], [-0.08469594], [0.08846992], [0.4843894], [0.4843894], [0.08846992], [-0.08469594], [-0.002710326], [0.01885659], [-0.003809699]]) 42 | elif name is "qmf16": 43 | kernel = math.sqrt(2) * numpy.array([[0.001050167], [-0.005054526], [-0.002589756], [0.0276414], [-0.009666376], [-0.09039223], [0.09779817], [0.4810284], [0.4810284], [0.09779817], [-0.09039223], [-0.009666376], [0.0276414], [-0.002589756], [-0.005054526], [0.001050167]]) 44 | elif name is "haar": 45 | kernel = numpy.array([[1], [1]]) / math.sqrt(2) 46 | elif name is "daub2": 47 | kernel = numpy.array([[0.482962913145], [0.836516303738], [0.224143868042], [-0.129409522551]]); 48 | elif name is "daub3": 49 | kernel = numpy.array([[0.332670552950], [0.806891509311], [0.459877502118], [-0.135011020010], [-0.085441273882], [0.035226291882]]) 50 | elif name is "daub4": 51 | kernel = numpy.array([[0.230377813309], [0.714846570553], [0.630880767930], [-0.027983769417], [-0.187034811719], [0.030841381836], [0.032883011667], [-0.010597401785]]) 52 | elif name is "gauss5": # for backward-compatibility 53 | kernel = math.sqrt(2) * numpy.array([[0.0625], [0.25], [0.375], [0.25], [0.0625]]) 54 | elif name is "gauss3": # for backward-compatibility 55 | kernel = math.sqrt(2) * numpy.array([[0.25], [0.5], [0.25]]) 56 | else: 57 | print "Error: Bad filter name: %s" % (name) 58 | exit(1) 59 | 60 | return numpy.array(kernel) 61 | -------------------------------------------------------------------------------- /pyPyrTools/nextSz.py: -------------------------------------------------------------------------------- 1 | def nextSz(size, sizeList): 2 | ''' find next largest size in pyramid list ''' 3 | 4 | ## make sure sizeList is strictly increasing 5 | if sizeList[0] > sizeList[len(sizeList)-1]: 6 | sizeList = sizeList[::-1] 7 | outSize = (0,0) 8 | idx = 0; 9 | while outSize == (0,0) and idx < len(sizeList): 10 | if sizeList[idx] > size: 11 | outSize = sizeList[idx] 12 | idx += 1 13 | 14 | return outSize 15 | -------------------------------------------------------------------------------- /pyPyrTools/pointOp.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | import ctypes 3 | import os 4 | 5 | libpath = os.path.dirname(os.path.realpath(__file__))+'/../wrapConv.so' 6 | # load the C library 7 | lib = ctypes.cdll.LoadLibrary(libpath) 8 | 9 | def pointOp(image, lut, origin, increment, warnings): 10 | """Apply a point operation, specified by lookup table `lut`, to image `im`. 11 | 12 | `lut` must be a row or column vector, and is assumed to contain (equi-spaced) samples of the 13 | function. `origin` specifies the abscissa associated with the first sample, and `increment` 14 | specifies the spacing between samples. Between-sample values are estimated via linear 15 | interpolation. If `warnings` is non-zero, the function prints a warning whenever the lookup 16 | table is extrapolated. 17 | 18 | This function is very fast and allows extrapolation beyond the lookup table domain. The 19 | drawbacks are that the lookup table must be equi-spaced, and the interpolation is linear. 20 | """ 21 | result = numpy.zeros((image.shape[0], image.shape[1])) 22 | 23 | lib.internal_pointop(image.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), 24 | result.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), 25 | image.shape[0] * image.shape[1], 26 | lut.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), 27 | lut.shape[0], 28 | ctypes.c_double(origin), 29 | ctypes.c_double(increment), warnings) 30 | 31 | return numpy.array(result) 32 | -------------------------------------------------------------------------------- /pyPyrTools/pyramid.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | class pyramid: # pyramid 4 | # properties 5 | pyr = [] 6 | pyrSize = [] 7 | pyrType = '' 8 | image = '' 9 | 10 | # constructor 11 | def __init__(self): 12 | print "please specify type of pyramid to create (Gpry, Lpyr, etc.)" 13 | return 14 | 15 | # methods 16 | def nbands(self): 17 | return len(self.pyr) 18 | 19 | def band(self, bandNum): 20 | return numpy.array(self.pyr[bandNum]) 21 | -------------------------------------------------------------------------------- /pyPyrTools/range2.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | def range2(*args): 4 | ''' compute minimum and maximum values of input matrix, returning them 5 | as tuple ''' 6 | 7 | if not numpy.isreal(args[0]).all(): 8 | print 'Error: matrix must be real-valued' 9 | 10 | return (args[0].min(), args[0].max()) 11 | -------------------------------------------------------------------------------- /pyPyrTools/rconv2.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | import scipy.signal 3 | 4 | def rconv2(*args): 5 | ''' Convolution of two matrices, with boundaries handled via reflection 6 | about the edge pixels. Result will be of size of LARGER matrix. 7 | 8 | The origin of the smaller matrix is assumed to be its center. 9 | For even dimensions, the origin is determined by the CTR (optional) 10 | argument: 11 | CTR origin 12 | 0 DIM/2 (default) 13 | 1 (DIM/2)+1 ''' 14 | 15 | if len(args) < 2: 16 | print "Error: two matrices required as input parameters" 17 | return 18 | 19 | if len(args) == 2: 20 | ctr = 0 21 | 22 | if ( args[0].shape[0] >= args[1].shape[0] and 23 | args[0].shape[1] >= args[1].shape[1] ): 24 | large = args[0] 25 | small = args[1] 26 | elif ( args[0].shape[0] <= args[1].shape[0] and 27 | args[0].shape[1] <= args[1].shape[1] ): 28 | large = args[1] 29 | small = args[0] 30 | else: 31 | print 'one arg must be larger than the other in both dimensions!' 32 | return 33 | 34 | ly = large.shape[0] 35 | lx = large.shape[1] 36 | sy = small.shape[0] 37 | sx = small.shape[1] 38 | 39 | ## These values are one less than the index of the small mtx that falls on 40 | ## the border pixel of the large matrix when computing the first 41 | ## convolution response sample: 42 | sy2 = int(numpy.floor((sy+ctr-1)/2)) 43 | sx2 = int(numpy.floor((sx+ctr-1)/2)) 44 | 45 | # pad with reflected copies 46 | nw = large[sy-sy2-1:0:-1, sx-sx2-1:0:-1] 47 | n = large[sy-sy2-1:0:-1, :] 48 | ne = large[sy-sy2-1:0:-1, lx-2:lx-sx2-2:-1] 49 | w = large[:, sx-sx2-1:0:-1] 50 | e = large[:, lx-2:lx-sx2-2:-1] 51 | sw = large[ly-2:ly-sy2-2:-1, sx-sx2-1:0:-1] 52 | s = large[ly-2:ly-sy2-2:-1, :] 53 | se = large[ly-2:ly-sy2-2:-1, lx-2:lx-sx2-2:-1] 54 | 55 | n = numpy.column_stack((nw, n, ne)) 56 | c = numpy.column_stack((w,large,e)) 57 | s = numpy.column_stack((sw, s, se)) 58 | 59 | clarge = numpy.concatenate((n, c), axis=0) 60 | clarge = numpy.concatenate((clarge, s), axis=0) 61 | 62 | return scipy.signal.convolve(clarge, small, 'valid') 63 | -------------------------------------------------------------------------------- /pyPyrTools/rcosFn.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | def rcosFn(width=1, position=0, values=(0, 1)): 4 | ''' [X, Y] = rcosFn(WIDTH, POSITION, VALUES) 5 | 6 | Return a lookup table (suitable for use by INTERP1) 7 | containing a "raised cosine" soft threshold function: 8 | 9 | Y = VALUES(1) + (VALUES(2)-VALUES(1)) * 10 | cos^2( PI/2 * (X - POSITION + WIDTH)/WIDTH ) 11 | 12 | WIDTH is the width of the region over which the transition occurs 13 | (default = 1). POSITION is the location of the center of the 14 | threshold (default = 0). VALUES (default = [0,1]) specifies the 15 | values to the left and right of the transition. ''' 16 | 17 | sz = 256 # arbitrary! 18 | 19 | X = numpy.pi * numpy.array(range(-sz-1,2)) / (2*sz) 20 | 21 | Y = values[0] + (values[1]-values[0]) * numpy.cos(X)**2; 22 | 23 | # make sure end values are repeated, for extrapolation... 24 | Y[0] = Y[1] 25 | Y[sz+2] = Y[sz+1] 26 | 27 | X = position + (2*width/numpy.pi) * (X + numpy.pi/4) 28 | 29 | return (X,Y) 30 | -------------------------------------------------------------------------------- /pyPyrTools/round.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | from roundVal import roundVal 3 | 4 | def round(arr): 5 | ''' round equivalent to matlab function 6 | used in histo so we can unit test against matlab code 7 | numpy version rounds to closest even number to remove bias ''' 8 | 9 | if isinstance(arr, (int, float, long)): 10 | arr = roundVal(arr) 11 | else: 12 | for i in range(len(arr)): 13 | arr[i] = roundVal(arr[i]) 14 | 15 | return arr 16 | -------------------------------------------------------------------------------- /pyPyrTools/roundVal.py: -------------------------------------------------------------------------------- 1 | import math 2 | import numpy 3 | 4 | def roundVal(val): 5 | ''' for use with round() - returns the rounded integer part of val ''' 6 | 7 | (fracPart, intPart) = math.modf(val) 8 | if numpy.abs(fracPart) >= 0.5: 9 | if intPart >= 0: 10 | intPart += 1 11 | else: 12 | intPart -= 1 13 | return intPart 14 | -------------------------------------------------------------------------------- /pyPyrTools/shift.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | def shift(mtx, offset): 4 | ''' Circular shift 2D matrix samples by OFFSET (a [Y,X] 2-tuple), 5 | such that RES(POS) = MTX(POS-OFFSET). ''' 6 | 7 | dims = mtx.shape 8 | if len(dims) == 1: 9 | mtx = mtx.reshape((1, dims[0])) 10 | dims = mtx.shape 11 | 12 | offset = numpy.mod(numpy.negative(offset), dims) 13 | 14 | top = numpy.column_stack((mtx[offset[0]:dims[0], offset[1]:dims[1]], 15 | mtx[offset[0]:dims[0], 0:offset[1]])) 16 | bottom = numpy.column_stack((mtx[0:offset[0], offset[1]:dims[1]], 17 | mtx[0:offset[0], 0:offset[1]])) 18 | 19 | ret = numpy.concatenate((top, bottom), axis=0) 20 | 21 | return ret 22 | -------------------------------------------------------------------------------- /pyPyrTools/showIm.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | from PIL import ImageTk 3 | import PIL 4 | import scipy.stats 5 | import Tkinter 6 | import math 7 | from round import round 8 | 9 | def showIm(*args): 10 | # check and set input parameters 11 | if len(args) == 0: 12 | print "showIm( matrix, range, zoom, label, nshades )" 13 | print " matrix is string. It should be the name of a 2D array." 14 | print " range is a two element tuple. It specifies the values that " 15 | print " map to the min and max colormap values. Passing a value " 16 | print " of 'auto' (default) sets range=[min,max]. 'auto2' sets " 17 | print " range=[mean-2*stdev, mean+2*stdev]. 'auto3' sets " 18 | print " range=[p1-(p2-p1)/8, p2+(p2-p1)/8], where p1 is the 10th " 19 | print " percientile value of the sorted matix samples, and p2 is " 20 | print " the 90th percentile value." 21 | print " zoom specifies the number of matrix samples per screen pixel." 22 | print " It will be rounded to an integer, or 1 divided by an " 23 | print " integer." 24 | #print " A value of 'same' or 'auto' (default) causes the " 25 | #print " zoom value to be chosen automatically to fit the image into" 26 | #print " the current axes." 27 | #print " A value of 'full' fills the axis region " 28 | #print " (leaving no room for labels)." 29 | print " label - A string that is used as a figure title." 30 | print " NSHADES (optional) specifies the number of gray shades, " 31 | print " and defaults to the size of the current colormap. " 32 | 33 | if len(args) > 0: # matrix entered 34 | matrix = numpy.array(args[0]) 35 | 36 | if len(args) > 1: # range entered 37 | if isinstance(args[1], basestring): 38 | if args[1] is "auto": 39 | imRange = ( numpy.amin(matrix), numpy.amax(matrix) ) 40 | elif args[1] is "auto2": 41 | imRange = ( matrix.mean()-2*matrix.std(), 42 | matrix.mean()+2*matrix.std() ) 43 | elif args[1] is "auto3": 44 | #p1 = numpy.percentile(matrix, 10) not in python 2.6.6?! 45 | #p2 = numpy.percentile(matrix, 90) 46 | p1 = scipy.stats.scoreatpercentile(numpy.hstack(matrix), 10) 47 | p2 = scipy.stats.scoreatpercentile(numpy.hstack(matrix), 90) 48 | imRange = (p1-(p2-p1)/8.0, p2+(p2-p1)/8.0) 49 | else: 50 | print "Error: range of %s is not recognized." % args[1] 51 | print " please use a two element tuple or " 52 | print " 'auto', 'auto2' or 'auto3'" 53 | print " enter 'showIm' for more info about options" 54 | return 55 | else: 56 | imRange = args[1][0], args[1][1] 57 | else: 58 | imRange = ( numpy.amin(matrix), numpy.amax(matrix) ) 59 | 60 | if len(args) > 2: # zoom entered 61 | zoom = args[2] 62 | else: 63 | zoom = 1 64 | 65 | if len(args) > 3: # label entered 66 | label = args[3] 67 | else: 68 | label = '' 69 | 70 | if len(args) > 4: # colormap entered 71 | nshades = args[4] 72 | else: 73 | nshades = 256 74 | 75 | # create window 76 | #master = Tkinter.Tk() 77 | master = Tkinter.Toplevel() 78 | master.title('showIm') 79 | canvas_width = matrix.shape[0] * zoom 80 | canvas_height = matrix.shape[1] * zoom 81 | master.geometry(str(canvas_width+20) + "x" + str(canvas_height+60) + 82 | "+200+200") 83 | # put in top spacer 84 | spacer = Tkinter.Label(master, text='').pack() 85 | 86 | # create canvas 87 | canvas = Tkinter.Canvas(master, width=canvas_width, height=canvas_height) 88 | canvas.pack() 89 | # shift matrix to 0.0-1.0 then to 0-255 90 | if (matrix < 0).any(): 91 | matrix = matrix + math.fabs(matrix.min()) 92 | matrix = (matrix / matrix.max()) * 255.0 93 | print matrix.astype('uint8')[0,:] 94 | img = PIL.Image.fromarray(matrix.astype('uint8')) 95 | 96 | # make colormap 97 | colorTable = [0] * 256 98 | incr = int(numpy.ceil(float(matrix.max()-matrix.min()+1) / float(nshades))) 99 | colors = range(int(matrix.min()), int(matrix.max())+1, incr) 100 | colors[0] = 0 101 | colors[-1] = 255 102 | colctr = -1 103 | # compute color transition indices 104 | thresh = round( (matrix.max() - matrix.min()) / len(colors) ) 105 | for i in range(len(colorTable)): 106 | # handle uneven color boundaries 107 | if thresh == 0 or (i % thresh == 0 and colctr < len(colors)-1): 108 | colctr += 1 109 | colorTable[i] = colors[colctr] 110 | img = img.point(colorTable) 111 | 112 | # zoom 113 | if zoom != 1: 114 | img = img.resize((canvas_width, canvas_height), Image.NEAREST) 115 | 116 | # apply image to canvas 117 | imgPI = ImageTk.PhotoImage(img) 118 | canvas.create_image(0,0, anchor=Tkinter.NW, image=imgPI) 119 | 120 | # add labels 121 | rangeStr = 'Range: [%.1f, %.1f]' % (imRange[0], imRange[1]) 122 | rangeLabel = Tkinter.Label(master, text=rangeStr).pack() 123 | dimsStr = 'Dims: [%d, %d] / %d' % (matrix.shape[0], matrix.shape[1], zoom) 124 | dimsLabel = Tkinter.Label(master, text=dimsStr).pack() 125 | 126 | Tkinter.mainloop() 127 | -------------------------------------------------------------------------------- /pyPyrTools/skew2.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | from var2 import var2 3 | 4 | def skew2(*args): 5 | ''' Sample skew (third moment divided by variance^3/2) of a matrix. 6 | MEAN (optional) and VAR (optional) make the computation faster. ''' 7 | 8 | if len(args) == 0: 9 | print 'Usage: skew2(matrix, mean, variance)' 10 | print 'mean and variance arguments are optional' 11 | else: 12 | mtx = numpy.array(args[0]) 13 | 14 | if len(args) > 1: 15 | mn = args[1] 16 | else: 17 | mn = mtx.mean() 18 | 19 | if len(args) > 2: 20 | v = args[2] 21 | else: 22 | v = var2(mtx, mn) 23 | 24 | if isinstance(mtx, complex): 25 | res = ( ( ((mtx.real - mn.real)**3).mean() / (v.real**(3.0/2.0)) ) + 26 | ( (1j * (mtx.imag-mn.image)**3) / (v.imag**(3.0/2.0)))) 27 | else: 28 | res = ((mtx.real - mn.real)**3).mean() / (v.real**(3.0/2.0)) 29 | 30 | return res 31 | -------------------------------------------------------------------------------- /pyPyrTools/sp0Filters.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | def sp0Filters(): 4 | ''' Steerable pyramid filters. Transform described in: 5 | 6 | @INPROCEEDINGS{Simoncelli95b, 7 | TITLE = "The Steerable Pyramid: A Flexible Architecture for 8 | Multi-Scale Derivative Computation", 9 | AUTHOR = "E P Simoncelli and W T Freeman", 10 | BOOKTITLE = "Second Int'l Conf on Image Processing", 11 | ADDRESS = "Washington, DC", MONTH = "October", YEAR = 1995 } 12 | 13 | Filter kernel design described in: 14 | 15 | @INPROCEEDINGS{Karasaridis96, 16 | TITLE = "A Filter Design Technique for 17 | Steerable Pyramid Image Transforms", 18 | AUTHOR = "A Karasaridis and E P Simoncelli", 19 | BOOKTITLE = "ICASSP", ADDRESS = "Atlanta, GA", 20 | MONTH = "May", YEAR = 1996 } ''' 21 | filters = {} 22 | filters['harmonics'] = numpy.array([0]) 23 | filters['lo0filt'] = ( 24 | numpy.array([[-4.514000e-04, -1.137100e-04, -3.725800e-04, -3.743860e-03, 25 | -3.725800e-04, -1.137100e-04, -4.514000e-04], 26 | [-1.137100e-04, -6.119520e-03, -1.344160e-02, -7.563200e-03, 27 | -1.344160e-02, -6.119520e-03, -1.137100e-04], 28 | [-3.725800e-04, -1.344160e-02, 6.441488e-02, 1.524935e-01, 29 | 6.441488e-02, -1.344160e-02, -3.725800e-04], 30 | [-3.743860e-03, -7.563200e-03, 1.524935e-01, 3.153017e-01, 31 | 1.524935e-01, -7.563200e-03, -3.743860e-03], 32 | [-3.725800e-04, -1.344160e-02, 6.441488e-02, 1.524935e-01, 33 | 6.441488e-02, -1.344160e-02, -3.725800e-04], 34 | [-1.137100e-04, -6.119520e-03, -1.344160e-02, -7.563200e-03, 35 | -1.344160e-02, -6.119520e-03, -1.137100e-04], 36 | [-4.514000e-04, -1.137100e-04, -3.725800e-04, -3.743860e-03, 37 | -3.725800e-04, -1.137100e-04, -4.514000e-04]]) ) 38 | filters['lofilt'] = ( 39 | numpy.array([[-2.257000e-04, -8.064400e-04, -5.686000e-05, 8.741400e-04, 40 | -1.862800e-04, -1.031640e-03, -1.871920e-03, -1.031640e-03, 41 | -1.862800e-04, 8.741400e-04, -5.686000e-05, -8.064400e-04, 42 | -2.257000e-04], 43 | [-8.064400e-04, 1.417620e-03, -1.903800e-04, -2.449060e-03, 44 | -4.596420e-03, -7.006740e-03, -6.948900e-03, -7.006740e-03, 45 | -4.596420e-03, -2.449060e-03, -1.903800e-04, 1.417620e-03, 46 | -8.064400e-04], 47 | [-5.686000e-05, -1.903800e-04, -3.059760e-03, -6.401000e-03, 48 | -6.720800e-03, -5.236180e-03, -3.781600e-03, -5.236180e-03, 49 | -6.720800e-03, -6.401000e-03, -3.059760e-03, -1.903800e-04, 50 | -5.686000e-05], 51 | [8.741400e-04, -2.449060e-03, -6.401000e-03, -5.260020e-03, 52 | 3.938620e-03, 1.722078e-02, 2.449600e-02, 1.722078e-02, 53 | 3.938620e-03, -5.260020e-03, -6.401000e-03, -2.449060e-03, 54 | 8.741400e-04], 55 | [-1.862800e-04, -4.596420e-03, -6.720800e-03, 3.938620e-03, 56 | 3.220744e-02, 6.306262e-02, 7.624674e-02, 6.306262e-02, 57 | 3.220744e-02, 3.938620e-03, -6.720800e-03, -4.596420e-03, 58 | -1.862800e-04], 59 | [-1.031640e-03, -7.006740e-03, -5.236180e-03, 1.722078e-02, 60 | 6.306262e-02, 1.116388e-01, 1.348999e-01, 1.116388e-01, 61 | 6.306262e-02, 1.722078e-02, -5.236180e-03, -7.006740e-03, 62 | -1.031640e-03], 63 | [-1.871920e-03, -6.948900e-03, -3.781600e-03, 2.449600e-02, 64 | 7.624674e-02, 1.348999e-01, 1.576508e-01, 1.348999e-01, 65 | 7.624674e-02, 2.449600e-02, -3.781600e-03, -6.948900e-03, 66 | -1.871920e-03], 67 | [-1.031640e-03, -7.006740e-03, -5.236180e-03, 1.722078e-02, 68 | 6.306262e-02, 1.116388e-01, 1.348999e-01, 1.116388e-01, 69 | 6.306262e-02, 1.722078e-02, -5.236180e-03, -7.006740e-03, 70 | -1.031640e-03], 71 | [-1.862800e-04, -4.596420e-03, -6.720800e-03, 3.938620e-03, 72 | 3.220744e-02, 6.306262e-02, 7.624674e-02, 6.306262e-02, 73 | 3.220744e-02, 3.938620e-03, -6.720800e-03, -4.596420e-03, 74 | -1.862800e-04], 75 | [8.741400e-04, -2.449060e-03, -6.401000e-03, -5.260020e-03, 76 | 3.938620e-03, 1.722078e-02, 2.449600e-02, 1.722078e-02, 77 | 3.938620e-03, -5.260020e-03, -6.401000e-03, -2.449060e-03, 78 | 8.741400e-04], 79 | [-5.686000e-05, -1.903800e-04, -3.059760e-03, -6.401000e-03, 80 | -6.720800e-03, -5.236180e-03, -3.781600e-03, -5.236180e-03, 81 | -6.720800e-03, -6.401000e-03, -3.059760e-03, -1.903800e-04, 82 | -5.686000e-05], 83 | [-8.064400e-04, 1.417620e-03, -1.903800e-04, -2.449060e-03, 84 | -4.596420e-03, -7.006740e-03, -6.948900e-03, -7.006740e-03, 85 | -4.596420e-03, -2.449060e-03, -1.903800e-04, 1.417620e-03, 86 | -8.064400e-04], 87 | [-2.257000e-04, -8.064400e-04, -5.686000e-05, 8.741400e-04, 88 | -1.862800e-04, -1.031640e-03, -1.871920e-03, -1.031640e-03, 89 | -1.862800e-04, 8.741400e-04, -5.686000e-05, -8.064400e-04, 90 | -2.257000e-04]]) ) 91 | filters['mtx'] = numpy.array([ 1.000000 ]) 92 | filters['hi0filt'] = ( 93 | numpy.array([[5.997200e-04, -6.068000e-05, -3.324900e-04, -3.325600e-04, 94 | -2.406600e-04, -3.325600e-04, -3.324900e-04, -6.068000e-05, 95 | 5.997200e-04], 96 | [-6.068000e-05, 1.263100e-04, 4.927100e-04, 1.459700e-04, 97 | -3.732100e-04, 1.459700e-04, 4.927100e-04, 1.263100e-04, 98 | -6.068000e-05], 99 | [-3.324900e-04, 4.927100e-04, -1.616650e-03, -1.437358e-02, 100 | -2.420138e-02, -1.437358e-02, -1.616650e-03, 4.927100e-04, 101 | -3.324900e-04], 102 | [-3.325600e-04, 1.459700e-04, -1.437358e-02, -6.300923e-02, 103 | -9.623594e-02, -6.300923e-02, -1.437358e-02, 1.459700e-04, 104 | -3.325600e-04], 105 | [-2.406600e-04, -3.732100e-04, -2.420138e-02, -9.623594e-02, 106 | 8.554893e-01, -9.623594e-02, -2.420138e-02, -3.732100e-04, 107 | -2.406600e-04], 108 | [-3.325600e-04, 1.459700e-04, -1.437358e-02, -6.300923e-02, 109 | -9.623594e-02, -6.300923e-02, -1.437358e-02, 1.459700e-04, 110 | -3.325600e-04], 111 | [-3.324900e-04, 4.927100e-04, -1.616650e-03, -1.437358e-02, 112 | -2.420138e-02, -1.437358e-02, -1.616650e-03, 4.927100e-04, 113 | -3.324900e-04], 114 | [-6.068000e-05, 1.263100e-04, 4.927100e-04, 1.459700e-04, 115 | -3.732100e-04, 1.459700e-04, 4.927100e-04, 1.263100e-04, 116 | -6.068000e-05], 117 | [5.997200e-04, -6.068000e-05, -3.324900e-04, -3.325600e-04, 118 | -2.406600e-04, -3.325600e-04, -3.324900e-04, -6.068000e-05, 119 | 5.997200e-04]]) ) 120 | filters['bfilts'] = ( 121 | numpy.array([-9.066000e-05, -1.738640e-03, -4.942500e-03, -7.889390e-03, 122 | -1.009473e-02, -7.889390e-03, -4.942500e-03, -1.738640e-03, 123 | -9.066000e-05, -1.738640e-03, -4.625150e-03, -7.272540e-03, 124 | -7.623410e-03, -9.091950e-03, -7.623410e-03, -7.272540e-03, 125 | -4.625150e-03, -1.738640e-03, -4.942500e-03, -7.272540e-03, 126 | -2.129540e-02, -2.435662e-02, -3.487008e-02, -2.435662e-02, 127 | -2.129540e-02, -7.272540e-03, -4.942500e-03, -7.889390e-03, 128 | -7.623410e-03, -2.435662e-02, -1.730466e-02, -3.158605e-02, 129 | -1.730466e-02, -2.435662e-02, -7.623410e-03, -7.889390e-03, 130 | -1.009473e-02, -9.091950e-03, -3.487008e-02, -3.158605e-02, 131 | 9.464195e-01, -3.158605e-02, -3.487008e-02, -9.091950e-03, 132 | -1.009473e-02, -7.889390e-03, -7.623410e-03, -2.435662e-02, 133 | -1.730466e-02, -3.158605e-02, -1.730466e-02, -2.435662e-02, 134 | -7.623410e-03, -7.889390e-03, -4.942500e-03, -7.272540e-03, 135 | -2.129540e-02, -2.435662e-02, -3.487008e-02, -2.435662e-02, 136 | -2.129540e-02, -7.272540e-03, -4.942500e-03, -1.738640e-03, 137 | -4.625150e-03, -7.272540e-03, -7.623410e-03, -9.091950e-03, 138 | -7.623410e-03, -7.272540e-03, -4.625150e-03, -1.738640e-03, 139 | -9.066000e-05, -1.738640e-03, -4.942500e-03, -7.889390e-03, 140 | -1.009473e-02, -7.889390e-03, -4.942500e-03, -1.738640e-03, 141 | -9.066000e-05]) ) 142 | filters['bfilts'] = filters['bfilts'].reshape(len(filters['bfilts']),1) 143 | 144 | return filters 145 | -------------------------------------------------------------------------------- /pyPyrTools/sp5Filters.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | def sp5Filters(): 4 | ''' Steerable pyramid filters. Transform described in: 5 | 6 | @INPROCEEDINGS{Simoncelli95b, 7 | TITLE = "The Steerable Pyramid: A Flexible Architecture for 8 | Multi-Scale Derivative Computation", 9 | AUTHOR = "E P Simoncelli and W T Freeman", 10 | BOOKTITLE = "Second Int'l Conf on Image Processing", 11 | ADDRESS = "Washington, DC", MONTH = "October", YEAR = 1995 } 12 | 13 | Filter kernel design described in: 14 | 15 | @INPROCEEDINGS{Karasaridis96, 16 | TITLE = "A Filter Design Technique for 17 | Steerable Pyramid Image Transforms", 18 | AUTHOR = "A Karasaridis and E P Simoncelli", 19 | BOOKTITLE = "ICASSP", ADDRESS = "Atlanta, GA", 20 | MONTH = "May", YEAR = 1996 } ''' 21 | 22 | filters = {} 23 | filters['harmonics'] = numpy.array([1, 3, 5]) 24 | filters['mtx'] = ( 25 | numpy.array([[0.3333, 0.2887, 0.1667, 0.0000, -0.1667, -0.2887], 26 | [0.0000, 0.1667, 0.2887, 0.3333, 0.2887, 0.1667], 27 | [0.3333, -0.0000, -0.3333, -0.0000, 0.3333, -0.0000], 28 | [0.0000, 0.3333, 0.0000, -0.3333, 0.0000, 0.3333], 29 | [0.3333, -0.2887, 0.1667, -0.0000, -0.1667, 0.2887], 30 | [-0.0000, 0.1667, -0.2887, 0.3333, -0.2887, 0.1667]])) 31 | filters['hi0filt'] = ( 32 | numpy.array([[-0.00033429, -0.00113093, -0.00171484, 33 | -0.00133542, -0.00080639, -0.00133542, 34 | -0.00171484, -0.00113093, -0.00033429], 35 | [-0.00113093, -0.00350017, -0.00243812, 36 | 0.00631653, 0.01261227, 0.00631653, 37 | -0.00243812,-0.00350017, -0.00113093], 38 | [-0.00171484, -0.00243812, -0.00290081, 39 | -0.00673482, -0.00981051, -0.00673482, 40 | -0.00290081, -0.00243812, -0.00171484], 41 | [-0.00133542, 0.00631653, -0.00673482, 42 | -0.07027679, -0.11435863, -0.07027679, 43 | -0.00673482, 0.00631653, -0.00133542], 44 | [-0.00080639, 0.01261227, -0.00981051, 45 | -0.11435863, 0.81380200, -0.11435863, 46 | -0.00981051, 0.01261227, -0.00080639], 47 | [-0.00133542, 0.00631653, -0.00673482, 48 | -0.07027679, -0.11435863, -0.07027679, 49 | -0.00673482, 0.00631653, -0.00133542], 50 | [-0.00171484, -0.00243812, -0.00290081, 51 | -0.00673482, -0.00981051, -0.00673482, 52 | -0.00290081, -0.00243812, -0.00171484], 53 | [-0.00113093, -0.00350017, -0.00243812, 54 | 0.00631653, 0.01261227, 0.00631653, 55 | -0.00243812, -0.00350017, -0.00113093], 56 | [-0.00033429, -0.00113093, -0.00171484, 57 | -0.00133542, -0.00080639, -0.00133542, 58 | -0.00171484, -0.00113093, -0.00033429]])) 59 | filters['lo0filt'] = ( 60 | numpy.array([[0.00341614, -0.01551246, -0.03848215, -0.01551246, 61 | 0.00341614], 62 | [-0.01551246, 0.05586982, 0.15925570, 0.05586982, 63 | -0.01551246], 64 | [-0.03848215, 0.15925570, 0.40304148, 0.15925570, 65 | -0.03848215], 66 | [-0.01551246, 0.05586982, 0.15925570, 0.05586982, 67 | -0.01551246], 68 | [0.00341614, -0.01551246, -0.03848215, -0.01551246, 69 | 0.00341614]])) 70 | filters['lofilt'] = ( 71 | 2 * numpy.array([[0.00085404, -0.00244917, -0.00387812, -0.00944432, 72 | -0.00962054, -0.00944432, -0.00387812, -0.00244917, 73 | 0.00085404], 74 | [-0.00244917, -0.00523281, -0.00661117, 0.00410600, 75 | 0.01002988, 0.00410600, -0.00661117, -0.00523281, 76 | -0.00244917], 77 | [-0.00387812, -0.00661117, 0.01396746, 0.03277038, 78 | 0.03981393, 0.03277038, 0.01396746, -0.00661117, 79 | -0.00387812], 80 | [-0.00944432, 0.00410600, 0.03277038, 0.06426333, 81 | 0.08169618, 0.06426333, 0.03277038, 0.00410600, 82 | -0.00944432], 83 | [-0.00962054, 0.01002988, 0.03981393, 0.08169618, 84 | 0.10096540, 0.08169618, 0.03981393, 0.01002988, 85 | -0.00962054], 86 | [-0.00944432, 0.00410600, 0.03277038, 0.06426333, 87 | 0.08169618, 0.06426333, 0.03277038, 0.00410600, 88 | -0.00944432], 89 | [-0.00387812, -0.00661117, 0.01396746, 0.03277038, 90 | 0.03981393, 0.03277038, 0.01396746, -0.00661117, 91 | -0.00387812], 92 | [-0.00244917, -0.00523281, -0.00661117, 0.00410600, 93 | 0.01002988, 0.00410600, -0.00661117, -0.00523281, 94 | -0.00244917], 95 | [0.00085404, -0.00244917, -0.00387812, -0.00944432, 96 | -0.00962054, -0.00944432, -0.00387812, -0.00244917, 97 | 0.00085404]])) 98 | filters['bfilts'] = ( 99 | numpy.array([[0.00277643, 0.00496194, 0.01026699, 0.01455399, 0.01026699, 100 | 0.00496194, 0.00277643, -0.00986904, -0.00893064, 101 | 0.01189859, 0.02755155, 0.01189859, -0.00893064, 102 | -0.00986904, -0.01021852, -0.03075356, -0.08226445, 103 | -0.11732297, -0.08226445, -0.03075356, -0.01021852, 104 | 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 105 | 0.00000000, 0.00000000, 0.01021852, 0.03075356, 0.08226445, 106 | 0.11732297, 0.08226445, 0.03075356, 0.01021852, 0.00986904, 107 | 0.00893064, -0.01189859, -0.02755155, -0.01189859, 108 | 0.00893064, 0.00986904, -0.00277643, -0.00496194, 109 | -0.01026699, -0.01455399, -0.01026699, -0.00496194, 110 | -0.00277643], 111 | [-0.00343249, -0.00640815, -0.00073141, 0.01124321, 112 | 0.00182078, 0.00285723, 0.01166982, -0.00358461, 113 | -0.01977507, -0.04084211, -0.00228219, 0.03930573, 114 | 0.01161195, 0.00128000, 0.01047717, 0.01486305, 115 | -0.04819057, -0.12227230, -0.05394139, 0.00853965, 116 | -0.00459034, 0.00790407, 0.04435647, 0.09454202, 117 | -0.00000000, -0.09454202, -0.04435647, -0.00790407, 118 | 0.00459034, -0.00853965, 0.05394139, 0.12227230, 119 | 0.04819057, -0.01486305, -0.01047717, -0.00128000, 120 | -0.01161195, -0.03930573, 0.00228219, 0.04084211, 121 | 0.01977507, 0.00358461, -0.01166982, -0.00285723, 122 | -0.00182078, -0.01124321, 0.00073141, 0.00640815, 123 | 0.00343249], 124 | [0.00343249, 0.00358461, -0.01047717, -0.00790407, 125 | -0.00459034, 0.00128000, 0.01166982, 0.00640815, 126 | 0.01977507, -0.01486305, -0.04435647, 0.00853965, 127 | 0.01161195, 0.00285723, 0.00073141, 0.04084211, 0.04819057, 128 | -0.09454202, -0.05394139, 0.03930573, 0.00182078, 129 | -0.01124321, 0.00228219, 0.12227230, -0.00000000, 130 | -0.12227230, -0.00228219, 0.01124321, -0.00182078, 131 | -0.03930573, 0.05394139, 0.09454202, -0.04819057, 132 | -0.04084211, -0.00073141, -0.00285723, -0.01161195, 133 | -0.00853965, 0.04435647, 0.01486305, -0.01977507, 134 | -0.00640815, -0.01166982, -0.00128000, 0.00459034, 135 | 0.00790407, 0.01047717, -0.00358461, -0.00343249], 136 | [-0.00277643, 0.00986904, 0.01021852, -0.00000000, 137 | -0.01021852, -0.00986904, 0.00277643, -0.00496194, 138 | 0.00893064, 0.03075356, -0.00000000, -0.03075356, 139 | -0.00893064, 0.00496194, -0.01026699, -0.01189859, 140 | 0.08226445, -0.00000000, -0.08226445, 0.01189859, 141 | 0.01026699, -0.01455399, -0.02755155, 0.11732297, 142 | -0.00000000, -0.11732297, 0.02755155, 0.01455399, 143 | -0.01026699, -0.01189859, 0.08226445, -0.00000000, 144 | -0.08226445, 0.01189859, 0.01026699, -0.00496194, 145 | 0.00893064, 0.03075356, -0.00000000, -0.03075356, 146 | -0.00893064, 0.00496194, -0.00277643, 0.00986904, 147 | 0.01021852, -0.00000000, -0.01021852, -0.00986904, 148 | 0.00277643], 149 | [-0.01166982, -0.00128000, 0.00459034, 0.00790407, 150 | 0.01047717, -0.00358461, -0.00343249, -0.00285723, 151 | -0.01161195, -0.00853965, 0.04435647, 0.01486305, 152 | -0.01977507, -0.00640815, -0.00182078, -0.03930573, 153 | 0.05394139, 0.09454202, -0.04819057, -0.04084211, 154 | -0.00073141, -0.01124321, 0.00228219, 0.12227230, 155 | -0.00000000, -0.12227230, -0.00228219, 0.01124321, 156 | 0.00073141, 0.04084211, 0.04819057, -0.09454202, 157 | -0.05394139, 0.03930573, 0.00182078, 0.00640815, 158 | 0.01977507, -0.01486305, -0.04435647, 0.00853965, 159 | 0.01161195, 0.00285723, 0.00343249, 0.00358461, 160 | -0.01047717, -0.00790407, -0.00459034, 0.00128000, 161 | 0.01166982], 162 | [-0.01166982, -0.00285723, -0.00182078, -0.01124321, 163 | 0.00073141, 0.00640815, 0.00343249, -0.00128000, 164 | -0.01161195, -0.03930573, 0.00228219, 0.04084211, 165 | 0.01977507, 0.00358461, 0.00459034, -0.00853965, 166 | 0.05394139, 0.12227230, 0.04819057, -0.01486305, 167 | -0.01047717, 0.00790407, 0.04435647, 0.09454202, 168 | -0.00000000, -0.09454202, -0.04435647, -0.00790407, 169 | 0.01047717, 0.01486305, -0.04819057, -0.12227230, 170 | -0.05394139, 0.00853965, -0.00459034, -0.00358461, 171 | -0.01977507, -0.04084211, -0.00228219, 0.03930573, 172 | 0.01161195, 0.00128000, -0.00343249, -0.00640815, 173 | -0.00073141, 0.01124321, 0.00182078, 0.00285723, 174 | 0.01166982]]).T) 175 | 176 | return filters 177 | -------------------------------------------------------------------------------- /pyPyrTools/steer.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | from steer2HarmMtx import steer2HarmMtx 3 | 4 | def steer(basis, angle, harmonics=None, steermtx=None): 5 | '''Steer BASIS to the specfied ANGLE. 6 | 7 | BASIS should be a matrix whose columns are vectorized rotated copies of a steerable 8 | function, or the responses of a set of steerable filters. 9 | 10 | ANGLE can be a scalar, or a column vector the size of the basis. 11 | 12 | HARMONICS (optional, default is N even or odd low frequencies, as for derivative filters) 13 | should be a list of harmonic numbers indicating the angular harmonic content of the basis. 14 | 15 | STEERMTX (optional, default assumes cosine phase harmonic components, and filter positions at 16 | 2pi*n/N) should be a matrix which maps the filters onto Fourier series components (ordered 17 | [cos0 cos1 sin1 cos2 sin2 ... sinN]). See steer2HarmMtx function for more details 18 | 19 | Eero Simoncelli, 7/96. Ported to Python by Rob Young, 5/14. 20 | ''' 21 | 22 | num = basis.shape[1] 23 | 24 | if isinstance(angle, (int, long, float)): 25 | angle = numpy.array([angle]) 26 | else: 27 | if angle.shape[0] != basis.shape[0] or angle.shape[1] != 1: 28 | raise Exception('ANGLE must be a scalar, or a column vector the size of the basis elements') 29 | 30 | # If HARMONICS is not specified, assume derivatives. 31 | if harmonics is None: 32 | if num % 2 == 0: 33 | harmonics = numpy.array(range(num/2))*2+1 34 | else: 35 | harmonics = numpy.array(range((15+1)/2))*2 36 | 37 | if len(harmonics.shape) == 1 or harmonics.shape[0] == 1: 38 | # reshape to column matrix 39 | harmonics = harmonics.reshape(harmonics.shape[0], 1) 40 | elif harmonics.shape[0] != 1 and harmonics.shape[1] != 1: 41 | raise Exception('input parameter HARMONICS must be 1D!') 42 | 43 | if 2*harmonics.shape[0] - (harmonics == 0).sum() != num: 44 | raise Exception('harmonics list is incompatible with basis size!') 45 | 46 | # If STEERMTX not passed, assume evenly distributed cosine-phase filters: 47 | if steermtx is None: 48 | steermtx = steer2HarmMtx(harmonics, numpy.pi*numpy.array(range(num))/num, 'even') 49 | 50 | steervect = numpy.zeros((angle.shape[0], num)) 51 | arg = angle * harmonics[numpy.nonzero(harmonics)[0]].T 52 | if all(harmonics): 53 | steervect[:, range(0, num, 2)] = numpy.cos(arg) 54 | steervect[:, range(1, num, 2)] = numpy.sin(arg) 55 | else: 56 | steervect[:, 1] = numpy.ones((arg.shape[0], 1)) 57 | steervect[:, range(0, num, 2)] = numpy.cos(arg) 58 | steervect[:, range(1, num, 2)] = numpy.sin(arg) 59 | 60 | steervect = numpy.dot(steervect, steermtx) 61 | 62 | if steervect.shape[0] > 1: 63 | tmp = numpy.dot(basis, steervect) 64 | res = sum(tmp).T 65 | else: 66 | res = numpy.dot(basis, steervect.T) 67 | 68 | return res 69 | -------------------------------------------------------------------------------- /pyPyrTools/steer2HarmMtx.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | def steer2HarmMtx(*args): 4 | ''' Compute a steering matrix (maps a directional basis set onto the 5 | angular Fourier harmonics). HARMONICS is a vector specifying the 6 | angular harmonics contained in the steerable basis/filters. ANGLES 7 | (optional) is a vector specifying the angular position of each filter. 8 | REL_PHASES (optional, default = 'even') specifies whether the harmonics 9 | are cosine or sine phase aligned about those positions. 10 | The result matrix is suitable for passing to the function STEER. 11 | mtx = steer2HarmMtx(harmonics, angles, evenorodd) ''' 12 | 13 | if len(args) == 0: 14 | print "Error: first parameter 'harmonics' is required." 15 | return 16 | 17 | if len(args) > 0: 18 | harmonics = numpy.array(args[0]) 19 | 20 | # optional parameters 21 | numh = (2*harmonics.shape[0]) - (harmonics == 0).sum() 22 | if len(args) > 1: 23 | angles = args[1] 24 | else: 25 | angles = numpy.pi * numpy.array(range(numh)) / numh 26 | 27 | if len(args) > 2: 28 | if isinstance(args[2], basestring): 29 | if args[2] == 'even' or args[2] == 'EVEN': 30 | evenorodd = 0 31 | elif args[2] == 'odd' or args[2] == 'ODD': 32 | evenorodd = 1 33 | else: 34 | print "Error: only 'even' and 'odd' are valid entries for the third input parameter." 35 | return 36 | else: 37 | print "Error: third input parameter must be a string (even/odd)." 38 | else: 39 | evenorodd = 0 40 | 41 | # Compute inverse matrix, which maps to Fourier components onto 42 | # steerable basis 43 | imtx = numpy.zeros((angles.shape[0], numh)) 44 | col = 0 45 | for h in harmonics: 46 | args = h * angles 47 | if h == 0: 48 | imtx[:, col] = numpy.ones(angles.shape) 49 | col += 1 50 | elif evenorodd: 51 | imtx[:, col] = numpy.sin(args) 52 | imtx[:, col+1] = numpy.negative( numpy.cos(args) ) 53 | col += 2 54 | else: 55 | imtx[:, col] = numpy.cos(args) 56 | imtx[:, col+1] = numpy.sin(args) 57 | col += 2 58 | 59 | r = numpy.rank(imtx) 60 | if r != numh and r != angles.shape[0]: 61 | print "Warning: matrix is not full rank" 62 | 63 | mtx = numpy.linalg.pinv(imtx) 64 | 65 | return mtx 66 | -------------------------------------------------------------------------------- /pyPyrTools/strictly_decreasing.py: -------------------------------------------------------------------------------- 1 | def strictly_decreasing(L): 2 | ''' are all elements of list strictly decreasing ''' 3 | return all(x>y for x, y in zip(L, L[1:])) 4 | -------------------------------------------------------------------------------- /pyPyrTools/upBlur.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | from namedFilter import namedFilter 3 | from upConv import upConv 4 | 5 | def upBlur(*args): 6 | ''' RES = upBlur(IM, LEVELS, FILT) 7 | 8 | Upsample and blur an image. The blurring is done with filter 9 | kernel specified by FILT (default = 'binom5'), which can be a string 10 | (to be passed to namedFilter), a vector (applied separably as a 1D 11 | convolution kernel in X and Y), or a matrix (applied as a 2D 12 | convolution kernel). The downsampling is always by 2 in each 13 | direction. 14 | 15 | The procedure is applied recursively LEVELS times (default=1). 16 | 17 | Eero Simoncelli, 4/97. Python port by Rob Young, 10/15. ''' 18 | 19 | #--------------------------------------------------------------- 20 | # REQUIRED ARGS 21 | 22 | if len(args) == 0: 23 | print 'Usage: upBlur(image, levels, filter)' 24 | print 'first argument is required' 25 | else: 26 | im = numpy.array(args[0]) 27 | 28 | #--------------------------------------------------------------- 29 | # OPTIONAL ARGS 30 | 31 | if len(args) > 1: 32 | nlevs = args[1] 33 | else: 34 | nlevs = 1 35 | 36 | if len(args) > 2: 37 | filt = args[2] 38 | else: 39 | filt = 'binom5' 40 | 41 | #------------------------------------------------------------------ 42 | 43 | if isinstance(filt, basestring): 44 | filt = namedFilter(filt) 45 | 46 | if nlevs > 1: 47 | im = upBlur(im, nlevs-1, filt) 48 | 49 | if nlevs >= 1: 50 | if im.shape[0] == 1 or im.shape[1] == 1: 51 | if im.shape[0] == 1: 52 | filt = filt.reshape(filt.shape[1], filt.shape[0]) 53 | start = (1,2) 54 | else: 55 | start = (2,1) 56 | res = upConv(im, filt, 'reflect1', start) 57 | elif filt.shape[0] == 1 or filt.shape[1] == 1: 58 | if filt.shape[0] == 1: 59 | filt = filt.reshape(filt.shape[1], 1) 60 | res = upConv(im, filt, 'reflect1', [2,1]) 61 | res = upConv(res, filt.T, 'reflect1', [1,2]) 62 | else: 63 | res = upConv(im, filt, 'reflect1', [2,2]) 64 | else: 65 | res = im 66 | 67 | return res 68 | -------------------------------------------------------------------------------- /pyPyrTools/upConv.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | import ctypes 3 | import os 4 | 5 | libpath = os.path.dirname(os.path.realpath(__file__))+'/../wrapConv.so' 6 | # load the C library 7 | lib = ctypes.cdll.LoadLibrary(libpath) 8 | 9 | 10 | def upConv(image, filt, edges='reflect1', step=(1, 1), start=(0, 0), stop=None, result=None): 11 | """Upsample matrix image, followed by convolution with matrix filt. 12 | 13 | These arguments should be 1D or 2D matrices, and image must be larger (in both dimensions) than 14 | filt. The origin of filt is assumed to be floor(size(filt)/2)+1. 15 | 16 | edges is a string determining boundary handling: 17 | 'circular' - Circular convolution 18 | 'reflect1' - Reflect about the edge pixels 19 | 'reflect2' - Reflect, doubling the edge pixels 20 | 'repeat' - Repeat the edge pixels 21 | 'zero' - Assume values of zero outside image boundary 22 | 'extend' - Reflect and invert 23 | 'dont-compute' - Zero output when filter overhangs OUTPUT boundaries 24 | 25 | Upsampling factors are determined by step (optional, default=(1, 1)), 26 | a 2-tuple (y, x). 27 | 28 | The window over which the convolution occurs is specfied by start (optional, default=(0, 0), 29 | and stop (optional, default = step .* (size(IM) + floor((start-1)./step))). 30 | 31 | result is an optional result matrix. The convolution result will be destructively added into 32 | this matrix. If this argument is passed, the result matrix will not be returned. DO NOT USE 33 | THIS ARGUMENT IF YOU DO NOT UNDERSTAND WHAT THIS MEANS!! 34 | 35 | NOTE: this operation corresponds to multiplication of a signal vector by a matrix whose columns 36 | contain copies of the time-reversed (or space-reversed) FILT shifted by multiples of STEP. See 37 | corrDn.m for the operation corresponding to the transpose of this matrix. 38 | 39 | WARNING: if both the image and filter are 1d, they must be 1d in the same dimension. E.g., if 40 | image.shape is (1, 36), then filt.shape must be (1, 5) and NOT (5, 1). If they're both 1d and 41 | 1d in different dimensions, then this may encounter a segfault. I've not been able to find a 42 | way to avoid that within this function (simply reshaping it does not work). 43 | """ 44 | image = image.copy() 45 | filt = filt.copy() 46 | 47 | if len(filt.shape) == 1: 48 | filt = numpy.reshape(filt, (1, len(filt))) 49 | 50 | if ( (edges != "reflect1" or edges != "extend" or edges != "repeat") and 51 | (filt.shape[0] % 2 == 0 or filt.shape[1] % 2 == 0) ): 52 | if filt.shape[1] == 1: 53 | filt = numpy.append(filt,0.0); 54 | filt = numpy.reshape(filt, (len(filt), 1)) 55 | elif filt.shape[0] == 1: 56 | filt = numpy.append(filt,0.0); 57 | filt = numpy.reshape(filt, (1, len(filt))) 58 | else: 59 | raise Exception('Even sized 2D filters not yet supported by upConv.') 60 | 61 | if stop is None and result is None: 62 | stop = (image.shape[0]*step[0], image.shape[1]*step[1]) 63 | stop = (stop[0], stop[1]) 64 | elif stop is None: 65 | stop = (result.shape[0], result.shape[1]) 66 | 67 | if result is None: 68 | result = numpy.zeros((stop[1], stop[0])) 69 | else: 70 | result = numpy.array(result.copy()) 71 | 72 | temp = numpy.zeros((filt.shape[1], filt.shape[0])) 73 | 74 | if edges == 'circular': 75 | lib.internal_wrap_expand(image.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), 76 | filt.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), 77 | filt.shape[1], filt.shape[0], start[1], 78 | step[1], stop[1], start[0], step[0], stop[0], 79 | result.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), 80 | stop[1], stop[0]) 81 | result = result.T 82 | else: 83 | lib.internal_expand(image.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), 84 | filt.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), 85 | temp.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), 86 | filt.shape[1], filt.shape[0], start[1], step[1], 87 | stop[1], start[0], step[0], stop[0], 88 | result.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), 89 | stop[1], stop[0], edges) 90 | result = numpy.reshape(result, stop) 91 | 92 | return result 93 | -------------------------------------------------------------------------------- /pyPyrTools/var2.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | def var2(*args): 4 | ''' Sample variance of a matrix. 5 | Passing MEAN (optional) makes the calculation faster. ''' 6 | 7 | if len(args) == 1: 8 | mn = args[0].mean() 9 | elif len(args) == 2: 10 | mn = args[1] 11 | 12 | if(numpy.isreal(args[0]).all()): 13 | res = sum(sum((args[0]-mn)**2)) / max(numpy.prod(args[0].shape)-1, 1) 14 | else: 15 | res = sum((args[0]-mn).real**2) + 1j*sum((args[0]-mn).imag)**2 16 | res = res / max(numpy.prod(args[0].shape)-1, 1) 17 | 18 | return res 19 | -------------------------------------------------------------------------------- /pyPyrTools/wrap.c: -------------------------------------------------------------------------------- 1 | /* 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3 | ;;; File: wrap.c 4 | ;;; Author: Eero Simoncelli 5 | ;;; Description: Circular convolution on 2D images. 6 | ;;; Creation Date: Spring, 1987. 7 | ;;; MODIFICATIONS: 8 | ;;; 6/96: Switched array types to double float. 9 | ;;; 2/97: made more robust and readable. Added STOP arguments. 10 | ;;; ---------------------------------------------------------------- 11 | ;;; Object-Based Vision and Image Understanding System (OBVIUS), 12 | ;;; Copyright 1988, Vision Science Group, Media Laboratory, 13 | ;;; Massachusetts Institute of Technology. 14 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 15 | */ 16 | 17 | #include 18 | 19 | #include "convolve.h" 20 | 21 | /* 22 | -------------------------------------------------------------------- 23 | Performs correlation (i.e., convolution with filt(-x,-y)) of FILT 24 | with IMAGE followed by subsampling (a.k.a. REDUCE in Burt&Adelson81). 25 | The operations are combined to avoid unnecessary computation of the 26 | convolution samples that are to be discarded in the subsampling 27 | operation. The convolution is done in 9 sections so that mod 28 | operations are not performed unnecessarily. The subsampling lattice 29 | is specified by the START, STEP and STOP parameters. 30 | -------------------------------------------------------------------- */ 31 | 32 | /* abstract out the inner product computation */ 33 | #define INPROD(YSTART,YIND,XSTART,XIND) \ 34 | { \ 35 | sum=0.0; \ 36 | for (y_im=YSTART, filt_pos=0, x_filt_stop=x_fdim; \ 37 | x_filt_stop<=filt_size; \ 38 | y_im++, x_filt_stop+=x_fdim) \ 39 | for (x_im=XSTART ; \ 40 | filt_pos 3: 23 | print 'Usage: zconv2(matrix1, matrix2, center)' 24 | print 'first two input parameters are required' 25 | return 26 | else: 27 | a = numpy.array(args[0]) 28 | b = numpy.array(args[1]) 29 | 30 | # OPTIONAL ARGUMENT 31 | #---------------------------------------------------------------- 32 | 33 | if len(args) == 3: 34 | ctr = args[2] 35 | else: 36 | ctr = 0 37 | 38 | #---------------------------------------------------------------- 39 | 40 | if (a.shape[0] >= b.shape[0]) and (a.shape[1] >= b.shape[1]): 41 | large = a 42 | small = b 43 | elif (a.shape[0] <= b.shape[0]) and (a.shape[1] <= b.shape[1]): 44 | large = b 45 | small = a 46 | else: 47 | print 'Error: one arg must be larger than the other in both dimensions!' 48 | return 49 | 50 | ly = large.shape[0] 51 | lx = large.shape[1] 52 | sy = small.shape[0] 53 | sx = small.shape[1] 54 | 55 | ## These values are the index of the small matrix that falls on the 56 | ## border pixel of the large matrix when computing the first 57 | ## convolution response sample: 58 | sy2 = numpy.floor((sy+ctr+1)/2.0).astype(int)-1 59 | sx2 = numpy.floor((sx+ctr+1)/2.0).astype(int)-1 60 | 61 | clarge = scipy.signal.convolve(large, small, 'full') 62 | 63 | c = clarge[sy2:ly+sy2, sx2:lx+sx2] 64 | 65 | return c 66 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | . 2 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | description-file = README.md -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | from setuptools import setup, Extension 4 | 5 | setup( 6 | name='pyPyrTools', 7 | version='0.2.3', 8 | description='Python tools for multi-scale image processing, including Laplacian pyramids, Wavelets, and Steerable Pyramids', 9 | license='MIT', 10 | url='https://github.com/LabForComputationalVision/pyPyrTools', 11 | author='Eero Simoncelli, Rob Young, and William F. Broderick', 12 | author_email='eero.simoncelli@nyu.edu', 13 | keywords='multi-scale image-processing', 14 | packages=['pyPyrTools'], 15 | package_data={'': ['*.h', 'LICENSE']}, 16 | install_requires=['numpy>=1.1', 17 | 'scipy>=0.18', 18 | 'matplotlib>=1.5', 19 | 'Pillow>=3.4'], 20 | ext_modules=[Extension('wrapConv', 21 | sources=['pyPyrTools/convolve.c', 'pyPyrTools/edges.c', 22 | 'pyPyrTools/wrap.c', 'pyPyrTools/internal_pointOp.c'], 23 | depends=['pyPyrTools/convolve.h', 'pyPyrTools/internal_pointOp.h'], 24 | extra_compile_args=['-fPIC', '-shared'])], 25 | tests='tests', 26 | ) 27 | --------------------------------------------------------------------------------