summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/texture_synthesis
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis')
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/ChangeLog430
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/Contents.m107
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/-MacReadMe1
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.AppleDouble/.Parentbin589 -> 0 bytes
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.FBCIndexbin258048 -> 0 bytes
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.FBCLockFolder/.FBCSemaphoreFilebin6 -> 0 bytes
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-linux39
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-ml6-linux39
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-osx39
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-solaris38
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-sun439
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/convolve.c325
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/convolve.h55
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/convolve.mexglxbin13605 -> 0 bytes
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/corrDn.c145
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/edges.c647
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/edges.mexa64bin16059 -> 0 bytes
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/histo.c140
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.c52
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.dllbin41984 -> 0 bytes
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexa64bin7725 -> 0 bytes
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexglxbin17704 -> 0 bytes
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexlxbin4479 -> 0 bytes
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexmacbin21600 -> 0 bytes
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexsolbin3948 -> 0 bytes
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/pointOp.c126
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/range2.c56
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/upConv.c195
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/wrap.c281
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/README55
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/adjustCorr1s.m63
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/adjustCorr2s.m99
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/binomialFilter.m18
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/blur.m28
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/blurDn.m59
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/buildGpyr.m82
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/buildLpyr.m109
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/buildSCFpyr.m90
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/buildSCFpyrLevs.m73
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/buildSFpyr.m102
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/buildSFpyrLevs.m63
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/buildSpyr.m61
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/buildSpyrLevs.m37
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/buildWpyr.m100
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/cconv2.m50
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/clip.m32
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/corrDn.m63
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/edges-orig.c494
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/einstein.pgmbin65596 -> 0 bytes
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/entropy2.m31
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/expand.m34
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/factorial.m16
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/feynman.pgmbin65593 -> 0 bytes
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/histo.m58
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/histoMatch.m35
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/ifftshift.m15
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/imGradient.m48
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/imStats.m41
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/innerProd.m12
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/kurt2.m24
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/lplot.m43
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/lpyrHt.m11
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/maxPyrHt.m25
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/mccExcludedFiles.log11
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/mean2.m7
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/mkAngle.m32
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/mkAngularSine.m42
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/mkDisc.m61
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/mkFract.m36
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/mkGaussian.m58
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/mkImpulse.m25
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/mkR.m32
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/mkRamp.m47
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/mkSine.m67
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/mkSquare.m89
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/mkZonePlate.m33
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/mod.m14
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/modacor22.m127
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/modkurt.m172
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/modskew.m183
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/modulateFlip.m19
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/namedFilter.m71
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/nextFig.m19
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/pgmRead.m59
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/pgmWrite.m120
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/pixelAxes.m70
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/pointOp.m28
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/pwd2path.m6
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/pyrBand.m11
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/pyrBandIndices.m24
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/pyrLow.m12
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/range2.m18
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/rconv2.m50
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/rcosFn.m45
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/reconLpyr.m83
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/reconSCFpyr.m87
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/reconSFpyr.m108
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/reconSFpyrLevs.m69
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/reconSpyr.m96
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/reconSpyrLevs.m46
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/reconWpyr.m148
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/script_run_profile.m142
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/script_run_profile1.m34
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/setPyrBand.m32
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/shift.m15
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/showIm.m221
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/showLpyr.m202
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/showSpyr.m188
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/showWpyr.m204
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/shrink.m25
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/skew2.m21
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/snr.m10
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/sp0Filters.m72
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/sp1Filters.m91
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/sp3Filters.m121
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/sp5Filters.m110
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/spyrBand.m34
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/spyrHigh.m10
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/spyrHt.m16
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/spyrLev.m24
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/spyrNumBands.m20
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/steer.m68
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/steer2HarmMtx.m71
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/subMtx.m21
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/textureAnalysis.m245
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/textureSynthesis.m436
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/upBlur.m52
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/upConv.m80
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/var2.m17
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/vectify.m8
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/vector.m7
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/wpyrBand.m39
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/wpyrHt.m15
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/wpyrLev.m30
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/zconv2.m41
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/ChangeLog430
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/Contents.m107
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/-MacReadMe1
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/.AppleDouble/.Parentbin589 -> 0 bytes
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/.FBCIndexbin258048 -> 0 bytes
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/.FBCLockFolder/.FBCSemaphoreFilebin6 -> 0 bytes
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/Makefile-linux39
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/Makefile-ml6-linux39
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/Makefile-osx39
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/Makefile-solaris38
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/Makefile-sun439
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/convolve.c325
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/convolve.h55
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/corrDn.c145
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/edges-orig.c494
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/edges.c647
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/histo.c140
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.c52
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.dllbin41984 -> 0 bytes
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.mexglxbin17704 -> 0 bytes
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.mexlxbin4479 -> 0 bytes
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.mexmacbin21600 -> 0 bytes
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.mexsolbin3948 -> 0 bytes
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/pointOp.c126
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/range2.c56
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/upConv.c195
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/wrap.c281
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/README55
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/TUTORIALS/README18
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/TUTORIALS/matlabPyrTools.m145
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/TUTORIALS/pyramids.m903
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/binomialFilter.m18
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/blur.m28
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/blurDn.m59
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildGpyr.m82
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildLpyr.m109
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSCFpyr.m90
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSCFpyrLevs.m73
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSFpyr.m102
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSFpyrLevs.m63
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSpyr.m61
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSpyrLevs.m37
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildWpyr.m100
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/cconv2.m50
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/clip.m32
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/corrDn.m63
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/einstein.pgmbin65596 -> 0 bytes
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/entropy2.m31
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/factorial.m16
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/feynman.pgmbin65593 -> 0 bytes
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/histo.m58
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/histoMatch.m35
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/ifftshift.m15
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/imGradient.m48
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/imStats.m41
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/innerProd.m12
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/kurt2.m24
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/lplot.m43
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/lpyrHt.m11
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/maxPyrHt.m25
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mean2.m7
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkAngle.m32
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkAngularSine.m42
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkDisc.m61
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkFract.m36
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkGaussian.m58
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkImpulse.m25
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkR.m32
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkRamp.m47
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkSine.m67
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkSquare.m89
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkZonePlate.m33
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mod.m14
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/modulateFlip.m19
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/namedFilter.m71
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/nextFig.m19
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pgmRead.m59
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pgmWrite.m120
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pixelAxes.m70
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pointOp.m28
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pwd2path.m6
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pyrBand.m11
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pyrBandIndices.m24
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pyrLow.m12
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/range2.m18
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/rconv2.m50
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/rcosFn.m45
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconLpyr.m83
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconSCFpyr.m87
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconSFpyr.m108
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconSFpyrLevs.m69
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconSpyr.m96
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconSpyrLevs.m46
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconWpyr.m148
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/setPyrBand.m32
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/shift.m15
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/showIm.m221
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/showLpyr.m202
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/showSpyr.m188
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/showWpyr.m204
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/skew2.m21
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/sp0Filters.m72
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/sp1Filters.m91
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/sp3Filters.m121
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/sp5Filters.m110
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/spyrBand.m34
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/spyrHigh.m10
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/spyrHt.m16
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/spyrLev.m24
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/spyrNumBands.m20
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/steer.m68
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/steer2HarmMtx.m71
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/subMtx.m21
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/upBlur.m52
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/upConv.m80
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/var2.m17
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/vectify.m8
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/wpyrBand.m39
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/wpyrHt.m15
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/wpyrLev.m30
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/zconv2.m41
256 files changed, 0 insertions, 19022 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/ChangeLog b/SD-VBS/benchmarks/texture_synthesis/src/matlab/ChangeLog
deleted file mode 100755
index f20c499..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/ChangeLog
+++ /dev/null
@@ -1,430 +0,0 @@
1 Log of changes made to matlabPyrTools code
2 (important changes marked with **)
3-----------------------------------------------------------------------
42004-10-14 Eero Simoncelli <eero@sesto.cns.nyu.edu>
5
6 * Made new tarfile (version 1.3)
7
8 * Incorporated complex-valued steerable pyramid code (buildSCFpyr,
9 buildSCFpyrLevs,reconSCFpyr) written by Javier Portilla in 9/97,
10 and used in our work on texture representation/synthesis
11 (Portilla&Simoncelli, Int'l Journal of Computer Vision,
12 40(1):49-71, Dec 2000).
13
14 * Incorporated imGradient.m from personal code.
15
16 * reagan.pgm out. feynam.pgm in
17
182004-03-20 Eero Simoncelli <eero@sesto.cns.nyu.edu>
19
20 * blur.m added (just calls blurDn and then upBlur).
21
222003-08-06 Eero Simoncelli <eero@sesto.cns.nyu.edu>
23
24 * blurDn.m (filt): Forced correct scaling of filters in 1D
25
262003-05-28 Eero Simoncelli <eero@ferrando.cns.nyu.edu>
27
28 * incorporated setPyrBand.m from local code
29
302002-10-01 Eero Simoncelli <eero.simoncelli@nyu.edu>
31
32 * incorporated clip.m from local code
33
342002-09-18 Eero Simoncelli <eero.simoncelli@nyu.edu>
35
36 * pointOp.m: Added the new 'extrap' option for matlab's interp1 to
37 make this m-file version more compatible with the mex version.
38
39Wed Aug 28 2002 Eero Simoncelli <eero.simoncelli@nyu.edu>
40
41 * var2.m: now returns zero (instead of error) for matrix of size 1.
42 * function VECTORIZE renamed to VECTIFY, since it was colliding
43 with a function introduced in standard matlab.
44
45Dec 27 2001 Eero Simoncelli <eero.simoncelli@nyu.edu>
46
47 * Modified calls to upConv in reconSpyr.m and reconSpyrLevs.m so
48 that the returned result is bound. Previously, had relied on the
49 MEX version of upConv to destructively modify the result array,
50 users had been getting errors because they were using the m-file
51 version of upConv.
52
53Wed Sep 19 2001 Eero Simoncelli <eero.simoncelli@nyu.edu>
54
55 * buildSFpyrLevs/reconSFpyrLevs: replace use of "i" with sqrt(-1), to
56 avoid problems if user rebinds it!
57
58Wed Mar 28 10:22:01 2001 Eero Simoncelli <eero.simoncelli@nyu.edu>
59
60 * Moved innerProd.m and all associated MEX files from the
61 matlabLocal source tree into matlabPyrTools.
62 * Added innerProd to Contents.m
63 * Updated/clarified WARNINGS in all *.m files that have MEX versions.
64
65Tue Mar 27 11:21:53 2001 Eero Simoncelli <eero.simoncelli@nyu.edu>
66
67 * Incorporated Windows MEX files (*.dll) into MEX subdirectory.
68 Windows users should either copy these into the main directory,
69 or put the MEX subdirectory in their matlab path.
70
71Fri Mar 23 14:46:16 2001 Eero Simoncelli <eero.simoncelli@nyu.edu>
72
73 * buildSFpyrLevs.m, reconSFpyrLevs.m: shift the raised-cosine
74 lookup table (Xrcos) instead of incrementing the log-radial image
75 (log_rad). THis is more efficient...
76
77Fri Oct 1 19:37:03 1999 Eero Simoncelli <eero.simoncelli@nyu.edu>
78
79 * upConv.m: Did not return correct size result when STOP argument
80 was passed. Thanks to hertzman@mrl.nyu.edu for pointing this out.
81
82Fri Sep 17 15:53:26 1999 Eero Simoncelli <eero.simoncelli@nyu.edu>
83
84 * buildSFpyrLevs.m: Changed lutsize to 1024, giving a slight
85 increase in accuracy.
86
87Thu Feb 25 18:10:38 1999 Eero Simoncelli <eero.simoncelli@nyu.edu>
88
89 * histo1.m: Modified histo.m to be more compatible (but still not
90 exactly the same) as the MEX file version.
91
92Fri Jun 12 21:15:39 1998 Eero Simoncelli <eero.simoncelli@nyu.edu>
93
94 * TUTORIALS pyramids.m upgraded.
95
96Tue Feb 17 13:22:28 1998 Eero Simoncelli <eero.simoncelli@nyu.edu>
97
98 * showIm.m: Dims are now printed followed by the zoom factor.
99
100Mon Oct 13 14:49:51 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
101
102 * mkSquare.m: Modified to do raised-cosine soft threshold
103 transitions.
104
105Tue Oct 7 10:13:51 1997 Eero Simoncelli <eero@chrysothemis.cims.nyu.edu>
106
107 * upConv.m: Argument order was wrong (this function is not used
108 anyway, unless you don't compile the MEX code). - Thanks to
109 farid@psyche.mit.edu for pointing this out.
110
111Thu Sep 25 16:09:49 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
112
113 * MEX/wrap.c: Changed #include <malloc.h> to <stdlib.h>, as
114 suggested by David Brainard. * Incorporated Mac-compiled mex
115 files, courtesy of David Brainard.
116
117Sat Sep 6 16:10:25 1997 Eero Simoncelli <eero@chrysothemis.cims.nyu.edu>
118
119 * MEX/convolve.h: abstracted out type of images with typedef image_type.
120 Added ansi declarations.
121
122Fri Aug 29 13:49:16 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
123
124 ** showIm.m: Modified to behave better under resizing (and printing):
125 resets axis units to "normalized".
126
127Thu Aug 28 22:56:52 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
128
129 ** MEX/edges.c: reflect1, reflect2, repeat, extend upgraded to work
130 properly for non-symmetric filters. reflect2 and extend were also
131 broken for upConv. Added qreflect2 to handle even-length QMF's
132 which broke under the reflect2 modification.
133 * Added example code to TUTORIALS/matlabPyrTools to illustrate the
134 boundary-handling behavior...
135
136Thu Aug 21 13:34:17 1997 Eero Simoncelli <eero@chrysothemis.cims.nyu.edu>
137
138 * var2, skew2, kurt2: modified to return complex values for complex images.
139 * imStats.m: now gives an error for complex args.
140
141Thu Aug 14 15:24:29 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
142
143 * Modified shift.m: negated the meaning of the offset parameter,
144 such that RES=shift(MTX,OFFSET) means RES(POS)=MTX(POS-OFFSET)
145 (this is more intuitive).
146
147Thu Jul 10 17:06:52 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
148
149 * Modified MEX/Makefile-* to be consistent with matlab5:
150 - call mex instead of cmex
151 - use -V4 flag (creating matlab v4 compatible binaries)
152
153 * showIm.m (xlbl_offset): Modified to use "points" units, so that
154 printed images look correct. Still slightly busted for arbitrary figure
155 window sizes and for printing.
156
157 * Modified upConv.c: does not return ANYTHING if you pass a result
158 argument (this had been causing occasional problems with matlab's
159 memory manager).
160
161Mon Jun 30 12:09:30 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
162
163 * reconSFpyr.m (res): now returns real part (oops).
164
165 * reconSpyrLevs.m (maxLev): got rid of superfluous nbands argument
166 (can be calculated from bfilts).
167
168Mon May 26 12:29:54 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
169
170 * showIm.m/pgmWrite.m: Modified 'auto3'-scaling to use a
171 histogram. This gives a significant speedup.
172
173 * fixed a few minor bugs in the TUTORIALS, having to do with
174 matching image sizes to the machine speed...
175
176Sat May 10 17:27:25 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
177
178 * pgmWrite.m: fixed auto-scaling bug. Added new scaling
179 calculations, parallel to those of imShow.
180
181Fri May 9 09:02:56 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
182
183 * buildSFpyr.m: Changed NBANDS argument to be ORDER, which is one
184 less than the number of orientation bands. This is consistent
185 with the derivative order, and the labels on the spNFilters files.
186
187Tue May 6 19:08:18 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
188
189 ** Added buildSFpyr, reconSFpyr: Steerable pyramids constructed
190 in the Fourier domain. Radial functions tile, with a
191 raised-cosine falloff. Angular functions are
192 cos(theta-k\pi/(K+1))^K, where K is the order (number of bands
193 minus 1). Compared to the convolution version:
194 + Reconstruction is exact (within floating point errors)
195 + Can produce any number of orientation bands.
196 - Typically slower.
197 - Boundary-handling must be circular.
198 Could be made much more efficient by taking advantage of symmetries in
199 the fft!
200
201 * Added example usage of Fourier steerable pyramid to TUTORIALS/pyramids.m
202
203 * steer.m: fixed for harmonic lists including zero.
204
205Sun May 4 15:16:10 1997 Eero Simoncelli <eero@ferrando.cns.nyu.edu>
206
207 * MEX/Makefile-linux: created.
208
209 * spyrHt, spyrNumBands: Modified to return 0 for pyramids of height 0.
210
211 * reconWpyr.m: utilize desctructive addition in calls to upConv.
212
213 * reconSpyr.m: Added error check to ensure consistancy between
214 pyramid and filter file. Utilize destructive addition in upConv
215 call on highpass band. Modified to work properly with pyramids of
216 height 0.
217
218Mon Apr 28 13:38:10 1997 Eero Simoncelli <eero@ferrando.cns.nyu.edu>
219
220 * lplot.m: modified to handle complex vectors, use standard MatLab
221 indices, and show minimal axes. Added xrange parameter to allow
222 adjustment of X axis labeling.
223
224Sun Apr 27 20:20:41 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
225
226 * var2, skew2, kurt2: enhanced to work on complex matrices.
227
228Sat Apr 26 11:16:12 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
229
230 * Changed parent directory (and distribution) name:
231 matlabImTools -> matlabPyrTools
232
233 * namedFilter.m: Added two more Daubechies filters, and modified
234 names to match the reference (e.g., daub2 is now a 4-tap filter).
235
236 * Added vectorize.m: trivial function to pack matrix into vector (i.e.,
237 computes mtx(:)).
238
239 * Added upBlur.m: Upsample and blur (parallels blurDn).
240
241Sun Apr 13 14:23:38 1997 Eero Simoncelli <eero@chrysothemis.cims.nyu.edu>
242
243 * TUTORIALS/pyramids.m: Added plots of Fourier spectra for Wavelet bases.
244
245 * make-tar-file: switched from compress to gzip for the
246 distribution tarfile.
247
248 * namedFilter.m: Added a few even-length QMF's from Johnston80.
249
250Fri Apr 11 19:16:21 1997 Eero Simoncelli <eero@chrysothemis.cims.nyu.edu>
251
252 * buildWpyr.m, reconWpyr.m: Modified slightly, so that subsampling
253 lattice is better for even-length filters.
254
255 * TUTORIALS/pyramids.m: Substantially overhauled.
256
257Thu Apr 10 15:20:23 1997 Eero Simoncelli <eero@chrysothemis.cims.nyu.edu>
258
259 * blurDn.m: added this function to downsample an image by a factor
260 2^L.
261
262 * Fixed minor bug in upConv.m: errors in image size checking.
263
264Mon Apr 7 13:25:37 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
265
266 * Changed TUTORIALS/matlabImTools.m to use histo.mex instead of
267 matlab's hist.
268
269Wed Apr 2 13:20:55 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
270
271 ** Incorporated Denis Pelli's ThinkC and MetroWorks projects for
272 Macintosh versions of the MEX code, along with MEX binaries. These
273 are included as an HQX'ed self-extracting archive
274 (Macintosh-MEX.sit.hqx), in the MEX subdirectory.
275
276Tue Apr 1 15:35:31 1997 Eero Simoncelli <eero@chrysothemis.cims.nyu.edu>
277
278 * edges.c: modified by Denis Pelli to support THINK C. * edges.c:
279
280 * histo.c, upConv.c, corrDn.c: minor changes in error message
281 printouts, to work around bugs in THINK C.
282
283 * Included Denis Pelli's MacReadMe file in the MEX subdirectory,
284 which gives instructions for MEX file compilation on a MacIntosh
285 (PPC or 68k).
286
287 * wrap.c, convolve.c, edges.c: added explicit int function
288 declarations, and return values.
289
290 * range2.m/range2.c: A MEX function for fast min/max computation.
291 Adjusted entropy2.m, histo.m, imStats.m, pgmWrite.m, showIm.m,
292 showLpyr.m, showSpyr.m, showWpyr.m to call it.
293
294Thu Mar 27 17:23:05 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
295
296 ** histo.m/histo.c: Added MEX function HISTO, a fast replacement
297 for matlab's HIST function. Modified histoMatch.m, entropy2.m to
298 call it.
299
300 * Changed main directory name to matlabImTools.
301
302 * Added TUTORIALS/README file.
303
304Wed Mar 19 14:19:51 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
305
306 * Changed directory name: MEX_SRC -> MEX
307
308Wed Mar 12 17:00:03 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
309
310 * mkGaussian.m: fixed another (X,Y) bug: both dimensions and
311 cov/mean are now specified in [y,x] order.
312
313Tue Mar 11 19:08:17 1997 Eero Simoncelli <eero@chrysothemis.cims.nyu.edu>
314
315 * showSpyr.m: Fixed a bug that was dropping display of one
316 orientation band when there were more than 2 of them!
317
318Mon Mar 10 19:08:24 1997 Eero Simoncelli <eero@chrysothemis.cims.nyu.edu>
319
320 * Added shift.m
321
322 * makeSteerMtx -> steerDir2HarmMtx
323
324 * Added TUTORIALS/matlab-EPS.m: examples using the code in this
325 distribution.
326
327Sun Mar 9 17:49:18 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
328
329 ** showIm.m:
330 - args: changed order so that NSHADES is last.
331 - TITLES: Can now pass a string for IM, which will be evaluated
332 in the global environment to get the matrix. The string is
333 used as a title. MATLAB v.5 ONLY!!!
334 - Added 'auto3' RANGE value, that scales based on percentiles.
335 THis is more robust to outliers than 'auto2' or 'auto1'.
336
337 * pixelAxes.m: Made a more serious attempt to reverse-engineer
338 Mathworks' image pixelization. It is improved, but still makes
339 occasional errors.
340
341 * Added skew2.m.
342
343Fri Mar 7 10:11:07 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
344
345 * pixelAxes.m: Modified to take an optional
346 ZOOM argument. Fixed dimension ordering bug
347 (positions are reported (x,y), but mtx dims are (y,x)!)
348
349 * showIm.m: Added an optional ZOOM argument.
350
351Thu Mar 6 14:17:19 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
352
353 * Added showLpyr, showWpyr, showSpyr. Modified
354 TUTORIALS/pyramids.m to use them.
355
356 * added pixelAxes.m: Adjusts size (in pixels) of currently
357 displayed image to be a multiple of the matrix dimensions,
358 thus eliminating display aliasing artifacts.
359 This is now called by all the "show" commands.
360
361Mon Mar 3 17:33:25 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
362
363 * Fixed bug in pgmWrite (dimensions were written in reverse order).
364
365 * Fixed bug in showIm (X and Y coords were swapped on label display).
366
367 * Fixed bug in reconLpyr (swapped X and Y coords on int_sz)
368
369 * Changed calls to "reshape" to pass dimensions individually --
370 older version of matlab do not accept the reshape(mtx,[y x]) form.
371
372 * Fixed bug in mkDisc: sz a scalar.
373
374 * Added ifftshift.m
375
376Fri Feb 28 11:07:20 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
377
378 * Re-worked TUTORIALS/pyramids.m
379
380 * buildGpyr and buildLpyr now use 1+maxPyrHt for default height.
381
382 * Fixed buildGpyr to work on 1D signals.
383
384 ** Gaussian/Laplacian/Wavelet pyramid build and recon functions:
385 - work properly with new corrDn/upConv.
386 - use separable convolutions
387 - use destructive modification ability of upConv (less memory
388 allocation)
389
390 * modulateFlipShift -> modulateFlip.
391
392 * added lpyrHt, wpyrHt, spyrHt to return number of levels in a pyramid.
393
394Thu Feb 27 15:39:53 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
395
396 * Changed angular coordinate systems to CLOCKWISE in mkRamp,
397 mkTheta, mkSine, mkSquare. This is unnatural for screen viewing,
398 but consistent with an origin in the upper left corner of the
399 image, which is the way one addresses the underlying matrix.
400
401 * mkSine and mkSquare can now take a frequency vector or the
402 period and direction args
403
404Tue Feb 25 11:58:33 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
405
406 ** Rewrote corrDn/upConv C routines:
407 - more efficient
408 - changed START parameters to have [1 1] origin, consistent with
409 matlab
410 - added STOP parameters
411 - upConv allows destructive modification of a result arg
412 - changed order of other params (sorry)
413 - wrote test file conv_test.m
414 * wrote zconv2.m
415
416Wed Aug 19 20:39:15 1996 Eero Simoncelli (eero@tarpon.cis.upenn.edu)
417
418 ** Added "pointOp" function (MUCH faster than interp1).
419 ** Added "histoMatch" function.
420
421Fri Aug 2 00:56:31 1996 Eero Simoncelli (eero@tarpon.cis.upenn.edu)
422
423 * Changed all function/file-names to be of the form "fooBar". *
424 Fixed entropy2.m (busted due to typo).
425
426Original convolution code was written in Spring 1986, and comes from
427OBVIUS (Object-Based Vision and Image Understanding System), an
428interactive image-processing system written in Common Lisp (with calls
429to C code).
430
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/Contents.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/Contents.m
deleted file mode 100755
index d19f067..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/Contents.m
+++ /dev/null
@@ -1,107 +0,0 @@
1% Image and Multi-scale Pyramid Tools
2% Version 1.3, October 2004.
3% Created: Early Spring, 1996. Eero Simoncelli, eero.simoncelli@nyu.edu
4%
5% See README file for brief description.
6% See ChangeLog file for latest modifications.
7% See TUTORIALS subdirectory for demonstrations.
8% Type "help <command-name>" for documentation on individual commands.
9% -----------------------------------------------------------------
10% Synthetic Images (matrices):
11% mkImpulse - Make an image containing an impulse.
12% mkRamp - Make an image containing a ramp function.
13% mkR - Make an image containing distance from the origin.
14% mkAngle - Make an image containing angle about origin.
15% mkDisc - Make an image containing a disk image.
16% mkGaussian - Make an image containing a Gaussian function.
17% mkZonePlate - Make an image containing a zone plate (cos(r^2)).
18% mkAngularSine - Make an image containing an angular sine wave (pinwheel).
19% mkSine - Make an image containing a sine grating.
20% mkSquare - Make an image containing a square grating.
21% mkFract - Make an image containing fractal (1/f) noise.
22%
23% Point Operations:
24% clip - clip values to a range.
25% pointOp - Lookup table (much faster than interp1) [MEX file]
26% histo - Efficient histogram computation [MEX file]
27% histoMatch - Modify matrix elements to match specified histogram stats.
28%
29% Convolution (first two are significantly faster):
30% corrDn - Correlate & downsample with boundary-handling [MEX file]
31% upConv - Upsample & convolve with boundary-handling [MEX file]
32% blurDn - Blur and subsample a signal/image.
33% upBlur - Upsample and blur a signal/image.
34% blur - Multi-scale blurring, calls blurDn and then upBlur.
35% cconv2 - Circular convolution.
36% rconv2 - Convolution with reflected boundaries.
37% zconv2 - Convolution assuming zeros beyond image boundaries.
38%
39% General pyramids:
40% pyrLow - Access lowpass subband from (any type of) pyramid
41% pyrBand - Access a subband from (any type of) pyramid
42% setPyrBand - Insert an image into (any type of) pyramid as a subband
43% pyrBandIndices - Returns indices for given band in a pyramid vector
44% maxPyrHt - compute maximum number of scales in a pyramid
45%
46% Gaussian/Laplacian Pyramids:
47% buildGpyr - Build a Gaussian pyramid of an input signal/image.
48% buildLpyr - Build a Laplacian pyramid of an input signal/image.
49% reconLpyr - Reconstruct (invert) the Laplacian pyramid transform.
50%
51% Separable orthonormal QMF/wavelet Pyramids:
52% buildWpyr - Build a separable wavelet representation of an input signal/image.
53% reconWpyr - Reconstruct (invert) the wavelet transform.
54% wpyrBand - Extract a single band of the wavelet representation.
55% wpyrLev - Extract (packed) subbands at a particular level
56% wpyrHt - Number of levels (height) of a wavelet pyramid.
57%
58% Steerable Pyramids:
59% buildSpyr - Build a steerable pyramid representation of an input image.
60% reconSpyr - Reconstruct (invert) the steerable pyramid transform.
61% buildSFpyr - Build a steerable pyramid representation in the Fourier domain.
62% reconSFpyr - Reconstruct (invert) the (Fourier domain) steerable pyramid transform.
63% spyrBand - Extract a single band from a steerable pyramid.
64% spyrHigh - Highpass residual band.
65% spyrLev - A whole level (i.e., all images at a given scale) of a steerable pyramid.
66% spyrHt - Number of levels (height) of a steerable pyramid.
67% spyrNumBands - Number of orientation bands in a steerable pyramid.
68%
69% Steerable filters / derivatives:
70% imGradient - Compute gradient of image using directionally accurete filters.
71% steer - Steer filters (or responses).
72% steer2HarmMtx - Construct a matrix mapping direcional basis to angular harmonics.
73%
74% Filters:
75% binomialFilter - returns a filter of binomial coefficients.
76% namedFilter - some typical Laplacian/Wavelet pyramid filters
77% spNFilters - Set of Nth order steerable pyramid filters.
78% derivNFiltersS - Matched set of S-tap 1D derivatives, orders 0 to N.
79%
80% Display:
81% showIm - Display a matrix (real or complex) as grayscale image(s).
82% Displays dimensions, subsampling, and range of pixel values.
83% showLpyr - Display a Laplacian pyramid.
84% showWpyr - Display a separable wavelet pyramid.
85% showSpyr - Display a steerable pyramid.
86% lplot - "lollipop" plot.
87% nextFig - Make next figure window current.
88% pixelAxes - Make image display use an integer number of pixels
89% per sample to avoid resampling artifacts.
90%
91% Statistics (for 2D Matrices):
92% range2 - Min and max of image (matrix) [MEX file]
93% mean2 - Sample mean of an image (matrix).
94% var2 - Sample variance of an image (matrix).
95% skew2 - Sample skew (3rd moment / variance^1.5) of an image (matrix).
96% kurt2 - Sample kurtosis (4th moment / variance^2) of an image (matrix).
97% entropy2 - Sample entropy of an image (matrix).
98% imStats - Report sample statistics of an image, or pair of images.
99%
100% Miscellaneous:
101% pgmRead - Load a "pgm" image into a MatLab matrix [try einstein.pgm,feynman.pgm]
102% pgmWrite - Write a MatLab matrix to a "pgm" image file.
103% shift - circular shift a 2D matrix by an arbitrary amount.
104% vectify - pack matrix into column vector (i.e., function to compute mtx(:)).
105% ifftshift - inverse of MatLab's FFTSHIFT (differs for odd-length dimensions)
106% rcosFn - return a lookup table of a raised-cosine threshold fn.
107% innerProd - Compute M'*M efficiently (i.e., do not copy) [MEX file]
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/-MacReadMe b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/-MacReadMe
deleted file mode 100755
index 898dc0c..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/-MacReadMe
+++ /dev/null
@@ -1 +0,0 @@
1MacReadMe How to compile a MEX file for Macintosh (Based on a similar note written by David Brainard and Denis Pelli to accompany the Psychophysics Toolbox.) A MEX file (short for "MATLAB extension") contains code that implements a new MATLAB function, allowing users to use the full power of the C language and the Macintosh hardware and operating system in implementing a new MATLAB function. This document explains how to produce a MEX file that is "fat" (i.e. will run as native code on both 68K and PowerPC Macs) and is compatible with both MATLAB 4 and 5. 1) To produce a MATLAB MEX file with PowerPC code you must have the Metrowerks CodeWarrior C compiler (version 10 or better, abbreviated as CW below). To produce 68K code we still use the Symantec THINK C compiler (version from Symantec C++ 8 CD-ROM release 5), but we will soon be switching to Metrowerks CodeWarrior. (See note A below.) 2) Place a copy of the MATLAB 4:Extern folder, supplied by Mathworks, on your compiler's search path. We suggest that you name the copy "MEX V4". (See notes B and C, below.) 3) Build any of the MEX files simply by opening its project file and asking your compiler to "Build Code Resource" (in THINK C) or to "Make" it (in CW). For each MEX file, e.g. histo.mex, there are two associated projects, e.g. histo.µ for CW, and histo.¹.4 for THINK C. To build a "fat" MEX, that runs native on both 68K and PowerPC, you should first compile in THINK C, and then in CW. (See note A, below.) Denis Pelli April 2, 1997 Notes A) The Mathworks support only the THINK C compiler to make 68K MEX code for MATLAB version 4 and only the CW compiler to make PPC MEX files for MATLAB 4 and both 68K and PPC for MATLAB 5. This archive includes THINK and CW projects. To build a fat MEX file for MATLAB 4, first "make" the THINK C version (e.g. histo.¹.4), producing a file with a .rsrc extension (e.g. histo.µ.rsrc). This is the 68K MEX file. When you then "make" histo.µ, the CW project incorporates the .rsrc file and generates a "fat" MEX file that will run native (i.e. fast) on both 68K and PowerPC. To make a 68K-only MEX file, simply rename, e.g., histo.µ.rsrc to histo.mex after you make the THINK project, and set the file type and creator to match the other MEX files. THINK C is slow and hard to work with. Symantec hasn't significantly upgraded in it many years. There is an error in the math.h header (version from Symantec C++ 8 CD-ROM release 5). We fix that error by some tricky preprocessor defines and undefines in the THINK C Prefix in each of the THINK projects. B) The easiest way to put a folder on your compilerÕs search path is simply to put the folder in the same folder as the compiler itself. If you want to use both CW and THINK C, then put the folder under CW, make an alias of it, and put the alias in THINK C's "Aliases" folder. C) Happily, MATLAB 5 is capable of running both V4 and V5 MEX files. Thus we are currently distributing sources that compile into V4 MEX files. The resulting MEX files run both under V4 and V5. In the future we will drop support for V4 and THINK C. (See note A above.) \ No newline at end of file
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.AppleDouble/.Parent b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.AppleDouble/.Parent
deleted file mode 100755
index f242a99..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.AppleDouble/.Parent
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.FBCIndex b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.FBCIndex
deleted file mode 100755
index 848736b..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.FBCIndex
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.FBCLockFolder/.FBCSemaphoreFile b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.FBCLockFolder/.FBCSemaphoreFile
deleted file mode 100755
index ab2c684..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.FBCLockFolder/.FBCSemaphoreFile
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-linux b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-linux
deleted file mode 100755
index 726dd31..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-linux
+++ /dev/null
@@ -1,39 +0,0 @@
1MLAB = /usr/local/matlab5.1
2
3MXSFX = mexlx
4MEX = ${MLAB}/bin/mex
5
6MFLAGS = -V4
7INC = -I ${MLAB}/extern/include
8LIB = -L ${MLAB}/extern/lib
9
10CC = gcc -Wall -pedantic
11C_OPTIMIZE_SWITCH = -O2 ## For GCC
12CFLAGS = ${C_OPTIMIZE_SWITCH} ${INC} ${LIB}
13
14all: corrDn.${MXSFX} upConv.${MXSFX} pointOp.${MXSFX} \
15 histo.${MXSFX} range2.${MXSFX}
16
17clean:
18 /bin/rm *.o
19
20corrDn.${MXSFX}: corrDn.o wrap.o convolve.o edges.o
21 ${MEX} ${MFLAGS} corrDn.o wrap.o convolve.o edges.o
22
23upConv.${MXSFX}: upConv.o wrap.o convolve.o edges.o
24 ${MEX} ${MFLAGS} upConv.o wrap.o convolve.o edges.o
25
26pointOp.${MXSFX}: pointOp.o
27 ${MEX} ${MFLAGS} pointOp.o
28
29histo.${MXSFX}: histo.o
30 ${MEX} ${MFLAGS} histo.o
31
32range2.${MXSFX}: range2.o
33 ${MEX} ${MFLAGS} range2.o
34
35convolve.o wrap.o edges.o: convolve.h
36
37%.o : %.c
38 ${CC} -c ${CFLAGS} $<
39
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-ml6-linux b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-ml6-linux
deleted file mode 100755
index f596ad7..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-ml6-linux
+++ /dev/null
@@ -1,39 +0,0 @@
1MLAB = /usr/local/matlab6.0
2
3MXSFX = mexglx
4MEX = ${MLAB}/bin/mex
5
6MFLAGS = -V4
7INC = -I ${MLAB}/extern/include
8LIB = -L ${MLAB}/extern/lib
9
10CC = gcc -Wall -pedantic
11C_OPTIMIZE_SWITCH = -O2 ## For GCC
12CFLAGS = ${C_OPTIMIZE_SWITCH} ${INC} ${LIB}
13
14all: corrDn.${MXSFX} upConv.${MXSFX} pointOp.${MXSFX} \
15 histo.${MXSFX} range2.${MXSFX}
16
17clean:
18 /bin/rm *.o
19
20corrDn.${MXSFX}: corrDn.o wrap.o convolve.o edges.o
21 ${MEX} ${MFLAGS} corrDn.o wrap.o convolve.o edges.o
22
23upConv.${MXSFX}: upConv.o wrap.o convolve.o edges.o
24 ${MEX} ${MFLAGS} upConv.o wrap.o convolve.o edges.o
25
26pointOp.${MXSFX}: pointOp.o
27 ${MEX} ${MFLAGS} pointOp.o
28
29histo.${MXSFX}: histo.o
30 ${MEX} ${MFLAGS} histo.o
31
32range2.${MXSFX}: range2.o
33 ${MEX} ${MFLAGS} range2.o
34
35convolve.o wrap.o edges.o: convolve.h
36
37%.o : %.c
38 ${CC} -c ${CFLAGS} $<
39
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-osx b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-osx
deleted file mode 100755
index 352d15b..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-osx
+++ /dev/null
@@ -1,39 +0,0 @@
1MLAB = /share/wotan/matlab13
2
3MXSFX = mexosx
4MEX = ${MLAB}/bin/mex
5
6MFLAGS =
7INC = -I ${MLAB}/extern/include
8LIB = -L ${MLAB}/extern/lib
9
10CC = cc -Wall -pedantic -no-cpp-precomp
11C_OPTIMIZE_SWITCH = -O2 ## For GCC
12CFLAGS = ${C_OPTIMIZE_SWITCH} ${INC} ${LIB}
13
14all: corrDn.${MXSFX} upConv.${MXSFX} pointOp.${MXSFX} \
15 histo.${MXSFX} range2.${MXSFX}
16
17clean:
18 /bin/rm *.o
19
20corrDn.${MXSFX}: corrDn.o wrap.o convolve.o edges.o
21 ${MEX} ${MFLAGS} corrDn.o wrap.o convolve.o edges.o
22
23upConv.${MXSFX}: upConv.o wrap.o convolve.o edges.o
24 ${MEX} ${MFLAGS} upConv.o wrap.o convolve.o edges.o
25
26pointOp.${MXSFX}: pointOp.o
27 ${MEX} ${MFLAGS} pointOp.o
28
29histo.${MXSFX}: histo.o
30 ${MEX} ${MFLAGS} histo.o
31
32range2.${MXSFX}: range2.o
33 ${MEX} ${MFLAGS} range2.o
34
35convolve.o wrap.o edges.o: convolve.h
36
37%.o : %.c
38 ${CC} -c ${CFLAGS} $<
39
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-solaris b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-solaris
deleted file mode 100755
index 2be2bdb..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-solaris
+++ /dev/null
@@ -1,38 +0,0 @@
1MLAB = /export/home/Solaris2/matlab5.1
2
3MXSFX = mexsol
4MEX = ${MLAB}/bin/mex
5
6MFLAGS = -V4
7INC = -I ${MLAB}/extern/include
8LIB = -L ${MLAB}/extern/lib
9
10CC = gcc -Wall -pedantic
11C_OPTIMIZE_SWITCH = -O2 ## For GCC
12CFLAGS = ${C_OPTIMIZE_SWITCH} ${INC} ${LIB}
13
14all: corrDn.${MXSFX} upConv.${MXSFX} pointOp.${MXSFX} \
15 histo.${MXSFX} range2.${MXSFX}
16
17clean:
18 /bin/rm *.o
19
20corrDn.${MXSFX}: corrDn.o wrap.o convolve.o edges.o
21 ${MEX} ${MFLAGS} corrDn.o wrap.o convolve.o edges.o
22
23upConv.${MXSFX}: upConv.o wrap.o convolve.o edges.o
24 ${MEX} ${MFLAGS} upConv.o wrap.o convolve.o edges.o
25
26pointOp.${MXSFX}: pointOp.o
27 ${MEX} ${MFLAGS} pointOp.o
28
29histo.${MXSFX}: histo.o
30 ${MEX} ${MFLAGS} histo.o
31
32range2.${MXSFX}: range2.o
33 ${MEX} ${MFLAGS} range2.o
34
35convolve.o wrap.o edges.o: convolve.h
36
37%.o : %.c
38 ${CC} -c ${CFLAGS} $<
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-sun4 b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-sun4
deleted file mode 100755
index 432b181..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-sun4
+++ /dev/null
@@ -1,39 +0,0 @@
1MLAB = /home/alberich/matlab4
2
3MXSFX = mex4
4MEX = ${MLAB}/bin/cmex
5
6MFLAGS =
7INC = -I ${MLAB}/extern/include
8LIB = -L ${MLAB}/extern/lib/sun4
9
10CC = gcc
11C_OPTIMIZE_SWITCH = -O2 ## For GCC
12CFLAGS = ${C_OPTIMIZE_SWITCH} ${INC} ${LIB}
13
14all: corrDn.${MXSFX} upConv.${MXSFX} pointOp.${MXSFX} \
15 histo.${MXSFX} range2.${MXSFX}
16
17clean:
18 /bin/rm *.o
19
20corrDn.${MXSFX}: corrDn.o wrap.o convolve.o edges.o
21 ${MEX} ${MFLAGS} corrDn.o wrap.o convolve.o edges.o
22
23upConv.${MXSFX}: upConv.o wrap.o convolve.o edges.o
24 ${MEX} ${MFLAGS} upConv.o wrap.o convolve.o edges.o
25
26pointOp.${MXSFX}: pointOp.o
27 ${MEX} ${MFLAGS} pointOp.o
28
29histo.${MXSFX}: histo.o
30 ${MEX} ${MFLAGS} histo.o
31
32range2.${MXSFX}: range2.o
33 ${MEX} ${MFLAGS} range2.o
34
35convolve.o wrap.o edges.o: convolve.h
36
37%.o : %.c
38 ${CC} -c ${CFLAGS} $<
39
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/convolve.c b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/convolve.c
deleted file mode 100755
index 60a11a4..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/convolve.c
+++ /dev/null
@@ -1,325 +0,0 @@
1/*
2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3;;; File: convolve.c
4;;; Author: Eero Simoncelli
5;;; Description: General convolution code for 2D images
6;;; Creation Date: Spring, 1987.
7;;; MODIFICATIONS:
8;;; 10/89: approximately optimized the choice of register vars on SPARCS.
9;;; 6/96: Switched array types to double float.
10;;; 2/97: made more robust and readable. Added STOP arguments.
11;;; 8/97: Bug: when calling internal_reduce with edges in {reflect1,repeat,
12;;; extend} and an even filter dimension. Solution: embed the filter
13;;; in the upper-left corner of a filter with odd Y and X dimensions.
14;;; ----------------------------------------------------------------
15;;; Object-Based Vision and Image Understanding System (OBVIUS),
16;;; Copyright 1988, Vision Science Group, Media Laboratory,
17;;; Massachusetts Institute of Technology.
18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
19*/
20
21#include <stdio.h>
22#include <math.h>
23#include "convolve.h"
24
25/*
26 --------------------------------------------------------------------
27 Correlate FILT with IMAGE, subsampling according to START, STEP, and
28 STOP parameters, with values placed into RESULT array. RESULT
29 dimensions should be ceil((stop-start)/step). TEMP should be a
30 pointer to a temporary double array the size of the filter.
31 EDGES is a string specifying how to handle boundaries -- see edges.c.
32 The convolution is done in 9 sections, where the border sections use
33 specially computed edge-handling filters (see edges.c). The origin
34 of the filter is assumed to be (floor(x_fdim/2), floor(y_fdim/2)).
35------------------------------------------------------------------------ */
36
37/* abstract out the inner product computation */
38#define INPROD(XCNR,YCNR) \
39 { \
40 sum=0.0; \
41 for (im_pos=YCNR*x_dim+XCNR, filt_pos=0, x_filt_stop=x_fdim; \
42 x_filt_stop<=filt_size; \
43 im_pos+=(x_dim-x_fdim), x_filt_stop+=x_fdim) \
44 for (; \
45 filt_pos<x_filt_stop; \
46 filt_pos++, im_pos++) \
47 sum+= image[im_pos]*temp[filt_pos]; \
48 result[res_pos] = sum; \
49 }
50
51int internal_reduce(image, x_dim, y_dim, filt, temp, x_fdim, y_fdim,
52 x_start, x_step, x_stop, y_start, y_step, y_stop,
53 result, edges)
54 register image_type *image, *temp;
55 register int x_fdim, x_dim;
56 register image_type *result;
57 register int x_step, y_step;
58 int x_start, y_start;
59 int x_stop, y_stop;
60 image_type *filt;
61 int y_dim, y_fdim;
62 char *edges;
63 {
64 register double sum;
65 register int filt_pos, im_pos, x_filt_stop;
66 register int x_pos, filt_size = x_fdim*y_fdim;
67 register int y_pos, res_pos;
68 register int y_ctr_stop = y_dim - ((y_fdim==1)?0:y_fdim);
69 register int x_ctr_stop = x_dim - ((x_fdim==1)?0:x_fdim);
70 register int x_res_dim = (x_stop-x_start+x_step-1)/x_step;
71 int x_ctr_start = ((x_fdim==1)?0:1);
72 int y_ctr_start = ((y_fdim==1)?0:1);
73 int x_fmid = x_fdim/2;
74 int y_fmid = y_fdim/2;
75 int base_res_pos;
76 fptr reflect = edge_function(edges); /* look up edge-handling function */
77
78 if (!reflect) return(-1);
79
80 /* shift start/stop coords to filter upper left hand corner */
81 x_start -= x_fmid; y_start -= y_fmid;
82 x_stop -= x_fmid; y_stop -= y_fmid;
83
84 if (x_stop < x_ctr_stop) x_ctr_stop = x_stop;
85 if (y_stop < y_ctr_stop) y_ctr_stop = y_stop;
86
87 for (res_pos=0, y_pos=y_start; /* TOP ROWS */
88 y_pos<y_ctr_start;
89 y_pos+=y_step)
90 {
91 for (x_pos=x_start; /* TOP-LEFT CORNER */
92 x_pos<x_ctr_start;
93 x_pos+=x_step, res_pos++)
94 {
95 (*reflect)(filt,x_fdim,y_fdim,x_pos-1,y_pos-1,temp,REDUCE);
96 INPROD(0,0)
97 }
98
99 (*reflect)(filt,x_fdim,y_fdim,0,y_pos-1,temp,REDUCE);
100 for (; /* TOP EDGE */
101 x_pos<x_ctr_stop;
102 x_pos+=x_step, res_pos++)
103 INPROD(x_pos,0)
104
105 for (; /* TOP-RIGHT CORNER */
106 x_pos<x_stop;
107 x_pos+=x_step, res_pos++)
108 {
109 (*reflect)(filt,x_fdim,y_fdim,x_pos-x_ctr_stop+1,y_pos-1,temp,REDUCE);
110 INPROD(x_ctr_stop,0)
111 }
112 } /* end TOP ROWS */
113
114 y_ctr_start = y_pos; /* hold location of top */
115 for (base_res_pos=res_pos, x_pos=x_start; /* LEFT EDGE */
116 x_pos<x_ctr_start;
117 x_pos+=x_step, base_res_pos++)
118 {
119 (*reflect)(filt,x_fdim,y_fdim,x_pos-1,0,temp,REDUCE);
120 for (y_pos=y_ctr_start, res_pos=base_res_pos;
121 y_pos<y_ctr_stop;
122 y_pos+=y_step, res_pos+=x_res_dim)
123 INPROD(0,y_pos)
124 }
125
126 (*reflect)(filt,x_fdim,y_fdim,0,0,temp,REDUCE);
127 for (; /* CENTER */
128 x_pos<x_ctr_stop;
129 x_pos+=x_step, base_res_pos++)
130 for (y_pos=y_ctr_start, res_pos=base_res_pos;
131 y_pos<y_ctr_stop;
132 y_pos+=y_step, res_pos+=x_res_dim)
133 INPROD(x_pos,y_pos)
134
135 for (; /* RIGHT EDGE */
136 x_pos<x_stop;
137 x_pos+=x_step, base_res_pos++)
138 {
139 (*reflect)(filt,x_fdim,y_fdim,x_pos-x_ctr_stop+1,0,temp,REDUCE);
140 for (y_pos=y_ctr_start, res_pos=base_res_pos;
141 y_pos<y_ctr_stop;
142 y_pos+=y_step, res_pos+=x_res_dim)
143 INPROD(x_ctr_stop,y_pos)
144 }
145
146 for (res_pos-=(x_res_dim-1);
147 y_pos<y_stop; /* BOTTOM ROWS */
148 y_pos+=y_step)
149 {
150 for (x_pos=x_start; /* BOTTOM-LEFT CORNER */
151 x_pos<x_ctr_start;
152 x_pos+=x_step, res_pos++)
153 {
154 (*reflect)(filt,x_fdim,y_fdim,x_pos-1,y_pos-y_ctr_stop+1,temp,REDUCE);
155 INPROD(0,y_ctr_stop)
156 }
157
158 (*reflect)(filt,x_fdim,y_fdim,0,y_pos-y_ctr_stop+1,temp,REDUCE);
159 for (; /* BOTTOM EDGE */
160 x_pos<x_ctr_stop;
161 x_pos+=x_step, res_pos++)
162 INPROD(x_pos,y_ctr_stop)
163
164 for (; /* BOTTOM-RIGHT CORNER */
165 x_pos<x_stop;
166 x_pos+=x_step, res_pos++)
167 {
168 (*reflect)(filt,x_fdim,y_fdim,x_pos-x_ctr_stop+1,y_pos-y_ctr_stop+1,temp,REDUCE);
169 INPROD(x_ctr_stop,y_ctr_stop)
170 }
171 } /* end BOTTOM */
172 return(0);
173 } /* end of internal_reduce */
174
175
176/*
177 --------------------------------------------------------------------
178 Upsample IMAGE according to START,STEP, and STOP parameters and then
179 convolve with FILT, adding values into RESULT array. IMAGE
180 dimensions should be ceil((stop-start)/step). See
181 description of internal_reduce (above).
182
183 WARNING: this subroutine destructively modifies the RESULT array!
184 ------------------------------------------------------------------------ */
185
186/* abstract out the inner product computation */
187#define INPROD2(XCNR,YCNR) \
188 { \
189 val = image[im_pos]; \
190 for (res_pos=YCNR*x_dim+XCNR, filt_pos=0, x_filt_stop=x_fdim; \
191 x_filt_stop<=filt_size; \
192 res_pos+=(x_dim-x_fdim), x_filt_stop+=x_fdim) \
193 for (; \
194 filt_pos<x_filt_stop; \
195 filt_pos++, res_pos++) \
196 result[res_pos] += val*temp[filt_pos]; \
197 }
198
199int internal_expand(image,filt,temp,x_fdim,y_fdim,
200 x_start,x_step,x_stop,y_start,y_step,y_stop,
201 result,x_dim,y_dim,edges)
202 register image_type *result, *temp;
203 register int x_fdim, x_dim;
204 register int x_step, y_step;
205 register image_type *image;
206 int x_start, y_start;
207 image_type *filt;
208 int y_fdim, y_dim;
209 char *edges;
210 {
211 register double val;
212 register int filt_pos, res_pos, x_filt_stop;
213 register int x_pos, filt_size = x_fdim*y_fdim;
214 register int y_pos, im_pos;
215 register int x_ctr_stop = x_dim - ((x_fdim==1)?0:x_fdim);
216 int y_ctr_stop = (y_dim - ((y_fdim==1)?0:y_fdim));
217 int x_ctr_start = ((x_fdim==1)?0:1);
218 int y_ctr_start = ((y_fdim==1)?0:1);
219 int x_fmid = x_fdim/2;
220 int y_fmid = y_fdim/2;
221 int base_im_pos, x_im_dim = (x_stop-x_start+x_step-1)/x_step;
222 fptr reflect = edge_function(edges); /* look up edge-handling function */
223
224 if (!reflect) return(-1);
225
226 /* shift start/stop coords to filter upper left hand corner */
227 x_start -= x_fmid; y_start -= y_fmid;
228 x_stop -= x_fmid; y_stop -= y_fmid;
229
230 if (x_stop < x_ctr_stop) x_ctr_stop = x_stop;
231 if (y_stop < y_ctr_stop) y_ctr_stop = y_stop;
232
233 for (im_pos=0, y_pos=y_start; /* TOP ROWS */
234 y_pos<y_ctr_start;
235 y_pos+=y_step)
236 {
237 for (x_pos=x_start; /* TOP-LEFT CORNER */
238 x_pos<x_ctr_start;
239 x_pos+=x_step, im_pos++)
240 {
241 (*reflect)(filt,x_fdim,y_fdim,x_pos-1,y_pos-1,temp,EXPAND);
242 INPROD2(0,0)
243 }
244
245 (*reflect)(filt,x_fdim,y_fdim,0,y_pos-1,temp,EXPAND);
246 for (; /* TOP EDGE */
247 x_pos<x_ctr_stop;
248 x_pos+=x_step, im_pos++)
249 INPROD2(x_pos,0)
250
251 for (; /* TOP-RIGHT CORNER */
252 x_pos<x_stop;
253 x_pos+=x_step, im_pos++)
254 {
255 (*reflect)(filt,x_fdim,y_fdim,x_pos-x_ctr_stop+1,y_pos-1,temp,EXPAND);
256 INPROD2(x_ctr_stop,0)
257 }
258 } /* end TOP ROWS */
259
260 y_ctr_start = y_pos; /* hold location of top */
261 for (base_im_pos=im_pos, x_pos=x_start; /* LEFT EDGE */
262 x_pos<x_ctr_start;
263 x_pos+=x_step, base_im_pos++)
264 {
265 (*reflect)(filt,x_fdim,y_fdim,x_pos-1,0,temp,EXPAND);
266 for (y_pos=y_ctr_start, im_pos=base_im_pos;
267 y_pos<y_ctr_stop;
268 y_pos+=y_step, im_pos+=x_im_dim)
269 INPROD2(0,y_pos)
270 }
271
272 (*reflect)(filt,x_fdim,y_fdim,0,0,temp,EXPAND);
273 for (; /* CENTER */
274 x_pos<x_ctr_stop;
275 x_pos+=x_step, base_im_pos++)
276 for (y_pos=y_ctr_start, im_pos=base_im_pos;
277 y_pos<y_ctr_stop;
278 y_pos+=y_step, im_pos+=x_im_dim)
279 INPROD2(x_pos,y_pos)
280
281 for (; /* RIGHT EDGE */
282 x_pos<x_stop;
283 x_pos+=x_step, base_im_pos++)
284 {
285 (*reflect)(filt,x_fdim,y_fdim,x_pos-x_ctr_stop+1,0,temp,EXPAND);
286 for (y_pos=y_ctr_start, im_pos=base_im_pos;
287 y_pos<y_ctr_stop;
288 y_pos+=y_step, im_pos+=x_im_dim)
289 INPROD2(x_ctr_stop,y_pos)
290 }
291
292 for (im_pos-=(x_im_dim-1);
293 y_pos<y_stop; /* BOTTOM ROWS */
294 y_pos+=y_step)
295 {
296 for (x_pos=x_start; /* BOTTOM-LEFT CORNER */
297 x_pos<x_ctr_start;
298 x_pos+=x_step, im_pos++)
299 {
300 (*reflect)(filt,x_fdim,y_fdim,x_pos-1,y_pos-y_ctr_stop+1,temp,EXPAND);
301 INPROD2(0,y_ctr_stop)
302 }
303
304 (*reflect)(filt,x_fdim,y_fdim,0,y_pos-y_ctr_stop+1,temp,EXPAND);
305 for (; /* BOTTOM EDGE */
306 x_pos<x_ctr_stop;
307 x_pos+=x_step, im_pos++)
308 INPROD2(x_pos,y_ctr_stop)
309
310 for (; /* BOTTOM-RIGHT CORNER */
311 x_pos<x_stop;
312 x_pos+=x_step, im_pos++)
313 {
314 (*reflect)(filt,x_fdim,y_fdim,x_pos-x_ctr_stop+1,y_pos-y_ctr_stop+1,temp,EXPAND);
315 INPROD2(x_ctr_stop,y_ctr_stop)
316 }
317 } /* end BOTTOM */
318 return(0);
319 } /* end of internal_expand */
320
321
322/* Local Variables: */
323/* buffer-read-only: t */
324/* End: */
325
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/convolve.h b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/convolve.h
deleted file mode 100755
index 48d55f7..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/convolve.h
+++ /dev/null
@@ -1,55 +0,0 @@
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 <stdio.h>
15#include <stdlib.h>
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
26typedef int (*fptr)();
27
28typedef struct
29 {
30 char *name;
31 fptr func;
32 } EDGE_HANDLER;
33
34typedef double image_type;
35
36fptr edge_function(char *edges);
37int 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);
42int 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);
47int 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);
52int 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);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/convolve.mexglx b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/convolve.mexglx
deleted file mode 100755
index 2dea157..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/convolve.mexglx
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/corrDn.c b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/corrDn.c
deleted file mode 100755
index c74df1f..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/corrDn.c
+++ /dev/null
@@ -1,145 +0,0 @@
1/*
2RES = corrDn(IM, FILT, EDGES, STEP, START, STOP);
3 >>> See corrDn.m for documentation <<<
4 This is a matlab interface to the internal_reduce function.
5 EPS, 7/96.
6*/
7
8#define V4_COMPAT
9#include <matrix.h> /* Matlab matrices */
10#include <mex.h>
11
12#include "convolve.h"
13
14#define notDblMtx(it) (!mxIsNumeric(it) || !mxIsDouble(it) || mxIsSparse(it) || mxIsComplex(it))
15
16void mexFunction(int nlhs, /* Num return vals on lhs */
17 mxArray *plhs[], /* Matrices on lhs */
18 int nrhs, /* Num args on rhs */
19 const mxArray *prhs[] /* Matrices on rhs */
20 )
21 {
22 double *image,*filt, *temp, *result;
23 int x_fdim, y_fdim, x_idim, y_idim;
24 int x_rdim, y_rdim;
25 int x_start = 1;
26 int x_step = 1;
27 int y_start = 1;
28 int y_step = 1;
29 int x_stop, y_stop;
30 mxArray *arg;
31 double *mxMat;
32 char edges[15] = "reflect1";
33
34 if (nrhs<2) mexErrMsgTxt("requres at least 2 args.");
35
36 /* ARG 1: IMAGE */
37 arg = prhs[0];
38 if notDblMtx(arg) mexErrMsgTxt("IMAGE arg must be a non-sparse double float matrix.");
39 image = mxGetPr(arg);
40 x_idim = (int) mxGetM(arg); /* X is inner index! */
41 y_idim = (int) mxGetN(arg);
42
43 /* ARG 2: FILTER */
44 arg = prhs[1];
45 if notDblMtx(arg) mexErrMsgTxt("FILTER arg must be non-sparse double float matrix.");
46 filt = mxGetPr(arg);
47 x_fdim = (int) mxGetM(arg);
48 y_fdim = (int) mxGetN(arg);
49
50 if ((x_fdim > x_idim) || (y_fdim > y_idim))
51 {
52 mexPrintf("Filter: [%d %d], Image: [%d %d]\n",x_fdim,y_fdim,x_idim,y_idim);
53 mexErrMsgTxt("FILTER dimensions larger than IMAGE dimensions.");
54 }
55
56 /* ARG 3 (optional): EDGES */
57 if (nrhs>2)
58 {
59 if (!mxIsChar(prhs[2]))
60 mexErrMsgTxt("EDGES arg must be a string.");
61 mxGetString(prhs[2],edges,15);
62 }
63
64 /* ARG 4 (optional): STEP */
65 if (nrhs>3)
66 {
67 arg = prhs[3];
68 if notDblMtx(arg) mexErrMsgTxt("STEP arg must be a double float matrix.");
69 if (mxGetM(arg) * mxGetN(arg) != 2)
70 mexErrMsgTxt("STEP arg must contain two elements.");
71 mxMat = mxGetPr(arg);
72 x_step = (int) mxMat[0];
73 y_step = (int) mxMat[1];
74 if ((x_step<1) || (y_step<1))
75 mexErrMsgTxt("STEP values must be greater than zero.");
76 }
77
78 /* ARG 5 (optional): START */
79 if (nrhs>4)
80 {
81 arg = prhs[4];
82 if notDblMtx(arg) mexErrMsgTxt("START arg must be a double float matrix.");
83 if (mxGetM(arg) * mxGetN(arg) != 2)
84 mexErrMsgTxt("START arg must contain two elements.");
85 mxMat = mxGetPr(arg);
86 x_start = (int) mxMat[0];
87 y_start = (int) mxMat[1];
88 if ((x_start<1) || (x_start>x_idim) ||
89 (y_start<1) || (y_start>y_idim))
90 mexErrMsgTxt("START values must lie between 1 and the image dimensions.");
91 }
92 x_start--; /* convert from Matlab to standard C indexes */
93 y_start--;
94
95 /* ARG 6 (optional): STOP */
96 if (nrhs>5)
97 {
98 if notDblMtx(prhs[5]) mexErrMsgTxt("STOP arg must be double float matrix.");
99 if (mxGetM(prhs[5]) * mxGetN(prhs[5]) != 2)
100 mexErrMsgTxt("STOP arg must contain two elements.");
101 mxMat = mxGetPr(prhs[5]);
102 x_stop = (int) mxMat[0];
103 y_stop = (int) mxMat[1];
104 if ((x_stop<x_start) || (x_stop>x_idim) ||
105 (y_stop<y_start) || (y_stop>y_idim))
106 mexErrMsgTxt("STOP values must lie between START and the image dimensions.");
107 }
108 else
109 {
110 x_stop = x_idim;
111 y_stop = y_idim;
112 }
113
114 x_rdim = (x_stop-x_start+x_step-1) / x_step;
115 y_rdim = (y_stop-y_start+y_step-1) / y_step;
116
117 /* mxFreeMatrix(plhs[0]); */
118 plhs[0] = (mxArray *) mxCreateDoubleMatrix(x_rdim,y_rdim,mxREAL);
119 if (plhs[0] == NULL) mexErrMsgTxt("Cannot allocate result matrix");
120 result = mxGetPr(plhs[0]);
121
122 temp = mxCalloc(x_fdim*y_fdim, sizeof(double));
123 if (temp == NULL)
124 mexErrMsgTxt("Cannot allocate necessary temporary space");
125
126 /*
127 printf("i(%d, %d), f(%d, %d), r(%d, %d), X(%d, %d, %d), Y(%d, %d, %d), %s\n",
128 x_idim,y_idim,x_fdim,y_fdim,x_rdim,y_rdim,
129 x_start,x_step,x_stop,y_start,y_step,y_stop,edges);
130 */
131
132 if (strcmp(edges,"circular") == 0)
133 internal_wrap_reduce(image, x_idim, y_idim, filt, x_fdim, y_fdim,
134 x_start, x_step, x_stop, y_start, y_step, y_stop,
135 result);
136 else internal_reduce(image, x_idim, y_idim, filt, temp, x_fdim, y_fdim,
137 x_start, x_step, x_stop, y_start, y_step, y_stop,
138 result, edges);
139
140 mxFree((char *) temp);
141 return;
142 }
143
144
145
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/edges.c b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/edges.c
deleted file mode 100755
index 98b377d..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/edges.c
+++ /dev/null
@@ -1,647 +0,0 @@
1/*
2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3;;; File: edges.c
4;;; Author: Eero Simoncelli
5;;; Description: Boundary handling routines for use with convolve.c
6;;; Creation Date: Spring 1987.
7;;; MODIFIED, 6/96, to operate on double float arrays.
8;;; MODIFIED by dgp, 4/1/97, to support THINK C.
9;;; MODIFIED, 8/97: reflect1, reflect2, repeat, extend upgraded to
10;;; work properly for non-symmetric filters. Added qreflect2 to handle
11;;; even-length QMF's which broke under the reflect2 modification.
12;;; ----------------------------------------------------------------
13;;; Object-Based Vision and Image Understanding System (OBVIUS),
14;;; Copyright 1988, Vision Science Group, Media Laboratory,
15;;; Massachusetts Institute of Technology.
16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17*/
18
19/* This file contains functions which determine how edges are to be
20handled when performing convolutions of images with linear filters.
21Any edge handling function which is local and linear may be defined,
22except (unfortunately) constants cannot be added. So to treat the
23edges as if the image is surrounded by a gray field, you must paste it
24into a gray image, convolve, and crop it out... The main convolution
25functions are called internal_reduce and internal_expand and are
26defined in the file convolve.c. The idea is that the convolution
27function calls the edge handling function which computes a new filter
28based on the old filter and the distance to the edge of the image.
29For example, reflection is done by reflecting the filter through the
30appropriate axis and summing. Currently defined functions are listed
31below.
32*/
33
34
35#include <stdio.h>
36#include <math.h>
37#include <string.h>
38#include "convolve.h"
39
40#define sgn(a) ( ((a)>0)?1:(((a)<0)?-1:0) )
41#define clip(a,mn,mx) ( ((a)<(mn))?(mn):(((a)>=(mx))?(mx-1):(a)) )
42
43int reflect1(), reflect2(), qreflect2(), repeat(), zero(), Extend(), nocompute();
44int ereflect(), predict();
45
46/* Lookup table matching a descriptive string to the edge-handling function */
47#if !THINK_C
48 static EDGE_HANDLER edge_foos[] =
49 {
50 { "dont-compute", nocompute }, /* zero output for filter touching edge */
51 { "zero", zero }, /* zero outside of image */
52 { "repeat", repeat }, /* repeat edge pixel */
53 { "reflect1", reflect1 }, /* reflect about edge pixels */
54 { "reflect2", reflect2 }, /* reflect image, including edge pixels */
55 { "qreflect2", qreflect2 }, /* reflect image, including edge pixels
56 for even-length QMF decompositions */
57 { "extend", Extend }, /* extend (reflect & invert) */
58 { "ereflect", ereflect }, /* orthogonal QMF reflection */
59 };
60#else
61 /*
62 This is really stupid, but THINK C won't allow initialization of static variables in
63 a code resource with string addresses. So we do it this way.
64 The 68K code for a MATLAB 4 MEX file can only be created by THINK C.
65 However, for MATLAB 5, we'll be able to use Metrowerks CodeWarrior for both 68K and PPC, so this
66 cludge can be dropped when we drop support for MATLAB 4.
67 Denis Pelli, 4/1/97.
68 */
69 static EDGE_HANDLER edge_foos[8];
70
71 void InitializeTable(EDGE_HANDLER edge_foos[])
72 {
73 static int i=0;
74
75 if(i>0) return;
76 edge_foos[i].name="dont-compute";
77 edge_foos[i++].func=nocompute;
78 edge_foos[i].name="zero";
79 edge_foos[i++].func=zero;
80 edge_foos[i].name="repeat";
81 edge_foos[i++].func=repeat;
82 edge_foos[i].name="reflect1";
83 edge_foos[i++].func=reflect1;
84 edge_foos[i].name="reflect2";
85 edge_foos[i++].func=reflect2;
86 edge_foos[i].name="qreflect2";
87 edge_foos[i++].func=qreflect2;
88 edge_foos[i].name="extend";
89 edge_foos[i++].func=Extend;
90 edge_foos[i].name="ereflect";
91 edge_foos[i++].func=ereflect;
92 }
93#endif
94
95/*
96Function looks up an edge handler id string in the structure above, and
97returns the associated function
98*/
99fptr edge_function(char *edges)
100 {
101 int i;
102
103#if THINK_C
104 InitializeTable(edge_foos);
105#endif
106 for (i = 0; i<sizeof(edge_foos)/sizeof(EDGE_HANDLER); i++)
107 if (strcmp(edges,edge_foos[i].name) IS 0)
108 return(edge_foos[i].func);
109 printf("Error: '%s' is not the name of a valid edge-handler!\n",edges);
110 for (i=0; i<sizeof(edge_foos)/sizeof(EDGE_HANDLER); i++)
111 {
112 if (i IS 0) printf(" Options are: ");
113 else printf(", ");
114 printf("%s",edge_foos[i].name);
115 }
116 printf("\n");
117 return(0);
118 }
119
120/*
121---------------- EDGE HANDLER ARGUMENTS ------------------------
122filt - array of filter taps.
123x_dim, y_dim - x and y dimensions of filt.
124x_pos - position of filter relative to the horizontal image edges. Negative
125 values indicate left edge, positive indicate right edge. Zero
126 indicates that the filter is not touching either edge. An absolute
127 value of 1 indicates that the edge tap of the filter is over the
128 edge pixel of the image.
129y_pos - analogous to x_pos.
130result - array where the resulting filter will go. The edge
131 of this filter will be aligned with the image for application...
132r_or_e - equal to one of the two constants EXPAND or REDUCE.
133--------------------------------------------------------------------
134*/
135
136
137/* --------------------------------------------------------------------
138nocompute() - Return zero for values where filter hangs over the edge.
139*/
140
141int nocompute(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e)
142 register double *filt, *result;
143 register int x_dim;
144 int y_dim, x_pos, y_pos, r_or_e;
145 {
146 register int i;
147 register int size = x_dim*y_dim;
148
149 if ( (x_pos>1) OR (x_pos<-1) OR (y_pos>1) OR (y_pos<-1) )
150 for (i=0; i<size; i++) result[i] = 0.0;
151 else
152 for (i=0; i<size; i++) result[i] = filt[i];
153
154 return(0);
155 }
156
157/* --------------------------------------------------------------------
158zero() - Zero outside of image. Discontinuous, but adds zero energy. */
159
160int zero(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e)
161 register double *filt, *result;
162 register int x_dim;
163 int y_dim, x_pos, y_pos, r_or_e;
164 {
165 register int y_filt,x_filt, y_res,x_res;
166 int filt_sz = x_dim*y_dim;
167 int x_start = ((x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0));
168 int y_start = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0));
169 int i;
170
171 for (i=0; i<filt_sz; i++) result[i] = 0.0;
172
173 for (y_filt=0, y_res=y_start;
174 y_filt<filt_sz;
175 y_filt+=x_dim, y_res+=x_dim)
176 if ((y_res >= 0) AND (y_res < filt_sz))
177 for (x_filt=y_filt, x_res=x_start;
178 x_filt<y_filt+x_dim;
179 x_filt++, x_res++)
180 if ((x_res >= 0) AND (x_res < x_dim))
181 result[y_res+x_res] = filt[x_filt];
182 return(0);
183 }
184
185
186/* --------------------------------------------------------------------
187reflect1() - Reflection through the edge pixels. Continuous, but
188discontinuous first derivative. This is the right thing to do if you
189are subsampling by 2, since it maintains parity (even pixels positions
190remain even, odd ones remain odd).
191*/
192
193int reflect1(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e)
194 register double *filt, *result;
195 register int x_dim;
196 int y_dim, x_pos, y_pos, r_or_e;
197 {
198 int filt_sz = x_dim*y_dim;
199 register int y_filt,x_filt, y_res, x_res;
200 register int x_base = (x_pos>0)?(x_dim-1):0;
201 register int y_base = x_dim * ((y_pos>0)?(y_dim-1):0);
202 int x_overhang = (x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0);
203 int y_overhang = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0));
204 int i;
205 int mx_pos = (x_pos<0)?(x_dim/2):((x_dim-1)/2);
206 int my_pos = x_dim * ((y_pos<0)?(y_dim/2):((y_dim-1)/2));
207
208 for (i=0; i<filt_sz; i++) result[i] = 0.0;
209
210 if (r_or_e IS REDUCE)
211 for (y_filt=0, y_res=y_overhang-y_base;
212 y_filt<filt_sz;
213 y_filt+=x_dim, y_res+=x_dim)
214 for (x_filt=y_filt, x_res=x_overhang-x_base;
215 x_filt<y_filt+x_dim;
216 x_filt++, x_res++)
217 result[ABS(y_base-ABS(y_res)) + ABS(x_base-ABS(x_res))]
218 += filt[x_filt];
219 else {
220 y_overhang = ABS(y_overhang);
221 x_overhang = ABS(x_overhang);
222 for (y_res=y_base, y_filt = y_base-y_overhang;
223 y_filt > y_base-filt_sz;
224 y_filt-=x_dim, y_res-=x_dim)
225 {
226 for (x_res=x_base, x_filt=x_base-x_overhang;
227 x_filt > x_base-x_dim;
228 x_res--, x_filt--)
229 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)];
230 if ((x_overhang ISNT mx_pos) AND (x_pos ISNT 0))
231 for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang;
232 x_filt > x_base-x_dim;
233 x_res--, x_filt--)
234 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)];
235 }
236 if ((y_overhang ISNT my_pos) AND (y_pos ISNT 0))
237 for (y_res=y_base, y_filt = y_base-2*my_pos+y_overhang;
238 y_filt > y_base-filt_sz;
239 y_filt-=x_dim, y_res-=x_dim)
240 {
241 for (x_res=x_base, x_filt=x_base-x_overhang;
242 x_filt > x_base-x_dim;
243 x_res--, x_filt--)
244 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)];
245 if ((x_overhang ISNT mx_pos) AND (x_pos ISNT 0))
246 for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang;
247 x_filt > x_base-x_dim;
248 x_res--, x_filt--)
249 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)];
250 }
251 }
252
253 return(0);
254 }
255
256/* --------------------------------------------------------------------
257reflect2() - Reflect image at boundary. The edge pixel is repeated,
258then the next pixel, etc. Continuous, but discontinuous first
259derivative.
260*/
261
262int reflect2(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e)
263 register double *filt, *result;
264 register int x_dim;
265 int y_dim, x_pos, y_pos, r_or_e;
266 {
267 int filt_sz = x_dim*y_dim;
268 register int y_filt,x_filt, y_res, x_res;
269 register int x_base = (x_pos>0)?(x_dim-1):0;
270 register int y_base = x_dim * ((y_pos>0)?(y_dim-1):0);
271 int x_overhang = (x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0);
272 int y_overhang = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0));
273 int i;
274 int mx_pos = (x_pos<0)?(x_dim/2):((x_dim-1)/2);
275 int my_pos = x_dim * ((y_pos<0)?(y_dim/2):((y_dim-1)/2));
276
277 for (i=0; i<filt_sz; i++) result[i] = 0.0;
278
279 if (r_or_e IS REDUCE)
280 for (y_filt=0, y_res = (y_overhang-y_base) - ((y_pos>0)?x_dim:0);
281 y_filt<filt_sz;
282 y_filt+=x_dim, y_res+=x_dim)
283 {
284 if (y_res IS 0) y_res+=x_dim;
285 for (x_filt=y_filt, x_res = (x_overhang-x_base) - ((x_pos>0)?1:0);
286 x_filt<y_filt+x_dim;
287 x_filt++, x_res++)
288 {
289 if (x_res IS 0) x_res++;
290 result[ABS(y_base-ABS(y_res)+x_dim) + ABS(x_base-ABS(x_res)+1)]
291 += filt[x_filt];
292 }
293 }
294 else {
295 y_overhang = ABS(y_overhang);
296 x_overhang = ABS(x_overhang);
297 for (y_res=y_base, y_filt = y_base-y_overhang;
298 y_filt > y_base-filt_sz;
299 y_filt-=x_dim, y_res-=x_dim)
300 {
301 for (x_res=x_base, x_filt=x_base-x_overhang;
302 x_filt > x_base-x_dim;
303 x_res--, x_filt--)
304 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)];
305 if (x_pos ISNT 0)
306 for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang-1;
307 x_filt > x_base-x_dim;
308 x_res--, x_filt--)
309 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)];
310 }
311 if (y_pos ISNT 0)
312 for (y_res=y_base, y_filt = y_base-2*my_pos+y_overhang-x_dim;
313 y_filt > y_base-filt_sz;
314 y_filt-=x_dim, y_res-=x_dim)
315 {
316 for (x_res=x_base, x_filt=x_base-x_overhang;
317 x_filt > x_base-x_dim;
318 x_res--, x_filt--)
319 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)];
320 if (x_pos ISNT 0)
321 for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang-1;
322 x_filt > x_base-x_dim;
323 x_res--, x_filt--)
324 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)];
325 }
326 }
327
328 return(0);
329 }
330
331
332/* --------------------------------------------------------------------
333qreflect2() - Modified version of reflect2 that works properly for
334even-length QMF filters.
335*/
336
337int qreflect2(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e)
338 double *filt, *result;
339 int x_dim, y_dim, x_pos, y_pos, r_or_e;
340 {
341 reflect2(filt,x_dim,y_dim,x_pos,y_pos,result,0);
342 return(0);
343 }
344
345/* --------------------------------------------------------------------
346repeat() - repeat edge pixel. Continuous, with discontinuous first
347derivative.
348*/
349
350int repeat(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e)
351 register double *filt, *result;
352 register int x_dim;
353 int y_dim, x_pos, y_pos, r_or_e;
354 {
355 register int y_filt,x_filt, y_res,x_res, y_tmp, x_tmp;
356 register int x_base = (x_pos>0)?(x_dim-1):0;
357 register int y_base = x_dim * ((y_pos>0)?(y_dim-1):0);
358 int x_overhang = ((x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0));
359 int y_overhang = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0));
360 int filt_sz = x_dim*y_dim;
361 int mx_pos = (x_dim/2);
362 int my_pos = x_dim * (y_dim/2);
363 int i;
364
365 for (i=0; i<filt_sz; i++) result[i] = 0.0;
366
367 if (r_or_e IS REDUCE)
368 for (y_filt=0, y_res=y_overhang;
369 y_filt<filt_sz;
370 y_filt+=x_dim, y_res+=x_dim)
371 for (x_filt=y_filt, x_res=x_overhang;
372 x_filt<y_filt+x_dim;
373 x_filt++, x_res++)
374 /* Clip the index: */
375 result[((y_res>=0)?((y_res<filt_sz)?y_res:(filt_sz-x_dim)):0)
376 + ((x_res>=0)?((x_res<x_dim)?x_res:(x_dim-1)):0)]
377 += filt[x_filt];
378 else {
379 if ((y_base-y_overhang) ISNT my_pos)
380 for (y_res=y_base, y_filt=y_base-ABS(y_overhang);
381 y_filt > y_base-filt_sz;
382 y_filt-=x_dim, y_res-=x_dim)
383 if ((x_base-x_overhang) ISNT mx_pos)
384 for (x_res=x_base, x_filt=x_base-ABS(x_overhang);
385 x_filt > x_base-x_dim;
386 x_res--, x_filt--)
387 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)];
388 else /* ((x_base-x_overhang) IS mx_pos) */
389 for (x_res=x_base, x_filt=x_base-ABS(x_overhang);
390 x_filt > x_base-x_dim;
391 x_filt--, x_res--)
392 for(x_tmp=x_filt; x_tmp > x_base-x_dim; x_tmp--)
393 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_tmp)];
394 else /* ((y_base-y_overhang) IS my_pos) */
395 for (y_res=y_base, y_filt=y_base-ABS(y_overhang);
396 y_filt > y_base-filt_sz;
397 y_filt-=x_dim, y_res-=x_dim)
398 for (y_tmp=y_filt; y_tmp > y_base-filt_sz; y_tmp-=x_dim)
399 if ((x_base-x_overhang) ISNT mx_pos)
400 for (x_res=x_base, x_filt=x_base-ABS(x_overhang);
401 x_filt > x_base-x_dim;
402 x_filt--, x_res--)
403 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_tmp)+ABS(x_filt)];
404 else /* ((x_base-x_overhang) IS mx_pos) */
405 for (x_res=x_base, x_filt=x_base-ABS(x_overhang);
406 x_filt > x_base-x_dim;
407 x_filt--, x_res--)
408 for (x_tmp=x_filt; x_tmp > x_base-x_dim; x_tmp--)
409 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_tmp)+ABS(x_tmp)];
410 } /* End, if r_or_e IS EXPAND */
411
412 return(0);
413 }
414
415/* --------------------------------------------------------------------
416extend() - Extend image by reflecting and inverting about edge pixel
417value. Maintains continuity in intensity AND first derivative (but
418not higher derivs).
419*/
420
421int Extend(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e)
422 register double *filt, *result;
423 register int x_dim;
424 int y_dim, x_pos, y_pos, r_or_e;
425 {
426 int filt_sz = x_dim*y_dim;
427 register int y_filt,x_filt, y_res,x_res, y_tmp, x_tmp;
428 register int x_base = (x_pos>0)?(x_dim-1):0;
429 register int y_base = x_dim * ((y_pos>0)?(y_dim-1):0);
430 int x_overhang = (x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0);
431 int y_overhang = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0));
432 int mx_pos = (x_pos<0)?(x_dim/2):((x_dim-1)/2);
433 int my_pos = x_dim * ((y_pos<0)?(y_dim/2):((y_dim-1)/2));
434 int i;
435
436 for (i=0; i<filt_sz; i++) result[i] = 0.0;
437
438 /* Modeled on reflect1() */
439 if (r_or_e IS REDUCE)
440 for (y_filt=0, y_res=y_overhang;
441 y_filt<filt_sz;
442 y_filt+=x_dim, y_res+=x_dim)
443 if ((y_res>=0) AND (y_res<filt_sz))
444 for (x_filt=y_filt, x_res=x_overhang;
445 x_filt<y_filt+x_dim;
446 x_filt++, x_res++)
447 if ((x_res>=0) AND (x_res<x_dim))
448 result[y_res+x_res] += filt[x_filt];
449 else
450 {
451 result[y_res+ABS(x_base-ABS(x_res-x_base))] -= filt[x_filt];
452 result[y_res+x_base] += 2*filt[x_filt];
453 }
454 else
455 for (x_filt=y_filt, x_res=x_overhang;
456 x_filt<y_filt+x_dim;
457 x_filt++, x_res++)
458 if ((x_res>=0) AND (x_res<x_dim))
459 {
460 result[ABS(y_base-ABS(y_res-y_base))+x_res] -= filt[x_filt];
461 result[y_base+x_res] += 2*filt[x_filt];
462 }
463 else
464 {
465 result[ABS(y_base-ABS(y_res-y_base))+ABS(x_base-ABS(x_res-x_base))]
466 -= filt[x_filt];
467 result[y_base+x_base] += 2*filt[x_filt];
468 }
469 else { /* r_or_e ISNT REDUCE */
470 y_overhang = ABS(y_overhang);
471 x_overhang = ABS(x_overhang);
472 for (y_res=y_base, y_filt = y_base-y_overhang;
473 y_filt > y_base-filt_sz;
474 y_filt-=x_dim, y_res-=x_dim)
475 {
476 for (x_res=x_base, x_filt=x_base-x_overhang;
477 x_filt > x_base-x_dim;
478 x_res--, x_filt--)
479 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)];
480 if (x_pos ISNT 0)
481 if (x_overhang ISNT mx_pos)
482 for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang;
483 x_filt > x_base-x_dim;
484 x_res--, x_filt--)
485 result[ABS(y_res)+ABS(x_res)] -= filt[ABS(y_filt)+ABS(x_filt)];
486 else /* x_overhang IS mx_pos */
487 for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang-1;
488 x_filt > x_base-x_dim;
489 x_res--, x_filt--)
490 for (x_tmp=x_filt; x_tmp > x_base-x_dim; x_tmp--)
491 result[ABS(y_res)+ABS(x_res)] += 2*filt[ABS(y_filt)+ABS(x_tmp)];
492 }
493 if (y_pos ISNT 0)
494 if (y_overhang ISNT my_pos)
495 for (y_res=y_base, y_filt = y_base-2*my_pos+y_overhang;
496 y_filt > y_base-filt_sz;
497 y_filt-=x_dim, y_res-=x_dim)
498 {
499 for (x_res=x_base, x_filt=x_base-x_overhang;
500 x_filt > x_base-x_dim;
501 x_res--, x_filt--)
502 result[ABS(y_res)+ABS(x_res)] -= filt[ABS(y_filt)+ABS(x_filt)];
503 if ((x_pos ISNT 0) AND (x_overhang ISNT mx_pos))
504 for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang;
505 x_filt > x_base-x_dim;
506 x_res--, x_filt--)
507 result[ABS(y_res)+ABS(x_res)] -= filt[ABS(y_filt)+ABS(x_filt)];
508 }
509 else /* y_overhang IS my_pos */
510 for (y_res=y_base, y_filt = y_base-2*my_pos+y_overhang-x_dim;
511 y_filt > y_base-filt_sz;
512 y_res-=x_dim, y_filt-=x_dim)
513 for (y_tmp=y_filt; y_tmp > y_base-filt_sz; y_tmp-=x_dim)
514 {
515 for (x_res=x_base, x_filt=x_base-x_overhang;
516 x_filt > x_base-x_dim;
517 x_res--, x_filt--)
518 result[ABS(y_res)+ABS(x_res)] += 2*filt[ABS(y_tmp)+ABS(x_filt)];
519 if ((x_pos ISNT 0) AND (x_overhang IS mx_pos))
520 for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang-1;
521 x_filt > x_base-x_dim;
522 x_res--, x_filt--)
523 for (x_tmp=x_filt; x_tmp > x_base-x_dim; x_tmp--)
524 result[ABS(y_res)+ABS(x_res)] += 2*filt[ABS(y_tmp)+ABS(x_tmp)];
525 }
526 } /* r_or_e ISNT REDUCE */
527
528 return(0);
529 }
530
531/* --------------------------------------------------------------------
532predict() - Simple prediction. Like zero, but multiplies the result
533by the reciprocal of the percentage of filter being used. (i.e. if
53450% of the filter is hanging over the edge of the image, multiply the
535taps being used by 2). */
536
537int predict(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e)
538 register double *filt, *result;
539 register int x_dim;
540 int y_dim, x_pos, y_pos, r_or_e;
541 {
542 register int y_filt,x_filt, y_res,x_res;
543 register double taps_used = 0.0; /* int *** */
544 register double fraction = 0.0;
545 int filt_sz = x_dim*y_dim;
546 int x_start = ((x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0));
547 int y_start = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0));
548 int i;
549
550 for (i=0; i<filt_sz; i++) result[i] = 0.0;
551
552 for (y_filt=0, y_res=y_start;
553 y_filt<filt_sz;
554 y_filt+=x_dim, y_res+=x_dim)
555 if ((y_res >= 0) AND (y_res < filt_sz))
556 for (x_filt=y_filt, x_res=x_start;
557 x_filt<y_filt+x_dim;
558 x_filt++, x_res++)
559 if ((x_res >= 0) AND (x_res < x_dim))
560 {
561 result[y_res+x_res] = filt[x_filt];
562 taps_used += ABS(filt[x_filt]);
563 }
564
565 if (r_or_e IS REDUCE)
566 {
567 /* fraction = ( (double) filt_sz ) / ( (double) taps_used ); */
568 for (i=0; i<filt_sz; i++) fraction += ABS(filt[i]);
569 fraction = ( fraction / taps_used );
570 for (i=0; i<filt_sz; i++) result[i] *= fraction;
571 }
572 return(0);
573 }
574
575
576/* --------------------------------------------------------------------
577Reflect, multiplying tap of filter which is at the edge of the image
578by root 2. This maintains orthogonality of odd-length linear-phase
579QMF filters, but it is not useful for most applications, since it
580alters the DC level. */
581
582int ereflect(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e)
583 register double *filt, *result;
584 register int x_dim;
585 int y_dim, x_pos, y_pos, r_or_e;
586 {
587 register int y_filt,x_filt, y_res,x_res;
588 register int x_base = (x_pos>0)?(x_dim-1):0;
589 register int y_base = x_dim * ((y_pos>0)?(y_dim-1):0);
590 int filt_sz = x_dim*y_dim;
591 int x_overhang = (x_pos>1)?(x_pos-x_dim):((x_pos<-1)?(x_pos+1):0);
592 int y_overhang = x_dim * ( (y_pos>1)?(y_pos-y_dim):((y_pos<-1)?(y_pos+1):0) );
593 int i;
594 double norm,onorm;
595
596 for (i=0; i<filt_sz; i++) result[i] = 0.0;
597
598 /* reflect at boundary */
599 for (y_filt=0, y_res=y_overhang;
600 y_filt<filt_sz;
601 y_filt+=x_dim, y_res+=x_dim)
602 for (x_filt=y_filt, x_res=x_overhang;
603 x_filt<y_filt+x_dim;
604 x_filt++, x_res++)
605 result[ABS(y_base-ABS(y_res)) + ABS(x_base-ABS(x_res))]
606 += filt[x_filt];
607
608 /* now multiply edge by root 2 */
609 if (x_pos ISNT 0)
610 for (y_filt=x_base; y_filt<filt_sz; y_filt+=x_dim)
611 result[y_filt] *= ROOT2;
612 if (y_pos ISNT 0)
613 for (x_filt=y_base; x_filt<y_base+x_dim; x_filt++)
614 result[x_filt] *= ROOT2;
615
616 /* now normalize to norm of original filter */
617 for (norm=0.0,i=0; i<filt_sz; i++)
618 norm += (result[i]*result[i]);
619 norm=sqrt(norm);
620
621 for (onorm=0.0,i=0; i<filt_sz; i++)
622 onorm += (filt[i]*filt[i]);
623 onorm = sqrt(onorm);
624
625 norm = norm/onorm;
626 for (i=0; i<filt_sz; i++)
627 result[i] /= norm;
628 return(0);
629 }
630
631
632/* ------- printout stuff for testing ------------------------------
633 printf("Xpos: %d, Ypos: %d", x_pos, y_pos);
634 for (y_filt=0; y_filt<y_dim; y_filt++)
635 {
636 printf("\n");
637 for (x_filt=0; x_filt<x_dim; x_filt++)
638 printf("%6.1f", result[y_filt*x_dim+x_filt]);
639 }
640 printf("\n");
641*/
642
643
644
645/* Local Variables: */
646/* buffer-read-only: t */
647/* End: */
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/edges.mexa64 b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/edges.mexa64
deleted file mode 100755
index 4839d1e..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/edges.mexa64
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/histo.c b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/histo.c
deleted file mode 100755
index 43a99c7..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/histo.c
+++ /dev/null
@@ -1,140 +0,0 @@
1/*
2[N, X] = histo(MTX, NBINS_OR_BINSIZE, BIN_CENTER)
3 >>> See histo.m for documentation <<<
4 EPS, ported from OBVIUS, 3/97.
5*/
6
7#define V4_COMPAT
8#include <matrix.h> /* Matlab matrices */
9#include <mex.h>
10
11#include <stddef.h> /* NULL */
12#include <math.h> /* ceil */
13
14#define notDblMtx(it) (!mxIsNumeric(it) || !mxIsDouble(it) || mxIsSparse(it) || mxIsComplex(it))
15
16#define PAD 0.49999 /* A hair below 1/2, to avoid roundoff errors */
17#define MAXBINS 20000
18
19void mexFunction(int nlhs, /* Num return vals on lhs */
20 mxArray *plhs[], /* Matrices on lhs */
21 int nrhs, /* Num args on rhs */
22 const mxArray *prhs[] /* Matrices on rhs */
23 )
24 {
25 register double temp;
26 register int binnum, i, size;
27 register double *im, binsize;
28 register double origin, *hist, mn, mx, mean;
29 register int nbins;
30 double *bincenters;
31 mxArray *arg;
32 double *mxMat;
33
34 if (nrhs < 1 ) mexErrMsgTxt("requires at least 1 argument.");
35
36 /* ARG 1: MATRIX */
37 arg = prhs[0];
38 if notDblMtx(arg) mexErrMsgTxt("MTX arg must be a real non-sparse matrix.");
39 im = mxGetPr(arg);
40 size = (int) mxGetM(arg) * mxGetN(arg);
41
42 /* FIND min, max, mean values of MTX */
43 mn = *im; mx = *im; binsize = 0;
44 for (i=1; i<size; i++)
45 {
46 temp = im[i];
47 if (temp < mn)
48 mn = temp;
49 else if (temp > mx)
50 mx = temp;
51 binsize += temp;
52 }
53 mean = binsize / size;
54
55 /* ARG 3: BIN_CENTER */
56 if (nrhs > 2)
57 {
58 arg = prhs[2];
59 if notDblMtx(arg) mexErrMsgTxt("BIN_CENTER arg must be a real scalar.");
60 if (mxGetM(arg) * mxGetN(arg) != 1)
61 mexErrMsgTxt("BIN_CENTER must be a real scalar.");
62 mxMat= mxGetPr(arg);
63 origin = *mxMat;
64 }
65 else
66 origin = mean;
67
68 /* ARG 2: If positive, NBINS. If negative, -BINSIZE. */
69 if (nrhs > 1)
70 {
71 arg = prhs[1];
72 if notDblMtx(arg) mexErrMsgTxt("NBINS_OR_BINSIZE arg must be a real scalar.");
73 if (mxGetM(arg) * mxGetN(arg) != 1)
74 mexErrMsgTxt("NBINS_OR_BINSIZE must be a real scalar.");
75 mxMat= mxGetPr(arg);
76 binsize = *mxMat;
77 }
78 else
79 {
80 binsize = 101; /* DEFAULT: 101 bins */
81 }
82
83 /* --------------------------------------------------
84 Adjust origin, binsize, nbins such that
85 mx <= origin + (nbins-1)*binsize + PAD*binsize
86 mn >= origin - PAD*binsize
87 -------------------------------------------------- */
88 if (binsize < 0) /* user specified BINSIZE */
89 {
90 binsize = -binsize;
91 origin -= binsize * ceil((origin-mn-PAD*binsize)/binsize);
92 nbins = (int) ceil((mx-origin-PAD*binsize)/binsize) + 1;
93 }
94 else /* user specified NBINS */
95 {
96 nbins = (int) (binsize + 0.5); /* round to int */
97 if (nbins == 0)
98 mexErrMsgTxt("NBINS must be greater than zero.");
99 binsize = (mx-mn)/(nbins-1+2*PAD); /* start with lower bound */
100 i = ceil((origin-mn-binsize/2)/binsize);
101 if ( mn < (origin-i*binsize-PAD*binsize) )
102 binsize = (origin-mn)/(i+PAD);
103 else if ( mx > (origin+(nbins-1-i)*binsize+PAD*binsize) )
104 binsize = (mx-origin)/((nbins-1-i)+PAD);
105 origin -= binsize * ceil((origin-mn-PAD*binsize)/binsize);
106 }
107
108 if (nbins > MAXBINS)
109 {
110 mexPrintf("nbins: %d, MAXBINS: %d\n",nbins,MAXBINS);
111 mexErrMsgTxt("Number of histo bins has exceeded maximum");
112 }
113
114 /* Allocate hist and xvals */
115 plhs[0] = (mxArray *) mxCreateDoubleMatrix(1,nbins,mxREAL);
116 if (plhs[0] == NULL) mexErrMsgTxt("Error allocating result matrix");
117 hist = mxGetPr(plhs[0]);
118
119 if (nlhs > 1)
120 {
121 plhs[1] = (mxArray *) mxCreateDoubleMatrix(1,nbins,mxREAL);
122 if (plhs[1] == NULL) mexErrMsgTxt("Error allocating result matrix");
123 bincenters = mxGetPr(plhs[1]);
124 for (i=0, temp=origin; i<nbins; i++, temp+=binsize)
125 bincenters[i] = temp;
126 }
127
128 for (i=0; i<size; i++)
129 {
130 binnum = (int) ((im[i] - origin)/binsize + 0.5);
131 if ((binnum < nbins) && (binnum >= 0))
132 (hist[binnum]) += 1.0;
133 else
134 printf("HISTO warning: value %f outside of range [%f,%f]\n",
135 im[i], origin-0.5*binsize, origin+(nbins-0.5)*binsize);
136 }
137
138 return;
139 }
140
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.c b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.c
deleted file mode 100755
index 8fa1224..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.c
+++ /dev/null
@@ -1,52 +0,0 @@
1/*
2RES = innerProd(MAT);
3 Computes mat'*mat
4 Odelia Schwartz, 8/97.
5*/
6
7#define V4_COMPAT
8#include <matrix.h>
9
10#include <stdio.h>
11#include <ctype.h>
12#include <math.h>
13#include <strings.h>
14#include <stdlib.h>
15
16void mexFunction(int nlhs, /* Num return vals on lhs */
17 mxArray *plhs[], /* Matrices on lhs */
18 int nrhs, /* Num args on rhs */
19 const mxArray *prhs[] /* Matrices on rhs */
20 )
21{
22 register double *res, *mat, tmp;
23 register int len, wid, i, k, j, jlen, ilen, imat, jmat;
24 mxArray *arg;
25
26 /* get matrix input argument */
27 /* should be matrix in which num rows >= num columns */
28 arg=prhs[0];
29 mat= mxGetPr(arg);
30 len = (int) mxGetM(arg);
31 wid = (int) mxGetN(arg);
32 if ( wid > len )
33 printf("innerProd: Warning: width %d is greater than length %d.\n",wid,len);
34 plhs[0] = (mxArray *) mxCreateDoubleMatrix(wid,wid,mxREAL);
35 if (plhs[0] == NULL)
36 mexErrMsgTxt(sprintf("Error allocating %dx%d result matrix",wid,wid));
37 res = mxGetPr(plhs[0]);
38
39 for(i=0, ilen=0; i<wid; i++, ilen+=len)
40 {
41 for(j=i, jlen=ilen; j<wid; j++, jlen+=len)
42 {
43 tmp = 0.0;
44 for(k=0, imat=ilen, jmat=jlen; k<len; k++, imat++, jmat++)
45 tmp += mat[imat]*mat[jmat];
46 res[i*wid+j] = tmp;
47 res[j*wid+i] = tmp;
48 }
49 }
50 return;
51
52}
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.dll b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.dll
deleted file mode 100755
index 40ac896..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.dll
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexa64 b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexa64
deleted file mode 100755
index e31a97e..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexa64
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexglx b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexglx
deleted file mode 100755
index 749a5b5..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexglx
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexlx b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexlx
deleted file mode 100755
index 151b08f..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexlx
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexmac b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexmac
deleted file mode 100755
index 6e11fcd..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexmac
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexsol b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexsol
deleted file mode 100755
index d761ed8..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexsol
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/pointOp.c b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/pointOp.c
deleted file mode 100755
index 6ffcb45..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/pointOp.c
+++ /dev/null
@@ -1,126 +0,0 @@
1/*
2RES = pointOp(IM, LUT, ORIGIN, INCREMENT, WARNINGS)
3 >>> See pointOp.m for documentation <<<
4 EPS, ported from OBVIUS, 7/96.
5*/
6
7#define V4_COMPAT
8#include <matrix.h> /* Matlab matrices */
9#include <mex.h>
10
11#include <stddef.h> /* NULL */
12
13#define notDblMtx(it) (!mxIsNumeric(it) || !mxIsDouble(it) || mxIsSparse(it) || mxIsComplex(it))
14
15void internal_pointop();
16
17void mexFunction(int nlhs, /* Num return vals on lhs */
18 mxArray *plhs[], /* Matrices on lhs */
19 int nrhs, /* Num args on rhs */
20 const mxArray *prhs[] /* Matrices on rhs */
21 )
22 {
23 double *image, *lut, *res;
24 double origin, increment;
25 int x_dim, y_dim, lx_dim, ly_dim;
26 int warnings = 1;
27 mxArray *arg;
28 double *mxMat;
29
30 if (nrhs < 4 ) mexErrMsgTxt("requres at least 4 args.");
31
32 /* ARG 1: IMAGE */
33 arg = prhs[0];
34 if notDblMtx(arg) mexErrMsgTxt("IMAGE arg must be a real non-sparse matrix.");
35 image = mxGetPr(arg);
36 x_dim = (int) mxGetM(arg); /* X is inner index! */
37 y_dim = (int) mxGetN(arg);
38
39 /* ARG 2: Lookup table */
40 arg = prhs[1];
41 if notDblMtx(arg) mexErrMsgTxt("LUT arg must be a real non-sparse matrix.");
42 lut = mxGetPr(arg);
43 lx_dim = (int) mxGetM(arg); /* X is inner index! */
44 ly_dim = (int) mxGetN(arg);
45 if ( (lx_dim != 1) && (ly_dim != 1) )
46 mexErrMsgTxt("Lookup table must be a row or column vector.");
47
48 /* ARG 3: ORIGIN */
49 arg = prhs[2];
50 if notDblMtx(arg) mexErrMsgTxt("ORIGIN arg must be a real scalar.");
51 if (mxGetM(arg) * mxGetN(arg) != 1)
52 mexErrMsgTxt("ORIGIN arg must be a real scalar.");
53 mxMat = mxGetPr(arg);
54 origin = *mxMat;
55
56 /* ARG 4: INCREMENT */
57 arg = prhs[3];
58 if notDblMtx(arg) mexErrMsgTxt("INCREMENT arg must be a real scalar.");
59 if (mxGetM(arg) * mxGetN(arg) != 1)
60 mexErrMsgTxt("INCREMENT arg must be a real scalar.");
61 mxMat = mxGetPr(arg);
62 increment = *mxMat;
63
64 /* ARG 5: WARNINGS */
65 if (nrhs>4)
66 {
67 arg = prhs[4];
68 if notDblMtx(arg) mexErrMsgTxt("WARINGS arg must be a real scalar.");
69 if (mxGetM(arg) * mxGetN(arg) != 1)
70 mexErrMsgTxt("WARNINGS arg must be a real scalar.");
71 mxMat = mxGetPr(arg);
72 warnings = (int) *mxMat;
73 }
74
75 plhs[0] = (mxArray *) mxCreateDoubleMatrix(x_dim,y_dim,mxREAL);
76 if (plhs[0] == NULL) mexErrMsgTxt("Cannot allocate result matrix");
77 res = mxGetPr(plhs[0]);
78
79 internal_pointop(image, res, x_dim*y_dim, lut, lx_dim*ly_dim,
80 origin, increment, warnings);
81 return;
82 }
83
84
85/* Use linear interpolation on a lookup table.
86 Taken from OBVIUS. EPS, Spring, 1987.
87 */
88void internal_pointop (im, res, size, lut, lutsize, origin, increment, warnings)
89 register double *im, *res, *lut;
90 register double origin, increment;
91 register int size, lutsize, warnings;
92 {
93 register int i, index;
94 register double pos;
95 register int l_unwarned = warnings;
96 register int r_unwarned = warnings;
97
98 lutsize = lutsize - 2; /* Maximum index value */
99 if (increment > 0)
100 for (i=0; i<size; i++)
101 {
102 pos = (im[i] - origin) / increment;
103 index = (int) pos; /* Floor */
104 if (index < 0)
105 {
106 index = 0;
107 if (l_unwarned)
108 {
109 mexPrintf("Warning: Extrapolating to left of lookup table...\n");
110 l_unwarned = 0;
111 }
112 }
113 else if (index > lutsize)
114 {
115 index = lutsize;
116 if (r_unwarned)
117 {
118 mexPrintf("Warning: Extrapolating to right of lookup table...\n");
119 r_unwarned = 0;
120 }
121 }
122 res[i] = lut[index] + (lut[index+1] - lut[index]) * (pos - index);
123 }
124 else
125 for (i=0; i<size; i++) res[i] = *lut;
126 }
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/range2.c b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/range2.c
deleted file mode 100755
index b84f4e1..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/range2.c
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2[MIN, MAX] = range2(MTX)
3 >>> See range2.m for documentation <<<
4 EPS, 3/97.
5*/
6
7#define V4_COMPAT
8#include <matrix.h> /* Matlab matrices */
9#include <mex.h>
10
11#include <stddef.h> /* NULL */
12
13#define notDblMtx(it) (!mxIsNumeric(it) || !mxIsDouble(it) || mxIsSparse(it) || mxIsComplex(it))
14
15void mexFunction(int nlhs, /* Num return vals on lhs */
16 mxArray *plhs[], /* Matrices on lhs */
17 int nrhs, /* Num args on rhs */
18 const mxArray *prhs[] /* Matrices on rhs */
19 )
20 {
21 register double temp, mn, mx;
22 register double *mtx;
23 register int i, size;
24 mxArray *arg;
25
26 if (nrhs != 1) mexErrMsgTxt("requires 1 argument.");
27
28 /* ARG 1: MATRIX */
29 arg = prhs[0];
30 if notDblMtx(arg) mexErrMsgTxt("MTX arg must be a real non-sparse matrix.");
31 mtx = mxGetPr(arg);
32 size = (int) mxGetM(arg) * mxGetN(arg);
33
34 /* FIND min, max values of MTX */
35 mn = *mtx; mx = *mtx;
36 for (i=1; i<size; i++)
37 {
38 temp = mtx[i];
39 if (temp < mn)
40 mn = temp;
41 else if (temp > mx)
42 mx = temp;
43 }
44
45 plhs[0] = (mxArray *) mxCreateDoubleMatrix(1,1,mxREAL);
46 if (plhs[0] == NULL) mexErrMsgTxt("Error allocating result matrix");
47 plhs[1] = (mxArray *) mxCreateDoubleMatrix(1,1,mxREAL);
48 if (plhs[1] == NULL) mexErrMsgTxt("Error allocating result matrix");
49 mtx = mxGetPr(plhs[0]);
50 mtx[0] = mn;
51 mtx = mxGetPr(plhs[1]);
52 mtx[0] = mx;
53
54 return;
55 }
56
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/upConv.c b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/upConv.c
deleted file mode 100755
index 3708f8a..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/upConv.c
+++ /dev/null
@@ -1,195 +0,0 @@
1/*
2RES = upConv(IM, FILT, EDGES, STEP, START, STOP, RES);
3 >>> See upConv.m for documentation <<<
4 This is a matlab interface to the internal_expand function.
5 EPS, 7/96.
6*/
7
8#define V4_COMPAT
9#include <matrix.h> /* Matlab matrices */
10#include <mex.h>
11
12#include "convolve.h"
13
14#define notDblMtx(it) (!mxIsNumeric(it) || !mxIsDouble(it) || mxIsSparse(it) || mxIsComplex(it))
15
16void mexFunction(int nlhs, /* Num return vals on lhs */
17 mxArray *plhs[], /* Matrices on lhs */
18 int nrhs, /* Num args on rhs */
19 const mxArray *prhs[] /* Matrices on rhs */
20 )
21 {
22 double *image,*filt, *temp, *result, *orig_filt;
23 int x_fdim, y_fdim, x_idim, y_idim;
24 int orig_x = 0, orig_y, x, y;
25 int x_rdim, y_rdim;
26 int x_start = 1;
27 int x_step = 1;
28 int y_start = 1;
29 int y_step = 1;
30 int x_stop, y_stop;
31 mxArray *arg;
32 double *mxMat;
33 char edges[15] = "reflect1";
34
35 if (nrhs<2) mexErrMsgTxt("requres at least 2 args.");
36
37 /* ARG 1: IMAGE */
38 arg = prhs[0];
39 if notDblMtx(arg) mexErrMsgTxt("IMAGE arg must be a non-sparse double float matrix.");
40 image = mxGetPr(arg);
41 x_idim = (int) mxGetM(arg); /* X is inner index! */
42 y_idim = (int) mxGetN(arg);
43
44 /* ARG 2: FILTER */
45 arg = prhs[1];
46 if notDblMtx(arg) mexErrMsgTxt("FILTER arg must be non-sparse double float matrix."); filt = mxGetPr(arg);
47 x_fdim = (int) mxGetM(arg);
48 y_fdim = (int) mxGetN(arg);
49
50 /* ARG 3 (optional): EDGES */
51 if (nrhs>2)
52 {
53 if (!mxIsChar(prhs[2]))
54 mexErrMsgTxt("EDGES arg must be a string.");
55 mxGetString(prhs[2],edges,15);
56 }
57
58 /* ARG 4 (optional): STEP */
59 if (nrhs>3)
60 {
61 arg = prhs[3];
62 if notDblMtx(arg) mexErrMsgTxt("STEP arg must be double float matrix.");
63 if (mxGetM(arg) * mxGetN(arg) != 2)
64 mexErrMsgTxt("STEP arg must contain two elements.");
65 mxMat = mxGetPr(arg);
66 x_step = (int) mxMat[0];
67 y_step = (int) mxMat[1];
68 if ((x_step<1) || (y_step<1))
69 mexErrMsgTxt("STEP values must be greater than zero.");
70 }
71
72 /* ARG 5 (optional): START */
73 if (nrhs>4)
74 {
75 arg = prhs[4];
76 if notDblMtx(arg) mexErrMsgTxt("START arg must be double float matrix.");
77 if (mxGetM(arg) * mxGetN(arg) != 2)
78 mexErrMsgTxt("START arg must contain two elements.");
79 mxMat = mxGetPr(arg);
80 x_start = (int) mxMat[0];
81 y_start = (int) mxMat[1];
82 if ((x_start<1) || (y_start<1))
83 mexErrMsgTxt("START values must be greater than zero.");
84 }
85 x_start--; /* convert to standard C indexes */
86 y_start--;
87
88 /* ARG 6 (optional): STOP */
89 if (nrhs>5)
90 {
91 if notDblMtx(prhs[5]) mexErrMsgTxt("STOP arg must be double float matrix.");
92 if (mxGetM(prhs[5]) * mxGetN(prhs[5]) != 2)
93 mexErrMsgTxt("STOP arg must contain two elements.");
94 mxMat = mxGetPr(prhs[5]);
95 x_stop = (int) mxMat[0];
96 y_stop = (int) mxMat[1];
97 if ((x_stop<x_start) || (y_stop<y_start))
98 mexErrMsgTxt("STOP values must be greater than START values.");
99 }
100 else
101 { /* default: make res dims a multiple of STEP size */
102 x_stop = x_step * ((x_start/x_step) + x_idim);
103 y_stop = y_step * ((y_start/y_step) + y_idim);
104 }
105
106 /* ARG 6 (optional): RESULT image */
107 if (nrhs>6)
108 {
109 arg = prhs[6];
110 if notDblMtx(arg) mexErrMsgTxt("RES arg must be double float matrix.");
111
112 /* 7/10/97: Returning one of the args causes problems with Matlab's memory
113 manager, so we don't return anything if the result image is passed */
114 /* plhs[0] = arg; */
115 result = mxGetPr(arg);
116 x_rdim = (int) mxGetM(arg); /* X is inner index! */
117 y_rdim = (int) mxGetN(arg);
118 if ((x_stop>x_rdim) || (y_stop>y_rdim))
119 mexErrMsgTxt("STOP values must within image dimensions.");
120 }
121 else
122 {
123 x_rdim = x_stop;
124 y_rdim = y_stop;
125 /* x_rdim = x_step * ((x_stop+x_step-1)/x_step);
126 y_rdim = y_step * ((y_stop+y_step-1)/y_step); */
127
128 plhs[0] = (mxArray *) mxCreateDoubleMatrix(x_rdim,y_rdim,mxREAL);
129 if (plhs[0] == NULL) mexErrMsgTxt("Cannot allocate result matrix");
130 result = mxGetPr(plhs[0]);
131 }
132
133 if ( (((x_stop-x_start+x_step-1) / x_step) != x_idim) ||
134 (((y_stop-y_start+y_step-1) / y_step) != y_idim) )
135 {
136 mexPrintf("Im dims: [%d %d]\n",x_idim,y_idim);
137 mexPrintf("Start: [%d %d]\n",x_start,y_start);
138 mexPrintf("Step: [%d %d]\n",x_step,y_step);
139 mexPrintf("Stop: [%d %d]\n",x_stop,y_stop);
140 mexPrintf("Res dims: [%d %d]\n",x_rdim,y_rdim);
141 mexErrMsgTxt("Image sizes and upsampling args are incompatible!");
142 }
143
144 /* upConv has a bug for even-length kernels when using the
145 reflect1, extend, or repeat edge-handlers */
146 if ((!strcmp(edges,"reflect1") || !strcmp(edges,"extend") || !strcmp(edges,"repeat"))
147 &&
148 ((x_fdim%2 == 0) || (y_fdim%2 == 0)))
149 {
150 orig_filt = filt;
151 orig_x = x_fdim;
152 orig_y = y_fdim;
153 x_fdim = 2*(orig_x/2)+1;
154 y_fdim = 2*(orig_y/2)+1;
155 filt = mxCalloc(x_fdim*y_fdim, sizeof(double));
156 if (filt == NULL)
157 mexErrMsgTxt("Cannot allocate necessary temporary space");
158 for (y=0; y<orig_y; y++)
159 for (x=0; x<orig_x; x++)
160 filt[y*x_fdim + x] = orig_filt[y*orig_x + x];
161 }
162
163 if ((x_fdim > x_rdim) || (y_fdim > y_rdim))
164 {
165 mexPrintf("Filter: [%d %d], ",x_fdim,y_fdim);
166 mexPrintf("Result: [%d %d]\n",x_rdim,y_rdim);
167 mexErrMsgTxt("FILTER dimensions larger than RESULT dimensions.");
168 }
169
170 temp = mxCalloc(x_fdim*y_fdim, sizeof(double));
171 if (temp == NULL)
172 mexErrMsgTxt("Cannot allocate necessary temporary space");
173
174 /*
175 printf("(%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), %s\n",
176 x_idim,y_idim,x_fdim,y_fdim,x_rdim,y_rdim,
177 x_start,x_step,y_start,y_step,edges);
178 */
179
180 if (strcmp(edges,"circular") == 0)
181 internal_wrap_expand(image, filt, x_fdim, y_fdim,
182 x_start, x_step, x_stop, y_start, y_step, y_stop,
183 result, x_rdim, y_rdim);
184 else internal_expand(image, filt, temp, x_fdim, y_fdim,
185 x_start, x_step, x_stop, y_start, y_step, y_stop,
186 result, x_rdim, y_rdim, edges);
187
188 if (orig_x) mxFree((char *) filt);
189 mxFree((char *) temp);
190
191 return;
192 }
193
194
195
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/wrap.c b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/wrap.c
deleted file mode 100755
index a081123..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/wrap.c
+++ /dev/null
@@ -1,281 +0,0 @@
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 <stdlib.h>
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<x_filt_stop; \
41 filt_pos++, x_im++) \
42 sum += imval[YIND][XIND] * filt[filt_pos]; \
43 result[res_pos] = sum; \
44 }
45
46int internal_wrap_reduce(image, x_dim, y_dim, filt, x_fdim, y_fdim,
47 x_start, x_step, x_stop, y_start, y_step, y_stop,
48 result)
49 register image_type *filt, *result;
50 register int x_dim, y_dim, x_fdim, y_fdim;
51 image_type *image;
52 int x_start, x_step, x_stop, y_start, y_step, y_stop;
53 {
54 register double sum;
55 register int filt_size = x_fdim*y_fdim;
56 image_type **imval;
57 register int filt_pos, x_im, y_im, x_filt_stop;
58 register int x_pos, y_pos, res_pos;
59 int x_ctr_stop = x_dim - x_fdim + 1;
60 int y_ctr_stop = y_dim - y_fdim + 1;
61 int x_ctr_start = 0;
62 int y_ctr_start = 0;
63 int x_fmid = x_fdim/2;
64 int y_fmid = y_fdim/2;
65
66 /* shift start/stop coords to filter upper left hand corner */
67 x_start -= x_fmid; y_start -= y_fmid;
68 x_stop -= x_fmid; y_stop -= y_fmid;
69
70 if (x_stop < x_ctr_stop) x_ctr_stop = x_stop;
71 if (y_stop < y_ctr_stop) y_ctr_stop = y_stop;
72
73 /* Set up pointer array for rows */
74 imval = (image_type **) malloc(y_dim*sizeof(image_type *));
75 if (imval IS NULL)
76 {
77 printf("INTERNAL_WRAP: Failed to allocate temp array!");
78 return(-1);
79 }
80 for (y_pos=y_im=0;y_pos<y_dim;y_pos++,y_im+=x_dim)
81 imval[y_pos] = (image+y_im);
82
83 for (res_pos=0, y_pos=y_start; /* TOP ROWS */
84 y_pos<y_ctr_start;
85 y_pos+=y_step)
86 {
87 for (x_pos=x_start;
88 x_pos<x_ctr_start;
89 x_pos+=x_step, res_pos++)
90 INPROD(y_pos+y_dim, y_im%y_dim, x_pos+x_dim, x_im%x_dim)
91
92 for (;
93 x_pos<x_ctr_stop;
94 x_pos+=x_step, res_pos++)
95 INPROD(y_pos+y_dim, y_im%y_dim, x_pos, x_im)
96
97 for (;
98 x_pos<x_stop;
99 x_pos+=x_step, res_pos++)
100 INPROD(y_pos+y_dim, y_im%y_dim, x_pos, x_im%x_dim)
101 } /* end TOP ROWS */
102
103 for (; /* MID ROWS */
104 y_pos<y_ctr_stop;
105 y_pos+=y_step)
106 {
107 for (x_pos=x_start;
108 x_pos<x_ctr_start;
109 x_pos+=x_step, res_pos++)
110 INPROD(y_pos, y_im, x_pos+x_dim, x_im%x_dim)
111
112 for (; /* CENTER SECTION */
113 x_pos<x_ctr_stop;
114 x_pos+=x_step, res_pos++)
115 INPROD(y_pos, y_im, x_pos, x_im)
116
117 for (;
118 x_pos<x_stop;
119 x_pos+=x_step, res_pos++)
120 INPROD(y_pos, y_im, x_pos, x_im%x_dim)
121 } /* end MID ROWS */
122
123 for (; /* BOTTOM ROWS */
124 y_pos<y_stop;
125 y_pos+=y_step)
126 {
127 for (x_pos=x_start;
128 x_pos<x_ctr_start;
129 x_pos+=x_step, res_pos++)
130 INPROD(y_pos, y_im%y_dim, x_pos+x_dim, x_im%x_dim)
131
132 for (;
133 x_pos<x_ctr_stop;
134 x_pos+=x_step, res_pos++)
135 INPROD(y_pos, y_im%y_dim, x_pos, x_im)
136
137 for (;
138 x_pos<x_stop;
139 x_pos+=x_step, res_pos++)
140 INPROD(y_pos, y_im%y_dim, x_pos, x_im%x_dim)
141 } /* end BOTTOM ROWS */
142
143 free ((image_type **) imval);
144
145 return(0);
146 } /* end of internal_wrap_reduce */
147
148
149
150/*
151 --------------------------------------------------------------------
152 Performs upsampling (padding with zeros) followed by convolution of
153 FILT with IMAGE (a.k.a. EXPAND in Burt&Adelson81). The operations
154 are combined to avoid unnecessary multiplication of filter samples
155 with zeros in the upsampled image. The convolution is done in 9
156 sections so that mod operation is not performed unnecessarily.
157 Arguments are described in the comment above internal_wrap_reduce.
158
159 WARNING: this subroutine destructively modifes the RESULT image, so
160 the user must zero the result before invocation!
161 -------------------------------------------------------------------- */
162
163/* abstract out the inner product computation */
164#define INPROD2(YSTART,YIND,XSTART,XIND) \
165 { \
166 val = image[im_pos]; \
167 for (y_res=YSTART, filt_pos=0, x_filt_stop=x_fdim; \
168 x_filt_stop<=filt_size; \
169 y_res++, x_filt_stop+=x_fdim) \
170 for (x_res=XSTART; \
171 filt_pos<x_filt_stop; \
172 filt_pos++, x_res++) \
173 imval[YIND][XIND] += val * filt[filt_pos]; \
174 }
175
176int internal_wrap_expand(image, filt, x_fdim, y_fdim,
177 x_start, x_step, x_stop, y_start, y_step, y_stop,
178 result, x_dim, y_dim)
179 register image_type *filt, *result;
180 register int x_fdim, y_fdim, x_dim, y_dim;
181 image_type *image;
182 int x_start, x_step, x_stop, y_start, y_step, y_stop;
183 {
184 register double val;
185 register int filt_size = x_fdim*y_fdim;
186 image_type **imval;
187 register int filt_pos, x_res, y_res, x_filt_stop;
188 register int x_pos, y_pos, im_pos;
189 int x_ctr_stop = x_dim - x_fdim + 1;
190 int y_ctr_stop = y_dim - y_fdim + 1;
191 int x_ctr_start = 0;
192 int y_ctr_start = 0;
193 int x_fmid = x_fdim/2;
194 int y_fmid = y_fdim/2;
195
196 /* shift start/stop coords to filter upper left hand corner */
197 x_start -= x_fmid; y_start -= y_fmid;
198 x_stop -= x_fmid; y_stop -= y_fmid;
199
200 if (x_stop < x_ctr_stop) x_ctr_stop = x_stop;
201 if (y_stop < y_ctr_stop) y_ctr_stop = y_stop;
202
203 /* Set up pointer array for rows */
204 imval = (image_type **) malloc(y_dim*sizeof(image_type *));
205 if (imval IS NULL)
206 {
207 printf("INTERNAL_WRAP: Failed to allocate temp array!");
208 return(-1);
209 }
210 for (y_pos=y_res=0;y_pos<y_dim;y_pos++,y_res+=x_dim)
211 imval[y_pos] = (result+y_res);
212
213 for (im_pos=0, y_pos=y_start; /* TOP ROWS */
214 y_pos<y_ctr_start;
215 y_pos+=y_step)
216 {
217 for (x_pos=x_start;
218 x_pos<x_ctr_start;
219 x_pos+=x_step, im_pos++)
220 INPROD2(y_pos+y_dim, y_res%y_dim, x_pos+x_dim, x_res%x_dim)
221
222 for (;
223 x_pos<x_ctr_stop;
224 x_pos+=x_step, im_pos++)
225 INPROD2(y_pos+y_dim, y_res%y_dim, x_pos, x_res)
226
227 for (;
228 x_pos<x_stop;
229 x_pos+=x_step, im_pos++)
230 INPROD2(y_pos+y_dim, y_res%y_dim, x_pos, x_res%x_dim)
231 } /* end TOP ROWS */
232
233 for (; /* MID ROWS */
234 y_pos<y_ctr_stop;
235 y_pos+=y_step)
236 {
237 for (x_pos=x_start;
238 x_pos<x_ctr_start;
239 x_pos+=x_step, im_pos++)
240 INPROD2(y_pos, y_res, x_pos+x_dim, x_res%x_dim)
241
242 for (; /* CENTER SECTION */
243 x_pos<x_ctr_stop;
244 x_pos+=x_step, im_pos++)
245 INPROD2(y_pos, y_res, x_pos, x_res)
246
247 for (;
248 x_pos<x_stop;
249 x_pos+=x_step, im_pos++)
250 INPROD2(y_pos, y_res, x_pos, x_res%x_dim)
251 } /* end MID ROWS */
252
253 for (; /* BOTTOM ROWS */
254 y_pos<y_stop;
255 y_pos+=y_step)
256 {
257 for (x_pos=x_start;
258 x_pos<x_ctr_start;
259 x_pos+=x_step, im_pos++)
260 INPROD2(y_pos, y_res%y_dim, x_pos+x_dim, x_res%x_dim)
261
262 for (;
263 x_pos<x_ctr_stop;
264 x_pos+=x_step, im_pos++)
265 INPROD2(y_pos, y_res%y_dim, x_pos, x_res)
266
267 for (;
268 x_pos<x_stop;
269 x_pos+=x_step, im_pos++)
270 INPROD2(y_pos, y_res%y_dim, x_pos, x_res%x_dim)
271 } /* end BOTTOM ROWS */
272
273 free ((image_type **) imval);
274 return(0);
275 } /* end of internal_wrap_expand */
276
277
278
279/* Local Variables: */
280/* buffer-read-only: t */
281/* End: */
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/README b/SD-VBS/benchmarks/texture_synthesis/src/matlab/README
deleted file mode 100755
index 8f339f3..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/README
+++ /dev/null
@@ -1,55 +0,0 @@
1This package contains some MatLab tools for multi-scale image
2processing. Briefly, the tools include:
3 - Recursive multi-scale image decompositions (pyramids), including
4 Laplacian pyramids, QMFs, Wavelets, and steerable pyramids. These
5 operate on 1D or 2D signals of arbitrary dimension. Data
6 structures are compatible with the MatLab wavelet toolbox.
7 - Fast 2D convolution routines, with subsampling and boundary-handling.
8 - Fast point-operations, histograms, histogram-matching.
9 - Fast synthetic image generation: sine gratings, zone plates, fractals, etc.
10 - Display routines for images and pyramids. These include several
11 auto-scaling options, rounding to integer zoom factors to avoid
12 resampling artifacts, and useful labeling (dimensions and gray-range).
13
14The package is available as a gnu-zipped UNIX "tar" file,
15accessible from the web page:
16 http://www.cns.nyu.edu/~lcv/software.html
17
18The code works in Matlab versions 4.2 and higher, and has been fully tested
19on Linux and Macintosh OSX platforms (it should, however, port easily to
20others). To use the code (these lines are for UNIX):
21 1) gunzip matlabPyrTools.tar.gz # unpack g'zipped file
22 2) tar tvf matlabPyrTools.tar # view contents
23 3) tar xvf matlabPyrTools.tar # extract contents
24 4) rm matlabPyrTools.tar # delete tarfile
25 5) Run matlab, and execute:
26 path(<pathname-of-matlabPyrTools>, path);
27 help matlabPyrTools
28
29A few functions are actually MEX interfaces to C code. These are
30contained in the subdirectory called MEX. The MEX files have been
31tested on Sun (Solaris), LinuX on a Pentium platform, and Macintosh
32OSX on a PowerPC, but should not be difficult to compile on most other
33platforms. Source code is included in the MEX directory, as well as
34Make files. I've included pre-compiled versions for a number of
35platforms (Solaris,Linux,Mac,Windows). To make sure these are in your
36matlab path, you can do *one* of the following:
37 1) Create a symbolic link (or macintosh "alias") for the relavent files
38 in the main matlabPyrTools directory, or
39 2) Copy the relavent files into the main matlabPyrTools directory, or
40 3) Put the MEX subdirectory in your matlab path.
41
42Some example script files showing usage of the code are in the
43directory <dir>/TUTORIALS. There is a README file in that directory
44describing the contents.
45
46Incremental changes to the code are documented in the ChangeLog file.
47
48Comments/Suggestions/Bugs to:
49 Eero P. Simoncelli
50 Associate Professor,
51 Center for Neural Science, and
52 Courant Institute for Mathematical Sciences
53 New York University
54 eero.simoncelli@nyu.edu
55 http://www.cns.nyu.edu/~eero/
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/adjustCorr1s.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/adjustCorr1s.m
deleted file mode 100755
index 81f428d..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/adjustCorr1s.m
+++ /dev/null
@@ -1,63 +0,0 @@
1% [newX, snr1, M] = adjustCorr1s(X, Cx, MODE, p)
2%
3% Linearly adjust variables in X to have correlation Cx.
4% Rows of X and newX are samples of a (random) row-vector, such that:
5% 1: newX = X * M
6% 2: newX' * newX = Cx
7%
8% MODE is optional:
9% 0 => choose randomly from the space of linear solutions
10% 1 => simplest soln
11% 2 => minimize angle change (DEFAULT)
12% 3 => SVD minimal vector change soln
13%
14% p is optional:
15% Imposes an intermediate value of correlation between the current one
16% C and Cx:
17% Cx' = (1-p)*C + p*Cx;
18% DEFAULT is p=1.
19
20% EPS, 11/23/97.
21
22function [newX, snr1, M] = adjustCorr1s(X,Co,mode,p)
23
24if (exist('mode') ~= 1)
25 mode = 2;
26end
27
28if (exist('p') ~= 1)
29 p = 1;
30end
31
32C = innerProd(X) / size(X,1);
33[E, D] = eig(C);
34D = diag(D);
35[junk,Ind] = sort(D);
36D = diag(sqrt(D(Ind(size(Ind,1):-1:1))));
37E = E(:,Ind(size(Ind,1):-1:1));
38
39Co0 = Co;
40Co = (1-p)*C + p*Co;
41
42[Eo,Do] = eig(Co);
43Do = diag(Do);
44[junk,Ind] = sort(Do);
45Do = diag(sqrt(Do(Ind(size(Ind,1):-1:1))));
46Eo = Eo(:,Ind(size(Ind,1):-1:1));
47
48if (mode == 0)
49 Orth = orth(rand(size(C)));
50elseif (mode == 1) % eye
51 Orth = eye(size(C));
52elseif (mode == 2) % simple
53 Orth = E' * Eo;
54else % SVD
55 [U,S,V] = svd(D * E' * Eo * inv(Do));
56 Orth = U * V';
57end
58
59M = E * inv(D) * Orth * Do * Eo';
60
61newX = X * M;
62
63snr1=10*log10(sum(sum(Co0.^2))/sum(sum((Co0-C).^2)));
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/adjustCorr2s.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/adjustCorr2s.m
deleted file mode 100755
index 3bd0c2e..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/adjustCorr2s.m
+++ /dev/null
@@ -1,99 +0,0 @@
1% [newX, snr1, snr2, Mx, My] = adjustCorr2s(X, Cx, Y, Cxy, MODE, p)
2%
3% Linearly adjust variables in X to have correlation Cx, and cross-correlation Cxy.
4% Rows of X, Y, and newX are samples of (random) row-vectors, such that:
5% 1: newX = X * Mx + Y * My
6% 2: newX' * newX = Cx
7% 3: newX' * Y = Cxy
8%
9% MODE is optional:
10% 0 => choose randomly from the space of linear solutions
11% 1 => simplest soln
12% 2 => minimize angle change
13% 3 => Simple rotational (DEFAULT)
14% 4 => SVD minimal vector change soln
15%
16% p is optional:
17% Imposes an intermediate value of correlation between the current ones
18% Bx and Bxy and the specified Cx and Cxy:
19% Cx' = (1-p)*Bx + p*Cx;
20% Cxy' = (1-p)*Bxy + p*Cxy;
21% DEFAULT is p=1.
22
23
24% EPS, 11/25/97
25
26function [newX,snr1,snr2,Mx,My] = adjustCorr2s(X, Cx, Y, Cxy, mode, p)
27
28Warn = 0; % Set to 1 if you want to display warning messages
29if (exist('mode') ~= 1)
30 mode = 3;
31end
32if (exist('p') ~= 1)
33 p = 1;
34end
35
36Bx = innerProd(X) / size(X,1);
37Bxy = (X' * Y) / size(X,1);
38By = innerProd(Y) / size(X,1);
39iBy = inv(By);
40
41Current = Bx - (Bxy * iBy * Bxy');
42Cx0 = Cx;
43Cx = (1-p)*Bx + p*Cx;
44Cxy0 = Cxy;
45Cxy = (1-p)*Bxy + p*Cxy;
46Desired = Cx - (Cxy * iBy * Cxy');
47
48[E, D] = eig(Current);
49D = diag(D);
50if any(D < 0) & Warn
51 ind = find(D<0);
52 fprintf(1,'Warning: negative current eigenvalues: %d\n',D(ind)');
53end
54[junk,Ind] = sort(D);
55D = diag(sqrt(D(Ind(size(Ind,1):-1:1))));
56E = E(:,Ind(size(Ind,1):-1:1));
57
58[Eo,Do] = eig(Desired);
59Do = diag(Do);
60if any(Do < 0) & Warn
61 ind = find(Do<0);
62 fprintf(1,'Warning: negative desired eigenvalues: %d\n',Do(ind)');
63end
64[junk,Ind] = sort(Do);
65Do = diag(sqrt(Do(Ind(size(Ind,1):-1:1))));
66Eo = Eo(:,Ind(size(Ind,1):-1:1));
67
68if (mode == 0)
69 Orth = orth(rand(size(D)));
70elseif (mode == 1) % eye
71 Orth = eye(size(D));
72elseif (mode == 2) % simple
73 A = [ eye(size(Cx)); -iBy*Bxy' ];
74 Ao = [ eye(size(Cx)); -iBy*Cxy' ];
75 [U,S,V] = svd(E' * pinv(A) * Ao * Eo);
76 Orth = U * V';
77elseif (mode == 3)
78 Orth = E' * Eo;
79else % SVD
80 A = [ eye(size(Cx)); -iBy*Bxy' ];
81 Ao = [ eye(size(Cx)); -iBy*Cxy' ];
82 [U,S,V] = svd(D * E' * pinv(A) * Ao * Eo * inv(Do));
83 Orth = U * V';
84end
85
86Mx = E * inv(D) * Orth * Do * Eo';
87My = iBy * (Cxy' - Bxy' * Mx);
88newX = X * Mx + Y * My;
89
90if Cx0~=Bx,
91 snr1=10*log10(sum(sum(Cx0.^2))/sum(sum((Cx0-Bx).^2)));
92else
93 snr1 = Inf;
94end
95if Cxy0~=Bxy,
96 snr2=10*log10(sum(sum(Cxy0.^2))/sum(sum((Cxy0-Bxy).^2)));
97else
98 snr2 = Inf;
99end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/binomialFilter.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/binomialFilter.m
deleted file mode 100755
index e5670c7..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/binomialFilter.m
+++ /dev/null
@@ -1,18 +0,0 @@
1% KERNEL = binomialFilter(size)
2%
3% Returns a vector of binomial coefficients of order (size-1) .
4
5% Eero Simoncelli, 2/97.
6
7function [kernel] = binomialFilter(sz)
8
9if (sz < 2)
10 error('size argument must be larger than 1');
11end
12
13kernel = [0.5 0.5]';
14
15for n=1:sz-2
16 kernel = conv([0.5 0.5]', kernel);
17end
18
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/blur.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/blur.m
deleted file mode 100755
index f993d09..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/blur.m
+++ /dev/null
@@ -1,28 +0,0 @@
1% RES = blur(IM, LEVELS, FILT)
2%
3% Blur an image, by filtering and downsampling LEVELS times
4% (default=1), followed by upsampling and filtering LEVELS times. The
5% blurring is done with filter kernel specified by FILT (default =
6% 'binom5'), which can be a string (to be passed to namedFilter), a
7% vector (applied separably as a 1D convolution kernel in X and Y), or
8% a matrix (applied as a 2D convolution kernel). The downsampling is
9% always by 2 in each direction.
10
11% Eero Simoncelli, 3/04.
12
13function res = blur(im, nlevs, filt)
14
15%------------------------------------------------------------
16%% OPTIONAL ARGS:
17
18if (exist('nlevs') ~= 1)
19 nlevs = 1;
20end
21
22if (exist('filt') ~= 1)
23 filt = 'binom5';
24end
25
26%------------------------------------------------------------
27
28res = upBlur(blurDn(im,nlevs,filt)); \ No newline at end of file
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/blurDn.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/blurDn.m
deleted file mode 100755
index 8120c04..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/blurDn.m
+++ /dev/null
@@ -1,59 +0,0 @@
1% RES = blurDn(IM, LEVELS, FILT)
2%
3% Blur and downsample an image. The blurring is done with filter
4% kernel specified by FILT (default = 'binom5'), which can be a string
5% (to be passed to namedFilter), a vector (applied separably as a 1D
6% convolution kernel in X and Y), or a matrix (applied as a 2D
7% convolution kernel). The downsampling is always by 2 in each
8% direction.
9%
10% The procedure is applied recursively LEVELS times (default=1).
11
12% Eero Simoncelli, 3/97.
13
14function res = blurDn(im, nlevs, filt)
15
16%------------------------------------------------------------
17%% OPTIONAL ARGS:
18
19if (exist('nlevs') ~= 1)
20 nlevs = 1;
21end
22
23if (exist('filt') ~= 1)
24 filt = 'binom5';
25end
26
27%------------------------------------------------------------
28
29if isstr(filt)
30 filt = namedFilter(filt);
31end
32
33filt = filt/sum(filt(:));
34
35if nlevs > 1
36 im = blurDn(im,nlevs-1,filt);
37end
38
39if (nlevs >= 1)
40 if (any(size(im)==1))
41 if (~any(size(filt)==1))
42 error('Cant apply 2D filter to 1D signal');
43 end
44 if (size(im,2)==1)
45 filt = filt(:);
46 else
47 filt = filt(:)';
48 end
49 res = corrDn(im,filt,'reflect1',(size(im)~=1)+1);
50 elseif (any(size(filt)==1))
51 filt = filt(:);
52 res = corrDn(im,filt,'reflect1',[2 1]);
53 res = corrDn(res,filt','reflect1',[1 2]);
54 else
55 res = corrDn(im,filt,'reflect1',[2 2]);
56 end
57else
58 res = im;
59end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildGpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildGpyr.m
deleted file mode 100755
index 3f3d07b..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildGpyr.m
+++ /dev/null
@@ -1,82 +0,0 @@
1% [PYR, INDICES] = buildGpyr(IM, HEIGHT, FILT, EDGES)
2%
3% Construct a Gaussian pyramid on matrix IM.
4%
5% HEIGHT (optional) specifies the number of pyramid levels to build. Default
6% is 1+maxPyrHt(size(IM),size(FILT)).
7% You can also specify 'auto' to use this value.
8%
9% FILT (optional) can be a string naming a standard filter (see
10% namedFilter), or a vector which will be used for (separable)
11% convolution. Default = 'binom5'. EDGES specifies edge-handling, and
12% defaults to 'reflect1' (see corrDn).
13%
14% PYR is a vector containing the N pyramid subbands, ordered from fine
15% to coarse. INDICES is an Nx2 matrix containing the sizes of
16% each subband. This is compatible with the MatLab Wavelet toolbox.
17
18% Eero Simoncelli, 6/96.
19
20function [pyr,pind] = buildGpyr(im, ht, filt, edges)
21
22if (nargin < 1)
23 error('First argument (IM) is required');
24end
25
26im_sz = size(im);
27
28%------------------------------------------------------------
29%% OPTIONAL ARGS:
30
31if (exist('filt') ~= 1)
32 filt = 'binom5';
33end
34
35if isstr(filt)
36 filt = namedFilter(filt);
37end
38
39if ( (size(filt,1) > 1) & (size(filt,2) > 1) )
40 error('FILT should be a 1D filter (i.e., a vector)');
41else
42 filt = filt(:);
43end
44
45max_ht = 1 + maxPyrHt(im_sz, size(filt,1));
46if ( (exist('ht') ~= 1) | (ht == 'auto') )
47 ht = max_ht;
48else
49 if (ht > max_ht)
50 error(sprintf('Cannot build pyramid higher than %d levels.',max_ht));
51 end
52end
53
54if (exist('edges') ~= 1)
55 edges= 'reflect1';
56end
57
58%------------------------------------------------------------
59
60if (ht <= 1)
61
62 pyr = im(:);
63 pind = im_sz;
64
65else
66
67 if (im_sz(2) == 1)
68 lo2 = corrDn(im, filt, edges, [2 1], [1 1]);
69 elseif (im_sz(1) == 1)
70 lo2 = corrDn(im, filt', edges, [1 2], [1 1]);
71 else
72 lo = corrDn(im, filt', edges, [1 2], [1 1]);
73 lo2 = corrDn(lo, filt, edges, [2 1], [1 1]);
74 end
75
76 [npyr,nind] = buildGpyr(lo2, ht-1, filt, edges);
77
78 pyr = [im(:); npyr];
79 pind = [im_sz; nind];
80
81end
82
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildLpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildLpyr.m
deleted file mode 100755
index facb0f3..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildLpyr.m
+++ /dev/null
@@ -1,109 +0,0 @@
1% [PYR, INDICES] = buildLpyr(IM, HEIGHT, FILT1, FILT2, EDGES)
2%
3% Construct a Laplacian pyramid on matrix (or vector) IM.
4%
5% HEIGHT (optional) specifies the number of pyramid levels to build. Default
6% is 1+maxPyrHt(size(IM),size(FILT)). You can also specify 'auto' to
7% use this value.
8%
9% FILT1 (optional) can be a string naming a standard filter (see
10% namedFilter), or a vector which will be used for (separable)
11% convolution. Default = 'binom5'. FILT2 specifies the "expansion"
12% filter (default = filt1). EDGES specifies edge-handling, and
13% defaults to 'reflect1' (see corrDn).
14%
15% PYR is a vector containing the N pyramid subbands, ordered from fine
16% to coarse. INDICES is an Nx2 matrix containing the sizes of
17% each subband. This is compatible with the MatLab Wavelet toolbox.
18
19% Eero Simoncelli, 6/96.
20
21function [pyr,pind] = buildLpyr(im, ht, filt1, filt2, edges)
22
23if (nargin < 1)
24 error('First argument (IM) is required');
25end
26
27im_sz = size(im);
28
29%------------------------------------------------------------
30%% OPTIONAL ARGS:
31
32if (exist('filt1') ~= 1)
33 filt1 = 'binom5';
34end
35
36if isstr(filt1)
37 filt1 = namedFilter(filt1);
38end
39
40if ( (size(filt1,1) > 1) & (size(filt1,2) > 1) )
41 error('FILT1 should be a 1D filter (i.e., a vector)');
42else
43 filt1 = filt1(:);
44end
45
46if (exist('filt2') ~= 1)
47 filt2 = filt1;
48end
49
50if isstr(filt2)
51 filt2 = namedFilter(filt2);
52end
53
54if ( (size(filt2,1) > 1) & (size(filt2,2) > 1) )
55 error('FILT2 should be a 1D filter (i.e., a vector)');
56else
57 filt2 = filt2(:);
58end
59
60max_ht = 1 + maxPyrHt(im_sz, max(size(filt1,1), size(filt2,1)));
61if ( (exist('ht') ~= 1) | (ht == 'auto') )
62 ht = max_ht;
63else
64 if (ht > max_ht)
65 error(sprintf('Cannot build pyramid higher than %d levels.',max_ht));
66 end
67end
68
69if (exist('edges') ~= 1)
70 edges= 'reflect1';
71end
72
73%------------------------------------------------------------
74
75if (ht <= 1)
76
77 pyr = im(:);
78 pind = im_sz;
79
80else
81
82 if (im_sz(2) == 1)
83 lo2 = corrDn(im, filt1, edges, [2 1], [1 1]);
84 elseif (im_sz(1) == 1)
85 lo2 = corrDn(im, filt1', edges, [1 2], [1 1]);
86 else
87 lo = corrDn(im, filt1', edges, [1 2], [1 1]);
88 int_sz = size(lo);
89 lo2 = corrDn(lo, filt1, edges, [2 1], [1 1]);
90 end
91
92 [npyr,nind] = buildLpyr(lo2, ht-1, filt1, filt2, edges);
93
94 if (im_sz(1) == 1)
95 hi2 = upConv(lo2, filt2', edges, [1 2], [1 1], im_sz);
96 elseif (im_sz(2) == 1)
97 hi2 = upConv(lo2, filt2, edges, [2 1], [1 1], im_sz);
98 else
99 hi = upConv(lo2, filt2, edges, [2 1], [1 1], int_sz);
100 hi2 = upConv(hi, filt2', edges, [1 2], [1 1], im_sz);
101 end
102
103 hi2 = im - hi2;
104
105 pyr = [hi2(:); npyr];
106 pind = [im_sz; nind];
107
108end
109
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSCFpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSCFpyr.m
deleted file mode 100755
index 101b6d2..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSCFpyr.m
+++ /dev/null
@@ -1,90 +0,0 @@
1% [PYR, INDICES, STEERMTX, HARMONICS] = buildSCFpyr(IM, HEIGHT, ORDER, TWIDTH)
2%
3% This is a modified version of buildSFpyr, that constructs a
4% complex-valued steerable pyramid using Hilbert-transform pairs
5% of filters. Note that the imaginary parts will *not* be steerable.
6%
7% To reconstruct from this representation, either call reconSFpyr
8% on the real part of the pyramid, *or* call reconSCFpyr which will
9% use both real and imaginary parts (forcing analyticity).
10%
11% Description of this transform appears in: Portilla & Simoncelli,
12% Int'l Journal of Computer Vision, 40(1):49-71, Oct 2000.
13% Further information: http://www.cns.nyu.edu/~eero/STEERPYR/
14
15% Original code: Eero Simoncelli, 5/97.
16% Modified by Javier Portilla to return complex (quadrature pair) channels,
17% 9/97.
18
19function [pyr,pind,steermtx,harmonics] = buildSCFpyr(im, ht, order, twidth)
20
21%-----------------------------------------------------------------
22%% DEFAULTS:
23
24max_ht = floor(log2(min(size(im)))) - 2;
25
26if (exist('ht') ~= 1)
27 ht = max_ht;
28else
29 if (ht > max_ht)
30 error(sprintf('Cannot build pyramid higher than %d levels.',max_ht));
31 end
32end
33
34if (exist('order') ~= 1)
35 order = 3;
36elseif ((order > 15) | (order < 0))
37 fprintf(1,'Warning: ORDER must be an integer in the range [0,15]. Truncating.\n');
38 order = min(max(order,0),15);
39else
40 order = round(order);
41end
42nbands = order+1;
43
44if (exist('twidth') ~= 1)
45 twidth = 1;
46elseif (twidth <= 0)
47 fprintf(1,'Warning: TWIDTH must be positive. Setting to 1.\n');
48 twidth = 1;
49end
50
51%-----------------------------------------------------------------
52%% Steering stuff:
53
54if (mod((nbands),2) == 0)
55 harmonics = [0:(nbands/2)-1]'*2 + 1;
56else
57 harmonics = [0:(nbands-1)/2]'*2;
58end
59
60steermtx = steer2HarmMtx(harmonics, pi*[0:nbands-1]/nbands, 'even');
61
62%-----------------------------------------------------------------
63
64dims = size(im);
65ctr = ceil((dims+0.5)/2);
66
67[xramp,yramp] = meshgrid( ([1:dims(2)]-ctr(2))./(dims(2)/2), ...
68 ([1:dims(1)]-ctr(1))./(dims(1)/2) );
69angle = atan2(yramp,xramp);
70log_rad = sqrt(xramp.^2 + yramp.^2);
71log_rad(ctr(1),ctr(2)) = log_rad(ctr(1),ctr(2)-1);
72log_rad = log2(log_rad);
73
74%% Radial transition function (a raised cosine in log-frequency):
75[Xrcos,Yrcos] = rcosFn(twidth,(-twidth/2),[0 1]);
76Yrcos = sqrt(Yrcos);
77
78YIrcos = sqrt(1.0 - Yrcos.^2);
79lo0mask = pointOp(log_rad, YIrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
80imdft = fftshift(fft2(im));
81lo0dft = imdft .* lo0mask;
82
83[pyr,pind] = buildSCFpyrLevs(lo0dft, log_rad, Xrcos, Yrcos, angle, ht, nbands);
84
85hi0mask = pointOp(log_rad, Yrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
86hi0dft = imdft .* hi0mask;
87hi0 = ifft2(ifftshift(hi0dft));
88
89pyr = [real(hi0(:)) ; pyr];
90pind = [size(hi0); pind];
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSCFpyrLevs.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSCFpyrLevs.m
deleted file mode 100755
index bd75695..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSCFpyrLevs.m
+++ /dev/null
@@ -1,73 +0,0 @@
1% [PYR, INDICES] = buildSCFpyrLevs(LODFT, LOGRAD, XRCOS, YRCOS, ANGLE, HEIGHT, NBANDS)
2%
3% Recursive function for constructing levels of a steerable pyramid. This
4% is called by buildSCFpyr, and is not usually called directly.
5
6% Original code: Eero Simoncelli, 5/97.
7% Modified by Javier Portilla to generate complex bands in 9/97.
8
9function [pyr,pind] = buildSCFpyrLevs(lodft,log_rad,Xrcos,Yrcos,angle,ht,nbands);
10
11if (ht <= 0)
12
13 lo0 = ifft2(ifftshift(lodft));
14 pyr = real(lo0(:));
15 pind = size(lo0);
16
17else
18
19 bands = zeros(prod(size(lodft)), nbands);
20 bind = zeros(nbands,2);
21
22% log_rad = log_rad + 1;
23 Xrcos = Xrcos - log2(2); % shift origin of lut by 1 octave.
24
25 lutsize = 1024;
26 Xcosn = pi*[-(2*lutsize+1):(lutsize+1)]/lutsize; % [-2*pi:pi]
27 order = nbands-1;
28 %% divide by sqrt(sum_(n=0)^(N-1) cos(pi*n/N)^(2(N-1)) )
29 %% Thanks to Patrick Teo for writing this out :)
30 const = (2^(2*order))*(factorial(order)^2)/(nbands*factorial(2*order));
31
32%
33% Ycosn = sqrt(const) * (cos(Xcosn)).^order;
34%
35 % analityc version: only take one lobe
36 alfa= mod(pi+Xcosn,2*pi)-pi;
37 Ycosn = 2*sqrt(const) * (cos(Xcosn).^order) .* (abs(alfa)<pi/2);
38
39 himask = pointOp(log_rad, Yrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
40
41 for b = 1:nbands
42 anglemask = pointOp(angle, Ycosn, Xcosn(1)+pi*(b-1)/nbands, Xcosn(2)-Xcosn(1));
43 banddft = ((-i)^(nbands-1)) .* lodft .* anglemask .* himask;
44 band = ifft2(ifftshift(banddft));
45
46% bands(:,b) = real(band(:));
47 % analytic version: full complex value
48 bands(:,b)=band(:);
49 bind(b,:) = size(band);
50 end
51
52 dims = size(lodft);
53 ctr = ceil((dims+0.5)/2);
54 lodims = ceil((dims-0.5)/2);
55 loctr = ceil((lodims+0.5)/2);
56 lostart = ctr-loctr+1;
57 loend = lostart+lodims-1;
58
59 log_rad = log_rad(lostart(1):loend(1),lostart(2):loend(2));
60 angle = angle(lostart(1):loend(1),lostart(2):loend(2));
61 lodft = lodft(lostart(1):loend(1),lostart(2):loend(2));
62 YIrcos = abs(sqrt(1.0 - Yrcos.^2));
63 lomask = pointOp(log_rad, YIrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
64
65 lodft = lomask .* lodft;
66
67 [npyr,nind] = buildSCFpyrLevs(lodft, log_rad, Xrcos, Yrcos, angle, ht-1, nbands);
68
69 pyr = [bands(:); npyr];
70 pind = [bind; nind];
71
72end
73
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSFpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSFpyr.m
deleted file mode 100755
index ae67206..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSFpyr.m
+++ /dev/null
@@ -1,102 +0,0 @@
1% [PYR, INDICES, STEERMTX, HARMONICS] = buildSFpyr(IM, HEIGHT, ORDER, TWIDTH)
2%
3% Construct a steerable pyramid on matrix IM, in the Fourier domain.
4% This is similar to buildSpyr, except that:
5%
6% + Reconstruction is exact (within floating point errors)
7% + It can produce any number of orientation bands.
8% - Typically slower, especially for non-power-of-two sizes.
9% - Boundary-handling is circular.
10%
11% HEIGHT (optional) specifies the number of pyramid levels to build. Default
12% is maxPyrHt(size(IM),size(FILT));
13%
14% The squared radial functions tile the Fourier plane, with a raised-cosine
15% falloff. Angular functions are cos(theta-k\pi/(K+1))^K, where K is
16% the ORDER (one less than the number of orientation bands, default= 3).
17%
18% TWIDTH is the width of the transition region of the radial lowpass
19% function, in octaves (default = 1, which gives a raised cosine for
20% the bandpass filters).
21%
22% PYR is a vector containing the N pyramid subbands, ordered from fine
23% to coarse. INDICES is an Nx2 matrix containing the sizes of
24% each subband. This is compatible with the MatLab Wavelet toolbox.
25% See the function STEER for a description of STEERMTX and HARMONICS.
26
27% Eero Simoncelli, 5/97.
28% See http://www.cns.nyu.edu/~eero/STEERPYR/ for more
29% information about the Steerable Pyramid image decomposition.
30
31function [pyr,pind,steermtx,harmonics] = buildSFpyr(im, ht, order, twidth)
32
33%-----------------------------------------------------------------
34%% DEFAULTS:
35
36max_ht = floor(log2(min(size(im)))) - 2;
37
38if (exist('ht') ~= 1)
39 ht = max_ht;
40else
41 if (ht > max_ht)
42 error(sprintf('Cannot build pyramid higher than %d levels.',max_ht));
43 end
44end
45
46if (exist('order') ~= 1)
47 order = 3;
48elseif ((order > 15) | (order < 0))
49 fprintf(1,'Warning: ORDER must be an integer in the range [0,15]. Truncating.\n');
50 order = min(max(order,0),15);
51else
52 order = round(order);
53end
54nbands = order+1;
55
56if (exist('twidth') ~= 1)
57 twidth = 1;
58elseif (twidth <= 0)
59 fprintf(1,'Warning: TWIDTH must be positive. Setting to 1.\n');
60 twidth = 1;
61end
62
63%-----------------------------------------------------------------
64%% Steering stuff:
65
66if (mod((nbands),2) == 0)
67 harmonics = [0:(nbands/2)-1]'*2 + 1;
68else
69 harmonics = [0:(nbands-1)/2]'*2;
70end
71
72steermtx = steer2HarmMtx(harmonics, pi*[0:nbands-1]/nbands, 'even');
73
74%-----------------------------------------------------------------
75
76dims = size(im);
77ctr = ceil((dims+0.5)/2);
78
79[xramp,yramp] = meshgrid( ([1:dims(2)]-ctr(2))./(dims(2)/2), ...
80 ([1:dims(1)]-ctr(1))./(dims(1)/2) );
81angle = atan2(yramp,xramp);
82log_rad = sqrt(xramp.^2 + yramp.^2);
83log_rad(ctr(1),ctr(2)) = log_rad(ctr(1),ctr(2)-1);
84log_rad = log2(log_rad);
85
86%% Radial transition function (a raised cosine in log-frequency):
87[Xrcos,Yrcos] = rcosFn(twidth,(-twidth/2),[0 1]);
88Yrcos = sqrt(Yrcos);
89
90YIrcos = sqrt(1.0 - Yrcos.^2);
91lo0mask = pointOp(log_rad, YIrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
92imdft = fftshift(fft2(im));
93lo0dft = imdft .* lo0mask;
94
95[pyr,pind] = buildSFpyrLevs(lo0dft, log_rad, Xrcos, Yrcos, angle, ht, nbands);
96
97hi0mask = pointOp(log_rad, Yrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
98hi0dft = imdft .* hi0mask;
99hi0 = ifft2(ifftshift(hi0dft));
100
101pyr = [real(hi0(:)) ; pyr];
102pind = [size(hi0); pind];
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSFpyrLevs.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSFpyrLevs.m
deleted file mode 100755
index 472d861..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSFpyrLevs.m
+++ /dev/null
@@ -1,63 +0,0 @@
1% [PYR, INDICES] = buildSFpyrLevs(LODFT, LOGRAD, XRCOS, YRCOS, ANGLE, HEIGHT, NBANDS)
2%
3% Recursive function for constructing levels of a steerable pyramid. This
4% is called by buildSFpyr, and is not usually called directly.
5
6% Eero Simoncelli, 5/97.
7
8function [pyr,pind] = buildSFpyrLevs(lodft,log_rad,Xrcos,Yrcos,angle,ht,nbands);
9
10if (ht <= 0)
11
12 lo0 = ifft2(ifftshift(lodft));
13 pyr = real(lo0(:));
14 pind = size(lo0);
15
16else
17
18 bands = zeros(prod(size(lodft)), nbands);
19 bind = zeros(nbands,2);
20
21% log_rad = log_rad + 1;
22 Xrcos = Xrcos - log2(2); % shift origin of lut by 1 octave.
23
24 lutsize = 1024;
25 Xcosn = pi*[-(2*lutsize+1):(lutsize+1)]/lutsize; % [-2*pi:pi]
26 order = nbands-1;
27 %% divide by sqrt(sum_(n=0)^(N-1) cos(pi*n/N)^(2(N-1)) )
28 %% Thanks to Patrick Teo for writing this out :)
29 const = (2^(2*order))*(factorial(order)^2)/(nbands*factorial(2*order));
30 Ycosn = sqrt(const) * (cos(Xcosn)).^order;
31 himask = pointOp(log_rad, Yrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
32
33 for b = 1:nbands
34 anglemask = pointOp(angle, Ycosn, Xcosn(1)+pi*(b-1)/nbands, Xcosn(2)-Xcosn(1));
35 banddft = ((-sqrt(-1))^(nbands-1)) .* lodft .* anglemask .* himask;
36 band = ifft2(ifftshift(banddft));
37
38 bands(:,b) = real(band(:));
39 bind(b,:) = size(band);
40 end
41
42 dims = size(lodft);
43 ctr = ceil((dims+0.5)/2);
44 lodims = ceil((dims-0.5)/2);
45 loctr = ceil((lodims+0.5)/2);
46 lostart = ctr-loctr+1;
47 loend = lostart+lodims-1;
48
49 log_rad = log_rad(lostart(1):loend(1),lostart(2):loend(2));
50 angle = angle(lostart(1):loend(1),lostart(2):loend(2));
51 lodft = lodft(lostart(1):loend(1),lostart(2):loend(2));
52 YIrcos = abs(sqrt(1.0 - Yrcos.^2));
53 lomask = pointOp(log_rad, YIrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
54
55 lodft = lomask .* lodft;
56
57 [npyr,nind] = buildSFpyrLevs(lodft, log_rad, Xrcos, Yrcos, angle, ht-1, nbands);
58
59 pyr = [bands(:); npyr];
60 pind = [bind; nind];
61
62end
63
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSpyr.m
deleted file mode 100755
index b2bead6..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSpyr.m
+++ /dev/null
@@ -1,61 +0,0 @@
1% [PYR, INDICES, STEERMTX, HARMONICS] = buildSpyr(IM, HEIGHT, FILTFILE, EDGES)
2%
3% Construct a steerable pyramid on matrix IM.
4%
5% HEIGHT (optional) specifies the number of pyramid levels to build. Default
6% is maxPyrHt(size(IM),size(FILT)).
7% You can also specify 'auto' to use this value.
8%
9% FILTFILE (optional) should be a string referring to an m-file that
10% returns the rfilters. (examples: 'sp0Filters', 'sp1Filters',
11% 'sp3Filters','sp5Filters'. default = 'sp1Filters'). EDGES specifies
12% edge-handling, and defaults to 'reflect1' (see corrDn).
13%
14% PYR is a vector containing the N pyramid subbands, ordered from fine
15% to coarse. INDICES is an Nx2 matrix containing the sizes of
16% each subband. This is compatible with the MatLab Wavelet toolbox.
17% See the function STEER for a description of STEERMTX and HARMONICS.
18
19% Eero Simoncelli, 6/96.
20% See http://www.cis.upenn.edu/~eero/steerpyr.html for more
21% information about the Steerable Pyramid image decomposition.
22
23function [pyr,pind,steermtx,harmonics] = buildSpyr(im, ht, filtfile, edges)
24
25%-----------------------------------------------------------------
26%% DEFAULTS:
27
28if (exist('filtfile') ~= 1)
29 filtfile = 'sp1Filters';
30end
31
32if (exist('edges') ~= 1)
33 edges= 'reflect1';
34end
35
36if (isstr(filtfile) & (exist(filtfile) == 2))
37 [lo0filt,hi0filt,lofilt,bfilts,steermtx,harmonics] = eval(filtfile);
38else
39 fprintf(1,'\nUse buildSFpyr for pyramids with arbitrary numbers of orientation bands.\n');
40 error('FILTFILE argument must be the name of an M-file containing SPYR filters.');
41end
42
43max_ht = maxPyrHt(size(im), size(lofilt,1));
44if ( (exist('ht') ~= 1) | (ht == 'auto') )
45 ht = max_ht;
46else
47 if (ht > max_ht)
48 error(sprintf('Cannot build pyramid higher than %d levels.',max_ht));
49 end
50end
51
52%-----------------------------------------------------------------
53
54hi0 = corrDn(im, hi0filt, edges);
55lo0 = corrDn(im, lo0filt, edges);
56
57[pyr,pind] = buildSpyrLevs(lo0, ht, lofilt, bfilts, edges);
58
59pyr = [hi0(:) ; pyr];
60pind = [size(hi0); pind];
61
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSpyrLevs.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSpyrLevs.m
deleted file mode 100755
index 4c00077..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSpyrLevs.m
+++ /dev/null
@@ -1,37 +0,0 @@
1% [PYR, INDICES] = buildSpyrLevs(LOIM, HEIGHT, LOFILT, BFILTS, EDGES)
2%
3% Recursive function for constructing levels of a steerable pyramid. This
4% is called by buildSpyr, and is not usually called directly.
5
6% Eero Simoncelli, 6/96.
7
8function [pyr,pind] = buildSpyrLevs(lo0,ht,lofilt,bfilts,edges);
9
10if (ht <= 0)
11
12 pyr = lo0(:);
13 pind = size(lo0);
14
15else
16
17 % Assume square filters:
18 bfiltsz = round(sqrt(size(bfilts,1)));
19
20 bands = zeros(prod(size(lo0)),size(bfilts,2));
21 bind = zeros(size(bfilts,2),2);
22
23 for b = 1:size(bfilts,2)
24 filt = reshape(bfilts(:,b),bfiltsz,bfiltsz);
25 band = corrDn(lo0, filt, edges);
26 bands(:,b) = band(:);
27 bind(b,:) = size(band);
28 end
29
30 lo = corrDn(lo0, lofilt, edges, [2 2], [1 1]);
31
32 [npyr,nind] = buildSpyrLevs(lo, ht-1, lofilt, bfilts, edges);
33
34 pyr = [bands(:); npyr];
35 pind = [bind; nind];
36
37end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildWpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildWpyr.m
deleted file mode 100755
index 22ae32f..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildWpyr.m
+++ /dev/null
@@ -1,100 +0,0 @@
1% [PYR, INDICES] = buildWpyr(IM, HEIGHT, FILT, EDGES)
2%
3% Construct a separable orthonormal QMF/wavelet pyramid on matrix (or vector) IM.
4%
5% HEIGHT (optional) specifies the number of pyramid levels to build. Default
6% is maxPyrHt(IM,FILT). You can also specify 'auto' to use this value.
7%
8% FILT (optional) can be a string naming a standard filter (see
9% namedFilter), or a vector which will be used for (separable)
10% convolution. Filter can be of even or odd length, but should be symmetric.
11% Default = 'qmf9'. EDGES specifies edge-handling, and
12% defaults to 'reflect1' (see corrDn).
13%
14% PYR is a vector containing the N pyramid subbands, ordered from fine
15% to coarse. INDICES is an Nx2 matrix containing the sizes of
16% each subband. This is compatible with the MatLab Wavelet toolbox.
17
18% Eero Simoncelli, 6/96.
19
20function [pyr,pind] = buildWpyr(im, ht, filt, edges)
21
22if (nargin < 1)
23 error('First argument (IM) is required');
24end
25
26%------------------------------------------------------------
27%% OPTIONAL ARGS:
28
29if (exist('filt') ~= 1)
30 filt = 'qmf9';
31end
32
33if (exist('edges') ~= 1)
34 edges= 'reflect1';
35end
36
37if isstr(filt)
38 filt = namedFilter(filt);
39end
40
41if ( (size(filt,1) > 1) & (size(filt,2) > 1) )
42 error('FILT should be a 1D filter (i.e., a vector)');
43else
44 filt = filt(:);
45end
46
47hfilt = modulateFlip(filt);
48
49% Stagger sampling if filter is odd-length:
50if (mod(size(filt,1),2) == 0)
51 stag = 2;
52else
53 stag = 1;
54end
55
56im_sz = size(im);
57
58max_ht = maxPyrHt(im_sz, size(filt,1));
59if ( (exist('ht') ~= 1) | (ht == 'auto') )
60 ht = max_ht;
61else
62 if (ht > max_ht)
63 error(sprintf('Cannot build pyramid higher than %d levels.',max_ht));
64 end
65end
66
67if (ht <= 0)
68
69 pyr = im(:);
70 pind = im_sz;
71
72else
73
74 if (im_sz(2) == 1)
75 lolo = corrDn(im, filt, edges, [2 1], [stag 1]);
76 hihi = corrDn(im, hfilt, edges, [2 1], [2 1]);
77 elseif (im_sz(1) == 1)
78 lolo = corrDn(im, filt', edges, [1 2], [1 stag]);
79 hihi = corrDn(im, hfilt', edges, [1 2], [1 2]);
80 else
81 lo = corrDn(im, filt, edges, [2 1], [stag 1]);
82 hi = corrDn(im, hfilt, edges, [2 1], [2 1]);
83 lolo = corrDn(lo, filt', edges, [1 2], [1 stag]);
84 lohi = corrDn(hi, filt', edges, [1 2], [1 stag]); % horizontal
85 hilo = corrDn(lo, hfilt', edges, [1 2], [1 2]); % vertical
86 hihi = corrDn(hi, hfilt', edges, [1 2], [1 2]); % diagonal
87 end
88
89 [npyr,nind] = buildWpyr(lolo, ht-1, filt, edges);
90
91 if ((im_sz(1) == 1) | (im_sz(2) == 1))
92 pyr = [hihi(:); npyr];
93 pind = [size(hihi); nind];
94 else
95 pyr = [lohi(:); hilo(:); hihi(:); npyr];
96 pind = [size(lohi); size(hilo); size(hihi); nind];
97 end
98
99end
100
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/cconv2.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/cconv2.m
deleted file mode 100755
index efba438..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/cconv2.m
+++ /dev/null
@@ -1,50 +0,0 @@
1% RES = CCONV2(MTX1, MTX2, CTR)
2%
3% Circular convolution of two matrices. Result will be of size of
4% LARGER vector.
5%
6% The origin of the smaller matrix is assumed to be its center.
7% For even dimensions, the origin is determined by the CTR (optional)
8% argument:
9% CTR origin
10% 0 DIM/2 (default)
11% 1 (DIM/2)+1
12
13% Eero Simoncelli, 6/96. Modified 2/97.
14
15function c = cconv2(a,b,ctr)
16
17if (exist('ctr') ~= 1)
18 ctr = 0;
19end
20
21if (( size(a,1) >= size(b,1) ) & ( size(a,2) >= size(b,2) ))
22 large = a; small = b;
23elseif (( size(a,1) <= size(b,1) ) & ( size(a,2) <= size(b,2) ))
24 large = b; small = a;
25else
26 error('one arg must be larger than the other in both dimensions!');
27end
28
29ly = size(large,1);
30lx = size(large,2);
31sy = size(small,1);
32sx = size(small,2);
33
34%% These values are the index of the small mtx that falls on the
35%% border pixel of the large matrix when computing the first
36%% convolution response sample:
37sy2 = floor((sy+ctr+1)/2);
38sx2 = floor((sx+ctr+1)/2);
39
40% pad:
41clarge = [ ...
42 large(ly-sy+sy2+1:ly,lx-sx+sx2+1:lx), large(ly-sy+sy2+1:ly,:), ...
43 large(ly-sy+sy2+1:ly,1:sx2-1); ...
44 large(:,lx-sx+sx2+1:lx), large, large(:,1:sx2-1); ...
45 large(1:sy2-1,lx-sx+sx2+1:lx), ...
46 large(1:sy2-1,:), ...
47 large(1:sy2-1,1:sx2-1) ];
48
49c = conv2(clarge,small,'valid');
50
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/clip.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/clip.m
deleted file mode 100755
index 28804f3..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/clip.m
+++ /dev/null
@@ -1,32 +0,0 @@
1% [RES] = clip(IM, MINVALorRANGE, MAXVAL)
2%
3% Clip values of matrix IM to lie between minVal and maxVal:
4% RES = max(min(IM,MAXVAL),MINVAL)
5% The first argument can also specify both min and max, as a 2-vector.
6% If only one argument is passed, the range defaults to [0,1].
7
8function res = clip(im, minValOrRange, maxVal)
9
10if (exist('minValOrRange') ~= 1)
11 minVal = 0;
12 maxVal = 1;
13elseif (length(minValOrRange) == 2)
14 minVal = minValOrRange(1);
15 maxVal = minValOrRange(2);
16elseif (length(minValOrRange) == 1)
17 minVal = minValOrRange;
18 if (exist('maxVal') ~= 1)
19 maxVal=minVal+1;
20 end
21else
22 error('MINVAL must be a scalar or a 2-vector');
23end
24
25if ( maxVal < minVal )
26 error('MAXVAL should be less than MINVAL');
27end
28
29res = im;
30res(find(im < minVal)) = minVal;
31res(find(im > maxVal)) = maxVal;
32
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/corrDn.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/corrDn.m
deleted file mode 100755
index 7e07abf..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/corrDn.m
+++ /dev/null
@@ -1,63 +0,0 @@
1% RES = corrDn(IM, FILT, EDGES, STEP, START, STOP)
2%
3% Compute correlation of matrices IM with FILT, followed by
4% downsampling. These arguments should be 1D or 2D matrices, and IM
5% must be larger (in both dimensions) than FILT. The origin of filt
6% is assumed to be floor(size(filt)/2)+1.
7%
8% EDGES is a string determining boundary handling:
9% 'circular' - Circular convolution
10% 'reflect1' - Reflect about the edge pixels
11% 'reflect2' - Reflect, doubling the edge pixels
12% 'repeat' - Repeat the edge pixels
13% 'zero' - Assume values of zero outside image boundary
14% 'extend' - Reflect and invert
15% 'dont-compute' - Zero output when filter overhangs input boundaries
16%
17% Downsampling factors are determined by STEP (optional, default=[1 1]),
18% which should be a 2-vector [y,x].
19%
20% The window over which the convolution occurs is specfied by START
21% (optional, default=[1,1], and STOP (optional, default=size(IM)).
22%
23% NOTE: this operation corresponds to multiplication of a signal
24% vector by a matrix whose rows contain copies of the FILT shifted by
25% multiples of STEP. See upConv.m for the operation corresponding to
26% the transpose of this matrix.
27
28% Eero Simoncelli, 6/96, revised 2/97.
29
30function res = corrDn(im, filt, edges, step, start, stop)
31
32%% NOTE: THIS CODE IS NOT ACTUALLY USED! (MEX FILE IS CALLED INSTEAD)
33
34%fprintf(1,'WARNING: You should compile the MEX version of "corrDn.c",\n found in the MEX subdirectory of matlabPyrTools, and put it in your matlab path. It is MUCH faster, and provides more boundary-handling options.\n');
35
36%------------------------------------------------------------
37%% OPTIONAL ARGS:
38
39if (exist('edges') == 1)
40 if (strcmp(edges,'reflect1') ~= 1)
41 warning('Using REFLECT1 edge-handling (use MEX code for other options).');
42 end
43end
44
45if (exist('step') ~= 1)
46 step = [1,1];
47end
48
49if (exist('start') ~= 1)
50 start = [1,1];
51end
52
53if (exist('stop') ~= 1)
54 stop = size(im);
55end
56
57%------------------------------------------------------------
58
59% Reverse order of taps in filt, to do correlation instead of convolution
60filt = filt(size(filt,1):-1:1,size(filt,2):-1:1);
61
62tmp = rconv2(im,filt);
63res = tmp(start(1):step(1):stop(1),start(2):step(2):stop(2));
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/edges-orig.c b/SD-VBS/benchmarks/texture_synthesis/src/matlab/edges-orig.c
deleted file mode 100755
index 1f6a98b..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/edges-orig.c
+++ /dev/null
@@ -1,494 +0,0 @@
1/*
2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3;;; File: edges.c
4;;; Author: Eero Simoncelli
5;;; Description: Boundary handling routines for use with convolve.c
6;;; Creation Date: Spring 1987.
7;;; MODIFIED, 6/96, to operate on double float arrays.
8;;; MODIFIED by dgp, 4/1/97, to support THINK C.
9;;; ----------------------------------------------------------------
10;;; Object-Based Vision and Image Understanding System (OBVIUS),
11;;; Copyright 1988, Vision Science Group, Media Laboratory,
12;;; Massachusetts Institute of Technology.
13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14*/
15
16/*
17This file contains functions which determine how edges are to be
18handled when performing convolutions of images with linear filters.
19Any edge handling function which is local and linear may be defined,
20except (unfortunately) constants cannot be added. So to treat the
21edges as if the image is surrounded by a gray field, you must paste it
22into a gray image, convolve, and crop it out...
23The main convolution function is called internal_filter and is defined
24in the file convolve.c. The idea is that the convolution function
25calls the edge handling function which computes a new filter based on
26the old filter and the distance to the edge of the image. For
27example, reflection is done by reflecting the filter through the
28appropriate axis and summing. Currently defined functions are listed
29below.
30*/
31
32/*
33#define DEBUG
34*/
35
36#include <stdio.h>
37#include <math.h>
38#include <string.h>
39#include "convolve.h"
40
41#define sgn(a) ( ((a)>0)?1:(((a)<0)?-1:0) )
42#define clip(a,mn,mx) ( ((a)<(mn))?(mn):(((a)>=(mx))?(mx-1):(a)) )
43
44int reflect1(), reflect2(), repeat(), zero(), Extend(), nocompute();
45int ereflect(), predict();
46
47/* Lookup table matching a descriptive string to the edge-handling function */
48#if !THINK_C
49 static EDGE_HANDLER edge_foos[] =
50 {
51 { "dont-compute", nocompute }, /* zero output for filter touching edge */
52 { "zero", zero }, /* zero outside of image */
53 { "repeat", repeat }, /* repeat edge pixel */
54 { "reflect1", reflect1 }, /* reflect about edge pixels */
55 { "reflect2", reflect2 }, /* reflect image, including edge pixels */
56 { "extend", Extend }, /* extend (reflect & invert) */
57 { "predict", predict }, /* predict based on portion covered by filt */
58 { "ereflect", ereflect }, /* orthogonal QMF reflection */
59 };
60#else
61 /*
62 This is really stupid, but THINK C won't allow initialization of static variables in
63 a code resource with string addresses. So we do it this way.
64 The 68K code for a MATLAB 4 MEX file can only be created by THINK C.
65 However, for MATLAB 5, we'll be able to use Metrowerks CodeWarrior for both 68K and PPC, so this
66 cludge can be dropped when we drop support for MATLAB 4.
67 Denis Pelli, 4/1/97.
68 */
69 static EDGE_HANDLER edge_foos[8];
70
71 void InitializeTable(EDGE_HANDLER edge_foos[])
72 {
73 static int i=0;
74
75 if(i>0) return;
76 edge_foos[i].name="dont-compute";
77 edge_foos[i++].func=nocompute;
78 edge_foos[i].name="zero";
79 edge_foos[i++].func=zero;
80 edge_foos[i].name="repeat";
81 edge_foos[i++].func=repeat;
82 edge_foos[i].name="reflect1";
83 edge_foos[i++].func=reflect1;
84 edge_foos[i].name="reflect2";
85 edge_foos[i++].func=reflect2;
86 edge_foos[i].name="extend";
87 edge_foos[i++].func=Extend;
88 edge_foos[i].name="predict";
89 edge_foos[i++].func=predict;
90 edge_foos[i].name="ereflect";
91 edge_foos[i++].func=ereflect;
92 }
93#endif
94
95/*
96Function looks up an edge handler id string in the structure above, and
97returns the associated function
98*/
99fptr edge_function(char *edges)
100 {
101 int i;
102
103#if THINK_C
104 InitializeTable(edge_foos);
105#endif
106 for (i = 0; i<sizeof(edge_foos)/sizeof(EDGE_HANDLER); i++)
107 if (strcmp(edges,edge_foos[i].name) == 0)
108 return(edge_foos[i].func);
109 printf("Error: '%s' is not the name of a valid edge-handler!\n",edges);
110 for (i=0; i<sizeof(edge_foos)/sizeof(EDGE_HANDLER); i++)
111 {
112 if (i==0) printf(" Options are: ");
113 else printf(", ");
114 printf("%s",edge_foos[i].name);
115 }
116 printf("\n");
117 return(0);
118 }
119
120/*
121---------------- EDGE HANDLER ARGUMENTS ------------------------
122filt - array of filter taps.
123x_dim, y_dim - x and y dimensions of filt.
124x_pos - position of filter relative to the horizontal image edges. Negative
125 values indicate left edge, positive indicate right edge. Zero
126 indicates that the filter is not touching either edge. An absolute
127 value of 1 indicates that the edge tap of the filter is over the
128 edge pixel of the image.
129y_pos - analogous to x_pos.
130result - array where the resulting filter will go. The edge
131 of this filter will be aligned with the image for application...
132f_or_e - equal to one of the two constants EXPAND or FILTER.
133--------------------------------------------------------------------
134*/
135
136
137/* --------------------------------------------------------------------
138nocompute() - Return zero for values where filter hangs over the edge.
139*/
140
141int nocompute(filt,x_dim,y_dim,x_pos,y_pos,result,f_or_e)
142 register double *filt, *result;
143 register int x_dim;
144 int y_dim, x_pos, y_pos, f_or_e;
145 {
146 register int i;
147 register int size = x_dim*y_dim;
148
149 if ( (x_pos>1) OR (x_pos<-1) OR (y_pos>1) OR (y_pos<-1) )
150 for (i=0; i<size; i++) result[i] = 0.0;
151 else
152 for (i=0; i<size; i++) result[i] = filt[i];
153 return(0);
154 }
155
156/* --------------------------------------------------------------------
157zero() - Zero outside of image. Discontinuous, but adds zero energy. */
158
159int zero(filt,x_dim,y_dim,x_pos,y_pos,result,f_or_e)
160 register double *filt, *result;
161 register int x_dim;
162 int y_dim, x_pos, y_pos, f_or_e;
163 {
164 register int y_filt,x_filt, y_res,x_res;
165 int filt_sz = x_dim*y_dim;
166 int x_start = ((x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0));
167 int y_start = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0));
168 int i;
169
170 for (i=0; i<filt_sz; i++) result[i] = 0.0;
171
172 for (y_filt=0, y_res=y_start;
173 y_filt<filt_sz;
174 y_filt+=x_dim, y_res+=x_dim)
175 if ((y_res >= 0) AND (y_res < filt_sz))
176 for (x_filt=y_filt, x_res=x_start;
177 x_filt<y_filt+x_dim;
178 x_filt++, x_res++)
179 if ((x_res >= 0) AND (x_res < x_dim))
180 result[y_res+x_res] = filt[x_filt];
181 return(0);
182 }
183
184/* --------------------------------------------------------------------
185repeat() - repeat edge pixel. Continuous, but content is usually
186different from image.
187*/
188
189int repeat(filt,x_dim,y_dim,x_pos,y_pos,result,f_or_e)
190 register double *filt, *result;
191 register int x_dim;
192 int y_dim, x_pos, y_pos, f_or_e;
193 {
194 register int y_filt,x_filt, y_res,x_res;
195 int filt_sz = x_dim*y_dim;
196 int x_start = ((x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0));
197 int y_start = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0));
198 int i;
199
200 for (i=0; i<filt_sz; i++) result[i] = 0.0;
201
202 for (y_filt=0, y_res=y_start;
203 y_filt<filt_sz;
204 y_filt+=x_dim, y_res+=x_dim)
205 for (x_filt=y_filt, x_res=x_start;
206 x_filt<y_filt+x_dim;
207 x_filt++, x_res++)
208 result[((y_res>=0)?((y_res<filt_sz)?y_res:(filt_sz-x_dim)):0)
209 + ((x_res>=0)?((x_res<x_dim)?x_res:(x_dim-1)):0)]
210 += filt[x_filt];
211 return(0);
212 }
213
214/* --------------------------------------------------------------------
215reflect2() - "Normal" image reflection. The edge pixel is repeated,
216then the next pixel, etc. Continuous, attempting to maintain
217"similar" content, but discontinuous first derivative.
218*/
219
220int reflect2(filt,x_dim,y_dim,x_pos,y_pos,result,f_or_e)
221 register double *filt, *result;
222 register int x_dim;
223 int y_dim, x_pos, y_pos, f_or_e;
224 {
225 register int y_filt,x_filt, y_edge,x_edge;
226 register int x_base = (x_pos>0)?(x_dim-1):0;
227 register int y_base = (y_pos>0)?(x_dim*(y_dim-1)):0;
228 int filt_sz = x_dim*y_dim;
229 int x_edge_dist = (x_pos>0)?(x_pos-x_dim-1):(x_pos+1);
230 int y_edge_dist = x_dim * ((y_pos>0)?(y_pos-y_dim-1):(y_pos+1));
231 int i;
232
233 #ifdef DEBUG
234 printf("(%d,%d) ",y_pos,x_pos);
235 if (x_pos==0) printf("\n");
236 #endif
237
238 for (i=0; i<filt_sz; i++) result[i] = 0.0;
239
240 for (y_filt=0, y_edge=y_edge_dist;
241 y_filt<filt_sz;
242 y_filt+=x_dim, y_edge+=x_dim)
243 {
244 if (y_edge IS 0) y_edge+=x_dim;
245 for (x_filt=y_filt, x_edge=x_edge_dist;
246 x_filt<y_filt+x_dim;
247 x_filt++, x_edge++)
248 {
249 if (x_edge IS 0) x_edge++;
250 result[ABS(y_base-ABS(y_edge)+x_dim) + ABS(x_base-ABS(x_edge)+1)]
251 += filt[x_filt];
252 }
253 }
254 return(0);
255 }
256
257/* --------------------------------------------------------------------
258reflect1() - Reflection through the edge pixels. This is the right thing
259to do if you are subsampling by 2, since it maintains parity (even
260pixels positions remain even, odd ones remain odd). (note: procedure differs
261depending on f_or_e parameter). */
262
263int reflect1(filt,x_dim,y_dim,x_pos,y_pos,result,f_or_e)
264 register double *filt, *result;
265 register int x_dim;
266 int y_dim, x_pos, y_pos, f_or_e;
267 {
268 int filt_sz = x_dim*y_dim;
269 register int x_start = 0, y_start = 0, x_stop = x_dim, y_stop = filt_sz;
270 register int y_filt,x_filt, y_edge,x_edge;
271 register int x_base = (x_pos>0)?(x_dim-1):0;
272 register int y_base = (y_pos>0)?(x_dim*(y_dim-1)):0;
273 int x_edge_dist = (x_pos>0)?(x_pos-x_dim):((x_pos<0)?(x_pos+1):0);
274 int y_edge_dist = x_dim * ((y_pos>0)?(y_pos-y_dim):((y_pos<0)?(y_pos+1):0));
275 int i;
276 int mx_pos = (x_dim/2)+1;
277 int my_pos = (y_dim/2)+1;
278
279 #ifdef DEBUG
280 printf("(%d,%d) ",y_pos,x_pos);
281 if (x_pos==0) printf("\n");
282 #endif
283
284 for (i=0; i<filt_sz; i++) result[i] = 0.0;
285
286 /* if EXPAND and filter is centered on image edge, do not reflect */
287 if (f_or_e IS EXPAND)
288 {
289 if (x_pos IS mx_pos) x_stop = (x_dim+1)/2;
290 else if (x_pos IS -mx_pos) { x_start = x_dim/2; x_edge_dist = 0; }
291
292 if (y_pos IS my_pos) y_stop = x_dim*((y_dim+1)/2);
293 else if (y_pos IS -my_pos) { y_start = x_dim*(y_dim/2); y_edge_dist = 0;}
294 }
295
296 /* reflect at boundary of image */
297 for (y_filt=y_start, y_edge=y_edge_dist;
298 y_filt<y_stop;
299 y_filt+=x_dim, y_edge+=x_dim)
300 for (x_filt=y_filt+x_start, x_edge=x_edge_dist;
301 x_filt<y_filt+x_stop;
302 x_filt++, x_edge++)
303 result[ABS(y_base-ABS(y_edge)) + ABS(x_base-ABS(x_edge))]
304 += filt[x_filt];
305
306 /* if EXPAND and filter is not centered on image edge, mult edge by 2 */
307 if (f_or_e IS EXPAND)
308 {
309 if ( (ABS(x_pos) ISNT mx_pos) AND (x_pos ISNT 0) )
310 for (y_filt=x_base; y_filt<filt_sz; y_filt+=x_dim)
311 result[y_filt] += result[y_filt];
312 if ( (ABS(y_pos) ISNT my_pos) AND (y_pos ISNT 0) )
313 for (x_filt=y_base; x_filt<y_base+x_dim; x_filt++)
314 result[x_filt] += result[x_filt];
315 }
316 return(0);
317 }
318
319/* --------------------------------------------------------------------
320Extend() - Extend image by reflecting and inverting about edge pixel
321value. Maintains continuity in intensity AND first derivative (but
322not higher derivs).
323*/
324
325int Extend(filt,x_dim,y_dim,x_pos,y_pos,result,f_or_e)
326 register double *filt, *result;
327 register int x_dim;
328 int y_dim, x_pos, y_pos, f_or_e;
329 {
330 int filt_sz = x_dim*y_dim;
331 register int x_start = 0, y_start = 0, x_stop = x_dim, y_stop = filt_sz;
332 register int y_filt,x_filt, y_edge,x_edge;
333 register int x_base = (x_pos>0)?(x_dim-1):0;
334 register int y_base = (y_pos>0)?(x_dim*(y_dim-1)):0;
335 int x_edge_dist = (x_pos>0)?(x_pos-x_dim):((x_pos<-1)?(x_pos+1):0);
336 int y_edge_dist = x_dim * ((y_pos>0)?(y_pos-y_dim):((y_pos<-1)?(y_pos+1):0));
337 int i;
338 int mx_pos = (x_dim/2)+1;
339 int my_pos = (y_dim/2)+1;
340
341 for (i=0; i<filt_sz; i++) result[i] = 0.0;
342
343 /* if EXPAND and filter is centered on image edge, do not reflect */
344 if (f_or_e IS EXPAND)
345 {
346 if (x_pos IS mx_pos) x_stop = (x_dim+1)/2;
347 else if (x_pos IS -mx_pos) { x_start = x_dim/2; x_edge_dist = 0; }
348
349 if (y_pos IS my_pos) y_stop = x_dim*((y_dim+1)/2);
350 else if (y_pos IS -my_pos) { y_start = x_dim*(y_dim/2); y_edge_dist = 0;}
351 }
352
353 /* reflect at boundary of image */
354 for (y_filt=y_start, y_edge=y_edge_dist;
355 y_filt<y_stop;
356 y_filt+=x_dim, y_edge+=x_dim)
357 for (x_filt=y_filt+x_start, x_edge=x_edge_dist;
358 x_filt<y_filt+x_stop;
359 x_filt++, x_edge++)
360 if (((!y_base AND (sgn(y_edge) IS -1)) /* y overhanging */
361 OR
362 (y_base AND (sgn(y_edge) IS 1)))
363 ISNT /* XOR */
364 ((!x_base AND (sgn(x_edge) IS -1)) /* x overhanging */
365 OR
366 (x_base AND (sgn(x_edge) IS 1))))
367 {
368 result[ABS(y_base-ABS(y_edge)) + ABS(x_base-ABS(x_edge))]
369 -= filt[x_filt];
370 result[clip(y_base+y_edge,0,y_dim) + clip(x_base+x_edge,0,x_dim)]
371 += filt[x_filt] + filt[x_filt];
372 }
373 else result[ABS(y_base-ABS(y_edge)) + ABS(x_base-ABS(x_edge))]
374 += filt[x_filt];
375 return(0);
376 }
377
378/* --------------------------------------------------------------------
379predict() - Simple prediction. Like zero, but multiplies the result
380by the reciprocal of the percentage of filter being used. (i.e. if
38150% of the filter is hanging over the edge of the image, multiply the
382taps being used by 2). */
383
384int predict(filt,x_dim,y_dim,x_pos,y_pos,result,f_or_e)
385 register double *filt, *result;
386 register int x_dim;
387 int y_dim, x_pos, y_pos, f_or_e;
388 {
389 register int y_filt,x_filt, y_res,x_res;
390 register double taps_used = 0.0; /* int *** */
391 register double fraction = 0.0;
392 int filt_sz = x_dim*y_dim;
393 int x_start = ((x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0));
394 int y_start = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0));
395 int i;
396
397 for (i=0; i<filt_sz; i++) result[i] = 0.0;
398
399 for (y_filt=0, y_res=y_start;
400 y_filt<filt_sz;
401 y_filt+=x_dim, y_res+=x_dim)
402 if ((y_res >= 0) AND (y_res < filt_sz))
403 for (x_filt=y_filt, x_res=x_start;
404 x_filt<y_filt+x_dim;
405 x_filt++, x_res++)
406 if ((x_res >= 0) AND (x_res < x_dim))
407 {
408 result[y_res+x_res] = filt[x_filt];
409 taps_used += ABS(filt[x_filt]);
410 }
411 printf("TU: %f\n",taps_used);
412 if (f_or_e IS FILTER)
413 {
414 /* fraction = ( (double) filt_sz ) / ( (double) taps_used ); */
415 for (i=0; i<filt_sz; i++) fraction += ABS(filt[i]);
416 fraction = ( fraction / taps_used );
417 for (i=0; i<filt_sz; i++) result[i] *= fraction;
418 }
419 return(0);
420 }
421
422
423/* --------------------------------------------------------------------
424Reflect, multiplying tap of filter which is at the edge of the image
425by root 2. This maintains orthogonality of odd-length linear-phase
426QMF filters, but it is not useful for most applications, since it
427alters the DC level. */
428
429int ereflect(filt,x_dim,y_dim,x_pos,y_pos,result,f_or_e)
430 register double *filt, *result;
431 register int x_dim;
432 int y_dim, x_pos, y_pos, f_or_e;
433 {
434 register int y_filt,x_filt, y_edge,x_edge;
435 register int x_base = (x_pos>0)?(x_dim-1):0;
436 register int y_base = x_dim * ( (y_pos>0)?(y_dim-1):0 );
437 int filt_sz = x_dim*y_dim;
438 int x_edge_dist = (x_pos>1)?(x_pos-x_dim):((x_pos<-1)?(x_pos+1):0);
439 int y_edge_dist = x_dim * ( (y_pos>1)?(y_pos-y_dim):((y_pos<-1)?(y_pos+1):0) );
440 int i;
441 double norm,onorm;
442
443 for (i=0; i<filt_sz; i++) result[i] = 0.0;
444
445 /* reflect at boundary */
446 for (y_filt=0, y_edge=y_edge_dist;
447 y_filt<filt_sz;
448 y_filt+=x_dim, y_edge+=x_dim)
449 for (x_filt=y_filt, x_edge=x_edge_dist;
450 x_filt<y_filt+x_dim;
451 x_filt++, x_edge++)
452 result[ABS(y_base-ABS(y_edge)) + ABS(x_base-ABS(x_edge))]
453 += filt[x_filt];
454
455 /* now multiply edge by root 2 */
456 if (x_pos ISNT 0)
457 for (y_filt=x_base; y_filt<filt_sz; y_filt+=x_dim)
458 result[y_filt] *= ROOT2;
459 if (y_pos ISNT 0)
460 for (x_filt=y_base; x_filt<y_base+x_dim; x_filt++)
461 result[x_filt] *= ROOT2;
462
463 /* now normalize to norm of original filter */
464 for (norm=0.0,i=0; i<filt_sz; i++)
465 norm += (result[i]*result[i]);
466 norm=sqrt(norm);
467
468 for (onorm=0.0,i=0; i<filt_sz; i++)
469 onorm += (filt[i]*filt[i]);
470 onorm = sqrt(onorm);
471
472 norm = norm/onorm;
473 for (i=0; i<filt_sz; i++)
474 result[i] /= norm;
475 return(0);
476 }
477
478
479/* ------- printout stuff for testing ------------------------------
480 printf("Xpos: %d, Ypos: %d", x_pos, y_pos);
481 for (y_filt=0; y_filt<y_dim; y_filt++)
482 {
483 printf("\n");
484 for (x_filt=0; x_filt<x_dim; x_filt++)
485 printf("%6.1f", result[y_filt*x_dim+x_filt]);
486 }
487 printf("\n");
488*/
489
490
491
492/* Local Variables: */
493/* buffer-read-only: t */
494/* End: */
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/einstein.pgm b/SD-VBS/benchmarks/texture_synthesis/src/matlab/einstein.pgm
deleted file mode 100755
index 99b974c..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/einstein.pgm
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/entropy2.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/entropy2.m
deleted file mode 100755
index 68a2a9f..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/entropy2.m
+++ /dev/null
@@ -1,31 +0,0 @@
1% E = ENTROPY2(MTX,BINSIZE)
2%
3% Compute the first-order sample entropy of MTX. Samples of VEC are
4% first discretized. Optional argument BINSIZE controls the
5% discretization, and defaults to 256/(max(VEC)-min(VEC)).
6%
7% NOTE: This is a heavily biased estimate of entropy when you
8% don't have much data.
9
10% Eero Simoncelli, 6/96.
11
12function res = entropy2(mtx,binsize)
13
14%% Ensure it's a vector, not a matrix.
15vec = mtx(:);
16[mn,mx] = range2(vec);
17
18if (exist('binsize') == 1)
19 nbins = max((mx-mn)/binsize, 1);
20else
21 nbins = 256;
22end
23
24[bincount,bins] = histo(vec,nbins);
25
26%% Collect non-zero bins:
27H = bincount(find(bincount));
28H = H/sum(H);
29
30res = -sum(H .* log2(H));
31
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/expand.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/expand.m
deleted file mode 100755
index 5f6e4d9..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/expand.m
+++ /dev/null
@@ -1,34 +0,0 @@
1function te = expand(t,f)
2
3% Expand spatially an image t in a factor f
4% in X and in Y.
5% t may be complex.
6% It fills in with zeros in the Fourier domain.
7% te = expand(t, f)
8% See also: shrink.m
9% JPM, May 95, Instituto de Optica, CSIC, Madrid.
10
11[my mx]=size(t);
12my=f*my;
13mx=f*mx;
14Te=zeros(my,mx);
15T=f^2*fftshift(fft2(t));
16y1=my/2+2-my/(2*f);
17y2=my/2+my/(2*f);
18x1=mx/2+2-mx/(2*f);
19x2=mx/2+mx/(2*f);
20Te(y1:y2,x1:x2)=T(2:my/f,2:mx/f);
21Te(y1-1,x1:x2)=T(1,2:mx/f)/2;
22Te(y2+1,x1:x2)=((T(1,mx/f:-1:2)/2)').';
23Te(y1:y2,x1-1)=T(2:my/f,1)/2;
24Te(y1:y2,x2+1)=((T(my/f:-1:2,1)/2)').';
25esq=T(1,1)/4;
26Te(y1-1,x1-1)=esq;
27Te(y1-1,x2+1)=esq;
28Te(y2+1,x1-1)=esq;
29Te(y2+1,x2+1)=esq;
30Te=fftshift(Te);
31te=ifft2(Te);
32if all(imag(t)==0),
33 te = real(te);
34end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/factorial.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/factorial.m
deleted file mode 100755
index 9255f43..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/factorial.m
+++ /dev/null
@@ -1,16 +0,0 @@
1%% RES = factorial(NUM)
2%
3% Factorial function that works on matrices (matlab's does not).
4
5% EPS, 11/02
6
7function res = factorial(num)
8
9res = ones(size(num));
10
11ind = find(num > 0);
12if ( ~isempty(ind) )
13 subNum = num(ind);
14 res(ind) = subNum .* factorial(subNum-1);
15end
16
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/feynman.pgm b/SD-VBS/benchmarks/texture_synthesis/src/matlab/feynman.pgm
deleted file mode 100755
index 7d14101..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/feynman.pgm
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/histo.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/histo.m
deleted file mode 100755
index 8da36e5..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/histo.m
+++ /dev/null
@@ -1,58 +0,0 @@
1% [N,X] = histo(MTX, nbinsOrBinsize, binCenter);
2%
3% Compute a histogram of (all) elements of MTX. N contains the histogram
4% counts, X is a vector containg the centers of the histogram bins.
5%
6% nbinsOrBinsize (optional, default = 101) specifies either
7% the number of histogram bins, or the negative of the binsize.
8%
9% binCenter (optional, default = mean2(MTX)) specifies a center position
10% for (any one of) the histogram bins.
11%
12% How does this differ from MatLab's HIST function? This function:
13% - allows uniformly spaced bins only.
14% +/- operates on all elements of MTX, instead of columnwise.
15% + is much faster (approximately a factor of 80 on my machine).
16% + allows specification of number of bins OR binsize. Default=101 bins.
17% + allows (optional) specification of binCenter.
18
19% Eero Simoncelli, 3/97.
20
21function [N, X] = histo(mtx, nbins, binCtr)
22
23%% NOTE: THIS CODE IS NOT ACTUALLY USED! (MEX FILE IS CALLED INSTEAD)
24
25%fprintf(1,'WARNING: You should compile the MEX version of "histo.c",\n found in the MEX subdirectory of matlabPyrTools, and put it in your matlab path. It is MUCH faster.\n');
26
27mtx = mtx(:);
28
29%------------------------------------------------------------
30%% OPTIONAL ARGS:
31
32[mn,mx] = range2(mtx);
33
34if (exist('binCtr') ~= 1)
35 binCtr = mean(mtx);
36end
37
38if (exist('nbins') == 1)
39 if (nbins < 0)
40 binSize = -nbins;
41 else
42 binSize = ((mx-mn)/nbins);
43 tmpNbins = round((mx-binCtr)/binSize) - round((mn-binCtr)/binSize);
44 if (tmpNbins ~= nbins)
45 warning('Using %d bins instead of requested number (%d)',tmpNbins,nbins);
46 end
47 end
48else
49 binSize = ((mx-mn)/101);
50end
51
52firstBin = binCtr + binSize*round( (mn-binCtr)/binSize );
53
54tmpNbins = round((mx-binCtr)/binSize) - round((mn-binCtr)/binSize);
55
56bins = firstBin + binSize*[0:tmpNbins];
57
58[N, X] = hist(mtx, bins);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/histoMatch.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/histoMatch.m
deleted file mode 100755
index ab82782..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/histoMatch.m
+++ /dev/null
@@ -1,35 +0,0 @@
1% RES = histoMatch(MTX, N, X)
2%
3% Modify elements of MTX so that normalized histogram matches that
4% specified by vectors X and N, where N contains the histogram counts
5% and X the histogram bin positions (see histo).
6
7% Eero Simoncelli, 7/96.
8
9function res = histoMatch(mtx, N, X)
10
11if ( exist('histo') == 3 )
12 [oN, oX] = histo(mtx(:), size(X(:),1));
13else
14 [oN, oX] = hist(mtx(:), size(X(:),1));
15end
16
17oStep = oX(2) - oX(1);
18oC = [0, cumsum(oN)]/sum(oN);
19oX = [oX(1)-oStep/2, oX+oStep/2];
20
21N = N(:)';
22X = X(:)';
23N = N + mean(N)/(1e8); %% HACK: no empty bins ensures nC strictly monotonic
24
25nStep = X(2) - X(1);
26nC = [0, cumsum(N)]/sum(N);
27nX = [X(1)-nStep/2, X+nStep/2];
28
29nnX = interp1(nC, nX, oC, 'linear');
30
31if ( exist('pointOp') == 3 )
32 res = pointOp(mtx, nnX, oX(1), oStep);
33else
34 res = reshape(interp1(oX, nnX, mtx(:)),size(mtx,1),size(mtx,2));
35end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/ifftshift.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/ifftshift.m
deleted file mode 100755
index 2ade297..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/ifftshift.m
+++ /dev/null
@@ -1,15 +0,0 @@
1% [RES] = ifftshift (MTX)
2%
3% Inverse of MatLab's FFTSHIFT. That is,
4% ifftshift(fftshift(MTX)) = MTX
5% for any size MTX.
6
7% Eero Simoncelli, 2/97.
8
9function [res] = ifftshift(mtx)
10
11sz = size(mtx);
12DC = ceil((sz+1)./2); % location of DC term in a matlab fft.
13
14res = [mtx(DC(1):sz(1), DC(2):sz(2)) , mtx(DC(1):sz(1), 1:DC(2)-1); ...
15 mtx(1:DC(1)-1, DC(2):sz(2)) , mtx(1:DC(1)-1, 1:DC(2)-1)];
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/imGradient.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/imGradient.m
deleted file mode 100755
index 23187e3..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/imGradient.m
+++ /dev/null
@@ -1,48 +0,0 @@
1% [dx, dy] = imGradient(im, edges)
2%
3% Compute the gradient of the image using smooth derivative filters
4% optimized for accurate direction estimation. Coordinate system
5% corresponds to standard pixel indexing: X axis points rightward. Y
6% axis points downward. EDGES specify boundary handling (see corrDn
7% for options).
8
9% EPS, 1997.
10% original filters from Int'l Conf Image Processing, 1994.
11% updated filters 10/2003.
12% Added to matlabPyrTools 10/2004.
13
14function [dx, dy] = imGradient(im, edges)
15
16%% 1D smoothing and differentiation kernels.
17%% See Farid & Simoncelli, IEEE Trans Image Processing, 13(4):496-508, April 2004.
18
19if (exist('edges') ~= 1)
20 edges = 'dont-compute';
21end
22
23gp = [0.037659 0.249153 0.426375 0.249153 0.037659]';
24gd = [-0.109604 -0.276691 0.000000 0.276691 0.109604]';
25
26dx = corrDn(corrDn(im, gp, edges), gd', edges);
27dy = corrDn(corrDn(im, gd, edges), gp', edges);
28
29return
30
31%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32%%% TEST:
33
34%%Make a ramp with random slope and direction
35dir = 2*pi*rand - pi;
36slope = 10*rand;
37
38sz = 32
39im = mkRamp(sz, dir, slope);
40[dx,dy] = imGradient(im);
41showIm(dx + sqrt(-1)*dy);
42
43ctr = (sz*sz/2)+sz/2;
44slopeEst = sqrt(dx(ctr).^2 + dy(ctr).^2);
45dirEst = atan2(dy(ctr), dx(ctr));
46
47[slope, slopeEst]
48[dir, dirEst]
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/imStats.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/imStats.m
deleted file mode 100755
index 3d79b4c..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/imStats.m
+++ /dev/null
@@ -1,41 +0,0 @@
1% imStats(IM1,IM2)
2%
3% Report image (matrix) statistics.
4% When called on a single image IM1, report min, max, mean, stdev,
5% and kurtosis.
6% When called on two images (IM1 and IM2), report min, max, mean,
7% stdev of the difference, and also SNR (relative to IM1).
8
9% Eero Simoncelli, 6/96.
10
11function [] = imStats(im1,im2)
12
13if (~isreal(im1))
14 error('Args must be real-valued matrices');
15end
16
17if (exist('im2') == 1)
18 difference = im1 - im2;
19 [mn,mx] = range2(difference);
20 mean = mean2(difference);
21 v = var2(difference,mean);
22 if (v < realmin)
23 snr = Inf;
24 else
25 snr = 10 * log10(var2(im1)/v);
26 end
27 fprintf(1, 'Difference statistics:\n');
28 fprintf(1, ' Range: [%c, %c]\n',mn,mx);
29 fprintf(1, ' Mean: %f, Stdev (rmse): %f, SNR (dB): %f\n',...
30 mean,sqrt(v),snr);
31else
32 [mn,mx] = range2(im1);
33 mean = mean2(im1);
34 var = var2(im1);
35 stdev = sqrt(real(var))+sqrt(imag(var));
36 kurt = kurt2(im1, mean, stdev^2);
37 fprintf(1, 'Image statistics:\n');
38 fprintf(1, ' Range: [%f, %f]\n',mn,mx);
39 fprintf(1, ' Mean: %f, Stdev: %f, Kurtosis: %f\n',mean,stdev,kurt);
40end
41
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/innerProd.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/innerProd.m
deleted file mode 100755
index 9252c70..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/innerProd.m
+++ /dev/null
@@ -1,12 +0,0 @@
1% RES = innerProd(MTX)
2%
3% Compute (MTX' * MTX) efficiently (i.e., without copying the matrix)
4
5function res = innerProd(mtx)
6
7%fprintf(1,['WARNING: You should compile the MEX version of' ...
8% ' "innerProd.c",\n found in the MEX subdirectory' ...
9% ' of matlabPyrTools, and put it in your matlab path.' ...
10% ' It is MUCH faster and requires less memory.\n']);
11
12res = mtx' * mtx;
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/kurt2.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/kurt2.m
deleted file mode 100755
index 8351eb4..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/kurt2.m
+++ /dev/null
@@ -1,24 +0,0 @@
1% K = KURT2(MTX,MEAN,VAR)
2%
3% Sample kurtosis (fourth moment divided by squared variance)
4% of a matrix. Kurtosis of a Gaussian distribution is 3.
5% MEAN (optional) and VAR (optional) make the computation faster.
6
7% Eero Simoncelli, 6/96.
8
9function res = kurt2(mtx, mn, v)
10
11if (exist('mn') ~= 1)
12 mn = mean(mean(mtx));
13end
14
15if (exist('v') ~= 1)
16 v = var2(mtx,mn);
17end
18
19if (isreal(mtx))
20 res = mean(mean(abs(mtx-mn).^4)) / (v^2);
21else
22 res = mean(mean(real(mtx-mn).^4)) / (real(v)^2) + ...
23 i*mean(mean(imag(mtx-mn).^4)) / (imag(v)^2);
24end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/lplot.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/lplot.m
deleted file mode 100755
index 3c67d8b..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/lplot.m
+++ /dev/null
@@ -1,43 +0,0 @@
1% lplot(VEC, XRANGE)
2%
3% Plot VEC, a vector, in "lollipop" format.
4% XRANGE (optional, default = [1,length(VEC)]), should be a 2-vector
5% specifying the X positions (for labeling purposes) of the first and
6% last sample of VEC.
7
8% Mark Liberman, Linguistics Dept, UPenn, 1994.
9
10function lplot(x,xrange)
11
12if (exist('xrange') ~= 1)
13 xrange = [1,length(x)];
14end
15
16msize = size(x);
17if ( msize(2) == 1)
18 x = x';
19elseif (msize(1) ~= 1)
20 error('First arg must be a vector');
21end
22
23if (~isreal(x))
24 fprintf(1,'Warning: Imaginary part of signal ignored\n');
25 x = abs(x);
26end
27
28N = length(x);
29index = xrange(1) + (xrange(2)-xrange(1))*[0:(N-1)]/(N-1)
30xinc = index(2)-index(1);
31
32xx = [zeros(1,N);x;zeros(1,N)];
33indexis = [index;index;index];
34xdiscrete = [0 xx(:)' 0];
35idiscrete = [index(1)-xinc indexis(:)' index(N)+xinc];
36
37[mn,mx] = range2(xdiscrete);
38ypad = (mx-mn)/12; % MAGIC NUMBER: graph padding
39
40plot(idiscrete, xdiscrete, index, x, 'o');
41axis([index(1)-xinc, index(N)+xinc, mn-ypad, mx+ypad]);
42
43return
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/lpyrHt.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/lpyrHt.m
deleted file mode 100755
index d6834d7..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/lpyrHt.m
+++ /dev/null
@@ -1,11 +0,0 @@
1% [HEIGHT] = lpyrHt(INDICES)
2%
3% Compute height of Laplacian pyramid with given its INDICES matrix.
4% See buildLpyr.m
5
6% Eero Simoncelli, 6/96.
7
8function [ht] = lpyrHt(pind)
9
10% Don't count lowpass residual band
11ht = size(pind,1)-1;
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/maxPyrHt.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/maxPyrHt.m
deleted file mode 100755
index 84bcf29..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/maxPyrHt.m
+++ /dev/null
@@ -1,25 +0,0 @@
1% HEIGHT = maxPyrHt(IMSIZE, FILTSIZE)
2%
3% Compute maximum pyramid height for given image and filter sizes.
4% Specifically: the number of corrDn operations that can be sequentially
5% performed when subsampling by a factor of 2.
6
7% Eero Simoncelli, 6/96.
8
9function height = maxPyrHt(imsz, filtsz)
10
11imsz = imsz(:);
12filtsz = filtsz(:);
13
14if any(imsz == 1) % 1D image
15 imsz = prod(imsz);
16 filtsz = prod(filtsz);
17elseif any(filtsz == 1) % 2D image, 1D filter
18 filtsz = [filtsz(1); filtsz(1)];
19end
20
21if any(imsz < filtsz)
22 height = 0;
23else
24 height = 1 + maxPyrHt( floor(imsz/2), filtsz );
25end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mccExcludedFiles.log b/SD-VBS/benchmarks/texture_synthesis/src/matlab/mccExcludedFiles.log
deleted file mode 100755
index 2c5359b..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mccExcludedFiles.log
+++ /dev/null
@@ -1,11 +0,0 @@
1This file contains the list of various toolbox functions that are not
2included in the CTF file. An error will be thrown if any of these functions
3 are called at run-time. Some of these functions may be from toolboxes
4that you are not using in your application. The reason for this is that
5these toolboxes have overloaded some methods that are called by your code.
6If you know which toolboxes are being used by your code, you can use the -p
7 flag with the -N flag to list these toolboxes explicitly. This will
8cause MATLAB Compiler to only look for functions in the specified toolbox
9directories in addition to the MATLAB directories. Refer to the MCC
10documentation for more information on this.
11
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mean2.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/mean2.m
deleted file mode 100755
index 177f7ac..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mean2.m
+++ /dev/null
@@ -1,7 +0,0 @@
1% M = MEAN2(MTX)
2%
3% Sample mean of a matrix.
4
5function res = mean2(mtx)
6
7res = mean(mean(mtx));
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkAngle.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkAngle.m
deleted file mode 100755
index bd54f8d..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkAngle.m
+++ /dev/null
@@ -1,32 +0,0 @@
1% IM = mkAngle(SIZE, PHASE, ORIGIN)
2%
3% Compute a matrix of dimension SIZE (a [Y X] 2-vector, or a scalar)
4% containing samples of the polar angle (in radians, CW from the
5% X-axis, ranging from -pi to pi), relative to angle PHASE (default =
6% 0), about ORIGIN pixel (default = (size+1)/2).
7
8% Eero Simoncelli, 6/96.
9
10function [res] = mkAngle(sz, phase, origin)
11
12sz = sz(:);
13if (size(sz,1) == 1)
14 sz = [sz,sz];
15end
16
17% -----------------------------------------------------------------
18% OPTIONAL args:
19
20if (exist('origin') ~= 1)
21 origin = (sz+1)/2;
22end
23
24% -----------------------------------------------------------------
25
26[xramp,yramp] = meshgrid( [1:sz(2)]-origin(2), [1:sz(1)]-origin(1) );
27
28res = atan2(yramp,xramp);
29
30if (exist('phase') == 1)
31 res = mod(res+(pi-phase),2*pi)-pi;
32end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkAngularSine.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkAngularSine.m
deleted file mode 100755
index f5238cc..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkAngularSine.m
+++ /dev/null
@@ -1,42 +0,0 @@
1% IM = mkAngularSine(SIZE, HARMONIC, AMPL, PHASE, ORIGIN)
2%
3% Make an angular sinusoidal image:
4% AMPL * sin( HARMONIC*theta + PHASE),
5% where theta is the angle about the origin.
6% SIZE specifies the matrix size, as for zeros().
7% AMPL (default = 1) and PHASE (default = 0) are optional.
8
9% Eero Simoncelli, 2/97.
10
11function [res] = mkAngularSine(sz, harmonic, ampl, ph, origin)
12
13sz = sz(:);
14if (size(sz,1) == 1)
15 sz = [sz,sz];
16end
17
18mxsz = max(sz(1),sz(2));
19
20%------------------------------------------------------------
21%% OPTIONAL ARGS:
22
23if (exist('harmonic') ~= 1)
24 harmonic = 1;
25end
26
27if (exist('ampl') ~= 1)
28 ampl = 1;
29end
30
31if (exist('ph') ~= 1)
32 ph = 0;
33end
34
35if (exist('origin') ~= 1)
36 origin = (sz+1)/2;
37end
38
39%------------------------------------------------------------
40
41res = ampl * sin(harmonic*mkAngle(sz,ph,origin) + ph);
42
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkDisc.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkDisc.m
deleted file mode 100755
index 33e7d6d..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkDisc.m
+++ /dev/null
@@ -1,61 +0,0 @@
1% IM = mkDisc(SIZE, RADIUS, ORIGIN, TWIDTH, VALS)
2%
3% Make a "disk" image. SIZE specifies the matrix size, as for
4% zeros(). RADIUS (default = min(size)/4) specifies the radius of
5% the disk. ORIGIN (default = (size+1)/2) specifies the
6% location of the disk center. TWIDTH (in pixels, default = 2)
7% specifies the width over which a soft threshold transition is made.
8% VALS (default = [0,1]) should be a 2-vector containing the
9% intensity value inside and outside the disk.
10
11% Eero Simoncelli, 6/96.
12
13function [res] = mkDisc(sz, rad, origin, twidth, vals)
14
15if (nargin < 1)
16 error('Must pass at least a size argument');
17end
18
19sz = sz(:);
20if (size(sz,1) == 1)
21 sz = [sz sz];
22end
23
24%------------------------------------------------------------
25% OPTIONAL ARGS:
26
27if (exist('rad') ~= 1)
28 rad = min(sz(1),sz(2))/4;
29end
30
31if (exist('origin') ~= 1)
32 origin = (sz+1)./2;
33end
34
35if (exist('twidth') ~= 1)
36 twidth = 2;
37end
38
39if (exist('vals') ~= 1)
40 vals = [1,0];
41end
42
43%------------------------------------------------------------
44
45res = mkR(sz,1,origin);
46
47if (abs(twidth) < realmin)
48 res = vals(2) + (vals(1) - vals(2)) * (res <= rad);
49else
50 [Xtbl,Ytbl] = rcosFn(twidth, rad, [vals(1), vals(2)]);
51 res = pointOp(res, Ytbl, Xtbl(1), Xtbl(2)-Xtbl(1), 0);
52%
53% OLD interp1 VERSION:
54% res = res(:);
55% Xtbl(1) = min(res);
56% Xtbl(size(Xtbl,2)) = max(res);
57% res = reshape(interp1(Xtbl,Ytbl,res), sz(1), sz(2));
58%
59end
60
61
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkFract.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkFract.m
deleted file mode 100755
index af95cd5..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkFract.m
+++ /dev/null
@@ -1,36 +0,0 @@
1% IM = mkFract(SIZE, FRACT_DIM)
2%
3% Make a matrix of dimensions SIZE (a [Y X] 2-vector, or a scalar)
4% containing fractal (pink) noise with power spectral density of the
5% form: 1/f^(5-2*FRACT_DIM). Image variance is normalized to 1.0.
6% FRACT_DIM defaults to 1.0
7
8% Eero Simoncelli, 6/96.
9
10%% TODO: Verify that this matches Mandelbrot defn of fractal dimension.
11%% Make this more efficient!
12
13function res = mkFract(dims, fract_dim)
14
15if (exist('fract_dim') ~= 1)
16 fract_dim = 1.0;
17end
18
19res = randn(dims);
20fres = fft2(res);
21
22sz = size(res);
23ctr = ceil((sz+1)./2);
24
25shape = ifftshift(mkR(sz, -(2.5-fract_dim), ctr));
26shape(1,1) = 1; %%DC term
27
28fres = shape .* fres;
29fres = ifft2(fres);
30
31if (max(max(abs(imag(fres)))) > 1e-10)
32 error('Symmetry error in creating fractal');
33else
34 res = real(fres);
35 res = res / sqrt(var2(res));
36end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkGaussian.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkGaussian.m
deleted file mode 100755
index fa8a554..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkGaussian.m
+++ /dev/null
@@ -1,58 +0,0 @@
1% IM = mkGaussian(SIZE, COVARIANCE, MEAN, AMPLITUDE)
2%
3% Compute a matrix with dimensions SIZE (a [Y X] 2-vector, or a
4% scalar) containing a Gaussian function, centered at pixel position
5% specified by MEAN (default = (size+1)/2), with given COVARIANCE (can
6% be a scalar, 2-vector, or 2x2 matrix. Default = (min(size)/6)^2),
7% and AMPLITUDE. AMPLITUDE='norm' (default) will produce a
8% probability-normalized function. All but the first argument are
9% optional.
10
11% Eero Simoncelli, 6/96.
12
13function [res] = mkGaussian(sz, cov, mn, ampl)
14
15sz = sz(:);
16if (size(sz,1) == 1)
17 sz = [sz,sz];
18end
19
20%------------------------------------------------------------
21%% OPTIONAL ARGS:
22
23if (exist('cov') ~= 1)
24 cov = (min(sz(1),sz(2))/6)^2;
25end
26
27if (exist('mn') ~= 1)
28 mn = (sz+1)/2;
29end
30
31if (exist('ampl') ~= 1)
32 ampl = 'norm';
33end
34
35%------------------------------------------------------------
36
37[xramp,yramp] = meshgrid([1:sz(2)]-mn(2),[1:sz(1)]-mn(1));
38
39if (sum(size(cov)) == 2) % scalar
40 if (strcmp(ampl,'norm'))
41 ampl = 1/(2*pi*cov(1));
42 end
43 e = (xramp.^2 + yramp.^2)/(-2 * cov);
44elseif (sum(size(cov)) == 3) % a 2-vector
45 if (strcmp(ampl,'norm'))
46 ampl = 1/(2*pi*sqrt(cov(1)*cov(2)));
47 end
48 e = xramp.^2/(-2 * cov(2)) + yramp.^2/(-2 * cov(1));
49else
50 if (strcmp(ampl,'norm'))
51 ampl = 1/(2*pi*sqrt(det(cov)));
52 end
53 cov = -inv(cov)/2;
54 e = cov(2,2)*xramp.^2 + (cov(1,2)+cov(2,1))*(xramp.*yramp) ...
55 + cov(1,1)*yramp.^2;
56end
57
58res = ampl .* exp(e);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkImpulse.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkImpulse.m
deleted file mode 100755
index 9844ee8..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkImpulse.m
+++ /dev/null
@@ -1,25 +0,0 @@
1% IM = mkImpulse(SIZE, ORIGIN, AMPLITUDE)
2%
3% Compute a matrix of dimension SIZE (a [Y X] 2-vector, or a scalar)
4% containing a single non-zero entry, at position ORIGIN (defaults to
5% ceil(size/2)), of value AMPLITUDE (defaults to 1).
6
7% Eero Simoncelli, 6/96.
8
9function [res] = mkImpulse(sz, origin, amplitude)
10
11sz = sz(:)';
12if (size(sz,2) == 1)
13 sz = [sz sz];
14end
15
16if (exist('origin') ~= 1)
17 origin = ceil(sz/2);
18end
19
20if (exist('amplitude') ~= 1)
21 amplitude = 1;
22end
23
24res = zeros(sz);
25res(origin(1),origin(2)) = amplitude;
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkR.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkR.m
deleted file mode 100755
index a1e8448..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkR.m
+++ /dev/null
@@ -1,32 +0,0 @@
1% IM = mkR(SIZE, EXPT, ORIGIN)
2%
3% Compute a matrix of dimension SIZE (a [Y X] 2-vector, or a scalar)
4% containing samples of a radial ramp function, raised to power EXPT
5% (default = 1), with given ORIGIN (default = (size+1)/2, [1 1] =
6% upper left). All but the first argument are optional.
7
8% Eero Simoncelli, 6/96.
9
10function [res] = mkR(sz, expt, origin)
11
12sz = sz(:);
13if (size(sz,1) == 1)
14 sz = [sz,sz];
15end
16
17% -----------------------------------------------------------------
18% OPTIONAL args:
19
20if (exist('expt') ~= 1)
21 expt = 1;
22end
23
24if (exist('origin') ~= 1)
25 origin = (sz+1)/2;
26end
27
28% -----------------------------------------------------------------
29
30[xramp,yramp] = meshgrid( [1:sz(2)]-origin(2), [1:sz(1)]-origin(1) );
31
32res = (xramp.^2 + yramp.^2).^(expt/2);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkRamp.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkRamp.m
deleted file mode 100755
index dd37164..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkRamp.m
+++ /dev/null
@@ -1,47 +0,0 @@
1% IM = mkRamp(SIZE, DIRECTION, SLOPE, INTERCEPT, ORIGIN)
2%
3% Compute a matrix of dimension SIZE (a [Y X] 2-vector, or a scalar)
4% containing samples of a ramp function, with given gradient DIRECTION
5% (radians, CW from X-axis, default = 0), SLOPE (per pixel, default =
6% 1), and a value of INTERCEPT (default = 0) at the ORIGIN (default =
7% (size+1)/2, [1 1] = upper left). All but the first argument are
8% optional.
9
10% Eero Simoncelli, 6/96. 2/97: adjusted coordinate system.
11
12function [res] = mkRamp(sz, dir, slope, intercept, origin)
13
14sz = sz(:);
15if (size(sz,1) == 1)
16 sz = [sz,sz];
17end
18
19% -----------------------------------------------------------------
20% OPTIONAL args:
21
22if (exist('dir') ~= 1)
23 dir = 0;
24end
25
26if (exist('slope') ~= 1)
27 slope = 1;
28end
29
30if (exist('intercept') ~= 1)
31 intercept = 0;
32end
33
34if (exist('origin') ~= 1)
35 origin = (sz+1)/2;
36end
37
38% -----------------------------------------------------------------
39
40xinc = slope*cos(dir);
41yinc = slope*sin(dir);
42
43[xramp,yramp] = meshgrid( xinc*([1:sz(2)]-origin(2)), ...
44 yinc*([1:sz(1)]-origin(1)) );
45
46res = intercept + xramp + yramp;
47
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkSine.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkSine.m
deleted file mode 100755
index 147eb01..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkSine.m
+++ /dev/null
@@ -1,67 +0,0 @@
1% IM = mkSine(SIZE, PERIOD, DIRECTION, AMPLITUDE, PHASE, ORIGIN)
2% or
3% IM = mkSine(SIZE, FREQ, AMPLITUDE, PHASE, ORIGIN)
4%
5% Compute a matrix of dimension SIZE (a [Y X] 2-vector, or a scalar)
6% containing samples of a 2D sinusoid, with given PERIOD (in pixels),
7% DIRECTION (radians, CW from X-axis, default = 0), AMPLITUDE (default
8% = 1), and PHASE (radians, relative to ORIGIN, default = 0). ORIGIN
9% defaults to the center of the image.
10%
11% In the second form, FREQ is a 2-vector of frequencies (radians/pixel).
12
13% Eero Simoncelli, 6/96.
14
15function [res] = mkSine(sz, per_freq, dir_amp, amp_phase, phase_orig, orig)
16
17%------------------------------------------------------------
18%% OPTIONAL ARGS:
19
20if (prod(size(per_freq)) == 2)
21 frequency = norm(per_freq);
22 direction = atan2(per_freq(1),per_freq(2));
23 if (exist('dir_amp') == 1)
24 amplitude = dir_amp;
25 else
26 amplitude = 1;
27 end
28 if (exist('amp_phase') == 1)
29 phase = amp_phase;
30 else
31 phase = 0;
32 end
33 if (exist('phase_orig') == 1)
34 origin = phase_orig;
35 end
36 if (exist('orig') == 1)
37 error('Too many arguments for (second form) of mkSine');
38 end
39else
40 frequency = 2*pi/per_freq;
41 if (exist('dir_amp') == 1)
42 direction = dir_amp;
43 else
44 direction = 0;
45 end
46 if (exist('amp_phase') == 1)
47 amplitude = amp_phase;
48 else
49 amplitude = 1;
50 end
51 if (exist('phase_orig') == 1)
52 phase = phase_orig;
53 else
54 phase = 0;
55 end
56 if (exist('orig') == 1)
57 origin = orig;
58 end
59end
60
61%------------------------------------------------------------
62
63if (exist('origin') == 1)
64 res = amplitude*sin(mkRamp(sz, direction, frequency, phase, origin));
65else
66 res = amplitude*sin(mkRamp(sz, direction, frequency, phase));
67end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkSquare.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkSquare.m
deleted file mode 100755
index 84ef466..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkSquare.m
+++ /dev/null
@@ -1,89 +0,0 @@
1% IM = mkSquare(SIZE, PERIOD, DIRECTION, AMPLITUDE, PHASE, ORIGIN, TWIDTH)
2% or
3% IM = mkSine(SIZE, FREQ, AMPLITUDE, PHASE, ORIGIN, TWIDTH)
4%
5% Compute a matrix of dimension SIZE (a [Y X] 2-vector, or a scalar)
6% containing samples of a 2D square wave, with given PERIOD (in
7% pixels), DIRECTION (radians, CW from X-axis, default = 0), AMPLITUDE
8% (default = 1), and PHASE (radians, relative to ORIGIN, default = 0).
9% ORIGIN defaults to the center of the image. TWIDTH specifies width
10% of raised-cosine edges on the bars of the grating (default =
11% min(2,period/3)).
12%
13% In the second form, FREQ is a 2-vector of frequencies (radians/pixel).
14
15% Eero Simoncelli, 6/96.
16
17% TODO: Add duty cycle.
18
19function [res] = mkSquare(sz, per_freq, dir_amp, amp_phase, phase_orig, orig_twidth, twidth)
20
21%------------------------------------------------------------
22%% OPTIONAL ARGS:
23
24if (prod(size(per_freq)) == 2)
25 frequency = norm(per_freq);
26 direction = atan2(per_freq(1),per_freq(2));
27 if (exist('dir_amp') == 1)
28 amplitude = dir_amp;
29 else
30 amplitude = 1;
31 end
32 if (exist('amp_phase') == 1)
33 phase = amp_phase;
34 else
35 phase = 0;
36 end
37 if (exist('phase_orig') == 1)
38 origin = phase_orig;
39 end
40 if (exist('orig_twidth') == 1)
41 transition = orig_twidth;
42 else
43 transition = min(2,2*pi/(3*frequency));
44 end
45 if (exist('twidth') == 1)
46 error('Too many arguments for (second form) of mkSine');
47 end
48else
49 frequency = 2*pi/per_freq;
50 if (exist('dir_amp') == 1)
51 direction = dir_amp;
52 else
53 direction = 0;
54 end
55 if (exist('amp_phase') == 1)
56 amplitude = amp_phase;
57 else
58 amplitude = 1;
59 end
60 if (exist('phase_orig') == 1)
61 phase = phase_orig;
62 else
63 phase = 0;
64 end
65 if (exist('orig_twidth') == 1)
66 origin = orig_twidth;
67 end
68 if (exist('twidth') == 1)
69 transition = twidth;
70 else
71 transition = min(2,2*pi/(3*frequency));
72 end
73
74end
75
76%------------------------------------------------------------
77
78if (exist('origin') == 1)
79 res = mkRamp(sz, direction, frequency, phase, origin) - pi/2;
80else
81 res = mkRamp(sz, direction, frequency, phase) - pi/2;
82end
83
84[Xtbl,Ytbl] = rcosFn(transition*frequency,pi/2,[-amplitude amplitude]);
85
86res = pointOp(abs(mod(res+pi, 2*pi)-pi),Ytbl,Xtbl(1),Xtbl(2)-Xtbl(1),0);
87
88% OLD threshold version:
89%res = amplitude * (mod(res,2*pi) < pi);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkZonePlate.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkZonePlate.m
deleted file mode 100755
index 2b6a4a5..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkZonePlate.m
+++ /dev/null
@@ -1,33 +0,0 @@
1% IM = mkZonePlate(SIZE, AMPL, PHASE)
2%
3% Make a "zone plate" image:
4% AMPL * cos( r^2 + PHASE)
5% SIZE specifies the matrix size, as for zeros().
6% AMPL (default = 1) and PHASE (default = 0) are optional.
7
8% Eero Simoncelli, 6/96.
9
10function [res] = mkZonePlate(sz, ampl, ph)
11
12sz = sz(:);
13if (size(sz,1) == 1)
14 sz = [sz,sz];
15end
16
17mxsz = max(sz(1),sz(2));
18
19%------------------------------------------------------------
20%% OPTIONAL ARGS:
21
22if (exist('ampl') ~= 1)
23 ampl = 1;
24end
25
26if (exist('ph') ~= 1)
27 ph = 0;
28end
29
30%------------------------------------------------------------
31
32res = ampl * cos( (pi/mxsz) * mkR(sz,2) + ph );
33
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mod.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/mod.m
deleted file mode 100755
index 21167e5..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mod.m
+++ /dev/null
@@ -1,14 +0,0 @@
1% M = mod(A,B)
2%
3% Modulus operator: returns A mod B.
4% Works on matrics, vectors or scalars.
5%
6% NOTE: This function is a Matlab-5 builtin, but was missing from Matlab-4.
7
8% Eero Simoncelli, 7/96.
9
10function m = mod(a,n)
11
12m = a - n .* floor(a./n);
13return;
14
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/modacor22.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/modacor22.m
deleted file mode 100755
index 89c8d52..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/modacor22.m
+++ /dev/null
@@ -1,127 +0,0 @@
1function [Y,snrV,Chf]=modacor22(X,Cy,p);
2
3% It imposes the desired autocorrelation in the given (central) samples (Cy) to
4% an image X, convolving it with an even filter of size(Cy), in such a way
5% that the image containts change as less as possible, in a LSE sense.
6% [Y,snr,Chf]=modacor22(X,Cy,p);
7% Chf: Fourier transform of the filter that forces the autocorrelation
8% p [OPTIONAL]: mixing proportion between Cx and Cy
9% it imposes (1-p)*Cx + p*Cy,
10% being Cx the actual autocorrelation.
11% DEFAULT: p = 1;
12
13% JPM, 10/97, working with EPS, NYU
14
15Warn = 0; % Set to 1 if you want to see warning messages
16if (exist('p') ~= 1)
17 p = 1;
18end
19
20% Compute the autocorrelation function of the original image
21
22[Ny,Nx]=size(X);
23Nc=size(Cy,1); % Normally Nc<<Nx, only the low indices of the autocorrelation
24if (2*Nc-1 > Nx) & Warn
25 warning('Autocorrelation neighborhood too large for image: reducing');
26 Nc = 2*floor(Nx/4)-1;
27 first = (size(Cy,1)-Nc)/2;
28 Cy = Cy(first+1:first+Nc, first+1:first+Nc);
29end
30
31Xf=fft2(X);
32Xf2=abs(Xf).^2;
33Cx=fftshift(real(ifft2(Xf2)))/(2-isreal(X));
34Cy=Cy*prod(size(X)); % Unnormalize the previously normalized correlation
35
36cy=Ny/2+1;
37cx=Nx/2+1;
38Lc=(Nc-1)/2;
39Cy0 = Cy;
40Cy = p*Cy + (1-p)*Cx(cy-Lc:cy+Lc,cx-Lc:cx+Lc);
41
42% Compare the actual correlation with the desired one
43%imStats(Cx(cy-Lc:cy+Lc,cx-Lc:cx+Lc),Cy)
44snrV=10*log10(sum(sum(Cy0.^2))/sum(sum((Cy0-Cx(cy-Lc:cy+Lc,cx-Lc:cx+Lc)).^2)));
45
46% Take just the part that has influence on the samples of Cy (Cy=conv(Cx,Ch))
47Cx=Cx(cy-2*Lc:cy+2*Lc,cx-2*Lc:cx+2*Lc);
48
49% Build the matrix that performs the convolution Cy1=Tcx*Ch1
50
51Ncx=4*Lc+1;
52M=(Nc^2+1)/2;
53Tcx=zeros(M);
54
55for i=Lc+1:2*Lc,
56 for j=Lc+1:3*Lc+1,
57 nm=(i-Lc-1)*(2*Lc+1)+j-Lc;
58 ccx=Cx(i-Lc:i+Lc,j-Lc:j+Lc);
59 ccxi=ccx(2*Lc+1:-1:1,2*Lc+1:-1:1);
60 ccx=ccx+ccxi;
61 ccx(Lc+1,Lc+1)=ccx(Lc+1,Lc+1)/2;
62 ccx=vector(ccx');
63 Tcx(nm,:)=ccx(1:M)';
64 end
65end
66i=2*Lc+1;
67for j=Lc+1:2*Lc+1,
68 nm=(i-Lc-1)*(2*Lc+1)+j-Lc;
69 ccx=Cx(i-Lc:i+Lc,j-Lc:j+Lc);
70 ccxi=ccx(2*Lc+1:-1:1,2*Lc+1:-1:1);
71 ccx=ccx+ccxi;
72 ccx(Lc+1,Lc+1)=ccx(Lc+1,Lc+1)/2;
73 ccx=vector(ccx');
74 Tcx(nm,:)=ccx(1:M)';
75end
76
77% Rearrange Cy indices and solve the equation
78
79Cy1=vector(Cy');
80Cy1=Cy1(1:M);
81
82Ch1=inv(Tcx)*Cy1;
83
84% Rearrange Ch1
85
86Ch1=[Ch1;Ch1(length(Cy1)-1:-1:1)];
87Ch=reshape(Ch1,Nc,Nc)';
88
89% Compute H from Ch (H is zero-phase) through the DFT
90
91%s=2^(ceil(log(Nc)/log(2))+1);
92%H=sqrt(abs(fft2(Ch,s,s)));
93%h=fftshift(real(ifft2(H)));
94%h=h(s/2+1-Lc:s/2+1+Lc,s/2+1-Lc:s/2+1+Lc);
95%%plot(Ch);drawnow
96%h=recphase(Ch);
97
98% Compute Y as conv(X,H) in the Fourier domain
99
100%%Y=real(ifft2(Xf.*H));
101%Y=real(ifft2(Xf.*sqrt(abs(fft2(Ch,Ny,Nx)))));
102aux=zeros(Ny,Nx);
103aux(cy-Lc:cy+Lc,cx-Lc:cx+Lc)=Ch;
104Ch=fftshift(aux);
105Chf=real(fft2(Ch));
106%Chf=fft2(Ch,Ny,Nx);
107%figure(7);plot(Chf);drawnow;
108Yf=Xf.*sqrt(abs(Chf));
109Y=ifft2(Yf);
110%Y=cconv2(X,h);
111
112% Checks the fidelity of the imposition
113
114%Cy2=fftshift(real(ifft2(Xf2.*abs(Chf))))/(2-isreal(X));
115%Cy2=Cy2(cy-Lc:cy+Lc,cx-Lc:cx+Lc);
116%imStats(Cy,Cy2)
117%imStats(X,Y)
118
119%Yf2=abs(Yf).^2;
120%Cy3=fftshift(real(ifft2(Yf2)))/2;
121
122%Cy3=Cy3(cy-Lc:cy+Lc,cx-Lc:cx+Lc);
123%snr(Cy,Cy-Cy3)
124%imStats(Cy,Cy3)
125
126
127
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/modkurt.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/modkurt.m
deleted file mode 100755
index e144d32..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/modkurt.m
+++ /dev/null
@@ -1,172 +0,0 @@
1function [chm, snrk] = modkurt(ch,k,p);
2
3% Modify the kurtosis in one step, by moving in gradient direction until
4% reaching the desired kurtosis value.
5% It does not affect the mean nor the variance, but it affects the skewness.
6% This operation is not an orthogonal projection, but the projection angle is
7% near pi/2 when k is close to the original kurtosis, which is a realistic assumption
8% when doing iterative projections in a pyramid, for example (small corrections
9% to the channels' statistics).
10%
11% [chm, snrk] = modkurt(ch,k,p);
12% ch: channel
13% k: desired kurtosis (k=M4/M2^2)
14% p [OPTIONAL]: mixing proportion between k0 and k
15% it imposes (1-p)*k0 + p*k,
16% being k0 the current kurtosis.
17% DEFAULT: p = 1;
18
19
20% Javier Portilla, Oct.12/97, NYU
21
22Warn = 0; % Set to 1 if you want to see warning messages
23if ~exist('p'),
24 p = 1;
25end
26
27me=mean2(ch);
28ch=ch-me;
29
30% Compute the moments
31
32m=zeros(12,1);
33for n=2:12,
34 m(n)=mean2(ch.^n);
35end
36
37% The original kurtosis
38
39k0=m(4)/m(2)^2;
40snrk = snr(k, k-k0);
41if snrk > 60,
42 chm = ch+me;
43 return
44end
45k = k0*(1-p) + k*p;
46
47% Some auxiliar variables
48
49a=m(4)/m(2);
50
51% Coeficients of the numerator (A*lam^4+B*lam^3+C*lam^2+D*lam+E)
52
53A=m(12)-4*a*m(10)-4*m(3)*m(9)+6*a^2*m(8)+12*a*m(3)*m(7)+6*m(3)^2*m(6)-...
54 4*a^3*m(6)-12*a^2*m(3)*m(5)+a^4*m(4)-12*a*m(3)^2*m(4)+...
55 4*a^3*m(3)^2+6*a^2*m(3)^2*m(2)-3*m(3)^4;
56B=4*(m(10)-3*a*m(8)-3*m(3)*m(7)+3*a^2*m(6)+6*a*m(3)*m(5)+3*m(3)^2*m(4)-...
57 a^3*m(4)-3*a^2*m(3)^2-3*m(4)*m(3)^2);
58C=6*(m(8)-2*a*m(6)-2*m(3)*m(5)+a^2*m(4)+2*a*m(3)^2+m(3)^2*m(2));
59D=4*(m(6)-a^2*m(2)-m(3)^2);
60E=m(4);
61
62% Define the coefficients of the denominator (F*lam^2+G)^2
63
64F=D/4;
65G=m(2);
66
67% test
68test = 0;
69
70if test,
71
72 grd = ch.^3 - a*ch - m(3);
73 lam = -0.001:0.00001:0.001;
74 k = (A*lam.^4+B*lam.^3+C*lam.^2+D*lam+E)./...
75 (F*lam.^2 + G).^2;
76 for lam = -0.001:0.00001:0.001,
77 n = lam*100000+101;
78 chp = ch + lam*grd;
79 k2(n) = mean2(chp.^4)/mean2(chp.^2)^2;
80 %k2(n) = mean2(chp.^4);
81 end
82 lam = -0.001:0.00001:0.001;
83 snr(k2, k-k2)
84
85end % test
86
87% Now I compute its derivative with respect to lambda
88% (only the roots of derivative = 0 )
89
90d(1) = B*F;
91d(2) = 2*C*F - 4*A*G;
92d(3) = 4*F*D -3*B*G - D*F;
93d(4) = 4*F*E - 2*C*G;
94d(5) = -D*G;
95
96mMlambda = roots(d);
97
98tg = imag(mMlambda)./real(mMlambda);
99mMlambda = mMlambda(find(abs(tg)<1e-6));
100lNeg = mMlambda(find(mMlambda<0));
101if length(lNeg)==0,
102 lNeg = -1/eps;
103end
104lPos = mMlambda(find(mMlambda>=0));
105if length(lPos)==0,
106 lPos = 1/eps;
107end
108lmi = max(lNeg);
109lma = min(lPos);
110
111lam = [lmi lma];
112mMnewKt = polyval([A B C D E],lam)./(polyval([F 0 G],lam)).^2;
113kmin = min(mMnewKt);
114kmax = max(mMnewKt);
115
116% Given a desired kurtosis, solves for lambda
117
118if k<=kmin & Warn,
119 lam = lmi;
120 warning('Saturating (down) kurtosis!');
121 kmin
122elseif k>=kmax & Warn,
123 lam = lma;
124 warning('Saturating (up) kurtosis!');
125 kmax
126else
127
128% Coeficients of the algebraic equation
129
130c0 = E - k*G^2;
131c1 = D;
132c2 = C - 2*k*F*G;
133c3 = B;
134c4 = A - k*F^2;
135
136% Solves the equation
137
138r=roots([c4 c3 c2 c1 c0]);
139
140% Chose the real solution with minimum absolute value with the rigth sign
141
142tg = imag(r)./real(r);
143%lambda = real(r(find(abs(tg)<1e-6)));
144lambda = real(r(find(abs(tg)==0)));
145if length(lambda)>0,
146 lam = lambda(find(abs(lambda)==min(abs(lambda))));
147 lam = lam(1);
148else
149 lam = 0;
150end
151
152end % if ... else
153
154
155% Modify the channel
156
157chm=ch+lam*(ch.^3-a*ch-m(3)); % adjust the kurtosis
158chm=chm*sqrt(m(2)/mean2(chm.^2)); % adjust the variance
159chm=chm+me; % adjust the mean
160
161% Check the result
162%k2=mean2((chm-me).^4)/(mean2((chm-me).^2))^2;
163%SNR=snr(k,k-k2)
164
165
166
167
168
169
170
171
172
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/modskew.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/modskew.m
deleted file mode 100755
index 3de0e3c..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/modskew.m
+++ /dev/null
@@ -1,183 +0,0 @@
1function [chm, snrk] = modskew(ch,sk,p);
2
3% Adjust the sample skewness of a vector/matrix, using gradient projection,
4% without affecting its sample mean and variance.
5%
6% This operation is not an orthogonal projection, but the projection angle is
7% near pi/2 when sk is close to the original skewness, which is a realistic
8% assumption when doing iterative projections in a pyramid, for example
9% (small corrections to the channels' statistics).
10%
11% [xm, snrk] = modskew(x,sk,p);
12% sk: new skweness
13% p [OPTIONAL]: mixing proportion between sk0 and sk
14% it imposes (1-p)*sk0 + p*sk,
15% being sk0 the current skewness.
16% DEFAULT: p = 1;
17
18%
19% JPM. 2/98, IODV, CSIC
20% 4/00, CNS, NYU
21
22Warn = 0; % Set to 1 if you want to see warning messages
23if ~exist('p'),
24 p = 1;
25end
26
27N=prod(size(ch)); % number of samples
28me=mean2(ch);
29ch=ch-me;
30
31for n=2:6,
32 m(n)=mean2(ch.^n);
33end
34
35sd=sqrt(m(2)); % standard deviation
36s=m(3)/sd^3; % original skewness
37snrk = snr(sk, sk-s);
38sk = s*(1-p) + sk*p;
39
40% Define the coefficients of the numerator (A*lam^3+B*lam^2+C*lam+D)
41
42A=m(6)-3*sd*s*m(5)+3*sd^2*(s^2-1)*m(4)+sd^6*(2+3*s^2-s^4);
43B=3*(m(5)-2*sd*s*m(4)+sd^5*s^3);
44C=3*(m(4)-sd^4*(1+s^2));
45D=s*sd^3;
46
47a(7)=A^2;
48a(6)=2*A*B;
49a(5)=B^2+2*A*C;
50a(4)=2*(A*D+B*C);
51a(3)=C^2+2*B*D;
52a(2)=2*C*D;
53a(1)=D^2;
54
55% Define the coefficients of the denominator (A2+B2*lam^2)
56
57A2=sd^2;
58B2=m(4)-(1+s^2)*sd^4;
59
60b=zeros(1,7);
61b(7)=B2^3;
62b(5)=3*A2*B2^2;
63b(3)=3*A2^2*B2;
64b(1)=A2^3;
65
66
67if 0, % test
68
69 lam = -2:0.02:2;
70 S = (A*lam.^3+B*lam.^2+C*lam+D)./...
71 sqrt(b(7)*lam.^6 + b(5)*lam.^4 + b(3)*lam.^2 + b(1));
72% grd = ch.^2 - m(2) - sd * s * ch;
73% for lam = -1:0.01:1,
74% n = lam*100+101;
75% chp = ch + lam*grd;
76% S2(n) = mean2(chp.^3)/abs(mean2(chp.^2))^(1.5);
77% end
78 lam = -2:0.02:2;
79figure(1);plot(lam,S);grid;drawnow
80% snr(S2, S-S2)
81
82end % test
83
84% Now I compute its derivative with respect to lambda
85
86d(8) = B*b(7);
87d(7) = 2*C*b(7) - A*b(5);
88d(6) = 3*D*b(7);
89d(5) = C*b(5) - 2*A*b(3);
90d(4) = 2*D*b(5) - B*b(3);
91d(3) = -3*A*b(1);
92d(2) = D*b(3) - 2*B*b(1);
93d(1) = -C*b(1);
94
95d = d(8:-1:1);
96mMlambda = roots(d);
97
98tg = imag(mMlambda)./real(mMlambda);
99mMlambda = real(mMlambda(find(abs(tg)<1e-6)));
100lNeg = mMlambda(find(mMlambda<0));
101if length(lNeg)==0,
102 lNeg = -1/eps;
103end
104lPos = mMlambda(find(mMlambda>=0));
105if length(lPos)==0,
106 lPos = 1/eps;
107end
108lmi = max(lNeg);
109lma = min(lPos);
110
111lam = [lmi lma];
112mMnewSt = polyval([A B C D],lam)./(polyval(b(7:-1:1),lam)).^0.5;
113skmin = min(mMnewSt);
114skmax = max(mMnewSt);
115
116
117% Given a desired skewness, solves for lambda
118
119if sk<=skmin & Warn,
120 lam = lmi;
121 warning('Saturating (down) skewness!');
122 skmin
123elseif sk>=skmax & Warn,
124 lam = lma;
125 warning('Saturating (up) skewness!');
126 skmax
127else
128
129
130% The equation is sum(c.*lam.^(0:6))=0
131
132c=a-b*sk^2;
133
134c=c(7:-1:1);
135
136r=roots(c);
137
138% Chose the real solution with minimum absolute value with the rigth sign
139lam=-Inf;
140co=0;
141for n=1:6,
142 tg = imag(r(n))/real(r(n));
143 if (abs(tg)<1e-6)&(sign(real(r(n)))==sign(sk-s)),
144 co=co+1;
145 lam(co)=real(r(n));
146 end
147end
148if min(abs(lam))==Inf & Warn,
149 display('Warning: Skew adjustment skipped!');
150 lam=0;
151end
152
153p=[A B C D];
154
155if length(lam)>1,
156 foo=sign(polyval(p,lam));
157 if any(foo==0),
158 lam = lam(find(foo==0));
159 else
160 lam = lam(find(foo==sign(sk))); % rejects the symmetric solution
161 end
162 if length(lam)>0,
163 lam=lam(find(abs(lam)==min(abs(lam)))); % the smallest that fix the skew
164 lam=lam(1);
165 else
166 lam = 0;
167 end
168end
169end % if else
170
171% Modify the channel
172chm=ch+lam*(ch.^2-sd^2-sd*s*ch); % adjust the skewness
173chm=chm*sqrt(m(2)/mean2(chm.^2)); % adjust the variance
174chm=chm+me; % adjust the mean
175 % (These don't affect the skewness)
176% Check the result
177%mem=mean2(chm);
178%sk2=mean2((chm-mem).^3)/mean2((chm-mem).^2).^(3/2);
179%sk - sk2
180%SNR=snr(sk,sk-sk2)
181
182
183
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/modulateFlip.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/modulateFlip.m
deleted file mode 100755
index eb27303..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/modulateFlip.m
+++ /dev/null
@@ -1,19 +0,0 @@
1% [HFILT] = modulateFlipShift(LFILT)
2%
3% QMF/Wavelet highpass filter construction: modulate by (-1)^n,
4% reverse order (and shift by one, which is handled by the convolution
5% routines). This is an extension of the original definition of QMF's
6% (e.g., see Simoncelli90).
7
8% Eero Simoncelli, 7/96.
9
10function [hfilt] = modulateFlipShift(lfilt)
11
12lfilt = lfilt(:);
13
14sz = size(lfilt,1);
15sz2 = ceil(sz/2);
16
17ind = [sz:-1:1]';
18
19hfilt = lfilt(ind) .* (-1).^(ind-sz2);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/namedFilter.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/namedFilter.m
deleted file mode 100755
index 0689dbc..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/namedFilter.m
+++ /dev/null
@@ -1,71 +0,0 @@
1% KERNEL = NAMED_FILTER(NAME)
2%
3% Some standard 1D filter kernels. These are scaled such that
4% their L2-norm is 1.0.
5%
6% binomN - binomial coefficient filter of order N-1
7% haar: - Haar wavelet.
8% qmf8, qmf12, qmf16 - Symmetric Quadrature Mirror Filters [Johnston80]
9% daub2,daub3,daub4 - Daubechies wavelet [Daubechies88].
10% qmf5, qmf9, qmf13: - Symmetric Quadrature Mirror Filters [Simoncelli88,Simoncelli90]
11%
12% See bottom of file for full citations.
13
14% Eero Simoncelli, 6/96.
15
16function [kernel] = named_filter(name)
17
18if strcmp(name(1:min(5,size(name,2))), 'binom')
19 kernel = sqrt(2) * binomialFilter(str2num(name(6:size(name,2))));
20elseif strcmp(name,'qmf5')
21 kernel = [-0.076103 0.3535534 0.8593118 0.3535534 -0.076103]';
22elseif strcmp(name,'qmf9')
23 kernel = [0.02807382 -0.060944743 -0.073386624 0.41472545 0.7973934 ...
24 0.41472545 -0.073386624 -0.060944743 0.02807382]';
25elseif strcmp(name,'qmf13')
26 kernel = [-0.014556438 0.021651438 0.039045125 -0.09800052 ...
27 -0.057827797 0.42995453 0.7737113 0.42995453 -0.057827797 ...
28 -0.09800052 0.039045125 0.021651438 -0.014556438]';
29elseif strcmp(name,'qmf8')
30 kernel = sqrt(2) * [0.00938715 -0.07065183 0.06942827 0.4899808 ...
31 0.4899808 0.06942827 -0.07065183 0.00938715 ]';
32elseif strcmp(name,'qmf12')
33 kernel = sqrt(2) * [-0.003809699 0.01885659 -0.002710326 -0.08469594 ...
34 0.08846992 0.4843894 0.4843894 0.08846992 -0.08469594 -0.002710326 ...
35 0.01885659 -0.003809699 ]';
36elseif strcmp(name,'qmf16')
37 kernel = sqrt(2) * [0.001050167 -0.005054526 -0.002589756 0.0276414 -0.009666376 ...
38 -0.09039223 0.09779817 0.4810284 0.4810284 0.09779817 -0.09039223 -0.009666376 ...
39 0.0276414 -0.002589756 -0.005054526 0.001050167 ]';
40elseif strcmp(name,'haar')
41 kernel = [1 1]' / sqrt(2);
42elseif strcmp(name,'daub2')
43 kernel = [0.482962913145 0.836516303738 0.224143868042 -0.129409522551]';
44elseif strcmp(name,'daub3')
45 kernel = [0.332670552950 0.806891509311 0.459877502118 -0.135011020010 ...
46 -0.085441273882 0.035226291882]';
47elseif strcmp(name,'daub4')
48 kernel = [0.230377813309 0.714846570553 0.630880767930 -0.027983769417 ...
49 -0.187034811719 0.030841381836 0.032883011667 -0.010597401785]';
50elseif strcmp(name,'gauss5') % for backward-compatibility
51 kernel = sqrt(2) * [0.0625 0.25 0.375 0.25 0.0625]';
52elseif strcmp(name,'gauss3') % for backward-compatibility
53 kernel = sqrt(2) * [0.25 0.5 0.25]';
54else
55 error(sprintf('Bad filter name: %s\n',name));
56end
57
58% [Johnston80] - J D Johnston, "A filter family designed for use in quadrature
59% mirror filter banks", Proc. ICASSP, pp 291-294, 1980.
60%
61% [Daubechies88] - I Daubechies, "Orthonormal bases of compactly supported wavelets",
62% Commun. Pure Appl. Math, vol. 42, pp 909-996, 1988.
63%
64% [Simoncelli88] - E P Simoncelli, "Orthogonal sub-band image transforms",
65% PhD Thesis, MIT Dept. of Elec. Eng. and Comp. Sci. May 1988.
66% Also available as: MIT Media Laboratory Vision and Modeling Technical
67% Report #100.
68%
69% [Simoncelli90] - E P Simoncelli and E H Adelson, "Subband image coding",
70% Subband Transforms, chapter 4, ed. John W Woods, Kluwer Academic
71% Publishers, Norwell, MA, 1990, pp 143--192.
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/nextFig.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/nextFig.m
deleted file mode 100755
index e0ac73f..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/nextFig.m
+++ /dev/null
@@ -1,19 +0,0 @@
1% nextFig (MAXFIGS, SKIP)
2%
3% Make figure number mod((GCF+SKIP), MAXFIGS) the current figure.
4% MAXFIGS is optional, and defaults to 2.
5% SKIP is optional, and defaults to 1.
6
7% Eero Simoncelli, 2/97.
8
9function nextFig(maxfigs, skip)
10
11if (exist('maxfigs') ~= 1)
12 maxfigs = 2;
13end
14
15if (exist('skip') ~= 1)
16 skip = 1;
17end
18
19figure(1+mod(gcf-1+skip,maxfigs));
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/pgmRead.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/pgmRead.m
deleted file mode 100755
index 86c3b62..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/pgmRead.m
+++ /dev/null
@@ -1,59 +0,0 @@
1% IM = pgmRead( FILENAME )
2%
3% Load a pgm image into a MatLab matrix.
4% This format is accessible from the XV image browsing utility.
5% Only works for 8bit gray images (raw or ascii)
6
7% Hany Farid, Spring '96. Modified by Eero Simoncelli, 6/96.
8
9function im = pgmRead( fname );
10
11[fid,msg] = fopen( fname, 'r' );
12
13if (fid == -1)
14 error(msg);
15end
16
17%%% First line contains ID string:
18%%% "P1" = ascii bitmap, "P2" = ascii greymap,
19%%% "P3" = ascii pixmap, "P4" = raw bitmap,
20%%% "P5" = raw greymap, "P6" = raw pixmap
21TheLine = fgetl(fid);
22format = TheLine;
23
24if ~((format(1:2) == 'P2') | (format(1:2) == 'P5'))
25 error('PGM file must be of type P2 or P5');
26end
27
28%%% Any number of comment lines
29TheLine = fgetl(fid);
30while TheLine(1) == '#'
31 TheLine = fgetl(fid);
32end
33
34%%% dimensions
35sz = sscanf(TheLine,'%d',2);
36xdim = sz(1);
37ydim = sz(2);
38sz = xdim * ydim;
39
40%%% Maximum pixel value
41TheLine = fgetl(fid);
42maxval = sscanf(TheLine, '%d',1);
43
44%%im = zeros(dim,1);
45if (format(2) == '2')
46 [im,count] = fscanf(fid,'%d',sz);
47else
48 [im,count] = fread(fid,sz,'uchar');
49end
50
51fclose(fid);
52
53if (count == sz)
54 im = reshape( im, xdim, ydim )';
55else
56 fprintf(1,'Warning: File ended early!');
57 im = reshape( [im ; zeros(sz-count,1)], xdim, ydim)';
58end
59
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/pgmWrite.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/pgmWrite.m
deleted file mode 100755
index 09c14c9..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/pgmWrite.m
+++ /dev/null
@@ -1,120 +0,0 @@
1% RANGE = pgmWrite(MTX, FILENAME, RANGE, TYPE, COMMENT)
2%
3% Write a MatLab matrix to a pgm (graylevel image) file.
4% This format is accessible from the XV image browsing utility.
5%
6% RANGE (optional) is a 2-vector specifying the values that map to
7% black and white, respectively. Passing a value of 'auto' (default)
8% sets RANGE=[min,max] (as in MatLab's imagesc). 'auto2' sets
9% RANGE=[mean-2*stdev, mean+2*stdev]. 'auto3' sets
10% RANGE=[p1-(p2-p1)/8, p2+(p2-p1)/8], where p1 is the 10th percentile
11% value of the sorted MATRIX samples, and p2 is the 90th percentile
12% value.
13%
14% TYPE (optional) should be 'raw' or 'ascii'. Defaults to 'raw'.
15
16% Hany Farid, Spring '96. Modified by Eero Simoncelli, 6/96.
17
18function range = pgmWrite(mtx, fname, range, type, comment );
19
20[fid,msg] = fopen( fname, 'w' );
21
22if (fid == -1)
23 error(msg);
24end
25
26%------------------------------------------------------------
27%% optional ARGS:
28
29if (exist('range') ~= 1)
30 range = 'auto';
31end
32
33if (exist('type') ~= 1)
34 type = 'raw';
35end
36%------------------------------------------------------------
37
38%% Automatic range calculation:
39if (strcmp(range,'auto1') | strcmp(range,'auto'))
40 [mn,mx] = range2(mtx);
41 range = [mn,mx];
42
43elseif strcmp(range,'auto2')
44 stdev = sqrt(var2(mtx));
45 av = mean2(mtx);
46 range = [av-2*stdev,av+2*stdev]; % MAGIC NUMBER: 2 stdevs
47
48elseif strcmp(range, 'auto3')
49 percentile = 0.1; % MAGIC NUMBER: 0<p<0.5
50 [N,X] = histo(mtx);
51 binsz = X(2)-X(1);
52 N = N+1e-10; % Ensure cumsum will be monotonic for call to interp1
53 cumN = [0, cumsum(N)]/sum(N);
54 cumX = [X(1)-binsz, X] + (binsz/2);
55 ctrRange = interp1(cumN,cumX, [percentile, 1-percentile]);
56 range = mean(ctrRange) + (ctrRange-mean(ctrRange))/(1-2*percentile);
57
58elseif isstr(range)
59 error(sprintf('Bad RANGE argument: %s',range))
60
61end
62
63if ((range(2) - range(1)) <= eps)
64 range(1) = range(1) - 0.5;
65 range(2) = range(2) + 0.5;
66end
67
68
69%%% First line contains ID string:
70%%% "P1" = ascii bitmap, "P2" = ascii greymap,
71%%% "P3" = ascii pixmap, "P4" = raw bitmap,
72%%% "P5" = raw greymap, "P6" = raw pixmap
73if strcmp(type,'raw')
74 fprintf(fid,'P5\n');
75 format = 5;
76elseif strcmp(type,'ascii')
77 fprintf(fid,'P2\n');
78 format = 2;
79else
80 error(sprintf('PGMWRITE: Bad type argument: %s',type));
81end
82
83fprintf(fid,'# MatLab PGMWRITE file, saved %s\n',date);
84
85if (exist('comment') == 1)
86 fprintf(fid,'# %s\n', comment);
87end
88
89%%% dimensions
90fprintf(fid,'%d %d\n',size(mtx,2),size(mtx,1));
91
92%%% Maximum pixel value
93fprintf(fid,'255\n');
94
95
96%% MatLab's "fprintf" floors when writing floats, so we compute
97%% (mtx-r1)*255/(r2-r1)+0.5
98mult = (255 / (range(2)-range(1)));
99mtx = (mult * mtx) + (0.5 - mult * range(1));
100
101mtx = max(-0.5+eps,min(255.5-eps,mtx));
102
103if (format == 2)
104 count = fprintf(fid,'%d ',mtx');
105elseif (format == 5)
106 count = fwrite(fid,mtx','uchar');
107end
108
109fclose(fid);
110
111if (count ~= size(mtx,1)*size(mtx,2))
112 fprintf(1,'Warning: File output terminated early!');
113end
114
115%%% TEST:
116% foo = 257*rand(100)-1;
117% pgmWrite(foo,'foo.pgm',[0 255]);
118% foo2=pgmRead('foo.pgm');
119% size(find((foo2-round(foo))~=0))
120% foo(find((foo2-round(foo))~=0))
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/pixelAxes.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/pixelAxes.m
deleted file mode 100755
index f88210d..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/pixelAxes.m
+++ /dev/null
@@ -1,70 +0,0 @@
1% [ZOOM] = pixelAxes(DIMS, ZOOM)
2%
3% Set the axes of the current plot to cover a multiple of DIMS pixels,
4% thereby eliminating screen aliasing artifacts when displaying an
5% image of size DIMS.
6%
7% ZOOM (optional, default='same') expresses the desired number of
8% samples displayed per screen pixel. It should be a scalar, which
9% will be rounded to the nearest integer, or 1 over an integer. It
10% may also be the string 'same' or 'auto', in which case the value is chosen so
11% as to produce an image closest in size to the currently displayed
12% image. It may also be the string 'full', in which case the image is
13% made as large as possible while still fitting in the window.
14
15% Eero Simoncelli, 2/97.
16
17function [zoom] = pixelAxes(dims, zoom)
18
19%------------------------------------------------------------
20%% OPTIONAL ARGS:
21
22if (exist('zoom') ~= 1)
23 zoom = 'same';
24end
25
26%% Reverse dimension order, since Figure Positions reported as (x,y).
27dims = dims(2:-1:1);
28
29%% Use MatLab's axis function to force square pixels, etc:
30axis('image');
31ax = gca;
32
33oldunits = get(ax,'Units');
34
35if strcmp(zoom,'full');
36 set(ax,'Units','normalized');
37 set(ax,'Position',[0 0 1 1]);
38 zoom = 'same';
39end
40
41set(ax,'Units','pixels');
42pos = get(ax,'Position');
43ctr = pos(1:2)+pos(3:4)/2;
44
45if (strcmp(zoom,'same') | strcmp(zoom,'auto'))
46 %% HACK: enlarge slightly so that floor doesn't round down
47 zoom = min( pos(3:4) ./ (dims - 1) );
48elseif isstr(zoom)
49 error(sprintf('Bad ZOOM argument: %s',zoom));
50end
51
52%% Force zoom value to be an integer, or inverse integer.
53if (zoom < 0.75)
54 zoom = 1/ceil(1/zoom);
55 %% Round upward, subtracting 0.5 to avoid floating point errors.
56 newsz = ceil(zoom*(dims-0.5));
57else
58 zoom = floor(zoom + 0.001); % Avoid floating pt errors
59 if (zoom < 1.5) % zoom=1
60 zoom = 1;
61 newsz = dims + 0.5;
62 else
63 newsz = zoom*(dims-1) + mod(zoom,2);
64 end
65end
66
67set(ax,'Position', [floor(ctr-newsz/2)+0.5, newsz] )
68
69% Restore units
70set(ax,'Units',oldunits);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/pointOp.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/pointOp.m
deleted file mode 100755
index feb7750..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/pointOp.m
+++ /dev/null
@@ -1,28 +0,0 @@
1% RES = pointOp(IM, LUT, ORIGIN, INCREMENT, WARNINGS)
2%
3% Apply a point operation, specified by lookup table LUT, to image IM.
4% LUT must be a row or column vector, and is assumed to contain
5% (equi-spaced) samples of the function. ORIGIN specifies the
6% abscissa associated with the first sample, and INCREMENT specifies the
7% spacing between samples. Between-sample values are estimated via
8% linear interpolation. If WARNINGS is non-zero, the function prints
9% a warning whenever the lookup table is extrapolated.
10%
11% This function is much faster than MatLab's interp1, and allows
12% extrapolation beyond the lookup table domain. The drawbacks are
13% that the lookup table must be equi-spaced, and the interpolation is
14% linear.
15
16% Eero Simoncelli, 8/96.
17
18function res = pointOp(im, lut, origin, increment, warnings)
19
20%% NOTE: THIS CODE IS NOT ACTUALLY USED! (MEX FILE IS CALLED INSTEAD)
21
22%fprintf(1,'WARNING: You should compile the MEX version of "pointOp.c",\n found in the MEX subdirectory of matlabPyrTools, and put it in your matlab path. It is MUCH faster.\n');
23
24X = origin + increment*[0:size(lut(:),1)-1];
25Y = lut(:);
26
27res = reshape(interp1(X, Y, im(:), 'linear', 'extrap'),size(im));
28
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/pwd2path.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/pwd2path.m
deleted file mode 100755
index 15aecf0..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/pwd2path.m
+++ /dev/null
@@ -1,6 +0,0 @@
1% PWD2PATH()
2%
3% add current working directory (pwd) to path.
4
5P = path;
6path(pwd,P);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/pyrBand.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/pyrBand.m
deleted file mode 100755
index 1fb6461..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/pyrBand.m
+++ /dev/null
@@ -1,11 +0,0 @@
1% RES = pyrBand(PYR, INDICES, BAND_NUM)
2%
3% Access a subband from a pyramid (gaussian, laplacian, QMF/wavelet,
4% or steerable). Subbands are numbered consecutively, from finest
5% (highest spatial frequency) to coarsest (lowest spatial frequency).
6
7% Eero Simoncelli, 6/96.
8
9function res = pyrBand(pyr, pind, band)
10
11res = reshape( pyr(pyrBandIndices(pind,band)), pind(band,1), pind(band,2) );
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/pyrBandIndices.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/pyrBandIndices.m
deleted file mode 100755
index f94c217..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/pyrBandIndices.m
+++ /dev/null
@@ -1,24 +0,0 @@
1% RES = pyrBandIndices(INDICES, BAND_NUM)
2%
3% Return indices for accessing a subband from a pyramid
4% (gaussian, laplacian, QMF/wavelet, steerable).
5
6% Eero Simoncelli, 6/96.
7
8function indices = pyrBandIndices(pind,band)
9
10if ((band > size(pind,1)) | (band < 1))
11 error(sprintf('BAND_NUM must be between 1 and number of pyramid bands (%d).', ...
12 size(pind,1)));
13end
14
15if (size(pind,2) ~= 2)
16 error('INDICES must be an Nx2 matrix indicating the size of the pyramid subbands');
17end
18
19ind = 1;
20for l=1:band-1
21 ind = ind + prod(pind(l,:));
22end
23
24indices = ind:ind+prod(pind(band,:))-1;
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/pyrLow.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/pyrLow.m
deleted file mode 100755
index 290e806..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/pyrLow.m
+++ /dev/null
@@ -1,12 +0,0 @@
1% RES = pyrLow(PYR, INDICES)
2%
3% Access the lowpass subband from a pyramid
4% (gaussian, laplacian, QMF/wavelet, steerable).
5
6% Eero Simoncelli, 6/96.
7
8function res = pyrLow(pyr,pind)
9
10band = size(pind,1);
11
12res = reshape( pyr(pyrBandIndices(pind,band)), pind(band,1), pind(band,2) );
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/range2.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/range2.m
deleted file mode 100755
index 082bbe1..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/range2.m
+++ /dev/null
@@ -1,18 +0,0 @@
1% [MIN, MAX] = range2(MTX)
2%
3% Compute minimum and maximum values of MTX, returning them as a 2-vector.
4
5% Eero Simoncelli, 3/97.
6
7function [mn, mx] = range2(mtx)
8
9%% NOTE: THIS CODE IS NOT ACTUALLY USED! (MEX FILE IS CALLED INSTEAD)
10
11%fprintf(1,'WARNING: You should compile the MEX version of "range2.c",\n found in the MEX subdirectory of matlabPyrTools, and put it in your matlab path. It is MUCH faster.\n');
12
13if (~isreal(mtx))
14 error('MTX must be real-valued');
15end
16
17mn = min(min(mtx));
18mx = max(max(mtx));
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/rconv2.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/rconv2.m
deleted file mode 100755
index 0c12490..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/rconv2.m
+++ /dev/null
@@ -1,50 +0,0 @@
1% RES = RCONV2(MTX1, MTX2, CTR)
2%
3% Convolution of two matrices, with boundaries handled via reflection
4% about the edge pixels. Result will be of size of LARGER matrix.
5%
6% The origin of the smaller matrix is assumed to be its center.
7% For even dimensions, the origin is determined by the CTR (optional)
8% argument:
9% CTR origin
10% 0 DIM/2 (default)
11% 1 (DIM/2)+1
12
13% Eero Simoncelli, 6/96.
14
15function c = rconv2(a,b,ctr)
16
17if (exist('ctr') ~= 1)
18 ctr = 0;
19end
20
21if (( size(a,1) >= size(b,1) ) & ( size(a,2) >= size(b,2) ))
22 large = a; small = b;
23elseif (( size(a,1) <= size(b,1) ) & ( size(a,2) <= size(b,2) ))
24 large = b; small = a;
25else
26 error('one arg must be larger than the other in both dimensions!');
27end
28
29ly = size(large,1);
30lx = size(large,2);
31sy = size(small,1);
32sx = size(small,2);
33
34%% These values are one less than the index of the small mtx that falls on
35%% the border pixel of the large matrix when computing the first
36%% convolution response sample:
37sy2 = floor((sy+ctr-1)/2);
38sx2 = floor((sx+ctr-1)/2);
39
40% pad with reflected copies
41clarge = [
42 large(sy-sy2:-1:2,sx-sx2:-1:2), large(sy-sy2:-1:2,:), ...
43 large(sy-sy2:-1:2,lx-1:-1:lx-sx2); ...
44 large(:,sx-sx2:-1:2), large, large(:,lx-1:-1:lx-sx2); ...
45 large(ly-1:-1:ly-sy2,sx-sx2:-1:2), ...
46 large(ly-1:-1:ly-sy2,:), ...
47 large(ly-1:-1:ly-sy2,lx-1:-1:lx-sx2) ];
48
49c = conv2(clarge,small,'valid');
50
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/rcosFn.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/rcosFn.m
deleted file mode 100755
index 5dac344..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/rcosFn.m
+++ /dev/null
@@ -1,45 +0,0 @@
1% [X, Y] = rcosFn(WIDTH, POSITION, VALUES)
2%
3% Return a lookup table (suitable for use by INTERP1)
4% containing a "raised cosine" soft threshold function:
5%
6% Y = VALUES(1) + (VALUES(2)-VALUES(1)) *
7% cos^2( PI/2 * (X - POSITION + WIDTH)/WIDTH )
8%
9% WIDTH is the width of the region over which the transition occurs
10% (default = 1). POSITION is the location of the center of the
11% threshold (default = 0). VALUES (default = [0,1]) specifies the
12% values to the left and right of the transition.
13
14% Eero Simoncelli, 7/96.
15
16function [X, Y] = rcosFn(width,position,values)
17
18%------------------------------------------------------------
19% OPTIONAL ARGS:
20
21if (exist('width') ~= 1)
22 width = 1;
23end
24
25if (exist('position') ~= 1)
26 position = 0;
27end
28
29if (exist('values') ~= 1)
30 values = [0,1];
31end
32
33%------------------------------------------------------------
34
35sz = 256; %% arbitrary!
36
37X = pi * [-sz-1:1] / (2*sz);
38
39Y = values(1) + (values(2)-values(1)) * cos(X).^2;
40
41% Make sure end values are repeated, for extrapolation...
42Y(1) = Y(2);
43Y(sz+3) = Y(sz+2);
44
45X = position + (2*width/pi) * (X + pi/4);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconLpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconLpyr.m
deleted file mode 100755
index cddcc12..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconLpyr.m
+++ /dev/null
@@ -1,83 +0,0 @@
1% RES = reconLpyr(PYR, INDICES, LEVS, FILT2, EDGES)
2%
3% Reconstruct image from Laplacian pyramid, as created by buildLpyr.
4%
5% PYR is a vector containing the N pyramid subbands, ordered from fine
6% to coarse. INDICES is an Nx2 matrix containing the sizes of
7% each subband. This is compatible with the MatLab Wavelet toolbox.
8%
9% LEVS (optional) should be a list of levels to include, or the string
10% 'all' (default). The finest scale is number 1. The lowpass band
11% corresponds to lpyrHt(INDICES)+1.
12%
13% FILT2 (optional) can be a string naming a standard filter (see
14% namedFilter), or a vector which will be used for (separable)
15% convolution. Default = 'binom5'. EDGES specifies edge-handling,
16% and defaults to 'reflect1' (see corrDn).
17
18% Eero Simoncelli, 6/96
19
20function res = reconLpyr(pyr, ind, levs, filt2, edges)
21
22if (nargin < 2)
23 error('First two arguments (PYR, INDICES) are required');
24end
25
26%%------------------------------------------------------------
27%% DEFAULTS:
28
29if (exist('levs') ~= 1)
30 levs = 'all';
31end
32
33if (exist('filt2') ~= 1)
34 filt2 = 'binom5';
35end
36
37if (exist('edges') ~= 1)
38 edges= 'reflect1';
39end
40%%------------------------------------------------------------
41
42maxLev = 1+lpyrHt(ind);
43if strcmp(levs,'all')
44 levs = [1:maxLev]';
45else
46 if (any(levs > maxLev))
47 error(sprintf('Level numbers must be in the range [1, %d].', maxLev));
48 end
49 levs = levs(:);
50end
51
52if isstr(filt2)
53 filt2 = namedFilter(filt2);
54end
55
56filt2 = filt2(:);
57res_sz = ind(1,:);
58
59if any(levs > 1)
60
61 int_sz = [ind(1,1), ind(2,2)];
62
63 nres = reconLpyr( pyr(prod(res_sz)+1:size(pyr,1)), ...
64 ind(2:size(ind,1),:), levs-1, filt2, edges);
65
66 if (res_sz(1) == 1)
67 res = upConv(nres, filt2', edges, [1 2], [1 1], res_sz);
68 elseif (res_sz(2) == 1)
69 res = upConv(nres, filt2, edges, [2 1], [1 1], res_sz);
70 else
71 hi = upConv(nres, filt2, edges, [2 1], [1 1], int_sz);
72 res = upConv(hi, filt2', edges, [1 2], [1 1], res_sz);
73 end
74
75else
76
77 res = zeros(res_sz);
78
79end
80
81if any(levs == 1)
82 res = res + pyrBand(pyr,ind,1);
83end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconSCFpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconSCFpyr.m
deleted file mode 100755
index a86f03d..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconSCFpyr.m
+++ /dev/null
@@ -1,87 +0,0 @@
1% RES = reconSCFpyr(PYR, INDICES, LEVS, BANDS, TWIDTH)
2%
3% The inverse of buildSCFpyr: Reconstruct image from its complex steerable pyramid representation,
4% in the Fourier domain.
5%
6% The image is reconstructed by forcing the complex subbands to be analytic
7% (zero on half of the 2D Fourier plane, as they are supossed to be unless
8% they have being modified), and reconstructing from the real part of those
9% analytic subbands. That is equivalent to compute the Hilbert transforms of
10% the imaginary parts of the subbands, average them with their real
11% counterparts, and then reconstructing from the resulting real subbands.
12%
13% PYR is a vector containing the N pyramid subbands, ordered from fine
14% to coarse. INDICES is an Nx2 matrix containing the sizes of
15% each subband. This is compatible with the MatLab Wavelet toolbox.
16%
17% LEVS (optional) should be a list of levels to include, or the string
18% 'all' (default). 0 corresonds to the residual highpass subband.
19% 1 corresponds to the finest oriented scale. The lowpass band
20% corresponds to number spyrHt(INDICES)+1.
21%
22% BANDS (optional) should be a list of bands to include, or the string
23% 'all' (default). 1 = vertical, rest proceeding anti-clockwise.
24%
25% TWIDTH is the width of the transition region of the radial lowpass
26% function, in octaves (default = 1, which gives a raised cosine for
27% the bandpass filters).
28
29% Javier Portilla, 7/04, basing on Eero Simoncelli's Matlab Pyrtools code
30% and our common code on texture synthesis (textureSynthesis.m).
31
32function res = reconSCFpyr(pyr, indices, levs, bands, twidth)
33
34%%------------------------------------------------------------
35%% DEFAULTS:
36
37if ~exist('levs'),
38 levs = 'all';
39end
40
41if ~exist('bands')
42 bands = 'all';
43end
44
45if ~exist('twidth'),
46 twidth = 1;
47elseif (twidth <= 0)
48 fprintf(1,'Warning: TWIDTH must be positive. Setting to 1.\n');
49 twidth = 1;
50end
51
52%%------------------------------------------------------------
53
54
55pind = indices;
56Nsc = log2(pind(1,1)/pind(end,1));
57Nor = (size(pind,1)-2)/Nsc;
58
59for nsc = 1:Nsc,
60 firstBnum = (nsc-1)*Nor+2;
61
62%% Re-create analytic subbands
63 dims = pind(firstBnum,:);
64 ctr = ceil((dims+0.5)/2);
65 ang = mkAngle(dims, 0, ctr);
66 ang(ctr(1),ctr(2)) = -pi/2;
67 for nor = 1:Nor,
68 nband = (nsc-1)*Nor+nor+1;
69 ind = pyrBandIndices(pind,nband);
70 ch = pyrBand(pyr, pind, nband);
71 ang0 = pi*(nor-1)/Nor;
72 xang = mod(ang-ang0+pi, 2*pi) - pi;
73 amask = 2*(abs(xang) < pi/2) + (abs(xang) == pi/2);
74 amask(ctr(1),ctr(2)) = 1;
75 amask(:,1) = 1;
76 amask(1,:) = 1;
77 amask = fftshift(amask);
78 ch = ifft2(amask.*fft2(ch)); % "Analytic" version
79 %f = 1.000008; % With this factor the reconstruction SNR goes up around 6 dB!
80 f = 1;
81 ch = f*0.5*real(ch); % real part
82 pyr(ind) = ch;
83 end % nor
84end % nsc
85
86res = reconSFpyr(pyr, indices, levs, bands, twidth);
87
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconSFpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconSFpyr.m
deleted file mode 100755
index 0e3109e..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconSFpyr.m
+++ /dev/null
@@ -1,108 +0,0 @@
1% RES = reconSFpyr(PYR, INDICES, LEVS, BANDS, TWIDTH)
2%
3% Reconstruct image from its steerable pyramid representation, in the Fourier
4% domain, as created by buildSFpyr.
5%
6% PYR is a vector containing the N pyramid subbands, ordered from fine
7% to coarse. INDICES is an Nx2 matrix containing the sizes of
8% each subband. This is compatible with the MatLab Wavelet toolbox.
9%
10% LEVS (optional) should be a list of levels to include, or the string
11% 'all' (default). 0 corresonds to the residual highpass subband.
12% 1 corresponds to the finest oriented scale. The lowpass band
13% corresponds to number spyrHt(INDICES)+1.
14%
15% BANDS (optional) should be a list of bands to include, or the string
16% 'all' (default). 1 = vertical, rest proceeding anti-clockwise.
17%
18% TWIDTH is the width of the transition region of the radial lowpass
19% function, in octaves (default = 1, which gives a raised cosine for
20% the bandpass filters).
21
22%%% MODIFIED VERSION, 7/04, uses different lookup table for radial frequency!
23
24% Eero Simoncelli, 5/97.
25
26function res = reconSFpyr(pyr, pind, levs, bands, twidth)
27
28%%------------------------------------------------------------
29%% DEFAULTS:
30
31if (exist('levs') ~= 1)
32 levs = 'all';
33end
34
35if (exist('bands') ~= 1)
36 bands = 'all';
37end
38
39if (exist('twidth') ~= 1)
40 twidth = 1;
41elseif (twidth <= 0)
42 fprintf(1,'Warning: TWIDTH must be positive. Setting to 1.\n');
43 twidth = 1;
44end
45
46%%------------------------------------------------------------
47
48nbands = spyrNumBands(pind);
49
50maxLev = 1+spyrHt(pind);
51if strcmp(levs,'all')
52 levs = [0:maxLev]';
53else
54 if (any(levs > maxLev) | any(levs < 0))
55 error(sprintf('Level numbers must be in the range [0, %d].', maxLev));
56 end
57 levs = levs(:);
58end
59
60if strcmp(bands,'all')
61 bands = [1:nbands]';
62else
63 if (any(bands < 1) | any(bands > nbands))
64 error(sprintf('Band numbers must be in the range [1,3].', nbands));
65 end
66 bands = bands(:);
67end
68
69%----------------------------------------------------------------------
70
71dims = pind(1,:);
72ctr = ceil((dims+0.5)/2);
73
74[xramp,yramp] = meshgrid( ([1:dims(2)]-ctr(2))./(dims(2)/2), ...
75 ([1:dims(1)]-ctr(1))./(dims(1)/2) );
76angle = atan2(yramp,xramp);
77log_rad = sqrt(xramp.^2 + yramp.^2);
78log_rad(ctr(1),ctr(2)) = log_rad(ctr(1),ctr(2)-1);
79log_rad = log2(log_rad);
80
81%% Radial transition function (a raised cosine in log-frequency):
82[Xrcos,Yrcos] = rcosFn(twidth,(-twidth/2),[0 1]);
83Yrcos = sqrt(Yrcos);
84YIrcos = sqrt(abs(1.0 - Yrcos.^2));
85
86if (size(pind,1) == 2)
87 if (any(levs==1))
88 resdft = fftshift(fft2(pyrBand(pyr,pind,2)));
89 else
90 resdft = zeros(pind(2,:));
91 end
92else
93 resdft = reconSFpyrLevs(pyr(1+prod(pind(1,:)):size(pyr,1)), ...
94 pind(2:size(pind,1),:), ...
95 log_rad, Xrcos, Yrcos, angle, nbands, levs, bands);
96end
97
98lo0mask = pointOp(log_rad, YIrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
99resdft = resdft .* lo0mask;
100
101%% residual highpass subband
102if any(levs == 0)
103 hi0mask = pointOp(log_rad, Yrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
104 hidft = fftshift(fft2(subMtx(pyr, pind(1,:))));
105 resdft = resdft + hidft .* hi0mask;
106end
107
108res = real(ifft2(ifftshift(resdft)));
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconSFpyrLevs.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconSFpyrLevs.m
deleted file mode 100755
index 420f278..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconSFpyrLevs.m
+++ /dev/null
@@ -1,69 +0,0 @@
1% RESDFT = reconSFpyrLevs(PYR,INDICES,LOGRAD,XRCOS,YRCOS,ANGLE,NBANDS,LEVS,BANDS)
2%
3% Recursive function for reconstructing levels of a steerable pyramid
4% representation. This is called by reconSFpyr, and is not usually
5% called directly.
6
7% Eero Simoncelli, 5/97.
8
9function resdft = reconSFpyrLevs(pyr,pind,log_rad,Xrcos,Yrcos,angle,nbands,levs,bands);
10
11lo_ind = nbands+1;
12dims = pind(1,:);
13ctr = ceil((dims+0.5)/2);
14
15% log_rad = log_rad + 1;
16Xrcos = Xrcos - log2(2); % shift origin of lut by 1 octave.
17
18if any(levs > 1)
19
20 lodims = ceil((dims-0.5)/2);
21 loctr = ceil((lodims+0.5)/2);
22 lostart = ctr-loctr+1;
23 loend = lostart+lodims-1;
24 nlog_rad = log_rad(lostart(1):loend(1),lostart(2):loend(2));
25 nangle = angle(lostart(1):loend(1),lostart(2):loend(2));
26
27 if (size(pind,1) > lo_ind)
28 nresdft = reconSFpyrLevs( pyr(1+sum(prod(pind(1:lo_ind-1,:)')):size(pyr,1)),...
29 pind(lo_ind:size(pind,1),:), ...
30 nlog_rad, Xrcos, Yrcos, nangle, nbands,levs-1, bands);
31 else
32 nresdft = fftshift(fft2(pyrBand(pyr,pind,lo_ind)));
33 end
34
35 YIrcos = sqrt(abs(1.0 - Yrcos.^2));
36 lomask = pointOp(nlog_rad, YIrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
37
38 resdft = zeros(dims);
39 resdft(lostart(1):loend(1),lostart(2):loend(2)) = nresdft .* lomask;
40
41else
42
43 resdft = zeros(dims);
44
45end
46
47
48if any(levs == 1)
49
50 lutsize = 1024;
51 Xcosn = pi*[-(2*lutsize+1):(lutsize+1)]/lutsize; % [-2*pi:pi]
52 order = nbands-1;
53 %% divide by sqrt(sum_(n=0)^(N-1) cos(pi*n/N)^(2(N-1)) )
54 const = (2^(2*order))*(factorial(order)^2)/(nbands*factorial(2*order));
55 Ycosn = sqrt(const) * (cos(Xcosn)).^order;
56 himask = pointOp(log_rad, Yrcos, Xrcos(1), Xrcos(2)-Xrcos(1),0);
57
58 ind = 1;
59 for b = 1:nbands
60 if any(bands == b)
61 anglemask = pointOp(angle,Ycosn,Xcosn(1)+pi*(b-1)/nbands,Xcosn(2)-Xcosn(1));
62 band = reshape(pyr(ind:ind+prod(dims)-1), dims(1), dims(2));
63 banddft = fftshift(fft2(band));
64 resdft = resdft + (sqrt(-1))^(nbands-1) * banddft.*anglemask.*himask;
65 end
66 ind = ind + prod(dims);
67 end
68end
69
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconSpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconSpyr.m
deleted file mode 100755
index 270009d..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconSpyr.m
+++ /dev/null
@@ -1,96 +0,0 @@
1% RES = reconSpyr(PYR, INDICES, FILTFILE, EDGES, LEVS, BANDS)
2%
3% Reconstruct image from its steerable pyramid representation, as created
4% by buildSpyr.
5%
6% PYR is a vector containing the N pyramid subbands, ordered from fine
7% to coarse. INDICES is an Nx2 matrix containing the sizes of
8% each subband. This is compatible with the MatLab Wavelet toolbox.
9%
10% FILTFILE (optional) should be a string referring to an m-file that returns
11% the rfilters. examples: sp0Filters, sp1Filters, sp3Filters
12% (default = 'sp1Filters').
13% EDGES specifies edge-handling, and defaults to 'reflect1' (see
14% corrDn).
15%
16% LEVS (optional) should be a list of levels to include, or the string
17% 'all' (default). 0 corresonds to the residual highpass subband.
18% 1 corresponds to the finest oriented scale. The lowpass band
19% corresponds to number spyrHt(INDICES)+1.
20%
21% BANDS (optional) should be a list of bands to include, or the string
22% 'all' (default). 1 = vertical, rest proceeding anti-clockwise.
23
24% Eero Simoncelli, 6/96.
25
26function res = reconSpyr(pyr, pind, filtfile, edges, levs, bands)
27
28%%------------------------------------------------------------
29%% DEFAULTS:
30
31if (exist('filtfile') ~= 1)
32 filtfile = 'sp1Filters';
33end
34
35if (exist('edges') ~= 1)
36 edges= 'reflect1';
37end
38
39if (exist('levs') ~= 1)
40 levs = 'all';
41end
42
43if (exist('bands') ~= 1)
44 bands = 'all';
45end
46
47%%------------------------------------------------------------
48
49if (isstr(filtfile) & (exist(filtfile) == 2))
50 [lo0filt,hi0filt,lofilt,bfilts,steermtx,harmonics] = eval(filtfile);
51 nbands = spyrNumBands(pind);
52 if ((nbands > 0) & (size(bfilts,2) ~= nbands))
53 error('Number of pyramid bands is inconsistent with filter file');
54 end
55else
56 error('filtfile argument must be the name of an M-file containing SPYR filters.');
57end
58
59maxLev = 1+spyrHt(pind);
60if strcmp(levs,'all')
61 levs = [0:maxLev]';
62else
63 if (any(levs > maxLev) | any(levs < 0))
64 error(sprintf('Level numbers must be in the range [0, %d].', maxLev));
65 end
66 levs = levs(:);
67end
68
69if strcmp(bands,'all')
70 bands = [1:nbands]';
71else
72 if (any(bands < 1) | any(bands > nbands))
73 error(sprintf('Band numbers must be in the range [1,3].', nbands));
74 end
75 bands = bands(:);
76end
77
78if (spyrHt(pind) == 0)
79 if (any(levs==1))
80 res1 = pyrBand(pyr,pind,2);
81 else
82 res1 = zeros(pind(2,:));
83 end
84else
85 res1 = reconSpyrLevs(pyr(1+prod(pind(1,:)):size(pyr,1)), ...
86 pind(2:size(pind,1),:), ...
87 lofilt, bfilts, edges, levs, bands);
88end
89
90res = upConv(res1, lo0filt, edges);
91
92%% residual highpass subband
93if any(levs == 0)
94 upConv( subMtx(pyr, pind(1,:)), hi0filt, edges, [1 1], [1 1], size(res), res);
95end
96
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconSpyrLevs.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconSpyrLevs.m
deleted file mode 100755
index f8e456c..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconSpyrLevs.m
+++ /dev/null
@@ -1,46 +0,0 @@
1% RES = reconSpyrLevs(PYR,INDICES,LOFILT,BFILTS,EDGES,LEVS,BANDS)
2%
3% Recursive function for reconstructing levels of a steerable pyramid
4% representation. This is called by reconSpyr, and is not usually
5% called directly.
6
7% Eero Simoncelli, 6/96.
8
9function res = reconSpyrLevs(pyr,pind,lofilt,bfilts,edges,levs,bands);
10
11nbands = size(bfilts,2);
12lo_ind = nbands+1;
13res_sz = pind(1,:);
14
15% Assume square filters:
16bfiltsz = round(sqrt(size(bfilts,1)));
17
18if any(levs > 1)
19
20 if (size(pind,1) > lo_ind)
21 nres = reconSpyrLevs( pyr(1+sum(prod(pind(1:lo_ind-1,:)')):size(pyr,1)), ...
22 pind(lo_ind:size(pind,1),:), ...
23 lofilt, bfilts, edges, levs-1, bands);
24 else
25 nres = pyrBand(pyr,pind,lo_ind); % lowpass subband
26 end
27
28 res = upConv(nres, lofilt, edges, [2 2], [1 1], res_sz);
29
30else
31
32 res = zeros(res_sz);
33
34end
35
36if any(levs == 1)
37 ind = 1;
38 for b = 1:nbands
39 if any(bands == b)
40 bfilt = reshape(bfilts(:,b), bfiltsz, bfiltsz);
41 upConv(reshape(pyr(ind:ind+prod(res_sz)-1), res_sz(1), res_sz(2)), ...
42 bfilt, edges, [1 1], [1 1], res_sz, res);
43 end
44 ind = ind + prod(res_sz);
45 end
46end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconWpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconWpyr.m
deleted file mode 100755
index fc31226..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconWpyr.m
+++ /dev/null
@@ -1,148 +0,0 @@
1% RES = reconWpyr(PYR, INDICES, FILT, EDGES, LEVS, BANDS)
2%
3% Reconstruct image from its separable orthonormal QMF/wavelet pyramid
4% representation, as created by buildWpyr.
5%
6% PYR is a vector containing the N pyramid subbands, ordered from fine
7% to coarse. INDICES is an Nx2 matrix containing the sizes of
8% each subband. This is compatible with the MatLab Wavelet toolbox.
9%
10% FILT (optional) can be a string naming a standard filter (see
11% namedFilter), or a vector which will be used for (separable)
12% convolution. Default = 'qmf9'. EDGES specifies edge-handling,
13% and defaults to 'reflect1' (see corrDn).
14%
15% LEVS (optional) should be a vector of levels to include, or the string
16% 'all' (default). 1 corresponds to the finest scale. The lowpass band
17% corresponds to wpyrHt(INDICES)+1.
18%
19% BANDS (optional) should be a vector of bands to include, or the string
20% 'all' (default). 1=horizontal, 2=vertical, 3=diagonal. This is only used
21% for pyramids of 2D images.
22
23% Eero Simoncelli, 6/96.
24
25function res = reconWpyr(pyr, ind, filt, edges, levs, bands)
26
27if (nargin < 2)
28 error('First two arguments (PYR INDICES) are required');
29end
30
31%%------------------------------------------------------------
32%% OPTIONAL ARGS:
33
34if (exist('filt') ~= 1)
35 filt = 'qmf9';
36end
37
38if (exist('edges') ~= 1)
39 edges= 'reflect1';
40end
41
42if (exist('levs') ~= 1)
43 levs = 'all';
44end
45
46if (exist('bands') ~= 1)
47 bands = 'all';
48end
49
50%%------------------------------------------------------------
51
52maxLev = 1+wpyrHt(ind);
53if strcmp(levs,'all')
54 levs = [1:maxLev]';
55else
56 if (any(levs > maxLev))
57 error(sprintf('Level numbers must be in the range [1, %d].', maxLev));
58 end
59 levs = levs(:);
60end
61
62if strcmp(bands,'all')
63 bands = [1:3]';
64else
65 if (any(bands < 1) | any(bands > 3))
66 error('Band numbers must be in the range [1,3].');
67 end
68 bands = bands(:);
69end
70
71if isstr(filt)
72 filt = namedFilter(filt);
73end
74
75filt = filt(:);
76hfilt = modulateFlip(filt);
77
78%% For odd-length filters, stagger the sampling lattices:
79if (mod(size(filt,1),2) == 0)
80 stag = 2;
81else
82 stag = 1;
83end
84
85%% Compute size of result image: assumes critical sampling (boundaries correct)
86res_sz = ind(1,:);
87if (res_sz(1) == 1)
88 loind = 2;
89 res_sz(2) = sum(ind(:,2));
90elseif (res_sz(2) == 1)
91 loind = 2;
92 res_sz(1) = sum(ind(:,1));
93else
94 loind = 4;
95 res_sz = ind(1,:) + ind(2,:); %%horizontal + vertical bands.
96 hres_sz = [ind(1,1), res_sz(2)];
97 lres_sz = [ind(2,1), res_sz(2)];
98end
99
100
101%% First, recursively collapse coarser scales:
102if any(levs > 1)
103
104 if (size(ind,1) > loind)
105 nres = reconWpyr( pyr(1+sum(prod(ind(1:loind-1,:)')):size(pyr,1)), ...
106 ind(loind:size(ind,1),:), filt, edges, levs-1, bands);
107 else
108 nres = pyrBand(pyr, ind, loind); % lowpass subband
109 end
110
111 if (res_sz(1) == 1)
112 res = upConv(nres, filt', edges, [1 2], [1 stag], res_sz);
113 elseif (res_sz(2) == 1)
114 res = upConv(nres, filt, edges, [2 1], [stag 1], res_sz);
115 else
116 ires = upConv(nres, filt', edges, [1 2], [1 stag], lres_sz);
117 res = upConv(ires, filt, edges, [2 1], [stag 1], res_sz);
118 end
119
120else
121
122 res = zeros(res_sz);
123
124end
125
126
127%% Add in reconstructed bands from this level:
128if any(levs == 1)
129 if (res_sz(1) == 1)
130 upConv(pyrBand(pyr,ind,1), hfilt', edges, [1 2], [1 2], res_sz, res);
131 elseif (res_sz(2) == 1)
132 upConv(pyrBand(pyr,ind,1), hfilt, edges, [2 1], [2 1], res_sz, res);
133 else
134 if any(bands == 1) % horizontal
135 ires = upConv(pyrBand(pyr,ind,1),filt',edges,[1 2],[1 stag],hres_sz);
136 upConv(ires,hfilt,edges,[2 1],[2 1],res_sz,res); %destructively modify res
137 end
138 if any(bands == 2) % vertical
139 ires = upConv(pyrBand(pyr,ind,2),hfilt',edges,[1 2],[1 2],lres_sz);
140 upConv(ires,filt,edges,[2 1],[stag 1],res_sz,res); %destructively modify res
141 end
142 if any(bands == 3) % diagonal
143 ires = upConv(pyrBand(pyr,ind,3),hfilt',edges,[1 2],[1 2],hres_sz);
144 upConv(ires,hfilt,edges,[2 1],[2 1],res_sz,res); %destructively modify res
145 end
146 end
147end
148
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/script_run_profile.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/script_run_profile.m
deleted file mode 100755
index 133ca50..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/script_run_profile.m
+++ /dev/null
@@ -1,142 +0,0 @@
1% Example 2: Seamless blending of real and synthetic texture in an
2% image, using Portilla-Simoncelli texture analysis/synthesis code,
3% based on alternate projections onto statistical constraints in a
4% complex overcomplete wavelet representation.
5%
6% See Readme.txt, and headers of textureAnalysis.m and
7% textureSynthesis.m for more details.
8%
9% Javier Portilla (javier@decsai.ugr.es). March, 2001
10
11function script_run_profile(dataDir, resultDir, type, common,toolDir)
12
13path(path, common);
14Files = dir([dataDir,'/1.bmp']);
15inputFile = fullfile(dataDir,Files(1).name);
16
17close all
18
19Nsc = 4; % Number of scales
20Nor = 4; % Number of orientations
21Na = 5; % Spatial neighborhood is Na x Na coefficients
22 % It must be an odd number!
23Niter = 25; % Number of iterations of synthesis loop
24Nsx = 192; % Size of synthetic image is Nsy x Nsx
25Nsy = 192; % Warning: both dimensions must be multiple of 2^(Nsc+2)
26
27if(strcmp(type,'qcif'))
28Nsc = 4;
29Nor = 4;
30Na = 5;
31Niter = 5;
32elseif(strcmp(type,'sqcif'))
33Nsc = 2;
34Nor = 2;
35Na = 3;
36Niter = 5;
37elseif(strcmp(type, 'test'))
38Nsc = 2; % Number of scales
39Nor = 2; % Number of orientations
40Na = 1; % Spatial neighborhood is Na x Na coefficients
41 % It must be an odd number!
42Niter = 1; % Number of iterations of synthesis loop
43Nsx = 16; % Size of synthetic image is Nsy x Nsx
44Nsy = 16; % Warning: both dimensions must be multiple of 2^(Nsc+2)
45
46elseif(strcmp(type, 'sim_fast'))
47Nsc = 2; % Number of scales
48Nor = 2; % Number of orientations
49Na = 3; % Spatial neighborhood is Na x Na coefficients
50 % It must be an odd number!
51Niter = 2; % Number of iterations of synthesis loop
52Nsx = 16; % Size of synthetic image is Nsy x Nsx
53Nsy = 16; % Warning: both dimensions must be multiple of 2^(Nsc+2)
54
55elseif(strcmp(type, 'sim'))
56Nsc = 2; % Number of scales
57Nor = 2; % Number of orientations
58Na = 3; % Spatial neighborhood is Na x Na coefficients
59 % It must be an odd number!
60Niter = 1; % Number of iterations of synthesis loop
61Nsx = 32; % Size of synthetic image is Nsy x Nsx
62Nsy = 32; % Warning: both dimensions must be multiple of 2^(Nsc+2)
63
64elseif(strcmp(type, 'vga'))
65Nsc = 2; % Number of scales
66Nor = 2; % Number of orientations
67Na = 3; % Spatial neighborhood is Na x Na coefficients
68 % It must be an odd number!
69Niter = 1; % Number of iterations of synthesis loop
70Nsx = 640; % Size of synthetic image is Nsy x Nsx
71Nsy = 480; % Warning: both dimensions must be multiple of 2^(Nsc+2)
72
73elseif(strcmp(type, 'real'))
74Nsc = 2; % Number of scales
75Nor = 2; % Number of orientations
76Na = 3; % Spatial neighborhood is Na x Na coefficients
77 % It must be an odd number!
78Niter = 1; % Number of iterations of synthesis loop
79Nsx = 1920; % Size of synthetic image is Nsy x Nsx
80Nsy = 1200; % Warning: both dimensions must be multiple of 2^(Nsc+2)
81
82end
83
84im0 = readImage(inputFile); % Warning: im0 is a double float matrix!
85rows = size(im0,1);
86cols = size(im0,2);
87fprintf(1,'Input size\t\t- (%dx%d)\n', rows, cols);
88
89%% Self check params
90tol = 0.1;
91elapsed = zeros(1,2);
92
93%% Timing
94start = photonStartTiming;
95
96params = textureAnalysis(im0, Nsc, Nor, Na);
97
98%% Timing
99stop = photonEndTiming;
100
101temp = photonReportTiming(start, stop);
102elapsed(1) = elapsed(1) + temp(1);
103elapsed(2) = elapsed(2) + temp(2);
104
105% Use a mask and the original image to synthesize an image with the
106% left side synthetic and the right side real data.
107% The effective mask is M = (mask>0), its smoothness is for avoiding
108% border effects.
109ramp = meshgrid(1:Nsx/4,1:Nsy)*4/Nsy;
110mask = [zeros(Nsy,Nsx/2) ramp ramp(:,Nsx/4:-1:1)];
111mask = 1/2*(1-cos(pi*mask));
112
113imKeep = zeros(Nsx*Nsy,2);
114imKeep(:,1) = reshape(mask, [Nsy*Nsx,1]);
115imKeep(:,2) = reshape(im0(1:Nsy,1:Nsx), [Nsy*Nsx,1]); % Original
116
117%% Timing
118start = photonStartTiming;
119
120res = textureSynthesis(params, [Nsy Nsx], Niter,[],imKeep);
121
122%% Timing
123stop = photonEndTiming;
124
125temp = photonReportTiming(start, stop);
126elapsed(1) = elapsed(1) + temp(1);
127elapsed(2) = elapsed(2) + temp(2);
128
129%% Self checking
130fWriteMatrix(res, dataDir);
131
132rows = Nsy;
133cols = Nsx;
134
135%% Timing
136photonPrintTiming(elapsed);
137
138%close all
139%figure(1);showIm(mask>0, 'auto', 'auto', 'Mask');
140%figure(2);showIm(im0, 'auto', 'auto', 'Original Texture');
141%figure(3);showIm(res, 'auto', 'auto', 'Blended Original and Synthetic Texture');
142%pause;
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/script_run_profile1.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/script_run_profile1.m
deleted file mode 100755
index 2a7a0dc..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/script_run_profile1.m
+++ /dev/null
@@ -1,34 +0,0 @@
1% Example 1: Synthesis of a "text" texture image, using
2% Portilla-Simoncelli texture analysis/synthesis code, based on
3% alternate projections onto statistical constraints in a complex
4% overcomplete wavelet representation.
5%
6% See Readme.txt, and headers of textureAnalysis.m and
7% textureSynthesis.m for more details.
8%
9% Javier Portilla (javier@decsai.ugr.es). March, 2001
10
11close all
12
13im0 = imread('/u/kvs/VisionBenchmark/texture_synthesis/result/text.pgm'); % im0 is a double float matrix!
14
15Nsc = 4; % Number of scales
16Nor = 4; % Number of orientations
17Na = 9; % Spatial neighborhood is Na x Na coefficients
18 % It must be an odd number!
19
20params = textureAnalysis(im0, Nsc, Nor, Na);
21
22Niter = 25; % Number of iterations of synthesis loop
23Nsx = 192; % Size of synthetic image is Nsy x Nsx
24Nsy = 128; % WARNING: Both dimensions must be multiple of 2^(Nsc+2)
25
26res = textureSynthesis(params, [Nsy Nsx], Niter);
27
28close all
29figure(1)
30showIm(im0, 'auto', 1, 'Original texture');
31figure(2)
32showIm(res, 'auto', 1, 'Synthesized texture');
33
34% Can you read the NEW text? ;-)
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/setPyrBand.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/setPyrBand.m
deleted file mode 100755
index baa9f77..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/setPyrBand.m
+++ /dev/null
@@ -1,32 +0,0 @@
1% NEWPYR = setPyrBand(PYR, INDICES, BAND, BAND_NUM)
2%
3% Insert an image (BAND) into a pyramid (gaussian, laplacian, QMF/wavelet,
4% or steerable). Subbands are numbered consecutively, from finest
5% (highest spatial frequency) to coarsest (lowest spatial frequency).
6
7% Eero Simoncelli, 1/03.
8
9function pyr = pyrBand(pyr, pind, band, bandNum)
10
11%% Check: PIND a valid index matrix?
12if ( ~(ndims(pind) == 2) | ~(size(pind,2) == 2) | ~all(pind==round(pind)) )
13 pind
14 error('pyrTools:badArg',...
15 'PIND argument is not an Nbands X 2 matrix of integers');
16end
17
18%% Check: PIND consistent with size of PYR?
19if ( length(pyr) ~= sum(prod(pind,2)) )
20 error('pyrTools:badPyr',...
21 'Pyramid data vector length is inconsistent with index matrix PIND');
22end
23
24%% Check: size of BAND consistent with desired BANDNUM?
25if (~all(size(band) == pind(bandNum,:)))
26 size(band)
27 pind(bandNum,:)
28 error('pyrTools:badArg',...
29 'size of BAND to be inserted is inconsistent with BAND_NUM');
30end
31
32pyr(pyrBandIndices(pind,bandNum)) = vectify(band);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/shift.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/shift.m
deleted file mode 100755
index 497297e..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/shift.m
+++ /dev/null
@@ -1,15 +0,0 @@
1% [RES] = shift(MTX, OFFSET)
2%
3% Circular shift 2D matrix samples by OFFSET (a [Y,X] 2-vector),
4% such that RES(POS) = MTX(POS-OFFSET).
5
6function res = shift(mtx, offset)
7
8dims = size(mtx);
9
10offset = mod(-offset,dims);
11
12res = [ mtx(offset(1)+1:dims(1), offset(2)+1:dims(2)), ...
13 mtx(offset(1)+1:dims(1), 1:offset(2)); ...
14 mtx(1:offset(1), offset(2)+1:dims(2)), ...
15 mtx(1:offset(1), 1:offset(2)) ];
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/showIm.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/showIm.m
deleted file mode 100755
index a9e2bd1..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/showIm.m
+++ /dev/null
@@ -1,221 +0,0 @@
1% RANGE = showIm (MATRIX, RANGE, ZOOM, LABEL, NSHADES )
2%
3% Display a MatLab MATRIX as a grayscale image in the current figure,
4% inside the current axes. If MATRIX is complex, the real and imaginary
5% parts are shown side-by-side, with the same grayscale mapping.
6%
7% If MATRIX is a string, it should be the name of a variable bound to a
8% MATRIX in the base (global) environment. This matrix is displayed as an
9% image, with the title set to the string.
10%
11% RANGE (optional) is a 2-vector specifying the values that map to
12% black and white, respectively. Passing a value of 'auto' (default)
13% sets RANGE=[min,max] (as in MatLab's imagesc). 'auto2' sets
14% RANGE=[mean-2*stdev, mean+2*stdev]. 'auto3' sets
15% RANGE=[p1-(p2-p1)/8, p2+(p2-p1)/8], where p1 is the 10th percentile
16% value of the sorted MATRIX samples, and p2 is the 90th percentile
17% value.
18%
19% ZOOM specifies the number of matrix samples per screen pixel. It
20% will be rounded to an integer, or 1 divided by an integer. A value
21% of 'same' or 'auto' (default) causes the zoom value to be chosen
22% automatically to fit the image into the current axes. A value of
23% 'full' fills the axis region (leaving no room for labels). See
24% pixelAxes.m.
25%
26% If LABEL (optional, default = 1, unless zoom='full') is non-zero, the range
27% of values that are mapped into the gray colormap and the dimensions
28% (size) of the matrix and zoom factor are printed below the image. If label
29% is a string, it is used as a title.
30%
31% NSHADES (optional) specifies the number of gray shades, and defaults
32% to the size of the current colormap.
33
34% Eero Simoncelli, 6/96.
35
36%%TODO: should use "newplot"
37
38function range = showIm( im, range, zoom, label, nshades );
39
40%------------------------------------------------------------
41%% OPTIONAL ARGS:
42
43if (nargin < 1)
44 error('Requires at least one input argument.');
45end
46
47MLv = version;
48
49if isstr(im)
50 if (strcmp(MLv(1),'4'))
51 error('Cannot pass string arg for MATRIX in MatLab version 4.x');
52 end
53 label = im;
54 im = evalin('base',im);
55end
56
57if (exist('range') ~= 1)
58 range = 'auto1';
59end
60
61if (exist('nshades') ~= 1)
62 nshades = size(colormap,1);
63end
64nshades = max( nshades, 2 );
65
66if (exist('zoom') ~= 1)
67 zoom = 'auto';
68end
69
70if (exist('label') ~= 1)
71 if strcmp(zoom,'full')
72 label = 0; % no labeling
73 else
74 label = 1; % just print grayrange & dims
75 end
76end
77
78%------------------------------------------------------------
79
80%% Automatic range calculation:
81if (strcmp(range,'auto1') | strcmp(range,'auto'))
82 if isreal(im)
83 [mn,mx] = range2(im);
84 else
85 [mn1,mx1] = range2(real(im));
86 [mn2,mx2] = range2(imag(im));
87 mn = min(mn1,mn2);
88 mx = max(mx1,mx2);
89 end
90 if any(size(im)==1)
91 pad = (mx-mn)/12; % MAGIC NUMBER: graph padding
92 range = [mn-pad, mx+pad];
93 else
94 range = [mn,mx];
95 end
96
97elseif strcmp(range,'auto2')
98 if isreal(im)
99 stdev = sqrt(var2(im));
100 av = mean2(im);
101 else
102 stdev = sqrt((var2(real(im)) + var2(imag(im)))/2);
103 av = (mean2(real(im)) + mean2(imag(im)))/2;
104 end
105 range = [av-2*stdev,av+2*stdev]; % MAGIC NUMBER: 2 stdevs
106
107elseif strcmp(range, 'auto3')
108 percentile = 0.1; % MAGIC NUMBER: 0<p<0.5
109 [N,X] = histo(im);
110 binsz = X(2)-X(1);
111 N = N+1e-10; % Ensure cumsum will be monotonic for call to interp1
112 cumN = [0, cumsum(N)]/sum(N);
113 cumX = [X(1)-binsz, X] + (binsz/2);
114 ctrRange = interp1(cumN,cumX, [percentile, 1-percentile]);
115 range = mean(ctrRange) + (ctrRange-mean(ctrRange))/(1-2*percentile);
116
117elseif isstr(range)
118 error(sprintf('Bad RANGE argument: %s',range))
119
120end
121
122if ((range(2) - range(1)) <= eps)
123 range(1) = range(1) - 0.5;
124 range(2) = range(2) + 0.5;
125end
126
127
128if isreal(im)
129 factor=1;
130else
131 factor = 1+sqrt(-1);
132end
133
134xlbl_offset = 0; % default value
135
136if (~any(size(im)==1))
137 %% MatLab's "image" rounds when mapping to the colormap, so we compute
138 %% (im-r1)*(nshades-1)/(r2-r1) + 1.5
139 mult = ((nshades-1) / (range(2)-range(1)));
140 d_im = (mult * im) + factor*(1.5 - range(1)*mult);
141end
142
143if isreal(im)
144 if (any(size(im)==1))
145 hh = plot( im);
146 axis([1, prod(size(im)), range]);
147 else
148 hh = image( d_im );
149 axis('off');
150 zoom = pixelAxes(size(d_im),zoom);
151 end
152else
153 if (any(size(im)==1))
154 subplot(2,1,1);
155 hh = plot(real(im));
156 axis([1, prod(size(im)), range]);
157 subplot(2,1,2);
158 hh = plot(imag(im));
159 axis([1, prod(size(im)), range]);
160 else
161 subplot(1,2,1);
162 hh = image(real(d_im));
163 axis('off'); zoom = pixelAxes(size(d_im),zoom);
164 ax = gca; orig_units = get(ax,'Units');
165 set(ax,'Units','points');
166 pos1 = get(ax,'Position');
167 set(ax,'Units',orig_units);
168 subplot(1,2,2);
169 hh = image(imag(d_im));
170 axis('off'); zoom = pixelAxes(size(d_im),zoom);
171 ax = gca; orig_units = get(ax,'Units');
172 set(ax,'Units','points');
173 pos2 = get(ax,'Position');
174 set(ax,'Units',orig_units);
175 xlbl_offset = (pos1(1)-pos2(1))/2;
176 end
177end
178
179if ~any(size(im)==1)
180 colormap(gray(nshades));
181end
182
183if ((label ~= 0))
184 if isstr(label)
185 title(label);
186 h = get(gca,'Title');
187 orig_units = get(h,'Units');
188 set(h,'Units','points');
189 pos = get(h,'Position');
190 pos(1:2) = pos(1:2) + [xlbl_offset, -3]; % MAGIC NUMBER: y pixel offset
191 set(h,'Position',pos);
192 set(h,'Units',orig_units);
193 end
194
195 if (~any(size(im)==1))
196 if (zoom > 1)
197 zformat = sprintf('* %d',round(zoom));
198 else
199 zformat = sprintf('/ %d',round(1/zoom));
200 end
201 if isreal(im)
202 format=[' Range: [%.3g, %.3g] \n Dims: [%d, %d] ', zformat];
203 else
204 format=['Range: [%.3g, %.3g] ---- Dims: [%d, %d]', zformat];
205 end
206 xlabel(sprintf(format, range(1), range(2), size(im,1), size(im,2)));
207 h = get(gca,'Xlabel');
208 set(h,'FontSize', 9); % MAGIC NUMBER: font size!!!
209
210 orig_units = get(h,'Units');
211 set(h,'Units','points');
212 pos = get(h,'Position');
213 pos(1:2) = pos(1:2) + [xlbl_offset, 10]; % MAGIC NUMBER: y offset in points
214 set(h,'Position',pos);
215 set(h,'Units',orig_units);
216
217 set(h,'Visible','on'); % axis('image') turned the xlabel off...
218 end
219end
220
221return;
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/showLpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/showLpyr.m
deleted file mode 100755
index 0d85f9d..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/showLpyr.m
+++ /dev/null
@@ -1,202 +0,0 @@
1% RANGE = showLpyr (PYR, INDICES, RANGE, GAP, LEVEL_SCALE_FACTOR)
2%
3% Display a Laplacian (or Gaussian) pyramid, specified by PYR and
4% INDICES (see buildLpyr), in the current figure.
5%
6% RANGE is a 2-vector specifying the values that map to black and
7% white, respectively. These values are scaled by
8% LEVEL_SCALE_FACTOR^(lev-1) for bands at each level. Passing a value
9% of 'auto1' sets RANGE to the min and max values of MATRIX. 'auto2'
10% sets RANGE to 3 standard deviations below and above 0.0. In both of
11% these cases, the lowpass band is independently scaled. A value of
12% 'indep1' sets the range of each subband independently, as in a call
13% to showIm(subband,'auto1'). Similarly, 'indep2' causes each subband
14% to be scaled independently as if by showIm(subband,'indep2').
15% The default value for RANGE is 'auto1' for 1D images, and 'auto2' for
16% 2D images.
17%
18% GAP (optional, default=1) specifies the gap in pixels to leave
19% between subbands (2D images only).
20%
21% LEVEL_SCALE_FACTOR indicates the relative scaling between pyramid
22% levels. This should be set to the sum of the kernel taps of the
23% lowpass filter used to construct the pyramid (default assumes
24% L2-normalalized filters, using a value of 2 for 2D images, sqrt(2) for
25% 1D images).
26
27% Eero Simoncelli, 2/97.
28
29function [range] = showLpyr(pyr, pind, range, gap, scale);
30
31% Determine 1D or 2D pyramid:
32if ((pind(1,1) == 1) | (pind(1,2) ==1))
33 oned = 1;
34else
35 oned = 0;
36end
37
38%------------------------------------------------------------
39%% OPTIONAL ARGS:
40
41if (exist('range') ~= 1)
42 if (oned==1)
43 range = 'auto1';
44 else
45 range = 'auto2';
46 end
47end
48
49if (exist('gap') ~= 1)
50 gap = 1;
51end
52
53if (exist('scale') ~= 1)
54 if (oned == 1)
55 scale = sqrt(2);
56 else
57 scale = 2;
58 end
59end
60
61%------------------------------------------------------------
62
63nind = size(pind,1);
64
65%% Auto range calculations:
66if strcmp(range,'auto1')
67 range = zeros(nind,1);
68 mn = 0.0; mx = 0.0;
69 for bnum = 1:(nind-1)
70 band = pyrBand(pyr,pind,bnum)/(scale^(bnum-1));
71 range(bnum) = scale^(bnum-1);
72 [bmn,bmx] = range2(band);
73 mn = min(mn, bmn); mx = max(mx, bmx);
74 end
75 if (oned == 1)
76 pad = (mx-mn)/12; % *** MAGIC NUMBER!!
77 mn = mn-pad; mx = mx+pad;
78 end
79 range = range * [mn mx]; % outer product
80 band = pyrLow(pyr,pind);
81 [mn,mx] = range2(band);
82 if (oned == 1)
83 pad = (mx-mn)/12; % *** MAGIC NUMBER!!
84 mn = mn-pad; mx = mx+pad;
85 end
86 range(nind,:) = [mn, mx];
87
88elseif strcmp(range,'indep1')
89 range = zeros(nind,2);
90 for bnum = 1:nind
91 band = pyrBand(pyr,pind,bnum);
92 [mn,mx] = range2(band);
93 if (oned == 1)
94 pad = (mx-mn)/12; % *** MAGIC NUMBER!!
95 mn = mn-pad; mx = mx+pad;
96 end
97 range(bnum,:) = [mn mx];
98 end
99
100elseif strcmp(range,'auto2')
101 range = zeros(nind,1);
102 sqsum = 0; numpixels = 0;
103 for bnum = 1:(nind-1)
104 band = pyrBand(pyr,pind,bnum)/(scale^(bnum-1));
105 sqsum = sqsum + sum(sum(band.^2));
106 numpixels = numpixels + prod(size(band));
107 range(bnum) = scale^(bnum-1);
108 end
109 stdev = sqrt(sqsum/(numpixels-1));
110 range = range * [ -3*stdev 3*stdev ]; % outer product
111 band = pyrLow(pyr,pind);
112 av = mean2(band); stdev = sqrt(var2(band));
113 range(nind,:) = [av-2*stdev,av+2*stdev];
114
115elseif strcmp(range,'indep2')
116 range = zeros(nind,2);
117 for bnum = 1:(nind-1)
118 band = pyrBand(pyr,pind,bnum);
119 stdev = sqrt(var2(band));
120 range(bnum,:) = [ -3*stdev 3*stdev ];
121 end
122 band = pyrLow(pyr,pind);
123 av = mean2(band); stdev = sqrt(var2(band));
124 range(nind,:) = [av-2*stdev,av+2*stdev];
125
126elseif isstr(range)
127 error(sprintf('Bad RANGE argument: %s',range))
128
129elseif ((size(range,1) == 1) & (size(range,2) == 2))
130 scales = scale.^[0:nind-1];
131 range = scales(:) * range; % outer product
132 band = pyrLow(pyr,pind);
133 range(nind,:) = range(nind,:) + mean2(band) - mean(range(nind,:));
134
135end
136
137%% Clear Figure
138clf;
139
140if (oned == 1)
141
142 %%%%% 1D signal:
143 for bnum=1:nind
144 band = pyrBand(pyr,pind,bnum);
145 subplot(nind,1,nind-bnum+1);
146 plot(band);
147 axis([1, prod(size(band)), range(bnum,:)]);
148 end
149
150else
151
152 %%%%% 2D signal:
153 colormap(gray);
154 cmap = get(gcf,'Colormap');
155 nshades = size(cmap,1);
156
157 % Find background color index:
158 clr = get(gcf,'Color');
159 bg = 1;
160 dist = norm(cmap(bg,:)-clr);
161 for n = 1:nshades
162 ndist = norm(cmap(n,:)-clr);
163 if (ndist < dist)
164 dist = ndist;
165 bg = n;
166 end
167 end
168
169 %% Compute positions of subbands:
170 llpos = ones(nind,2);
171 dir = [-1 -1];
172 ctr = [pind(1,1)+1+gap 1];
173 sz = [0 0];
174 for bnum = 1:nind
175 prevsz = sz;
176 sz = pind(bnum,:);
177
178 % Determine center position of new band:
179 ctr = ctr + gap*dir/2 + dir.* floor((prevsz+(dir>0))/2);
180 dir = dir * [0 -1; 1 0]; % ccw rotation
181 ctr = ctr + gap*dir/2 + dir.* floor((sz+(dir<0))/2);
182 llpos(bnum,:) = ctr - floor(sz./2);
183 end
184
185 %% Make position list positive, and allocate appropriate image:
186 llpos = llpos - ones(nind,1)*min(llpos) + 1;
187 urpos = llpos + pind - 1;
188 d_im = bg + zeros(max(urpos));
189
190 %% Paste bands into image, (im-r1)*(nshades-1)/(r2-r1) + 1.5
191 for bnum=1:nind
192 mult = (nshades-1) / (range(bnum,2)-range(bnum,1));
193 d_im(llpos(bnum,1):urpos(bnum,1), llpos(bnum,2):urpos(bnum,2)) = ...
194 mult*pyrBand(pyr,pind,bnum) + (1.5-mult*range(bnum,1));
195 end
196
197 hh = image(d_im);
198 axis('off');
199 pixelAxes(size(d_im),'full');
200 set(hh,'UserData',range);
201
202end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/showSpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/showSpyr.m
deleted file mode 100755
index da85715..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/showSpyr.m
+++ /dev/null
@@ -1,188 +0,0 @@
1% RANGE = showSpyr (PYR, INDICES, RANGE, GAP, LEVEL_SCALE_FACTOR)
2%
3% Display a steerable pyramid, specified by PYR and INDICES
4% (see buildSpyr), in the current figure. The highpass band is not shown.
5%
6% RANGE is a 2-vector specifying the values that map to black and
7% white, respectively. These values are scaled by
8% LEVEL_SCALE_FACTOR^(lev-1) for bands at each level. Passing a value
9% of 'auto1' sets RANGE to the min and max values of MATRIX. 'auto2'
10% sets RANGE to 3 standard deviations below and above 0.0. In both of
11% these cases, the lowpass band is independently scaled. A value of
12% 'indep1' sets the range of each subband independently, as in a call
13% to showIm(subband,'auto1'). Similarly, 'indep2' causes each subband
14% to be scaled independently as if by showIm(subband,'indep2').
15% The default value for RANGE is 'auto2'.
16%
17% GAP (optional, default=1) specifies the gap in pixels to leave
18% between subbands.
19%
20% LEVEL_SCALE_FACTOR indicates the relative scaling between pyramid
21% levels. This should be set to the sum of the kernel taps of the
22% lowpass filter used to construct the pyramid (default is 2, which is
23% correct for L2-normalized filters.
24
25% Eero Simoncelli, 2/97.
26
27function [range] = showSpyr(pyr, pind, range, gap, scale);
28
29nbands = spyrNumBands(pind);
30
31%------------------------------------------------------------
32%% OPTIONAL ARGS:
33
34if (exist('range') ~= 1)
35 range = 'auto2';
36end
37
38if (exist('gap') ~= 1)
39 gap = 1;
40end
41
42if (exist('scale') ~= 1)
43 scale = 2;
44end
45
46%------------------------------------------------------------
47
48ht = spyrHt(pind);
49nind = size(pind,1);
50
51%% Auto range calculations:
52if strcmp(range,'auto1')
53 range = ones(nind,1);
54 band = spyrHigh(pyr,pind);
55 [mn,mx] = range2(band);
56 for lnum = 1:ht
57 for bnum = 1:nbands
58 band = spyrBand(pyr,pind,lnum,bnum)/(scale^(lnum-1));
59 range((lnum-1)*nbands+bnum+1) = scale^(lnum-1);
60 [bmn,bmx] = range2(band);
61 mn = min(mn, bmn);
62 mx = max(mx, bmx);
63 end
64 end
65 range = range * [mn mx]; % outer product
66 band = pyrLow(pyr,pind);
67 [mn,mx] = range2(band);
68 range(nind,:) = [mn, mx];
69
70elseif strcmp(range,'indep1')
71 range = zeros(nind,2);
72 for bnum = 1:nind
73 band = pyrBand(pyr,pind,bnum);
74 [mn,mx] = range2(band);
75 range(bnum,:) = [mn mx];
76 end
77
78elseif strcmp(range,'auto2')
79 range = ones(nind,1);
80 band = spyrHigh(pyr,pind);
81 sqsum = sum(sum(band.^2)); numpixels = prod(size(band));
82 for lnum = 1:ht
83 for bnum = 1:nbands
84 band = spyrBand(pyr,pind,lnum,bnum)/(scale^(lnum-1));
85 sqsum = sqsum + sum(sum(band.^2));
86 numpixels = numpixels + prod(size(band));
87 range((lnum-1)*nbands+bnum+1) = scale^(lnum-1);
88 end
89 end
90 stdev = sqrt(sqsum/(numpixels-1));
91 range = range * [ -3*stdev 3*stdev ]; % outer product
92 band = pyrLow(pyr,pind);
93 av = mean2(band); stdev = sqrt(var2(band));
94 range(nind,:) = [av-2*stdev,av+2*stdev];
95
96elseif strcmp(range,'indep2')
97 range = zeros(nind,2);
98 for bnum = 1:(nind-1)
99 band = pyrBand(pyr,pind,bnum);
100 stdev = sqrt(var2(band));
101 range(bnum,:) = [ -3*stdev 3*stdev ];
102 end
103 band = pyrLow(pyr,pind);
104 av = mean2(band); stdev = sqrt(var2(band));
105 range(nind,:) = [av-2*stdev,av+2*stdev];
106
107elseif isstr(range)
108 error(sprintf('Bad RANGE argument: %s',range))
109
110elseif ((size(range,1) == 1) & (size(range,2) == 2))
111 scales = scale.^[0:(ht-1)];
112 scales = ones(nbands,1) * scales; %outer product
113 scales = [1; scales(:); scale^ht]; %tack on highpass and lowpass
114 range = scales * range; % outer product
115 band = pyrLow(pyr,pind);
116 range(nind,:) = range(nind,:) + mean2(band) - mean(range(nind,:));
117
118end
119
120% CLEAR FIGURE:
121clf;
122
123colormap(gray);
124cmap = get(gcf,'Colormap');
125nshades = size(cmap,1);
126
127% Find background color index:
128clr = get(gcf,'Color');
129bg = 1;
130dist = norm(cmap(bg,:)-clr);
131for n = 1:nshades
132 ndist = norm(cmap(n,:)-clr);
133 if (ndist < dist)
134 dist = ndist;
135 bg = n;
136 end
137end
138
139%% Compute positions of subbands:
140llpos = ones(nind,2);
141
142if (nbands == 2)
143 ncols = 1; nrows = 2;
144else
145 ncols = ceil((nbands+1)/2); nrows = ceil(nbands/2);
146end
147relpos = [ (1-nrows):0, zeros(1,(ncols-1)); ...
148 zeros(1,nrows), -1:-1:(1-ncols) ]';
149if (nbands > 1)
150 mvpos = [-1 -1];
151else
152 mvpos = [0 -1];
153end
154basepos = [0 0];
155
156for lnum = 1:ht
157 ind1 = (lnum-1)*nbands + 2;
158 sz = pind(ind1,:)+gap;
159 basepos = basepos + mvpos .* sz;
160 if (nbands < 5) % to align edges...
161 sz = sz + gap*(ht-lnum+1);
162 end
163 llpos(ind1:ind1+nbands-1,:) = relpos * diag(sz) + ones(nbands,1)*basepos;
164end
165
166% lowpass band
167sz = pind(nind-1,:)+gap;
168basepos = basepos + mvpos .* sz;
169llpos(nind,:) = basepos;
170
171%% Make position list positive, and allocate appropriate image:
172llpos = llpos - ones(nind,1)*min(llpos) + 1;
173llpos(1,:) = [1 1];
174urpos = llpos + pind - 1;
175d_im = bg + zeros(max(urpos));
176
177%% Paste bands into image, (im-r1)*(nshades-1)/(r2-r1) + 1.5
178for bnum=2:nind
179 mult = (nshades-1) / (range(bnum,2)-range(bnum,1));
180 d_im(llpos(bnum,1):urpos(bnum,1), llpos(bnum,2):urpos(bnum,2)) = ...
181 mult*pyrBand(pyr,pind,bnum) + (1.5-mult*range(bnum,1));
182end
183
184hh = image(d_im);
185axis('off');
186pixelAxes(size(d_im),'full');
187set(hh,'UserData',range);
188
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/showWpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/showWpyr.m
deleted file mode 100755
index 510e395..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/showWpyr.m
+++ /dev/null
@@ -1,204 +0,0 @@
1% RANGE = showWpyr (PYR, INDICES, RANGE, GAP, LEVEL_SCALE_FACTOR)
2%
3% Display a separable QMF/wavelet pyramid, specified by PYR and INDICES
4% (see buildWpyr), in the current figure.
5%
6% RANGE is a 2-vector specifying the values that map to black and
7% white, respectively. These values are scaled by
8% LEVEL_SCALE_FACTOR^(lev-1) for bands at each level. Passing a value
9% of 'auto1' sets RANGE to the min and max values of MATRIX. 'auto2'
10% sets RANGE to 3 standard deviations below and above 0.0. In both of
11% these cases, the lowpass band is independently scaled. A value of
12% 'indep1' sets the range of each subband independently, as in a call
13% to showIm(subband,'auto1'). Similarly, 'indep2' causes each subband
14% to be scaled independently as if by showIm(subband,'indep2').
15% The default value for RANGE is 'auto1' for 1D images, and 'auto2' for
16% 2D images.
17%
18% GAP (optional, default=1) specifies the gap in pixels to leave
19% between subbands (2D images only).
20%
21% LEVEL_SCALE_FACTOR indicates the relative scaling between pyramid
22% levels. This should be set to the sum of the kernel taps of the
23% lowpass filter used to construct the pyramid (default assumes
24% L2-normalized filters, using a value of 2 for 2D images, sqrt(2) for
25% 1D images).
26
27% Eero Simoncelli, 2/97.
28
29function [range] = showWpyr(pyr, pind, range, gap, scale);
30
31% Determine 1D or 2D pyramid:
32if ((pind(1,1) == 1) | (pind(1,2) ==1))
33 nbands = 1;
34else
35 nbands = 3;
36end
37
38%------------------------------------------------------------
39%% OPTIONAL ARGS:
40
41if (exist('range') ~= 1)
42 if (nbands==1)
43 range = 'auto1';
44 else
45 range = 'auto2';
46 end
47end
48
49if (exist('gap') ~= 1)
50 gap = 1;
51end
52
53if (exist('scale') ~= 1)
54 if (nbands == 1)
55 scale = sqrt(2);
56 else
57 scale = 2;
58 end
59end
60
61%------------------------------------------------------------
62
63ht = wpyrHt(pind);
64nind = size(pind,1);
65
66%% Auto range calculations:
67if strcmp(range,'auto1')
68 range = zeros(nind,1);
69 mn = 0.0; mx = 0.0;
70 for lnum = 1:ht
71 for bnum = 1:nbands
72 band = wpyrBand(pyr,pind,lnum,bnum)/(scale^(lnum-1));
73 range((lnum-1)*nbands+bnum) = scale^(lnum-1);
74 [bmn,bmx] = range2(band);
75 mn = min(mn, bmn); mx = max(mx, bmx);
76 end
77 end
78 if (nbands == 1)
79 pad = (mx-mn)/12; % *** MAGIC NUMBER!!
80 mn = mn-pad; mx = mx+pad;
81 end
82 range = range * [mn mx]; % outer product
83 band = pyrLow(pyr,pind);
84 [mn,mx] = range2(band);
85 if (nbands == 1)
86 pad = (mx-mn)/12; % *** MAGIC NUMBER!!
87 mn = mn-pad; mx = mx+pad;
88 end
89 range(nind,:) = [mn, mx];
90
91elseif strcmp(range,'indep1')
92 range = zeros(nind,2);
93 for bnum = 1:nind
94 band = pyrBand(pyr,pind,bnum);
95 [mn,mx] = range2(band);
96 if (nbands == 1)
97 pad = (mx-mn)/12; % *** MAGIC NUMBER!!
98 mn = mn-pad; mx = mx+pad;
99 end
100 range(bnum,:) = [mn mx];
101 end
102
103elseif strcmp(range,'auto2')
104 range = zeros(nind,1);
105 sqsum = 0; numpixels = 0;
106 for lnum = 1:ht
107 for bnum = 1:nbands
108 band = wpyrBand(pyr,pind,lnum,bnum)/(scale^(lnum-1));
109 sqsum = sqsum + sum(sum(band.^2));
110 numpixels = numpixels + prod(size(band));
111 range((lnum-1)*nbands+bnum) = scale^(lnum-1);
112 end
113 end
114 stdev = sqrt(sqsum/(numpixels-1));
115 range = range * [ -3*stdev 3*stdev ]; % outer product
116 band = pyrLow(pyr,pind);
117 av = mean2(band); stdev = sqrt(var2(band));
118 range(nind,:) = [av-2*stdev,av+2*stdev];
119
120elseif strcmp(range,'indep2')
121 range = zeros(nind,2);
122 for bnum = 1:(nind-1)
123 band = pyrBand(pyr,pind,bnum);
124 stdev = sqrt(var2(band));
125 range(bnum,:) = [ -3*stdev 3*stdev ];
126 end
127 band = pyrLow(pyr,pind);
128 av = mean2(band); stdev = sqrt(var2(band));
129 range(nind,:) = [av-2*stdev,av+2*stdev];
130
131elseif isstr(range)
132 error(sprintf('Bad RANGE argument: %s',range))
133
134elseif ((size(range,1) == 1) & (size(range,2) == 2))
135 scales = scale.^[0:ht];
136 if (nbands ~= 1)
137 scales = [scales; scales; scales];
138 end
139 range = scales(:) * range; % outer product
140 band = pyrLow(pyr,pind);
141 range(nind,:) = range(nind,:) + mean2(band) - mean(range(nind,:));
142
143end
144
145% CLEAR FIGURE:
146clf;
147
148if (nbands == 1)
149
150 %%%%% 1D signal:
151 for bnum=1:nind
152 band = pyrBand(pyr,pind,bnum);
153 subplot(nind,1,nind-bnum+1);
154 plot(band);
155 axis([1, prod(size(band)), range(bnum,:)]);
156 end
157
158else
159
160 %%%%% 2D signal:
161 colormap(gray);
162 cmap = get(gcf,'Colormap');
163 nshades = size(cmap,1);
164
165 % Find background color index:
166 clr = get(gcf,'Color');
167 bg = 1;
168 dist = norm(cmap(bg,:)-clr);
169 for n = 1:nshades
170 ndist = norm(cmap(n,:)-clr);
171 if (ndist < dist)
172 dist = ndist;
173 bg = n;
174 end
175 end
176
177 %% Compute positions of subbands:
178 llpos = ones(nind,2);
179 for lnum = 1:ht
180 ind1 = nbands*(lnum-1) + 1;
181 xpos = pind(ind1,2) + 1 + gap*(ht-lnum+1);
182 ypos = pind(ind1+1,1) + 1 + gap*(ht-lnum+1);
183 llpos(ind1:ind1+2,:) = [ypos 1; 1 xpos; ypos xpos];
184 end
185 llpos(nind,:) = [1 1]; %lowpass
186
187 %% Make position list positive, and allocate appropriate image:
188 llpos = llpos - ones(nind,1)*min(llpos) + 1;
189 urpos = llpos + pind - 1;
190 d_im = bg + zeros(max(urpos));
191
192 %% Paste bands into image, (im-r1)*(nshades-1)/(r2-r1) + 1.5
193 for bnum=1:nind
194 mult = (nshades-1) / (range(bnum,2)-range(bnum,1));
195 d_im(llpos(bnum,1):urpos(bnum,1), llpos(bnum,2):urpos(bnum,2)) = ...
196 mult*pyrBand(pyr,pind,bnum) + (1.5-mult*range(bnum,1));
197 end
198
199 hh = image(d_im);
200 axis('off');
201 pixelAxes(size(d_im),'full');
202 set(hh,'UserData',range);
203
204end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/shrink.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/shrink.m
deleted file mode 100755
index 7af0151..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/shrink.m
+++ /dev/null
@@ -1,25 +0,0 @@
1function ts=shrink(t,f)
2
3% It shrinks an image in a factor f
4% in each dimension.
5% ts = shrink(t,f)
6% ts may also be complex.
7% See also: expand.m, blurDn.m
8% JPM, April 95, Instituto de Optica, CSIC, Madrid.
9
10[my,mx]=size(t);
11T=fftshift(fft2(t))/f^2;
12Ts=zeros(my/f,mx/f);
13y1=my/2+2-my/(2*f);
14y2=my/2+my/(2*f);
15x1=mx/2+2-mx/(2*f);
16x2=mx/2+mx/(2*f);
17Ts(2:my/f,2:mx/f)=T(y1:y2,x1:x2);
18Ts(1,2:mx/f)=(T(y1-1,x1:x2)+T(y2+1,x1:x2))/2;
19Ts(2:my/f,1)=(T(y1:y2,x1-1)+T(y1:y2,x2+1))/2;
20Ts(1,1)=(T(y1-1,x1-1)+T(y1-1,x2+1)+T(y2+1,x1-1)+T(y2+1,x2+1))/4;
21Ts=fftshift(Ts);
22ts=ifft2(Ts);
23if all(imag(t)==0),
24 ts = real(ts);
25end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/skew2.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/skew2.m
deleted file mode 100755
index 623d6ca..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/skew2.m
+++ /dev/null
@@ -1,21 +0,0 @@
1% S = SKEW2(MTX,MEAN,VAR)
2%
3% Sample skew (third moment divided by variance^3/2) of a matrix.
4% MEAN (optional) and VAR (optional) make the computation faster.
5
6function res = skew2(mtx, mn, v)
7
8if (exist('mn') ~= 1)
9 mn = mean2(mtx);
10end
11
12if (exist('v') ~= 1)
13 v = var2(mtx,mn);
14end
15
16if (isreal(mtx))
17 res = mean(mean((mtx-mn).^3)) / (v^(3/2));
18else
19 res = mean(mean(real(mtx-mn).^3)) / (real(v)^(3/2)) + ...
20 i * mean(mean(imag(mtx-mn).^3)) / (imag(v)^(3/2));
21end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/snr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/snr.m
deleted file mode 100755
index 3945d90..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/snr.m
+++ /dev/null
@@ -1,10 +0,0 @@
1function X=SNR(s,n);
2
3% Compute the signal-to-noise ratio in dB
4% X=SNR(signal,noise);
5% (it does not subtract the means).
6
7es=sum(sum(abs(s).^2))+0.0000001;
8en=sum(sum(abs(n).^2))+0.0000001;
9X=10*log10(es/en);
10
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/sp0Filters.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/sp0Filters.m
deleted file mode 100755
index 6b25e36..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/sp0Filters.m
+++ /dev/null
@@ -1,72 +0,0 @@
1% Steerable pyramid filters. Transform described in:
2%
3% @INPROCEEDINGS{Simoncelli95b,
4% TITLE = "The Steerable Pyramid: A Flexible Architecture for
5% Multi-Scale Derivative Computation",
6% AUTHOR = "E P Simoncelli and W T Freeman",
7% BOOKTITLE = "Second Int'l Conf on Image Processing",
8% ADDRESS = "Washington, DC", MONTH = "October", YEAR = 1995 }
9%
10% Filter kernel design described in:
11%
12%@INPROCEEDINGS{Karasaridis96,
13% TITLE = "A Filter Design Technique for
14% Steerable Pyramid Image Transforms",
15% AUTHOR = "A Karasaridis and E P Simoncelli",
16% BOOKTITLE = "ICASSP", ADDRESS = "Atlanta, GA",
17% MONTH = "May", YEAR = 1996 }
18
19% Eero Simoncelli, 6/96.
20
21function [lo0filt,hi0filt,lofilt,bfilts,mtx,harmonics] = sp0Filters();
22
23harmonics = [ 0 ];
24
25lo0filt = [ ...
26-4.514000e-04 -1.137100e-04 -3.725800e-04 -3.743860e-03 -3.725800e-04 -1.137100e-04 -4.514000e-04
27-1.137100e-04 -6.119520e-03 -1.344160e-02 -7.563200e-03 -1.344160e-02 -6.119520e-03 -1.137100e-04
28-3.725800e-04 -1.344160e-02 6.441488e-02 1.524935e-01 6.441488e-02 -1.344160e-02 -3.725800e-04
29-3.743860e-03 -7.563200e-03 1.524935e-01 3.153017e-01 1.524935e-01 -7.563200e-03 -3.743860e-03
30-3.725800e-04 -1.344160e-02 6.441488e-02 1.524935e-01 6.441488e-02 -1.344160e-02 -3.725800e-04
31-1.137100e-04 -6.119520e-03 -1.344160e-02 -7.563200e-03 -1.344160e-02 -6.119520e-03 -1.137100e-04
32-4.514000e-04 -1.137100e-04 -3.725800e-04 -3.743860e-03 -3.725800e-04 -1.137100e-04 -4.514000e-04];
33
34lofilt = [ ...
35-2.257000e-04 -8.064400e-04 -5.686000e-05 8.741400e-04 -1.862800e-04 -1.031640e-03 -1.871920e-03 -1.031640e-03 -1.862800e-04 8.741400e-04 -5.686000e-05 -8.064400e-04 -2.257000e-04
36-8.064400e-04 1.417620e-03 -1.903800e-04 -2.449060e-03 -4.596420e-03 -7.006740e-03 -6.948900e-03 -7.006740e-03 -4.596420e-03 -2.449060e-03 -1.903800e-04 1.417620e-03 -8.064400e-04
37-5.686000e-05 -1.903800e-04 -3.059760e-03 -6.401000e-03 -6.720800e-03 -5.236180e-03 -3.781600e-03 -5.236180e-03 -6.720800e-03 -6.401000e-03 -3.059760e-03 -1.903800e-04 -5.686000e-05
388.741400e-04 -2.449060e-03 -6.401000e-03 -5.260020e-03 3.938620e-03 1.722078e-02 2.449600e-02 1.722078e-02 3.938620e-03 -5.260020e-03 -6.401000e-03 -2.449060e-03 8.741400e-04
39-1.862800e-04 -4.596420e-03 -6.720800e-03 3.938620e-03 3.220744e-02 6.306262e-02 7.624674e-02 6.306262e-02 3.220744e-02 3.938620e-03 -6.720800e-03 -4.596420e-03 -1.862800e-04
40-1.031640e-03 -7.006740e-03 -5.236180e-03 1.722078e-02 6.306262e-02 1.116388e-01 1.348999e-01 1.116388e-01 6.306262e-02 1.722078e-02 -5.236180e-03 -7.006740e-03 -1.031640e-03
41-1.871920e-03 -6.948900e-03 -3.781600e-03 2.449600e-02 7.624674e-02 1.348999e-01 1.576508e-01 1.348999e-01 7.624674e-02 2.449600e-02 -3.781600e-03 -6.948900e-03 -1.871920e-03
42-1.031640e-03 -7.006740e-03 -5.236180e-03 1.722078e-02 6.306262e-02 1.116388e-01 1.348999e-01 1.116388e-01 6.306262e-02 1.722078e-02 -5.236180e-03 -7.006740e-03 -1.031640e-03
43-1.862800e-04 -4.596420e-03 -6.720800e-03 3.938620e-03 3.220744e-02 6.306262e-02 7.624674e-02 6.306262e-02 3.220744e-02 3.938620e-03 -6.720800e-03 -4.596420e-03 -1.862800e-04
448.741400e-04 -2.449060e-03 -6.401000e-03 -5.260020e-03 3.938620e-03 1.722078e-02 2.449600e-02 1.722078e-02 3.938620e-03 -5.260020e-03 -6.401000e-03 -2.449060e-03 8.741400e-04
45-5.686000e-05 -1.903800e-04 -3.059760e-03 -6.401000e-03 -6.720800e-03 -5.236180e-03 -3.781600e-03 -5.236180e-03 -6.720800e-03 -6.401000e-03 -3.059760e-03 -1.903800e-04 -5.686000e-05
46-8.064400e-04 1.417620e-03 -1.903800e-04 -2.449060e-03 -4.596420e-03 -7.006740e-03 -6.948900e-03 -7.006740e-03 -4.596420e-03 -2.449060e-03 -1.903800e-04 1.417620e-03 -8.064400e-04
47-2.257000e-04 -8.064400e-04 -5.686000e-05 8.741400e-04 -1.862800e-04 -1.031640e-03 -1.871920e-03 -1.031640e-03 -1.862800e-04 8.741400e-04 -5.686000e-05 -8.064400e-04 -2.257000e-04];
48
49mtx = [ 1.000000 ];
50
51hi0filt = [...
525.997200e-04 -6.068000e-05 -3.324900e-04 -3.325600e-04 -2.406600e-04 -3.325600e-04 -3.324900e-04 -6.068000e-05 5.997200e-04
53-6.068000e-05 1.263100e-04 4.927100e-04 1.459700e-04 -3.732100e-04 1.459700e-04 4.927100e-04 1.263100e-04 -6.068000e-05
54-3.324900e-04 4.927100e-04 -1.616650e-03 -1.437358e-02 -2.420138e-02 -1.437358e-02 -1.616650e-03 4.927100e-04 -3.324900e-04
55-3.325600e-04 1.459700e-04 -1.437358e-02 -6.300923e-02 -9.623594e-02 -6.300923e-02 -1.437358e-02 1.459700e-04 -3.325600e-04
56-2.406600e-04 -3.732100e-04 -2.420138e-02 -9.623594e-02 8.554893e-01 -9.623594e-02 -2.420138e-02 -3.732100e-04 -2.406600e-04
57-3.325600e-04 1.459700e-04 -1.437358e-02 -6.300923e-02 -9.623594e-02 -6.300923e-02 -1.437358e-02 1.459700e-04 -3.325600e-04
58-3.324900e-04 4.927100e-04 -1.616650e-03 -1.437358e-02 -2.420138e-02 -1.437358e-02 -1.616650e-03 4.927100e-04 -3.324900e-04
59-6.068000e-05 1.263100e-04 4.927100e-04 1.459700e-04 -3.732100e-04 1.459700e-04 4.927100e-04 1.263100e-04 -6.068000e-05
605.997200e-04 -6.068000e-05 -3.324900e-04 -3.325600e-04 -2.406600e-04 -3.325600e-04 -3.324900e-04 -6.068000e-05 5.997200e-04 ];
61
62bfilts = [ ...
63-9.066000e-05 -1.738640e-03 -4.942500e-03 -7.889390e-03 -1.009473e-02 -7.889390e-03 -4.942500e-03 -1.738640e-03 -9.066000e-05 ...
64-1.738640e-03 -4.625150e-03 -7.272540e-03 -7.623410e-03 -9.091950e-03 -7.623410e-03 -7.272540e-03 -4.625150e-03 -1.738640e-03 ...
65-4.942500e-03 -7.272540e-03 -2.129540e-02 -2.435662e-02 -3.487008e-02 -2.435662e-02 -2.129540e-02 -7.272540e-03 -4.942500e-03 ...
66-7.889390e-03 -7.623410e-03 -2.435662e-02 -1.730466e-02 -3.158605e-02 -1.730466e-02 -2.435662e-02 -7.623410e-03 -7.889390e-03 ...
67-1.009473e-02 -9.091950e-03 -3.487008e-02 -3.158605e-02 9.464195e-01 -3.158605e-02 -3.487008e-02 -9.091950e-03 -1.009473e-02 ...
68-7.889390e-03 -7.623410e-03 -2.435662e-02 -1.730466e-02 -3.158605e-02 -1.730466e-02 -2.435662e-02 -7.623410e-03 -7.889390e-03 ...
69-4.942500e-03 -7.272540e-03 -2.129540e-02 -2.435662e-02 -3.487008e-02 -2.435662e-02 -2.129540e-02 -7.272540e-03 -4.942500e-03 ...
70-1.738640e-03 -4.625150e-03 -7.272540e-03 -7.623410e-03 -9.091950e-03 -7.623410e-03 -7.272540e-03 -4.625150e-03 -1.738640e-03 ...
71-9.066000e-05 -1.738640e-03 -4.942500e-03 -7.889390e-03 -1.009473e-02 -7.889390e-03 -4.942500e-03 -1.738640e-03 -9.066000e-05 ]';
72
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/sp1Filters.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/sp1Filters.m
deleted file mode 100755
index 215e651..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/sp1Filters.m
+++ /dev/null
@@ -1,91 +0,0 @@
1% Steerable pyramid filters. Transform described in:
2%
3% @INPROCEEDINGS{Simoncelli95b,
4% TITLE = "The Steerable Pyramid: A Flexible Architecture for
5% Multi-Scale Derivative Computation",
6% AUTHOR = "E P Simoncelli and W T Freeman",
7% BOOKTITLE = "Second Int'l Conf on Image Processing",
8% ADDRESS = "Washington, DC", MONTH = "October", YEAR = 1995 }
9%
10% Filter kernel design described in:
11%
12%@INPROCEEDINGS{Karasaridis96,
13% TITLE = "A Filter Design Technique for
14% Steerable Pyramid Image Transforms",
15% AUTHOR = "A Karasaridis and E P Simoncelli",
16% BOOKTITLE = "ICASSP", ADDRESS = "Atlanta, GA",
17% MONTH = "May", YEAR = 1996 }
18
19% Eero Simoncelli, 6/96.
20
21function [lo0filt,hi0filt,lofilt,bfilts,mtx,harmonics] = sp1Filters();
22
23harmonics = [ 1 ];
24
25%% filters only contain first harmonic.
26mtx = eye(2);
27
28lo0filt = [ ...
29-8.701000e-05 -1.354280e-03 -1.601260e-03 -5.033700e-04 2.524010e-03 -5.033700e-04 -1.601260e-03 -1.354280e-03 -8.701000e-05
30-1.354280e-03 2.921580e-03 7.522720e-03 8.224420e-03 1.107620e-03 8.224420e-03 7.522720e-03 2.921580e-03 -1.354280e-03
31-1.601260e-03 7.522720e-03 -7.061290e-03 -3.769487e-02 -3.297137e-02 -3.769487e-02 -7.061290e-03 7.522720e-03 -1.601260e-03
32-5.033700e-04 8.224420e-03 -3.769487e-02 4.381320e-02 1.811603e-01 4.381320e-02 -3.769487e-02 8.224420e-03 -5.033700e-04
332.524010e-03 1.107620e-03 -3.297137e-02 1.811603e-01 4.376250e-01 1.811603e-01 -3.297137e-02 1.107620e-03 2.524010e-03
34-5.033700e-04 8.224420e-03 -3.769487e-02 4.381320e-02 1.811603e-01 4.381320e-02 -3.769487e-02 8.224420e-03 -5.033700e-04
35-1.601260e-03 7.522720e-03 -7.061290e-03 -3.769487e-02 -3.297137e-02 -3.769487e-02 -7.061290e-03 7.522720e-03 -1.601260e-03
36-1.354280e-03 2.921580e-03 7.522720e-03 8.224420e-03 1.107620e-03 8.224420e-03 7.522720e-03 2.921580e-03 -1.354280e-03
37-8.701000e-05 -1.354280e-03 -1.601260e-03 -5.033700e-04 2.524010e-03 -5.033700e-04 -1.601260e-03 -1.354280e-03 -8.701000e-05
38];
39
40lofilt = [ ...
41-4.350000e-05 1.207800e-04 -6.771400e-04 -1.243400e-04 -8.006400e-04 -1.597040e-03 -2.516800e-04 -4.202000e-04 1.262000e-03 -4.202000e-04 -2.516800e-04 -1.597040e-03 -8.006400e-04 -1.243400e-04 -6.771400e-04 1.207800e-04 -4.350000e-05 ; ...
421.207800e-04 4.460600e-04 -5.814600e-04 5.621600e-04 -1.368800e-04 2.325540e-03 2.889860e-03 4.287280e-03 5.589400e-03 4.287280e-03 2.889860e-03 2.325540e-03 -1.368800e-04 5.621600e-04 -5.814600e-04 4.460600e-04 1.207800e-04 ; ...
43-6.771400e-04 -5.814600e-04 1.460780e-03 2.160540e-03 3.761360e-03 3.080980e-03 4.112200e-03 2.221220e-03 5.538200e-04 2.221220e-03 4.112200e-03 3.080980e-03 3.761360e-03 2.160540e-03 1.460780e-03 -5.814600e-04 -6.771400e-04 ; ...
44-1.243400e-04 5.621600e-04 2.160540e-03 3.175780e-03 3.184680e-03 -1.777480e-03 -7.431700e-03 -9.056920e-03 -9.637220e-03 -9.056920e-03 -7.431700e-03 -1.777480e-03 3.184680e-03 3.175780e-03 2.160540e-03 5.621600e-04 -1.243400e-04 ; ...
45-8.006400e-04 -1.368800e-04 3.761360e-03 3.184680e-03 -3.530640e-03 -1.260420e-02 -1.884744e-02 -1.750818e-02 -1.648568e-02 -1.750818e-02 -1.884744e-02 -1.260420e-02 -3.530640e-03 3.184680e-03 3.761360e-03 -1.368800e-04 -8.006400e-04 ; ...
46-1.597040e-03 2.325540e-03 3.080980e-03 -1.777480e-03 -1.260420e-02 -2.022938e-02 -1.109170e-02 3.955660e-03 1.438512e-02 3.955660e-03 -1.109170e-02 -2.022938e-02 -1.260420e-02 -1.777480e-03 3.080980e-03 2.325540e-03 -1.597040e-03 ; ...
47-2.516800e-04 2.889860e-03 4.112200e-03 -7.431700e-03 -1.884744e-02 -1.109170e-02 2.190660e-02 6.806584e-02 9.058014e-02 6.806584e-02 2.190660e-02 -1.109170e-02 -1.884744e-02 -7.431700e-03 4.112200e-03 2.889860e-03 -2.516800e-04 ; ...
48-4.202000e-04 4.287280e-03 2.221220e-03 -9.056920e-03 -1.750818e-02 3.955660e-03 6.806584e-02 1.445500e-01 1.773651e-01 1.445500e-01 6.806584e-02 3.955660e-03 -1.750818e-02 -9.056920e-03 2.221220e-03 4.287280e-03 -4.202000e-04 ; ...
491.262000e-03 5.589400e-03 5.538200e-04 -9.637220e-03 -1.648568e-02 1.438512e-02 9.058014e-02 1.773651e-01 2.120374e-01 1.773651e-01 9.058014e-02 1.438512e-02 -1.648568e-02 -9.637220e-03 5.538200e-04 5.589400e-03 1.262000e-03 ; ...
50-4.202000e-04 4.287280e-03 2.221220e-03 -9.056920e-03 -1.750818e-02 3.955660e-03 6.806584e-02 1.445500e-01 1.773651e-01 1.445500e-01 6.806584e-02 3.955660e-03 -1.750818e-02 -9.056920e-03 2.221220e-03 4.287280e-03 -4.202000e-04 ; ...
51-2.516800e-04 2.889860e-03 4.112200e-03 -7.431700e-03 -1.884744e-02 -1.109170e-02 2.190660e-02 6.806584e-02 9.058014e-02 6.806584e-02 2.190660e-02 -1.109170e-02 -1.884744e-02 -7.431700e-03 4.112200e-03 2.889860e-03 -2.516800e-04 ; ...
52-1.597040e-03 2.325540e-03 3.080980e-03 -1.777480e-03 -1.260420e-02 -2.022938e-02 -1.109170e-02 3.955660e-03 1.438512e-02 3.955660e-03 -1.109170e-02 -2.022938e-02 -1.260420e-02 -1.777480e-03 3.080980e-03 2.325540e-03 -1.597040e-03 ; ...
53-8.006400e-04 -1.368800e-04 3.761360e-03 3.184680e-03 -3.530640e-03 -1.260420e-02 -1.884744e-02 -1.750818e-02 -1.648568e-02 -1.750818e-02 -1.884744e-02 -1.260420e-02 -3.530640e-03 3.184680e-03 3.761360e-03 -1.368800e-04 -8.006400e-04 ; ...
54-1.243400e-04 5.621600e-04 2.160540e-03 3.175780e-03 3.184680e-03 -1.777480e-03 -7.431700e-03 -9.056920e-03 -9.637220e-03 -9.056920e-03 -7.431700e-03 -1.777480e-03 3.184680e-03 3.175780e-03 2.160540e-03 5.621600e-04 -1.243400e-04 ; ...
55-6.771400e-04 -5.814600e-04 1.460780e-03 2.160540e-03 3.761360e-03 3.080980e-03 4.112200e-03 2.221220e-03 5.538200e-04 2.221220e-03 4.112200e-03 3.080980e-03 3.761360e-03 2.160540e-03 1.460780e-03 -5.814600e-04 -6.771400e-04 ; ...
561.207800e-04 4.460600e-04 -5.814600e-04 5.621600e-04 -1.368800e-04 2.325540e-03 2.889860e-03 4.287280e-03 5.589400e-03 4.287280e-03 2.889860e-03 2.325540e-03 -1.368800e-04 5.621600e-04 -5.814600e-04 4.460600e-04 1.207800e-04 ; ...
57-4.350000e-05 1.207800e-04 -6.771400e-04 -1.243400e-04 -8.006400e-04 -1.597040e-03 -2.516800e-04 -4.202000e-04 1.262000e-03 -4.202000e-04 -2.516800e-04 -1.597040e-03 -8.006400e-04 -1.243400e-04 -6.771400e-04 1.207800e-04 -4.350000e-05 ];
58
59hi0filt = [...
60-9.570000e-04 -2.424100e-04 -1.424720e-03 -8.742600e-04 -1.166810e-03 -8.742600e-04 -1.424720e-03 -2.424100e-04 -9.570000e-04 ; ...
61-2.424100e-04 -4.317530e-03 8.998600e-04 9.156420e-03 1.098012e-02 9.156420e-03 8.998600e-04 -4.317530e-03 -2.424100e-04 ; ...
62-1.424720e-03 8.998600e-04 1.706347e-02 1.094866e-02 -5.897780e-03 1.094866e-02 1.706347e-02 8.998600e-04 -1.424720e-03 ; ...
63-8.742600e-04 9.156420e-03 1.094866e-02 -7.841370e-02 -1.562827e-01 -7.841370e-02 1.094866e-02 9.156420e-03 -8.742600e-04 ; ...
64-1.166810e-03 1.098012e-02 -5.897780e-03 -1.562827e-01 7.282593e-01 -1.562827e-01 -5.897780e-03 1.098012e-02 -1.166810e-03 ; ...
65-8.742600e-04 9.156420e-03 1.094866e-02 -7.841370e-02 -1.562827e-01 -7.841370e-02 1.094866e-02 9.156420e-03 -8.742600e-04 ; ...
66-1.424720e-03 8.998600e-04 1.706347e-02 1.094866e-02 -5.897780e-03 1.094866e-02 1.706347e-02 8.998600e-04 -1.424720e-03 ; ...
67-2.424100e-04 -4.317530e-03 8.998600e-04 9.156420e-03 1.098012e-02 9.156420e-03 8.998600e-04 -4.317530e-03 -2.424100e-04 ; ...
68-9.570000e-04 -2.424100e-04 -1.424720e-03 -8.742600e-04 -1.166810e-03 -8.742600e-04 -1.424720e-03 -2.424100e-04 -9.570000e-04 ];
69
70bfilts = -[ ...
716.125880e-03 -8.052600e-03 -2.103714e-02 -1.536890e-02 -1.851466e-02 -1.536890e-02 -2.103714e-02 -8.052600e-03 6.125880e-03 ...
72-1.287416e-02 -9.611520e-03 1.023569e-02 6.009450e-03 1.872620e-03 6.009450e-03 1.023569e-02 -9.611520e-03 -1.287416e-02 ...
73-5.641530e-03 4.168400e-03 -2.382180e-02 -5.375324e-02 -2.076086e-02 -5.375324e-02 -2.382180e-02 4.168400e-03 -5.641530e-03 ...
74-8.957260e-03 -1.751170e-03 -1.836909e-02 1.265655e-01 2.996168e-01 1.265655e-01 -1.836909e-02 -1.751170e-03 -8.957260e-03 ...
750.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 ...
768.957260e-03 1.751170e-03 1.836909e-02 -1.265655e-01 -2.996168e-01 -1.265655e-01 1.836909e-02 1.751170e-03 8.957260e-03 ...
775.641530e-03 -4.168400e-03 2.382180e-02 5.375324e-02 2.076086e-02 5.375324e-02 2.382180e-02 -4.168400e-03 5.641530e-03 ...
781.287416e-02 9.611520e-03 -1.023569e-02 -6.009450e-03 -1.872620e-03 -6.009450e-03 -1.023569e-02 9.611520e-03 1.287416e-02 ...
79-6.125880e-03 8.052600e-03 2.103714e-02 1.536890e-02 1.851466e-02 1.536890e-02 2.103714e-02 8.052600e-03 -6.125880e-03; ...
80...
81-6.125880e-03 1.287416e-02 5.641530e-03 8.957260e-03 0.000000e+00 -8.957260e-03 -5.641530e-03 -1.287416e-02 6.125880e-03 ...
828.052600e-03 9.611520e-03 -4.168400e-03 1.751170e-03 0.000000e+00 -1.751170e-03 4.168400e-03 -9.611520e-03 -8.052600e-03 ...
832.103714e-02 -1.023569e-02 2.382180e-02 1.836909e-02 0.000000e+00 -1.836909e-02 -2.382180e-02 1.023569e-02 -2.103714e-02 ...
841.536890e-02 -6.009450e-03 5.375324e-02 -1.265655e-01 0.000000e+00 1.265655e-01 -5.375324e-02 6.009450e-03 -1.536890e-02 ...
851.851466e-02 -1.872620e-03 2.076086e-02 -2.996168e-01 0.000000e+00 2.996168e-01 -2.076086e-02 1.872620e-03 -1.851466e-02 ...
861.536890e-02 -6.009450e-03 5.375324e-02 -1.265655e-01 0.000000e+00 1.265655e-01 -5.375324e-02 6.009450e-03 -1.536890e-02 ...
872.103714e-02 -1.023569e-02 2.382180e-02 1.836909e-02 0.000000e+00 -1.836909e-02 -2.382180e-02 1.023569e-02 -2.103714e-02 ...
888.052600e-03 9.611520e-03 -4.168400e-03 1.751170e-03 0.000000e+00 -1.751170e-03 4.168400e-03 -9.611520e-03 -8.052600e-03 ...
89-6.125880e-03 1.287416e-02 5.641530e-03 8.957260e-03 0.000000e+00 -8.957260e-03 -5.641530e-03 -1.287416e-02 6.125880e-03 ...
90]';
91
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/sp3Filters.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/sp3Filters.m
deleted file mode 100755
index c9cfaaf..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/sp3Filters.m
+++ /dev/null
@@ -1,121 +0,0 @@
1% Steerable pyramid filters. Transform described in:
2%
3% @INPROCEEDINGS{Simoncelli95b,
4% TITLE = "The Steerable Pyramid: A Flexible Architecture for
5% Multi-Scale Derivative Computation",
6% AUTHOR = "E P Simoncelli and W T Freeman",
7% BOOKTITLE = "Second Int'l Conf on Image Processing",
8% ADDRESS = "Washington, DC", MONTH = "October", YEAR = 1995 }
9%
10% Filter kernel design described in:
11%
12%@INPROCEEDINGS{Karasaridis96,
13% TITLE = "A Filter Design Technique for
14% Steerable Pyramid Image Transforms",
15% AUTHOR = "A Karasaridis and E P Simoncelli",
16% BOOKTITLE = "ICASSP", ADDRESS = "Atlanta, GA",
17% MONTH = "May", YEAR = 1996 }
18
19% Eero Simoncelli, 6/96.
20
21function [lo0filt,hi0filt,lofilt,bfilts,mtx,harmonics] = sp3Filters();
22
23harmonics = [1 3];
24
25mtx = [ ...
26 0.5000 0.3536 0 -0.3536
27 -0.0000 0.3536 0.5000 0.3536
28 0.5000 -0.3536 0 0.3536
29 -0.0000 0.3536 -0.5000 0.3536];
30
31hi0filt = [
32-4.0483998600E-4 -6.2596000498E-4 -3.7829999201E-5 8.8387000142E-4 1.5450799838E-3 1.9235999789E-3 2.0687500946E-3 2.0898699295E-3 2.0687500946E-3 1.9235999789E-3 1.5450799838E-3 8.8387000142E-4 -3.7829999201E-5 -6.2596000498E-4 -4.0483998600E-4
33-6.2596000498E-4 -3.2734998967E-4 7.7435001731E-4 1.5874400269E-3 2.1750701126E-3 2.5626500137E-3 2.2892199922E-3 1.9755100366E-3 2.2892199922E-3 2.5626500137E-3 2.1750701126E-3 1.5874400269E-3 7.7435001731E-4 -3.2734998967E-4 -6.2596000498E-4
34-3.7829999201E-5 7.7435001731E-4 1.1793200392E-3 1.4050999889E-3 2.2253401112E-3 2.1145299543E-3 3.3578000148E-4 -8.3368999185E-4 3.3578000148E-4 2.1145299543E-3 2.2253401112E-3 1.4050999889E-3 1.1793200392E-3 7.7435001731E-4 -3.7829999201E-5
358.8387000142E-4 1.5874400269E-3 1.4050999889E-3 1.2960999738E-3 -4.9274001503E-4 -3.1295299996E-3 -4.5751798898E-3 -5.1014497876E-3 -4.5751798898E-3 -3.1295299996E-3 -4.9274001503E-4 1.2960999738E-3 1.4050999889E-3 1.5874400269E-3 8.8387000142E-4
361.5450799838E-3 2.1750701126E-3 2.2253401112E-3 -4.9274001503E-4 -6.3222697936E-3 -2.7556000277E-3 5.3632198833E-3 7.3032598011E-3 5.3632198833E-3 -2.7556000277E-3 -6.3222697936E-3 -4.9274001503E-4 2.2253401112E-3 2.1750701126E-3 1.5450799838E-3
371.9235999789E-3 2.5626500137E-3 2.1145299543E-3 -3.1295299996E-3 -2.7556000277E-3 1.3962360099E-2 7.8046298586E-3 -9.3812197447E-3 7.8046298586E-3 1.3962360099E-2 -2.7556000277E-3 -3.1295299996E-3 2.1145299543E-3 2.5626500137E-3 1.9235999789E-3
382.0687500946E-3 2.2892199922E-3 3.3578000148E-4 -4.5751798898E-3 5.3632198833E-3 7.8046298586E-3 -7.9501636326E-2 -0.1554141641 -7.9501636326E-2 7.8046298586E-3 5.3632198833E-3 -4.5751798898E-3 3.3578000148E-4 2.2892199922E-3 2.0687500946E-3
392.0898699295E-3 1.9755100366E-3 -8.3368999185E-4 -5.1014497876E-3 7.3032598011E-3 -9.3812197447E-3 -0.1554141641 0.7303866148 -0.1554141641 -9.3812197447E-3 7.3032598011E-3 -5.1014497876E-3 -8.3368999185E-4 1.9755100366E-3 2.0898699295E-3
402.0687500946E-3 2.2892199922E-3 3.3578000148E-4 -4.5751798898E-3 5.3632198833E-3 7.8046298586E-3 -7.9501636326E-2 -0.1554141641 -7.9501636326E-2 7.8046298586E-3 5.3632198833E-3 -4.5751798898E-3 3.3578000148E-4 2.2892199922E-3 2.0687500946E-3
411.9235999789E-3 2.5626500137E-3 2.1145299543E-3 -3.1295299996E-3 -2.7556000277E-3 1.3962360099E-2 7.8046298586E-3 -9.3812197447E-3 7.8046298586E-3 1.3962360099E-2 -2.7556000277E-3 -3.1295299996E-3 2.1145299543E-3 2.5626500137E-3 1.9235999789E-3
421.5450799838E-3 2.1750701126E-3 2.2253401112E-3 -4.9274001503E-4 -6.3222697936E-3 -2.7556000277E-3 5.3632198833E-3 7.3032598011E-3 5.3632198833E-3 -2.7556000277E-3 -6.3222697936E-3 -4.9274001503E-4 2.2253401112E-3 2.1750701126E-3 1.5450799838E-3
438.8387000142E-4 1.5874400269E-3 1.4050999889E-3 1.2960999738E-3 -4.9274001503E-4 -3.1295299996E-3 -4.5751798898E-3 -5.1014497876E-3 -4.5751798898E-3 -3.1295299996E-3 -4.9274001503E-4 1.2960999738E-3 1.4050999889E-3 1.5874400269E-3 8.8387000142E-4
44-3.7829999201E-5 7.7435001731E-4 1.1793200392E-3 1.4050999889E-3 2.2253401112E-3 2.1145299543E-3 3.3578000148E-4 -8.3368999185E-4 3.3578000148E-4 2.1145299543E-3 2.2253401112E-3 1.4050999889E-3 1.1793200392E-3 7.7435001731E-4 -3.7829999201E-5
45-6.2596000498E-4 -3.2734998967E-4 7.7435001731E-4 1.5874400269E-3 2.1750701126E-3 2.5626500137E-3 2.2892199922E-3 1.9755100366E-3 2.2892199922E-3 2.5626500137E-3 2.1750701126E-3 1.5874400269E-3 7.7435001731E-4 -3.2734998967E-4 -6.2596000498E-4
46-4.0483998600E-4 -6.2596000498E-4 -3.7829999201E-5 8.8387000142E-4 1.5450799838E-3 1.9235999789E-3 2.0687500946E-3 2.0898699295E-3 2.0687500946E-3 1.9235999789E-3 1.5450799838E-3 8.8387000142E-4 -3.7829999201E-5 -6.2596000498E-4 -4.0483998600E-4
47];
48
49lo0filt = [
50-8.7009997515E-5 -1.3542800443E-3 -1.6012600390E-3 -5.0337001448E-4 2.5240099058E-3 -5.0337001448E-4 -1.6012600390E-3 -1.3542800443E-3 -8.7009997515E-5
51-1.3542800443E-3 2.9215801042E-3 7.5227199122E-3 8.2244202495E-3 1.1076199589E-3 8.2244202495E-3 7.5227199122E-3 2.9215801042E-3 -1.3542800443E-3
52-1.6012600390E-3 7.5227199122E-3 -7.0612900890E-3 -3.7694871426E-2 -3.2971370965E-2 -3.7694871426E-2 -7.0612900890E-3 7.5227199122E-3 -1.6012600390E-3
53-5.0337001448E-4 8.2244202495E-3 -3.7694871426E-2 4.3813198805E-2 0.1811603010 4.3813198805E-2 -3.7694871426E-2 8.2244202495E-3 -5.0337001448E-4
542.5240099058E-3 1.1076199589E-3 -3.2971370965E-2 0.1811603010 0.4376249909 0.1811603010 -3.2971370965E-2 1.1076199589E-3 2.5240099058E-3
55-5.0337001448E-4 8.2244202495E-3 -3.7694871426E-2 4.3813198805E-2 0.1811603010 4.3813198805E-2 -3.7694871426E-2 8.2244202495E-3 -5.0337001448E-4
56-1.6012600390E-3 7.5227199122E-3 -7.0612900890E-3 -3.7694871426E-2 -3.2971370965E-2 -3.7694871426E-2 -7.0612900890E-3 7.5227199122E-3 -1.6012600390E-3
57-1.3542800443E-3 2.9215801042E-3 7.5227199122E-3 8.2244202495E-3 1.1076199589E-3 8.2244202495E-3 7.5227199122E-3 2.9215801042E-3 -1.3542800443E-3
58-8.7009997515E-5 -1.3542800443E-3 -1.6012600390E-3 -5.0337001448E-4 2.5240099058E-3 -5.0337001448E-4 -1.6012600390E-3 -1.3542800443E-3 -8.7009997515E-5
59];
60
61lofilt = [
62-4.3500000174E-5 1.2078000145E-4 -6.7714002216E-4 -1.2434000382E-4 -8.0063997302E-4 -1.5970399836E-3 -2.5168000138E-4 -4.2019999819E-4 1.2619999470E-3 -4.2019999819E-4 -2.5168000138E-4 -1.5970399836E-3 -8.0063997302E-4 -1.2434000382E-4 -6.7714002216E-4 1.2078000145E-4 -4.3500000174E-5
631.2078000145E-4 4.4606000301E-4 -5.8146001538E-4 5.6215998484E-4 -1.3688000035E-4 2.3255399428E-3 2.8898599558E-3 4.2872801423E-3 5.5893999524E-3 4.2872801423E-3 2.8898599558E-3 2.3255399428E-3 -1.3688000035E-4 5.6215998484E-4 -5.8146001538E-4 4.4606000301E-4 1.2078000145E-4
64-6.7714002216E-4 -5.8146001538E-4 1.4607800404E-3 2.1605400834E-3 3.7613599561E-3 3.0809799209E-3 4.1121998802E-3 2.2212199401E-3 5.5381999118E-4 2.2212199401E-3 4.1121998802E-3 3.0809799209E-3 3.7613599561E-3 2.1605400834E-3 1.4607800404E-3 -5.8146001538E-4 -6.7714002216E-4
65-1.2434000382E-4 5.6215998484E-4 2.1605400834E-3 3.1757799443E-3 3.1846798956E-3 -1.7774800071E-3 -7.4316998944E-3 -9.0569201857E-3 -9.6372198313E-3 -9.0569201857E-3 -7.4316998944E-3 -1.7774800071E-3 3.1846798956E-3 3.1757799443E-3 2.1605400834E-3 5.6215998484E-4 -1.2434000382E-4
66-8.0063997302E-4 -1.3688000035E-4 3.7613599561E-3 3.1846798956E-3 -3.5306399222E-3 -1.2604200281E-2 -1.8847439438E-2 -1.7508180812E-2 -1.6485679895E-2 -1.7508180812E-2 -1.8847439438E-2 -1.2604200281E-2 -3.5306399222E-3 3.1846798956E-3 3.7613599561E-3 -1.3688000035E-4 -8.0063997302E-4
67-1.5970399836E-3 2.3255399428E-3 3.0809799209E-3 -1.7774800071E-3 -1.2604200281E-2 -2.0229380578E-2 -1.1091699824E-2 3.9556599222E-3 1.4385120012E-2 3.9556599222E-3 -1.1091699824E-2 -2.0229380578E-2 -1.2604200281E-2 -1.7774800071E-3 3.0809799209E-3 2.3255399428E-3 -1.5970399836E-3
68-2.5168000138E-4 2.8898599558E-3 4.1121998802E-3 -7.4316998944E-3 -1.8847439438E-2 -1.1091699824E-2 2.1906599402E-2 6.8065837026E-2 9.0580143034E-2 6.8065837026E-2 2.1906599402E-2 -1.1091699824E-2 -1.8847439438E-2 -7.4316998944E-3 4.1121998802E-3 2.8898599558E-3 -2.5168000138E-4
69-4.2019999819E-4 4.2872801423E-3 2.2212199401E-3 -9.0569201857E-3 -1.7508180812E-2 3.9556599222E-3 6.8065837026E-2 0.1445499808 0.1773651242 0.1445499808 6.8065837026E-2 3.9556599222E-3 -1.7508180812E-2 -9.0569201857E-3 2.2212199401E-3 4.2872801423E-3 -4.2019999819E-4
701.2619999470E-3 5.5893999524E-3 5.5381999118E-4 -9.6372198313E-3 -1.6485679895E-2 1.4385120012E-2 9.0580143034E-2 0.1773651242 0.2120374441 0.1773651242 9.0580143034E-2 1.4385120012E-2 -1.6485679895E-2 -9.6372198313E-3 5.5381999118E-4 5.5893999524E-3 1.2619999470E-3
71-4.2019999819E-4 4.2872801423E-3 2.2212199401E-3 -9.0569201857E-3 -1.7508180812E-2 3.9556599222E-3 6.8065837026E-2 0.1445499808 0.1773651242 0.1445499808 6.8065837026E-2 3.9556599222E-3 -1.7508180812E-2 -9.0569201857E-3 2.2212199401E-3 4.2872801423E-3 -4.2019999819E-4
72-2.5168000138E-4 2.8898599558E-3 4.1121998802E-3 -7.4316998944E-3 -1.8847439438E-2 -1.1091699824E-2 2.1906599402E-2 6.8065837026E-2 9.0580143034E-2 6.8065837026E-2 2.1906599402E-2 -1.1091699824E-2 -1.8847439438E-2 -7.4316998944E-3 4.1121998802E-3 2.8898599558E-3 -2.5168000138E-4
73-1.5970399836E-3 2.3255399428E-3 3.0809799209E-3 -1.7774800071E-3 -1.2604200281E-2 -2.0229380578E-2 -1.1091699824E-2 3.9556599222E-3 1.4385120012E-2 3.9556599222E-3 -1.1091699824E-2 -2.0229380578E-2 -1.2604200281E-2 -1.7774800071E-3 3.0809799209E-3 2.3255399428E-3 -1.5970399836E-3
74-8.0063997302E-4 -1.3688000035E-4 3.7613599561E-3 3.1846798956E-3 -3.5306399222E-3 -1.2604200281E-2 -1.8847439438E-2 -1.7508180812E-2 -1.6485679895E-2 -1.7508180812E-2 -1.8847439438E-2 -1.2604200281E-2 -3.5306399222E-3 3.1846798956E-3 3.7613599561E-3 -1.3688000035E-4 -8.0063997302E-4
75-1.2434000382E-4 5.6215998484E-4 2.1605400834E-3 3.1757799443E-3 3.1846798956E-3 -1.7774800071E-3 -7.4316998944E-3 -9.0569201857E-3 -9.6372198313E-3 -9.0569201857E-3 -7.4316998944E-3 -1.7774800071E-3 3.1846798956E-3 3.1757799443E-3 2.1605400834E-3 5.6215998484E-4 -1.2434000382E-4
76-6.7714002216E-4 -5.8146001538E-4 1.4607800404E-3 2.1605400834E-3 3.7613599561E-3 3.0809799209E-3 4.1121998802E-3 2.2212199401E-3 5.5381999118E-4 2.2212199401E-3 4.1121998802E-3 3.0809799209E-3 3.7613599561E-3 2.1605400834E-3 1.4607800404E-3 -5.8146001538E-4 -6.7714002216E-4
771.2078000145E-4 4.4606000301E-4 -5.8146001538E-4 5.6215998484E-4 -1.3688000035E-4 2.3255399428E-3 2.8898599558E-3 4.2872801423E-3 5.5893999524E-3 4.2872801423E-3 2.8898599558E-3 2.3255399428E-3 -1.3688000035E-4 5.6215998484E-4 -5.8146001538E-4 4.4606000301E-4 1.2078000145E-4
78-4.3500000174E-5 1.2078000145E-4 -6.7714002216E-4 -1.2434000382E-4 -8.0063997302E-4 -1.5970399836E-3 -2.5168000138E-4 -4.2019999819E-4 1.2619999470E-3 -4.2019999819E-4 -2.5168000138E-4 -1.5970399836E-3 -8.0063997302E-4 -1.2434000382E-4 -6.7714002216E-4 1.2078000145E-4 -4.3500000174E-5
79];
80
81bfilts = [...
82-8.1125000725E-4 4.4451598078E-3 1.2316980399E-2 1.3955879956E-2 1.4179450460E-2 1.3955879956E-2 1.2316980399E-2 4.4451598078E-3 -8.1125000725E-4 ...
833.9103501476E-3 4.4565401040E-3 -5.8724298142E-3 -2.8760801069E-3 8.5267601535E-3 -2.8760801069E-3 -5.8724298142E-3 4.4565401040E-3 3.9103501476E-3 ...
841.3462699717E-3 -3.7740699481E-3 8.2581602037E-3 3.9442278445E-2 5.3605638444E-2 3.9442278445E-2 8.2581602037E-3 -3.7740699481E-3 1.3462699717E-3 ...
857.4700999539E-4 -3.6522001028E-4 -2.2522680461E-2 -0.1105690673 -0.1768419296 -0.1105690673 -2.2522680461E-2 -3.6522001028E-4 7.4700999539E-4 ...
860.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 ...
87-7.4700999539E-4 3.6522001028E-4 2.2522680461E-2 0.1105690673 0.1768419296 0.1105690673 2.2522680461E-2 3.6522001028E-4 -7.4700999539E-4 ...
88-1.3462699717E-3 3.7740699481E-3 -8.2581602037E-3 -3.9442278445E-2 -5.3605638444E-2 -3.9442278445E-2 -8.2581602037E-3 3.7740699481E-3 -1.3462699717E-3 ...
89-3.9103501476E-3 -4.4565401040E-3 5.8724298142E-3 2.8760801069E-3 -8.5267601535E-3 2.8760801069E-3 5.8724298142E-3 -4.4565401040E-3 -3.9103501476E-3 ...
908.1125000725E-4 -4.4451598078E-3 -1.2316980399E-2 -1.3955879956E-2 -1.4179450460E-2 -1.3955879956E-2 -1.2316980399E-2 -4.4451598078E-3 8.1125000725E-4; ...
91...
920.0000000000 -8.2846998703E-4 -5.7109999034E-5 4.0110000555E-5 4.6670897864E-3 8.0871898681E-3 1.4807609841E-2 8.6204400286E-3 -3.1221499667E-3 ...
938.2846998703E-4 0.0000000000 -9.7479997203E-4 -6.9718998857E-3 -2.0865600090E-3 2.3298799060E-3 -4.4814897701E-3 1.4917500317E-2 8.6204400286E-3 ...
945.7109999034E-5 9.7479997203E-4 0.0000000000 -1.2145539746E-2 -2.4427289143E-2 5.0797060132E-2 3.2785870135E-2 -4.4814897701E-3 1.4807609841E-2 ...
95-4.0110000555E-5 6.9718998857E-3 1.2145539746E-2 0.0000000000 -0.1510555595 -8.2495503128E-2 5.0797060132E-2 2.3298799060E-3 8.0871898681E-3 ...
96-4.6670897864E-3 2.0865600090E-3 2.4427289143E-2 0.1510555595 0.0000000000 -0.1510555595 -2.4427289143E-2 -2.0865600090E-3 4.6670897864E-3 ...
97-8.0871898681E-3 -2.3298799060E-3 -5.0797060132E-2 8.2495503128E-2 0.1510555595 0.0000000000 -1.2145539746E-2 -6.9718998857E-3 4.0110000555E-5 ...
98-1.4807609841E-2 4.4814897701E-3 -3.2785870135E-2 -5.0797060132E-2 2.4427289143E-2 1.2145539746E-2 0.0000000000 -9.7479997203E-4 -5.7109999034E-5 ...
99-8.6204400286E-3 -1.4917500317E-2 4.4814897701E-3 -2.3298799060E-3 2.0865600090E-3 6.9718998857E-3 9.7479997203E-4 0.0000000000 -8.2846998703E-4 ...
1003.1221499667E-3 -8.6204400286E-3 -1.4807609841E-2 -8.0871898681E-3 -4.6670897864E-3 -4.0110000555E-5 5.7109999034E-5 8.2846998703E-4 0.0000000000; ...
101...
1028.1125000725E-4 -3.9103501476E-3 -1.3462699717E-3 -7.4700999539E-4 0.0000000000 7.4700999539E-4 1.3462699717E-3 3.9103501476E-3 -8.1125000725E-4 ...
103-4.4451598078E-3 -4.4565401040E-3 3.7740699481E-3 3.6522001028E-4 0.0000000000 -3.6522001028E-4 -3.7740699481E-3 4.4565401040E-3 4.4451598078E-3 ...
104-1.2316980399E-2 5.8724298142E-3 -8.2581602037E-3 2.2522680461E-2 0.0000000000 -2.2522680461E-2 8.2581602037E-3 -5.8724298142E-3 1.2316980399E-2 ...
105-1.3955879956E-2 2.8760801069E-3 -3.9442278445E-2 0.1105690673 0.0000000000 -0.1105690673 3.9442278445E-2 -2.8760801069E-3 1.3955879956E-2 ...
106-1.4179450460E-2 -8.5267601535E-3 -5.3605638444E-2 0.1768419296 0.0000000000 -0.1768419296 5.3605638444E-2 8.5267601535E-3 1.4179450460E-2 ...
107-1.3955879956E-2 2.8760801069E-3 -3.9442278445E-2 0.1105690673 0.0000000000 -0.1105690673 3.9442278445E-2 -2.8760801069E-3 1.3955879956E-2 ...
108-1.2316980399E-2 5.8724298142E-3 -8.2581602037E-3 2.2522680461E-2 0.0000000000 -2.2522680461E-2 8.2581602037E-3 -5.8724298142E-3 1.2316980399E-2 ...
109-4.4451598078E-3 -4.4565401040E-3 3.7740699481E-3 3.6522001028E-4 0.0000000000 -3.6522001028E-4 -3.7740699481E-3 4.4565401040E-3 4.4451598078E-3 ...
1108.1125000725E-4 -3.9103501476E-3 -1.3462699717E-3 -7.4700999539E-4 0.0000000000 7.4700999539E-4 1.3462699717E-3 3.9103501476E-3 -8.1125000725E-4; ...
111...
1123.1221499667E-3 -8.6204400286E-3 -1.4807609841E-2 -8.0871898681E-3 -4.6670897864E-3 -4.0110000555E-5 5.7109999034E-5 8.2846998703E-4 0.0000000000 ...
113-8.6204400286E-3 -1.4917500317E-2 4.4814897701E-3 -2.3298799060E-3 2.0865600090E-3 6.9718998857E-3 9.7479997203E-4 -0.0000000000 -8.2846998703E-4 ...
114-1.4807609841E-2 4.4814897701E-3 -3.2785870135E-2 -5.0797060132E-2 2.4427289143E-2 1.2145539746E-2 0.0000000000 -9.7479997203E-4 -5.7109999034E-5 ...
115-8.0871898681E-3 -2.3298799060E-3 -5.0797060132E-2 8.2495503128E-2 0.1510555595 -0.0000000000 -1.2145539746E-2 -6.9718998857E-3 4.0110000555E-5 ...
116-4.6670897864E-3 2.0865600090E-3 2.4427289143E-2 0.1510555595 0.0000000000 -0.1510555595 -2.4427289143E-2 -2.0865600090E-3 4.6670897864E-3 ...
117-4.0110000555E-5 6.9718998857E-3 1.2145539746E-2 0.0000000000 -0.1510555595 -8.2495503128E-2 5.0797060132E-2 2.3298799060E-3 8.0871898681E-3 ...
1185.7109999034E-5 9.7479997203E-4 -0.0000000000 -1.2145539746E-2 -2.4427289143E-2 5.0797060132E-2 3.2785870135E-2 -4.4814897701E-3 1.4807609841E-2 ...
1198.2846998703E-4 -0.0000000000 -9.7479997203E-4 -6.9718998857E-3 -2.0865600090E-3 2.3298799060E-3 -4.4814897701E-3 1.4917500317E-2 8.6204400286E-3 ...
1200.0000000000 -8.2846998703E-4 -5.7109999034E-5 4.0110000555E-5 4.6670897864E-3 8.0871898681E-3 1.4807609841E-2 8.6204400286E-3 -3.1221499667E-3 ...
121]';
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/sp5Filters.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/sp5Filters.m
deleted file mode 100755
index 4cddcfd..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/sp5Filters.m
+++ /dev/null
@@ -1,110 +0,0 @@
1% Steerable pyramid filters. Transform described in:
2%
3% @INPROCEEDINGS{Simoncelli95b,
4% TITLE = "The Steerable Pyramid: A Flexible Architecture for
5% Multi-Scale Derivative Computation",
6% AUTHOR = "E P Simoncelli and W T Freeman",
7% BOOKTITLE = "Second Int'l Conf on Image Processing",
8% ADDRESS = "Washington, DC", MONTH = "October", YEAR = 1995 }
9%
10% Filter kernel design described in:
11%
12%@INPROCEEDINGS{Karasaridis96,
13% TITLE = "A Filter Design Technique for
14% Steerable Pyramid Image Transforms",
15% AUTHOR = "A Karasaridis and E P Simoncelli",
16% BOOKTITLE = "ICASSP", ADDRESS = "Atlanta, GA",
17% MONTH = "May", YEAR = 1996 }
18
19% Eero Simoncelli, 6/96.
20
21function [lo0filt,hi0filt,lofilt,bfilts,mtx,harmonics] = sp5Filters();
22
23harmonics = [1 3 5];
24
25mtx = [ ...
26 0.3333 0.2887 0.1667 0.0000 -0.1667 -0.2887
27 0.0000 0.1667 0.2887 0.3333 0.2887 0.1667
28 0.3333 -0.0000 -0.3333 -0.0000 0.3333 -0.0000
29 0.0000 0.3333 0.0000 -0.3333 0.0000 0.3333
30 0.3333 -0.2887 0.1667 -0.0000 -0.1667 0.2887
31 -0.0000 0.1667 -0.2887 0.3333 -0.2887 0.1667];
32
33hi0filt = [
34-0.00033429 -0.00113093 -0.00171484 -0.00133542 -0.00080639 -0.00133542 -0.00171484 -0.00113093 -0.00033429
35-0.00113093 -0.00350017 -0.00243812 0.00631653 0.01261227 0.00631653 -0.00243812 -0.00350017 -0.00113093
36-0.00171484 -0.00243812 -0.00290081 -0.00673482 -0.00981051 -0.00673482 -0.00290081 -0.00243812 -0.00171484
37-0.00133542 0.00631653 -0.00673482 -0.07027679 -0.11435863 -0.07027679 -0.00673482 0.00631653 -0.00133542
38-0.00080639 0.01261227 -0.00981051 -0.11435863 0.81380200 -0.11435863 -0.00981051 0.01261227 -0.00080639
39-0.00133542 0.00631653 -0.00673482 -0.07027679 -0.11435863 -0.07027679 -0.00673482 0.00631653 -0.00133542
40-0.00171484 -0.00243812 -0.00290081 -0.00673482 -0.00981051 -0.00673482 -0.00290081 -0.00243812 -0.00171484
41-0.00113093 -0.00350017 -0.00243812 0.00631653 0.01261227 0.00631653 -0.00243812 -0.00350017 -0.00113093
42-0.00033429 -0.00113093 -0.00171484 -0.00133542 -0.00080639 -0.00133542 -0.00171484 -0.00113093 -0.00033429];
43
44
45lo0filt = [
460.00341614 -0.01551246 -0.03848215 -0.01551246 0.00341614
47-0.01551246 0.05586982 0.15925570 0.05586982 -0.01551246
48-0.03848215 0.15925570 0.40304148 0.15925570 -0.03848215
49-0.01551246 0.05586982 0.15925570 0.05586982 -0.01551246
500.00341614 -0.01551246 -0.03848215 -0.01551246 0.00341614];
51
52lofilt = 2*[
530.00085404 -0.00244917 -0.00387812 -0.00944432 -0.00962054 -0.00944432 -0.00387812 -0.00244917 0.00085404
54-0.00244917 -0.00523281 -0.00661117 0.00410600 0.01002988 0.00410600 -0.00661117 -0.00523281 -0.00244917
55-0.00387812 -0.00661117 0.01396746 0.03277038 0.03981393 0.03277038 0.01396746 -0.00661117 -0.00387812
56-0.00944432 0.00410600 0.03277038 0.06426333 0.08169618 0.06426333 0.03277038 0.00410600 -0.00944432
57-0.00962054 0.01002988 0.03981393 0.08169618 0.10096540 0.08169618 0.03981393 0.01002988 -0.00962054
58-0.00944432 0.00410600 0.03277038 0.06426333 0.08169618 0.06426333 0.03277038 0.00410600 -0.00944432
59-0.00387812 -0.00661117 0.01396746 0.03277038 0.03981393 0.03277038 0.01396746 -0.00661117 -0.00387812
60-0.00244917 -0.00523281 -0.00661117 0.00410600 0.01002988 0.00410600 -0.00661117 -0.00523281 -0.00244917
610.00085404 -0.00244917 -0.00387812 -0.00944432 -0.00962054 -0.00944432 -0.00387812 -0.00244917 0.00085404];
62
63bfilts = [...
64 0.00277643 0.00496194 0.01026699 0.01455399 0.01026699 0.00496194 0.00277643 ...
65-0.00986904 -0.00893064 0.01189859 0.02755155 0.01189859 -0.00893064 -0.00986904 ...
66-0.01021852 -0.03075356 -0.08226445 -0.11732297 -0.08226445 -0.03075356 -0.01021852 ...
67 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 ...
68 0.01021852 0.03075356 0.08226445 0.11732297 0.08226445 0.03075356 0.01021852 ...
69 0.00986904 0.00893064 -0.01189859 -0.02755155 -0.01189859 0.00893064 0.00986904 ...
70-0.00277643 -0.00496194 -0.01026699 -0.01455399 -0.01026699 -0.00496194 -0.00277643;
71...
72-0.00343249 -0.00640815 -0.00073141 0.01124321 0.00182078 0.00285723 0.01166982 ...
73-0.00358461 -0.01977507 -0.04084211 -0.00228219 0.03930573 0.01161195 0.00128000 ...
74 0.01047717 0.01486305 -0.04819057 -0.12227230 -0.05394139 0.00853965 -0.00459034 ...
75 0.00790407 0.04435647 0.09454202 -0.00000000 -0.09454202 -0.04435647 -0.00790407 ...
76 0.00459034 -0.00853965 0.05394139 0.12227230 0.04819057 -0.01486305 -0.01047717 ...
77-0.00128000 -0.01161195 -0.03930573 0.00228219 0.04084211 0.01977507 0.00358461 ...
78-0.01166982 -0.00285723 -0.00182078 -0.01124321 0.00073141 0.00640815 0.00343249;
79...
80 0.00343249 0.00358461 -0.01047717 -0.00790407 -0.00459034 0.00128000 0.01166982 ...
81 0.00640815 0.01977507 -0.01486305 -0.04435647 0.00853965 0.01161195 0.00285723 ...
82 0.00073141 0.04084211 0.04819057 -0.09454202 -0.05394139 0.03930573 0.00182078 ...
83-0.01124321 0.00228219 0.12227230 -0.00000000 -0.12227230 -0.00228219 0.01124321 ...
84-0.00182078 -0.03930573 0.05394139 0.09454202 -0.04819057 -0.04084211 -0.00073141 ...
85-0.00285723 -0.01161195 -0.00853965 0.04435647 0.01486305 -0.01977507 -0.00640815 ...
86-0.01166982 -0.00128000 0.00459034 0.00790407 0.01047717 -0.00358461 -0.00343249;
87...
88-0.00277643 0.00986904 0.01021852 -0.00000000 -0.01021852 -0.00986904 0.00277643 ...
89-0.00496194 0.00893064 0.03075356 -0.00000000 -0.03075356 -0.00893064 0.00496194 ...
90-0.01026699 -0.01189859 0.08226445 -0.00000000 -0.08226445 0.01189859 0.01026699 ...
91-0.01455399 -0.02755155 0.11732297 -0.00000000 -0.11732297 0.02755155 0.01455399 ...
92-0.01026699 -0.01189859 0.08226445 -0.00000000 -0.08226445 0.01189859 0.01026699 ...
93-0.00496194 0.00893064 0.03075356 -0.00000000 -0.03075356 -0.00893064 0.00496194 ...
94-0.00277643 0.00986904 0.01021852 -0.00000000 -0.01021852 -0.00986904 0.00277643;
95...
96-0.01166982 -0.00128000 0.00459034 0.00790407 0.01047717 -0.00358461 -0.00343249 ...
97-0.00285723 -0.01161195 -0.00853965 0.04435647 0.01486305 -0.01977507 -0.00640815 ...
98-0.00182078 -0.03930573 0.05394139 0.09454202 -0.04819057 -0.04084211 -0.00073141 ...
99-0.01124321 0.00228219 0.12227230 -0.00000000 -0.12227230 -0.00228219 0.01124321 ...
100 0.00073141 0.04084211 0.04819057 -0.09454202 -0.05394139 0.03930573 0.00182078 ...
101 0.00640815 0.01977507 -0.01486305 -0.04435647 0.00853965 0.01161195 0.00285723 ...
102 0.00343249 0.00358461 -0.01047717 -0.00790407 -0.00459034 0.00128000 0.01166982;
103...
104-0.01166982 -0.00285723 -0.00182078 -0.01124321 0.00073141 0.00640815 0.00343249 ...
105-0.00128000 -0.01161195 -0.03930573 0.00228219 0.04084211 0.01977507 0.00358461 ...
106 0.00459034 -0.00853965 0.05394139 0.12227230 0.04819057 -0.01486305 -0.01047717 ...
107 0.00790407 0.04435647 0.09454202 -0.00000000 -0.09454202 -0.04435647 -0.00790407 ...
108 0.01047717 0.01486305 -0.04819057 -0.12227230 -0.05394139 0.00853965 -0.00459034 ...
109-0.00358461 -0.01977507 -0.04084211 -0.00228219 0.03930573 0.01161195 0.00128000 ...
110-0.00343249 -0.00640815 -0.00073141 0.01124321 0.00182078 0.00285723 0.01166982]';
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/spyrBand.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/spyrBand.m
deleted file mode 100755
index 474a8dc..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/spyrBand.m
+++ /dev/null
@@ -1,34 +0,0 @@
1% [LEV,IND] = spyrBand(PYR,INDICES,LEVEL,BAND)
2%
3% Access a band from a steerable pyramid.
4%
5% LEVEL indicates the scale (finest = 1, coarsest = spyrHt(INDICES)).
6%
7% BAND (optional, default=1) indicates which subband
8% (1 = vertical, rest proceeding anti-clockwise).
9
10% Eero Simoncelli, 6/96.
11
12function res = spyrBand(pyr,pind,level,band)
13
14if (exist('level') ~= 1)
15 level = 1;
16end
17
18if (exist('band') ~= 1)
19 band = 1;
20end
21
22nbands = spyrNumBands(pind);
23if ((band > nbands) | (band < 1))
24 error(sprintf('Bad band number (%d) should be in range [1,%d].', band, nbands));
25end
26
27maxLev = spyrHt(pind);
28if ((level > maxLev) | (level < 1))
29 error(sprintf('Bad level number (%d), should be in range [1,%d].', level, maxLev));
30end
31
32firstband = 1 + band + nbands*(level-1);
33res = pyrBand(pyr, pind, firstband);
34
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/spyrHigh.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/spyrHigh.m
deleted file mode 100755
index f91b466..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/spyrHigh.m
+++ /dev/null
@@ -1,10 +0,0 @@
1% RES = spyrHigh(PYR, INDICES)
2%
3% Access the highpass residual band from a steerable pyramid.
4
5% Eero Simoncelli, 6/96.
6
7function res = spyrHigh(pyr,pind)
8
9res = pyrBand(pyr, pind, 1);
10
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/spyrHt.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/spyrHt.m
deleted file mode 100755
index 8706b9e..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/spyrHt.m
+++ /dev/null
@@ -1,16 +0,0 @@
1% [HEIGHT] = spyrHt(INDICES)
2%
3% Compute height of steerable pyramid with given index matrix.
4
5% Eero Simoncelli, 6/96.
6
7function [ht] = spyrHt(pind)
8
9nbands = spyrNumBands(pind);
10
11% Don't count lowpass, or highpass residual bands
12if (size(pind,1) > 2)
13 ht = (size(pind,1)-2)/nbands;
14else
15 ht = 0;
16end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/spyrLev.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/spyrLev.m
deleted file mode 100755
index 5cb4a85..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/spyrLev.m
+++ /dev/null
@@ -1,24 +0,0 @@
1% [LEV,IND] = spyrLev(PYR,INDICES,LEVEL)
2%
3% Access a level from a steerable pyramid.
4% Return as an SxB matrix, B = number of bands, S = total size of a band.
5% Also returns an Bx2 matrix containing dimensions of the subbands.
6
7% Eero Simoncelli, 6/96.
8
9function [lev,ind] = spyrLev(pyr,pind,level)
10
11nbands = spyrNumBands(pind);
12
13if ((level > spyrHt(pind)) | (level < 1))
14 error(sprintf('Level number must be in the range [1, %d].', spyrHt(pind)));
15end
16
17firstband = 2 + nbands*(level-1);
18firstind = 1;
19for l=1:firstband-1
20 firstind = firstind + prod(pind(l,:));
21end
22
23ind = pind(firstband:firstband+nbands-1,:);
24lev = pyr(firstind:firstind+sum(prod(ind'))-1);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/spyrNumBands.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/spyrNumBands.m
deleted file mode 100755
index 68aec3f..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/spyrNumBands.m
+++ /dev/null
@@ -1,20 +0,0 @@
1% [NBANDS] = spyrNumBands(INDICES)
2%
3% Compute number of orientation bands in a steerable pyramid with
4% given index matrix. If the pyramid contains only the highpass and
5% lowpass bands (i.e., zero levels), returns 0.
6
7% Eero Simoncelli, 2/97.
8
9function [nbands] = spyrNumBands(pind)
10
11if (size(pind,1) == 2)
12 nbands = 0;
13else
14 % Count number of orientation bands:
15 b = 3;
16 while ((b <= size(pind,1)) & all( pind(b,:) == pind(2,:)) )
17 b = b+1;
18 end
19 nbands = b-2;
20end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/steer.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/steer.m
deleted file mode 100755
index 8f9c2ac..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/steer.m
+++ /dev/null
@@ -1,68 +0,0 @@
1% RES = STEER(BASIS, ANGLE, HARMONICS, STEERMTX)
2%
3% Steer BASIS to the specfied ANGLE.
4%
5% BASIS should be a matrix whose columns are vectorized rotated copies of a
6% steerable function, or the responses of a set of steerable filters.
7%
8% ANGLE can be a scalar, or a column vector the size of the basis.
9%
10% HARMONICS (optional, default is N even or odd low frequencies, as for
11% derivative filters) should be a list of harmonic numbers indicating
12% the angular harmonic content of the basis.
13%
14% STEERMTX (optional, default assumes cosine phase harmonic components,
15% and filter positions at 2pi*n/N) should be a matrix which maps
16% the filters onto Fourier series components (ordered [cos0 cos1 sin1
17% cos2 sin2 ... sinN]). See steer2HarmMtx.m
18
19% Eero Simoncelli, 7/96.
20
21function res = steer(basis,angle,harmonics,steermtx)
22
23num = size(basis,2);
24
25if ( any(size(angle) ~= [size(basis,1) 1]) & any(size(angle) ~= [1 1]) )
26 error('ANGLE must be a scalar, or a column vector the size of the basis elements');
27end
28
29%% If HARMONICS are not passed, assume derivatives.
30if (exist('harmonics') ~= 1)
31 if (mod(num,2) == 0)
32 harmonics = [0:(num/2)-1]'*2 + 1;
33 else
34 harmonics = [0:(num-1)/2]'*2;
35 end
36else
37 harmonics = harmonics(:);
38 if ((2*size(harmonics,1)-any(harmonics == 0)) ~= num)
39 error('harmonics list is incompatible with basis size');
40 end
41end
42
43%% If STEERMTX not passed, assume evenly distributed cosine-phase filters:
44if (exist('steermtx') ~= 1)
45 steermtx = steer2HarmMtx(harmonics, pi*[0:num-1]/num, 'even');
46end
47
48steervect = zeros(size(angle,1),num);
49arg = angle * harmonics(find(harmonics~=0))';
50if (all(harmonics))
51 steervect(:, 1:2:num) = cos(arg);
52 steervect(:, 2:2:num) = sin(arg);
53else
54 steervect(:, 1) = ones(size(arg,1),1);
55 steervect(:, 2:2:num) = cos(arg);
56 steervect(:, 3:2:num) = sin(arg);
57end
58
59steervect = steervect * steermtx;
60
61if (size(steervect,1) > 1)
62 tmp = basis' .* steervect';
63 res = sum(tmp)';
64else
65 res = basis * steervect';
66end
67
68
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/steer2HarmMtx.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/steer2HarmMtx.m
deleted file mode 100755
index 1f3e80e..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/steer2HarmMtx.m
+++ /dev/null
@@ -1,71 +0,0 @@
1% MTX = steer2HarmMtx(HARMONICS, ANGLES, REL_PHASES)
2%
3% Compute a steering matrix (maps a directional basis set onto the
4% angular Fourier harmonics). HARMONICS is a vector specifying the
5% angular harmonics contained in the steerable basis/filters. ANGLES
6% (optional) is a vector specifying the angular position of each filter.
7% REL_PHASES (optional, default = 'even') specifies whether the harmonics
8% are cosine or sine phase aligned about those positions.
9% The result matrix is suitable for passing to the function STEER.
10
11% Eero Simoncelli, 7/96.
12
13function mtx = steer2HarmMtx(harmonics, angles, evenorodd)
14
15%%=================================================================
16%%% Optional Parameters:
17
18if (exist('evenorodd') ~= 1)
19 evenorodd = 'even';
20end
21
22% Make HARMONICS a row vector
23harmonics = harmonics(:)';
24
25numh = 2*size(harmonics,2) - any(harmonics == 0);
26
27if (exist('angles') ~= 1)
28 angles = pi * [0:numh-1]'/numh;
29else
30 angles = angles(:);
31end
32
33%%=================================================================
34
35if isstr(evenorodd)
36 if strcmp(evenorodd,'even')
37 evenorodd = 0;
38 elseif strcmp(evenorodd,'odd')
39 evenorodd = 1;
40 else
41 error('EVEN_OR_ODD should be the string EVEN or ODD');
42 end
43end
44
45%% Compute inverse matrix, which maps Fourier components onto
46%% steerable basis.
47imtx = zeros(size(angles,1),numh);
48col = 1;
49for h=harmonics
50 args = h*angles;
51 if (h == 0)
52 imtx(:,col) = ones(size(angles));
53 col = col+1;
54 elseif evenorodd
55 imtx(:,col) = sin(args);
56 imtx(:,col+1) = -cos(args);
57 col = col+2;
58 else
59 imtx(:,col) = cos(args);
60 imtx(:,col+1) = sin(args);
61 col = col+2;
62 end
63end
64
65r = rank(imtx);
66if (( r ~= numh ) & ( r ~= size(angles,1) ))
67 fprintf(2,'WARNING: matrix is not full rank');
68end
69
70mtx = pinv(imtx);
71
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/subMtx.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/subMtx.m
deleted file mode 100755
index ea3c2ea..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/subMtx.m
+++ /dev/null
@@ -1,21 +0,0 @@
1% MTX = subMtx(VEC, DIMENSIONS, START_INDEX)
2%
3% Reshape a portion of VEC starting from START_INDEX (optional,
4% default=1) to the given dimensions.
5
6% Eero Simoncelli, 6/96.
7
8function mtx = subMtx(vec, sz, offset)
9
10if (exist('offset') ~= 1)
11 offset = 1;
12end
13
14vec = vec(:);
15sz = sz(:);
16
17if (size(sz,1) ~= 2)
18 error('DIMENSIONS must be a 2-vector.');
19end
20
21mtx = reshape( vec(offset:offset+prod(sz)-1), sz(1), sz(2) );
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/textureAnalysis.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/textureAnalysis.m
deleted file mode 100755
index d7a0ec1..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/textureAnalysis.m
+++ /dev/null
@@ -1,245 +0,0 @@
1function [params] = textureAnalysis(im0, Nsc, Nor, Na)
2
3% Analyze texture for application of Portilla-Simoncelli model/algorithm.
4%
5% [params] = textureAnalysis(im0, Nsc, Nor, Na);
6% im0: original image
7% Nsc: number of scales
8% Nor: number of orientations
9% Na: spatial neighborhood considered (Na x Na)
10%
11% Example: Nsc=4; Nor=4; Na=7;
12%
13% See also textureSynthesis.
14
15% Javier Portilla and Eero Simoncelli.
16% Work described in:
17% "A Parametric Texture Model based on Joint Statistics of Complex Wavelet Coefficients".
18% J Portilla and E P Simoncelli. Int'l Journal of Computer Vision,
19% vol.40(1), pp. 49-71, Dec 2000.
20%
21% Please refer to this publication if you use the program for research or
22% for technical applications. Thank you.
23%
24% Copyright, Center for Neural Science, New York University, January 2001.
25% All rights reserved.
26
27
28%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
29
30Warn = 0; % Set to 1 if you want to see warning messages
31
32%% Check required args are passed
33if (nargin < 4)
34 error('Function called with too few input arguments');
35end
36
37%% 1D interpolation filter, for scale cross-correlations:
38interp = [-1/16 0 9/16 1 9/16 0 -1/16]/sqrt(2);
39
40if ( mod(Na,2) == 0 )
41 error('Na is not an odd integer');
42end
43
44%% If the spatial neighborhood Na is too big for the lower scales,
45%% "modacor22.m" will make it as big as the spatial support at
46%% each scale:
47
48[Ny,Nx] = size(im0);
49nth = log2(min(Ny,Nx)/Na);
50if nth<Nsc & Warn,
51 fprintf(1,'Warning: Na will be cut off for levels above #%d !\n', floor(nth+1));
52end
53
54%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
55
56la = floor((Na-1)/2);
57
58%% Pixel statistics
59[mn0 mx0] = size(im0);
60mean0 = mean2(im0);
61var0 = var2(im0, mean0);
62skew0 = skew2(im0, mean0, var0);
63kurt0 = kurt2(im0, mean0, var0);
64statg0 = [mean0 var0 skew0 kurt0 mn0 mx0];
65
66% Add a little bit of noise to the original, in case it has been
67% artificially generated, to avoid instability crated by symmetric
68% conditions at the synthesis stage.
69
70%im0 = im0 + (mx0-mn0)/1000*randn(size(im0)); %kvs
71
72%% Build the steerable pyramid
73[pyr0,pind0] = buildSCFpyr(im0,Nsc,Nor-1);
74
75if ( any(vector(mod(pind0,2))) )
76 error('Algorithm will fail: Some bands have odd dimensions!');
77end
78
79%% Subtract mean of lowBand:
80nband = size(pind0,1);
81pyr0(pyrBandIndices(pind0,nband)) = ...
82 real(pyrBand(pyr0,pind0,nband)) - mean2(real(pyrBand(pyr0,pind0,nband)));
83
84rpyr0 = real(pyr0);
85apyr0 = abs(pyr0);
86
87figure(gcf)
88clf
89showIm(im0,'auto',1); title('Original'); drawnow
90
91%% Subtract mean of magnitude:
92magMeans0 = zeros(size(pind0,1), 1);
93for nband = 1:size(pind0,1)
94 indices = pyrBandIndices(pind0,nband);
95 magMeans0(nband) = mean2(apyr0(indices));
96 apyr0(indices) = apyr0(indices) - magMeans0(nband);
97end
98
99%% Compute central autoCorr of lowband
100acr = NaN * ones(Na,Na,Nsc+1);
101nband = size(pind0,1);
102ch = pyrBand(pyr0,pind0,nband);
103[mpyr,mpind] = buildSFpyr(real(ch),0,0);
104im = pyrBand(mpyr,mpind,2);
105[Nly Nlx] = size(ch);
106Sch = min(Nly,Nlx); %size of low band
107le = min(Sch/2-1,la);
108cy = Nly/2+1;
109cx = Nlx/2+1;
110ac = fftshift(real(ifft2(abs(fft2(im)).^2)))/prod(size(ch));
111ac = ac(cy-le:cy+le,cx-le:cx+le);
112acr(la-le+1:la+le+1,la-le+1:la+le+1,Nsc+1) = ac;
113skew0p = zeros(Nsc+1,1);
114kurt0p = zeros(Nsc+1,1);
115vari = ac(le+1,le+1);
116if vari/var0 > 1e-6,
117 skew0p(Nsc+1) = mean2(im.^3)/vari^1.5;
118 kurt0p(Nsc+1) = mean2(im.^4)/vari^2;
119else
120 skew0p(Nsc+1) = 0;
121 kurt0p(Nsc+1) = 3;
122end
123
124%% Compute central autoCorr of each Mag band, and the autoCorr of the
125%% combined (non-oriented) band.
126ace = NaN * ones(Na,Na,Nsc,Nor);
127for nsc = Nsc:-1:1,
128 for nor = 1:Nor,
129 nband = (nsc-1)*Nor+nor+1;
130 ch = pyrBand(apyr0,pind0,nband);
131 [Nly, Nlx] = size(ch);
132 Sch = min(Nlx, Nly);
133 le = min(Sch/2-1,la);
134 cx = Nlx/2+1; %Assumes Nlx even
135 cy = Nly/2+1;
136 ac = fftshift(real(ifft2(abs(fft2(ch)).^2)))/prod(size(ch));
137 ac = ac(cy-le:cy+le,cx-le:cx+le);
138 ace(la-le+1:la+le+1,la-le+1:la+le+1,nsc,nor) = ac;
139 end
140
141 %% Combine ori bands
142
143 bandNums = [1:Nor] + (nsc-1)*Nor+1; %ori bands only
144 ind1 = pyrBandIndices(pind0, bandNums(1));
145 indN = pyrBandIndices(pind0, bandNums(Nor));
146 bandInds = [ind1(1):indN(length(indN))];
147 %% Make fake pyramid, containing dummy hi, ori, lo
148 fakePind = [pind0(bandNums(1),:);pind0(bandNums(1):bandNums(Nor)+1,:)];
149 fakePyr = [zeros(prod(fakePind(1,:)),1);...
150 rpyr0(bandInds); zeros(prod(fakePind(size(fakePind,1),:)),1);];
151 ch = reconSFpyr(fakePyr, fakePind, [1]); % recon ori bands only
152 im = real(expand(im,2))/4;
153 im = im + ch;
154 ac = fftshift(real(ifft2(abs(fft2(im)).^2)))/prod(size(ch));
155 ac = ac(cy-le:cy+le,cx-le:cx+le);
156 acr(la-le+1:la+le+1,la-le+1:la+le+1,nsc) = ac;
157 vari = ac(le+1,le+1);
158 if vari/var0 > 1e-6,
159 skew0p(nsc) = mean2(im.^3)/vari^1.5;
160 kurt0p(nsc) = mean2(im.^4)/vari^2;
161 else
162 skew0p(nsc) = 0;
163 kurt0p(nsc) = 3;
164 end
165end
166
167%% Compute the cross-correlation matrices of the coefficient magnitudes
168%% pyramid at the different levels and orientations
169
170C0 = zeros(Nor,Nor,Nsc+1);
171Cx0 = zeros(Nor,Nor,Nsc);
172
173Cr0 = zeros(2*Nor,2*Nor,Nsc+1);
174Crx0 = zeros(2*Nor,2*Nor,Nsc);
175
176for nsc = 1:Nsc,
177 firstBnum = (nsc-1)*Nor+2;
178 cousinSz = prod(pind0(firstBnum,:));
179 ind = pyrBandIndices(pind0,firstBnum);
180 cousinInd = ind(1) + [0:Nor*cousinSz-1];
181
182 if (nsc<Nsc)
183 parents = zeros(cousinSz,Nor);
184 rparents = zeros(cousinSz,Nor*2);
185 for nor=1:Nor,
186 nband = (nsc-1+1)*Nor+nor+1;
187
188 tmp = expand(pyrBand(pyr0, pind0, nband),2)/4;
189 rtmp = real(tmp); itmp = imag(tmp);
190 %% Double phase:
191 tmp = sqrt(rtmp.^2 + itmp.^2) .* exp(2 * sqrt(-1) * atan2(rtmp,itmp));
192 rparents(:,nor) = vector(real(tmp));
193 rparents(:,Nor+nor) = vector(imag(tmp));
194
195 tmp = abs(tmp);
196 parents(:,nor) = vector(tmp - mean2(tmp));
197 end
198 else
199 tmp = real(expand(pyrLow(rpyr0,pind0),2))/4;
200 rparents = [vector(tmp),...
201 vector(shift(tmp,[0 1])), vector(shift(tmp,[0 -1])), ...
202 vector(shift(tmp,[1 0])), vector(shift(tmp,[-1 0]))];
203 parents = [];
204 end
205
206 cousins = reshape(apyr0(cousinInd), [cousinSz Nor]);
207 nc = size(cousins,2); np = size(parents,2);
208 C0(1:nc,1:nc,nsc) = innerProd(cousins)/cousinSz;
209 if (np > 0)
210 Cx0(1:nc,1:np,nsc) = (cousins'*parents)/cousinSz;
211 if (nsc==Nsc)
212 C0(1:np,1:np,Nsc+1) = innerProd(parents)/(cousinSz/4);
213 end
214 end
215
216 cousins = reshape(real(pyr0(cousinInd)), [cousinSz Nor]);
217 nrc = size(cousins,2); nrp = size(rparents,2);
218 Cr0(1:nrc,1:nrc,nsc) = innerProd(cousins)/cousinSz;
219 if (nrp > 0)
220 Crx0(1:nrc,1:nrp,nsc) = (cousins'*rparents)/cousinSz;
221 if (nsc==Nsc)
222 Cr0(1:nrp,1:nrp,Nsc+1) = innerProd(rparents)/(cousinSz/4);
223 end
224 end
225end
226
227%% Calculate the mean, range and variance of the LF and HF residuals' energy.
228
229channel = pyr0(pyrBandIndices(pind0,1));
230vHPR0 = mean2(channel.^2);
231
232statsLPim = [skew0p kurt0p];
233
234params = struct('pixelStats', statg0, ...
235 'pixelLPStats', statsLPim, ...
236 'autoCorrReal', acr, ...
237 'autoCorrMag', ace, ...
238 'magMeans', magMeans0, ...
239 'cousinMagCorr', C0, ...
240 'parentMagCorr', Cx0, ...
241 'cousinRealCorr', Cr0, ...
242 'parentRealCorr', Crx0, ...
243 'varianceHPR', vHPR0);
244
245
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/textureSynthesis.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/textureSynthesis.m
deleted file mode 100755
index 38fce5a..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/textureSynthesis.m
+++ /dev/null
@@ -1,436 +0,0 @@
1function [im,snrP,imS] = textureSynthesis(params, im0, Niter, cmask, imask)
2
3% [res,snrP,imS] = textureSynthesis(params, initialIm, Niter, cmask, imask)
4%
5% Synthesize texture applying Portilla-Simoncelli model/algorithm.
6%
7% params: structure containing texture parameters (as returned by textureAnalysis).
8%
9% im0: initial image, OR a vector (Ydim, Xdim, [SEED]) containing
10% dimensions of desired image and an optional seed for the random
11% number generator. If dimensions are passed, initial image is
12% Gaussian white noise.
13%
14% Niter (optional): Number of iterations. Default = 50.
15%
16% cmask (optional): binary column vector (4x1) indicating which sets of
17% constraints we want to apply in the synthesis. The four sets are:
18% 1) Marginal statistics (mean, var, skew, kurt, range)
19% 2) Correlation of subbands (space, orientation, scale)
20% 3) Correlation of magnitude responses (sp, or, sc)
21% 4) Relative local phase
22%
23% imask (optional): imsizex2 matrix. First column is a mask, second
24% column contains the image values to be imposed. If only one column is
25% provided, it assumes it corresponds to the image values, and it uses
26% a raised cosine square for the mask.
27% snrP (optional): Set of adjustment values (in dB) of the parameters.
28% imS (optional): Sequence of synthetic images, from niter = 1 to 2^n, being
29% n = floor(log2(Niter)).
30
31% Javier Portilla and Eero Simoncelli.
32% Work described in:
33% "A Parametric Texture Model based on Joint Statistics of Complex Wavelet Coefficients".
34% J Portilla and E P Simoncelli. Int'l Journal of Computer Vision,
35% vol.40(1), pp. 49-71, Dec 2000.
36%
37% Please refer to this publication if you use the program for research or
38% for technical applications. Thank you.
39%
40% Copyright, Center for Neural Science, New York University, January 2001.
41% All rights reserved.
42
43Warn = 0; % Set to 1 if you want to see warning messages
44
45%% Check required args are passed:
46if (nargin < 2)
47 error('Function called with too few input arguments');
48end
49
50if ( ~exist('Niter') | isempty(Niter) )
51 Niter = 50;
52end
53
54if (exist('cmask') & ~isempty(cmask) )
55 cmask = (cmask > 0.5); % indices of ones in mask
56else
57 cmask = ones(4,1);
58end
59
60%% Extract parameters
61statg0 = params.pixelStats;
62mean0 = statg0(1); var0 = statg0(2);
63skew0 = statg0(3); kurt0 = statg0(4);
64mn0 = statg0(5); mx0 = statg0(6);
65statsLPim = params.pixelLPStats;
66skew0p = statsLPim(:,1);
67kurt0p = statsLPim(:,2);
68vHPR0 = params.varianceHPR;
69acr0 = params.autoCorrReal;
70ace0 = params.autoCorrMag;
71magMeans0 = params.magMeans;
72C0 = params.cousinMagCorr;
73Cx0 = params.parentMagCorr;
74Crx0 = params.parentRealCorr;
75
76%% Extract {Nsc, Nor, Na} from params
77tmp = size(params.autoCorrMag);
78Na = tmp(1); Nsc = tmp(3);
79Nor = tmp(length(tmp))*(length(tmp)==4) + (length(tmp)<4);
80la = (Na-1)/2;
81
82%% If im0 is a vector of length 2, create Gaussian white noise image of this
83%% size, with desired pixel mean and variance. If vector length is
84%% 3, use the 3rd element to seed the random number generator.
85if ( length(im0) <= 3 )
86 if ( length(im0) == 3)
87 randn('state', im0(3)); % Reset Seed
88 im0 = im0(1:2);
89 end
90 im = mean0 + sqrt(var0)*randn(im0);
91else
92 im = im0;
93end
94
95%% If the spatial neighborhood Na is too big for the lower scales,
96%% "modacor22.m" will make it as big as the spatial support at
97%% each scale:
98[Ny,Nx] = size(im);
99nth = log2(min(Ny,Nx)/Na);
100if nth<Nsc+1 & Warn,
101 fprintf(1,'Warning: Na will be cut off for levels above #%d !\n',floor(nth));
102end
103
104if exist('imask') & ~isempty(imask),
105 if size(imask,1) ~= prod(size(im))
106 error(sprintf('imask size %d does not match image dimensions [%d,%d]',...
107 size(imask,1), size(im,1), size(im,2)));
108 end
109 if size(imask,2) == 1,
110 mask = (cos(-pi/2:2*pi/Ny:pi*(1-2/Ny)/2)).'*cos(-pi/2:2*pi/Nx:pi*(1-2/Nx)/2);
111 mask = mask.^2;
112 aux = zeros(size(im));
113 aux(Ny/4+1:Ny/4+Ny/2,Nx/4+1:Nx/4+Nx/2)=mask;
114 mask = aux;
115 else
116 mask = reshape(imask(:,1),size(im));
117 end
118end
119
120imf = max(1,gcf-1); snrf = imf+1;
121figure(imf); clf
122subplot(1,2,1); grayRange = showIm(im,'auto',1); title('Starting image');
123drawnow
124
125prev_im=im;
126
127imf = max(1,gcf-1);
128figure(imf);
129clf;showIm(im,'auto',1); title(sprintf('iteration 0'));
130
131nq = 0;
132Nq = floor(log2(Niter));
133imS = zeros(Ny,Nx,Nq);
134
135%% MAIN LOOP
136for niter = 1:Niter
137
138%p = niter/Niter;
139p = 1;
140
141 %% Build the steerable pyramid
142 [pyr,pind] = buildSCFpyr(im,Nsc,Nor-1);
143
144 if ( any(vector(mod(pind,4))) )
145 error('Algorithm will fail: band dimensions are not all multiples of 4!');
146 end
147
148 %% Subtract mean of lowBand:
149 nband = size(pind,1);
150 pyr(pyrBandIndices(pind,nband)) = ...
151 pyrBand(pyr,pind,nband) - mean2(pyrBand(pyr,pind,nband));
152
153 apyr = abs(pyr);
154
155 %% Adjust autoCorr of lowBand
156 nband = size(pind,1);
157 ch = pyrBand(pyr,pind,nband);
158 Sch = min(size(ch)/2);
159 nz = sum(sum(~isnan(acr0(:,:,Nsc+1))));
160 lz = (sqrt(nz)-1)/2;
161 le = min(Sch/2-1,lz);
162 im = real(ch); %Reconstructed image: initialize to lowband
163 [mpyr,mpind] = buildSFpyr(im,0,0);
164 im = pyrBand(mpyr,mpind,2);
165 vari = acr0(la+1:la+1,la+1:la+1,Nsc+1);
166if cmask(2),
167 if vari/var0 > 1e-4,
168 [im, snr2(niter,Nsc+1)] = ...
169 modacor22(im, acr0(la-le+1:la+le+1,la-le+1:la+le+1,Nsc+1),p);
170 else
171 im = im*sqrt(vari/var2(im));
172 end
173 if (var2(imag(ch))/var2(real(ch)) > 1e-6)
174 fprintf(1,'Discarding non-trivial imaginary part, lowPass autoCorr!');
175 end
176 im = real(im);
177end % cmask(2)
178if cmask(1),
179 if vari/var0 > 1e-4,
180 [im,snr7(niter,2*(Nsc+1)-1)] = modskew(im,skew0p(Nsc+1),p); % Adjusts skewness
181 [im,snr7(niter,2*(Nsc+1))] = modkurt(im,kurt0p(Nsc+1),p); % Adjusts kurtosis
182 end
183end % cmask(2)
184
185 %% Subtract mean of magnitude
186if cmask(3),
187 magMeans = zeros(size(pind,1), 1);
188 for nband = 1:size(pind,1)
189 indices = pyrBandIndices(pind,nband);
190 magMeans(nband) = mean2(apyr(indices));
191 apyr(indices) = apyr(indices) - magMeans(nband);
192 end
193end % cmask(3)
194
195 %% Coarse-to-fine loop:
196 for nsc = Nsc:-1:1
197
198 firstBnum = (nsc-1)*Nor+2;
199 cousinSz = prod(pind(firstBnum,:));
200 ind = pyrBandIndices(pind,firstBnum);
201 cousinInd = ind(1) + [0:Nor*cousinSz-1];
202
203 %% Interpolate parents
204if (cmask(3) | cmask(4)),
205 if (nsc<Nsc)
206 parents = zeros(cousinSz,Nor);
207 rparents = zeros(cousinSz,Nor*2);
208 for nor = 1:Nor
209 nband = (nsc+1-1)*Nor+nor+1;
210
211 tmp = expand(pyrBand(pyr, pind, nband),2)/4;
212 rtmp = real(tmp); itmp = imag(tmp);
213 tmp = sqrt(rtmp.^2 + itmp.^2) .* exp(2 * sqrt(-1) * atan2(rtmp,itmp));
214 rparents(:,nor) = vector(real(tmp));
215 rparents(:,Nor+nor) = vector(imag(tmp));
216
217 tmp = abs(tmp);
218 parents(:,nor) = vector(tmp - mean2(tmp));
219 end
220 else
221 rparents = [];
222 parents = [];
223 end
224end % if (cmask(3) | cmask(4))
225
226if cmask(3),
227 %% Adjust cross-correlation with MAGNITUDES at other orientations/scales:
228 cousins = reshape(apyr(cousinInd), [cousinSz Nor]);
229 nc = size(cousins,2); np = size(parents,2);
230 if (np == 0)
231 [cousins, snr3(niter,nsc)] = adjustCorr1s(cousins, C0(1:nc,1:nc,nsc), 2, p);
232 else
233 [cousins, snr3(niter,nsc), snr4(niter,nsc)] = ...
234 adjustCorr2s(cousins, C0(1:nc,1:nc,nsc), parents, Cx0(1:nc,1:np,nsc), 3, p);
235 end
236 if (var2(imag(cousins))/var2(real(cousins)) > 1e-6)
237 fprintf(1,'Non-trivial imaginary part, mag crossCorr, lev=%d!\n',nsc);
238 else
239 cousins = real(cousins);
240 ind = cousinInd;
241 apyr(ind) = vector(cousins);
242 end
243
244 %% Adjust autoCorr of mag responses
245 nband = (nsc-1)*Nor+2;
246 Sch = min(pind(nband,:)/2);
247 nz = sum(sum(~isnan(ace0(:,:,nsc,1))));
248 lz = (sqrt(nz)-1)/2;
249 le = min(Sch/2-1,lz);
250 for nor = 1:Nor,
251 nband = (nsc-1)*Nor+nor+1;
252 ch = pyrBand(apyr,pind,nband);
253 [ch, snr1(niter,nband-1)] = modacor22(ch,...
254 ace0(la-le+1:la+le+1,la-le+1:la+le+1,nsc,nor), p);
255 ch = real(ch);
256 ind = pyrBandIndices(pind,nband);
257 apyr(ind) = ch;
258 %% Impose magnitude:
259 mag = apyr(ind) + magMeans0(nband);
260 mag = mag .* (mag>0);
261 pyr(ind) = pyr(ind) .* (mag./(abs(pyr(ind))+(abs(pyr(ind))<eps)));
262 end
263end % cmask(3)
264
265 %% Adjust cross-correlation of REAL PARTS at other orientations/scales:
266 cousins = reshape(real(pyr(cousinInd)), [cousinSz Nor]);
267 Nrc = size(cousins,2); Nrp = size(rparents,2);
268 if cmask(4) & (Nrp ~= 0)
269 a3 = 0; a4 = 0;
270 for nrc = 1:Nrc,
271 cou = cousins(:,nrc);
272 [cou, s3, s4] = ...
273 adjustCorr2s(cou,mean(cou.^2),rparents,Crx0(nrc,1:Nrp,nsc), 3);
274 a3 = s3 + a3;
275 a4 = s4 + a4;
276 cousins(:,nrc) = cou;
277 end
278 snr4r(niter,nsc) = a4/Nrc;
279 end
280 if (var2(imag(cousins))/var2(real(cousins)) > 1e-6)
281 fprintf(1,'Non-trivial imaginary part, real crossCorr, lev=%d!\n',nsc);
282 else
283 %%% NOTE: THIS SETS REAL PART ONLY - signal is now NONANALYTIC!
284 pyr(cousinInd) = vector(cousins(1:Nor*cousinSz));
285 end
286
287 %% Re-create analytic subbands
288 dims = pind(firstBnum,:);
289 ctr = ceil((dims+0.5)/2);
290 ang = mkAngle(dims, 0, ctr);
291 ang(ctr(1),ctr(2)) = -pi/2;
292 for nor = 1:Nor,
293 nband = (nsc-1)*Nor+nor+1;
294 ind = pyrBandIndices(pind,nband);
295 ch = pyrBand(pyr, pind, nband);
296 ang0 = pi*(nor-1)/Nor;
297 xang = mod(ang-ang0+pi, 2*pi) - pi;
298 amask = 2*(abs(xang) < pi/2) + (abs(xang) == pi/2);
299 amask(ctr(1),ctr(2)) = 1;
300 amask(:,1) = 1;
301 amask(1,:) = 1;
302 amask = fftshift(amask);
303 ch = ifft2(amask.*fft2(ch)); % "Analytic" version
304 pyr(ind) = ch;
305 end
306
307 %% Combine ori bands
308 bandNums = [1:Nor] + (nsc-1)*Nor+1; %ori bands only
309 ind1 = pyrBandIndices(pind, bandNums(1));
310 indN = pyrBandIndices(pind, bandNums(Nor));
311 bandInds = [ind1(1):indN(length(indN))];
312 %% Make fake pyramid, containing dummy hi, ori, lo
313 fakePind = pind([bandNums(1), bandNums, bandNums(Nor)+1],:);
314 fakePyr = [zeros(prod(fakePind(1,:)),1);...
315 real(pyr(bandInds)); zeros(prod(fakePind(size(fakePind,1),:)),1)];
316 ch = reconSFpyr(fakePyr, fakePind, [1]); % recon ori bands only
317 im = real(expand(im,2))/4;
318 im = im + ch;
319 vari = acr0(la+1:la+1,la+1:la+1,nsc);
320if cmask(2),
321 if vari/var0 > 1e-4,
322 [im, snr2(niter,nsc)] = ...
323 modacor22(im, acr0(la-le+1:la+le+1,la-le+1:la+le+1,nsc), p);
324 else
325 im = im*sqrt(vari/var2(im));
326 end
327end % cmask(2)
328 im = real(im);
329
330if cmask(1),
331 %% Fix marginal stats
332 if vari/var0 > 1e-4,
333 [im,snr7(niter,2*nsc-1)] = modskew(im,skew0p(nsc),p); % Adjusts skewness
334 [im,snr7(niter,2*nsc)] = modkurt(im,kurt0p(nsc),p); % Adjusts kurtosis
335 end
336end % cmask(1)
337
338 end %END Coarse-to-fine loop
339
340 %% Adjust variance in HP, if higher than desired
341if (cmask(2)|cmask(3)|cmask(4)),
342 ind = pyrBandIndices(pind,1);
343 ch = pyr(ind);
344 vHPR = mean2(ch.^2);
345 if vHPR > vHPR0,
346 ch = ch * sqrt(vHPR0/vHPR);
347 pyr(ind) = ch;
348 end
349end % cmask
350 im = im + reconSFpyr(real(pyr), pind, [0]); %recon hi only
351
352 %% Pixel statistics
353 means = mean2(im);
354 vars = var2(im, means);
355 snr7(niter,2*(Nsc+1)+1) = snr(var0,var0-vars);
356 im = im-means; % Adjusts mean and variance
357 [mns mxs] = range2(im + mean0);
358 snr7(niter,2*(Nsc+1)+2) = snr(mx0-mn0,sqrt((mx0-mxs)^2+(mn0-mns)^2));
359if cmask(1),
360 im = im*sqrt(((1-p)*vars + p*var0)/vars);
361end % cmaks(1)
362 im = im+mean0;
363if cmask(1),
364 [im, snr7(niter,2*(Nsc+1)+3)] = modskew(im,skew0,p); % Adjusts skewness (keep mean and variance)
365 [im, snr7(niter,2*(Nsc+1)+4)] = modkurt(im,kurt0,p); % Adjusts kurtosis (keep mean and variance,
366 % but not skewness)
367 im = max(min(im,(1-p)*max(max(im))+p*mx0),...
368 (1-p)*min(min(im))+p*mn0); % Adjusts range (affects everything)
369else
370 snr7(niter,2*(Nsc+1)+3) = snr(skew0,skew0-skew2(im));
371 snr7(niter,2*(Nsc+1)+4) = snr(kurt0,kurt0-kurt2(im));
372end % cmask(1)
373
374 %% Force pixels specified by image mask
375 if (exist('imask') & ~isempty(imask) )
376 im = mask.*reshape(imask(:,2 - (size(imask,2)==1)),size(im)) + ...
377 (1-mask).*im;
378 end
379
380 snr6(niter,1) = snr(im-mean0,im-prev_im);
381
382 if floor(log2(niter))==log2(niter),
383 nq = nq + 1;
384 imS(:,:,nq) = im;
385 end
386
387 tmp = prev_im;
388 prev_im=im;
389
390 figure(imf);
391 subplot(1,2,1);
392 showIm(im-tmp,'auto',1); title('Change');
393 subplot(1,2,2);
394 showIm(im,'auto',1); title(sprintf('iteration %d/%d',niter,Niter));
395 drawnow
396
397 % accelerator
398 alpha = 0.8;
399 im = im + alpha*(im - tmp);
400
401commented = 1; % set it to 0 for displaying convergence of parameters in SNR (dB)
402if ~commented,
403
404% The graphs that appear reflect
405% the relative distance of each parameter or group
406% of parametersi, to the original's, in decibels.
407% Note, however, that when the original parameters
408% are close to zero, this measurement is meaningless.
409% This is why in some cases it seems that some of
410% the parameters do not converge at all.
411
412figure(snrf);
413if cmask(1)
414 subplot(171); plot(snr7); title('Mrgl stats');
415end
416if cmask(2),
417 subplot(172); plot(snr2); title('Raw auto');
418end
419if cmask(3),
420 subplot(173); plot(snr1); title('Mag auto');
421 subplot(174); plot(snr3); title('Mag ori');
422 subplot(175); plot(snr4); title('Mag scale');
423end
424if (Nrp > 0) & cmask(4),
425 subplot(176); plot(snr4r); title('Phs scale');
426end
427 subplot(177); plot(snr6); title('Im change');
428 drawnow
429
430end % if ~commented
431
432end %END MAIN LOOP
433
434im = prev_im;
435
436snrP = [snr7 snr2 snr1 snr3 snr4 snr4r snr6];
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/upBlur.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/upBlur.m
deleted file mode 100755
index 948c2e1..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/upBlur.m
+++ /dev/null
@@ -1,52 +0,0 @@
1% RES = upBlur(IM, LEVELS, FILT)
2%
3% Upsample and blur an image. The blurring is done with filter
4% kernel specified by FILT (default = 'binom5'), which can be a string
5% (to be passed to namedFilter), a vector (applied separably as a 1D
6% convolution kernel in X and Y), or a matrix (applied as a 2D
7% convolution kernel). The downsampling is always by 2 in each
8% direction.
9%
10% The procedure is applied recursively LEVELS times (default=1).
11
12% Eero Simoncelli, 4/97.
13
14function res = upBlur(im, nlevs, filt)
15
16%------------------------------------------------------------
17%% OPTIONAL ARGS:
18
19if (exist('nlevs') ~= 1)
20 nlevs = 1;
21end
22
23if (exist('filt') ~= 1)
24 filt = 'binom5';
25end
26
27%------------------------------------------------------------
28
29if isstr(filt)
30 filt = namedFilter(filt);
31end
32
33if nlevs > 1
34 im = upBlur(im,nlevs-1,filt);
35end
36
37if (nlevs >= 1)
38 if (any(size(im)==1))
39 if (size(im,1)==1)
40 filt = filt';
41 end
42 res = upConv(im,filt,'reflect1',(size(im)~=1)+1);
43 elseif (any(size(filt)==1))
44 filt = filt(:);
45 res = upConv(im,filt,'reflect1',[2 1]);
46 res = upConv(res,filt','reflect1',[1 2]);
47 else
48 res = upConv(im,filt,'reflect1',[2 2]);
49 end
50else
51 res = im;
52end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/upConv.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/upConv.m
deleted file mode 100755
index 10bea46..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/upConv.m
+++ /dev/null
@@ -1,80 +0,0 @@
1% RES = upConv(IM, FILT, EDGES, STEP, START, STOP, RES)
2%
3% Upsample matrix IM, followed by convolution with matrix FILT. These
4% arguments should be 1D or 2D matrices, and IM must be larger (in
5% both dimensions) than FILT. The origin of filt
6% is assumed to be floor(size(filt)/2)+1.
7%
8% EDGES is a string determining boundary handling:
9% 'circular' - Circular convolution
10% 'reflect1' - Reflect about the edge pixels
11% 'reflect2' - Reflect, doubling the edge pixels
12% 'repeat' - Repeat the edge pixels
13% 'zero' - Assume values of zero outside image boundary
14% 'extend' - Reflect and invert
15% 'dont-compute' - Zero output when filter overhangs OUTPUT boundaries
16%
17% Upsampling factors are determined by STEP (optional, default=[1 1]),
18% a 2-vector [y,x].
19%
20% The window over which the convolution occurs is specfied by START
21% (optional, default=[1,1], and STOP (optional, default =
22% step .* (size(IM) + floor((start-1)./step))).
23%
24% RES is an optional result matrix. The convolution result will be
25% destructively added into this matrix. If this argument is passed, the
26% result matrix will not be returned. DO NOT USE THIS ARGUMENT IF
27% YOU DO NOT UNDERSTAND WHAT THIS MEANS!!
28%
29% NOTE: this operation corresponds to multiplication of a signal
30% vector by a matrix whose columns contain copies of the time-reversed
31% (or space-reversed) FILT shifted by multiples of STEP. See corrDn.m
32% for the operation corresponding to the transpose of this matrix.
33
34% Eero Simoncelli, 6/96. revised 2/97.
35
36function result = upConv(im,filt,edges,step,start,stop,res)
37
38%% THIS CODE IS NOT ACTUALLY USED! (MEX FILE IS CALLED INSTEAD)
39
40%fprintf(1,'WARNING: You should compile the MEX version of "upConv.c",\n found in the MEX subdirectory of matlabPyrTools, and put it in your matlab path. It is MUCH faster, and provides more boundary-handling options.\n');
41
42%------------------------------------------------------------
43%% OPTIONAL ARGS:
44
45if (exist('edges') == 1)
46 if (strcmp(edges,'reflect1') ~= 1)
47 warning('Using REFLECT1 edge-handling (use MEX code for other options).');
48 end
49end
50
51if (exist('step') ~= 1)
52 step = [1,1];
53end
54
55if (exist('start') ~= 1)
56 start = [1,1];
57end
58
59% A multiple of step
60if (exist('stop') ~= 1)
61 stop = step .* (floor((start-ones(size(start)))./step)+size(im))
62end
63
64if ( ceil((stop(1)+1-start(1)) / step(1)) ~= size(im,1) )
65 error('Bad Y result dimension');
66end
67if ( ceil((stop(2)+1-start(2)) / step(2)) ~= size(im,2) )
68 error('Bad X result dimension');
69end
70
71if (exist('res') ~= 1)
72 res = zeros(stop-start+1);
73end
74
75%------------------------------------------------------------
76
77tmp = zeros(size(res));
78tmp(start(1):step(1):stop(1),start(2):step(2):stop(2)) = im;
79
80result = rconv2(tmp,filt) + res;
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/var2.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/var2.m
deleted file mode 100755
index 6957eff..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/var2.m
+++ /dev/null
@@ -1,17 +0,0 @@
1% V = VAR2(MTX,MEAN)
2%
3% Sample variance of a matrix.
4% Passing MEAN (optional) makes the calculation faster.
5
6function res = var2(mtx, mn)
7
8if (exist('mn') ~= 1)
9 mn = mean2(mtx);
10end
11
12if (isreal(mtx))
13 res = sum(sum(abs(mtx-mn).^2)) / max((prod(size(mtx)) - 1),1);
14else
15 res = sum(sum(real(mtx-mn).^2)) + i*sum(sum(imag(mtx-mn).^2));
16 res = res / max((prod(size(mtx)) - 1),1);
17end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/vectify.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/vectify.m
deleted file mode 100755
index 3664223..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/vectify.m
+++ /dev/null
@@ -1,8 +0,0 @@
1% [VEC] = columnize(MTX)
2%
3% Pack elements of MTX into a column vector. Just provides a
4% function-call notatoin for the operation MTX(:)
5
6function vec = columnize(mtx)
7
8vec = mtx(:);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/vector.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/vector.m
deleted file mode 100755
index 6168151..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/vector.m
+++ /dev/null
@@ -1,7 +0,0 @@
1% [VEC] = vector(MTX)
2%
3% Pack elements of MTX into a column vector. Same as VEC = MTX(:)
4
5function vec = vector(mtx)
6
7vec = mtx(:);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/wpyrBand.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/wpyrBand.m
deleted file mode 100755
index c027cca..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/wpyrBand.m
+++ /dev/null
@@ -1,39 +0,0 @@
1% RES = wpyrBand(PYR, INDICES, LEVEL, BAND)
2%
3% Access a subband from a separable QMF/wavelet pyramid.
4%
5% LEVEL (optional, default=1) indicates the scale (finest = 1,
6% coarsest = wpyrHt(INDICES)).
7%
8% BAND (optional, default=1) indicates which subband (1=horizontal,
9% 2=vertical, 3=diagonal).
10
11% Eero Simoncelli, 6/96.
12
13function im = wpyrBand(pyr,pind,level,band)
14
15if (exist('level') ~= 1)
16 level = 1;
17end
18
19if (exist('band') ~= 1)
20 band = 1;
21end
22
23if ((pind(1,1) == 1) | (pind(1,2) ==1))
24 nbands = 1;
25else
26 nbands = 3;
27end
28
29if ((band > nbands) | (band < 1))
30 error(sprintf('Bad band number (%d) should be in range [1,%d].', band, nbands));
31end
32
33maxLev = wpyrHt(pind);
34if ((level > maxLev) | (level < 1))
35 error(sprintf('Bad level number (%d), should be in range [1,%d].', level, maxLev));
36end
37
38band = band + nbands*(level-1);
39im = pyrBand(pyr,pind,band);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/wpyrHt.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/wpyrHt.m
deleted file mode 100755
index 476be83..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/wpyrHt.m
+++ /dev/null
@@ -1,15 +0,0 @@
1% [HEIGHT] = wpyrHt(INDICES)
2%
3% Compute height of separable QMF/wavelet pyramid with given index matrix.
4
5% Eero Simoncelli, 6/96.
6
7function [ht] = wpyrHt(pind)
8
9if ((pind(1,1) == 1) | (pind(1,2) ==1))
10 nbands = 1;
11else
12 nbands = 3;
13end
14
15ht = (size(pind,1)-1)/nbands;
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/wpyrLev.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/wpyrLev.m
deleted file mode 100755
index 18f30ae..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/wpyrLev.m
+++ /dev/null
@@ -1,30 +0,0 @@
1% [LEV,IND] = wpyrLev(PYR,INDICES,LEVEL)
2%
3% Access a level from a separable QMF/wavelet pyramid.
4% Return as an SxB matrix, B = number of bands, S = total size of a band.
5% Also returns an Bx2 matrix containing dimensions of the subbands.
6
7% Eero Simoncelli, 6/96.
8
9function [lev,ind] = wpyrLev(pyr,pind,level)
10
11if ((pind(1,1) == 1) | (pind(1,2) ==1))
12 nbands = 1;
13else
14 nbands = 3;
15end
16
17if ((level > wpyrHt(pind)) | (level < 1))
18 error(sprintf('Level number must be in the range [1, %d].', wpyrHt(pind)));
19end
20
21firstband = 1 + nbands*(level-1)
22firstind = 1;
23for l=1:firstband-1
24 firstind = firstind + prod(pind(l,:));
25end
26
27
28ind = pind(firstband:firstband+nbands-1,:);
29lev = pyr(firstind:firstind+sum(prod(ind'))-1);
30
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/zconv2.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/zconv2.m
deleted file mode 100755
index f678d89..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/zconv2.m
+++ /dev/null
@@ -1,41 +0,0 @@
1% RES = ZCONV2(MTX1, MTX2, CTR)
2%
3% Convolution of two matrices, with boundaries handled as if the larger mtx
4% lies in a sea of zeros. Result will be of size of LARGER vector.
5%
6% The origin of the smaller matrix is assumed to be its center.
7% For even dimensions, the origin is determined by the CTR (optional)
8% argument:
9% CTR origin
10% 0 DIM/2 (default)
11% 1 (DIM/2)+1 (behaves like conv2(mtx1,mtx2,'same'))
12
13% Eero Simoncelli, 2/97.
14
15function c = zconv2(a,b,ctr)
16
17if (exist('ctr') ~= 1)
18 ctr = 0;
19end
20
21if (( size(a,1) >= size(b,1) ) & ( size(a,2) >= size(b,2) ))
22 large = a; small = b;
23elseif (( size(a,1) <= size(b,1) ) & ( size(a,2) <= size(b,2) ))
24 large = b; small = a;
25else
26 error('one arg must be larger than the other in both dimensions!');
27end
28
29ly = size(large,1);
30lx = size(large,2);
31sy = size(small,1);
32sx = size(small,2);
33
34%% These values are the index of the small mtx that falls on the
35%% border pixel of the large matrix when computing the first
36%% convolution response sample:
37sy2 = floor((sy+ctr+1)/2);
38sx2 = floor((sx+ctr+1)/2);
39
40clarge = conv2(large,small);
41c = clarge(sy2:ly+sy2-1, sx2:lx+sx2-1);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/ChangeLog b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/ChangeLog
deleted file mode 100755
index f20c499..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/ChangeLog
+++ /dev/null
@@ -1,430 +0,0 @@
1 Log of changes made to matlabPyrTools code
2 (important changes marked with **)
3-----------------------------------------------------------------------
42004-10-14 Eero Simoncelli <eero@sesto.cns.nyu.edu>
5
6 * Made new tarfile (version 1.3)
7
8 * Incorporated complex-valued steerable pyramid code (buildSCFpyr,
9 buildSCFpyrLevs,reconSCFpyr) written by Javier Portilla in 9/97,
10 and used in our work on texture representation/synthesis
11 (Portilla&Simoncelli, Int'l Journal of Computer Vision,
12 40(1):49-71, Dec 2000).
13
14 * Incorporated imGradient.m from personal code.
15
16 * reagan.pgm out. feynam.pgm in
17
182004-03-20 Eero Simoncelli <eero@sesto.cns.nyu.edu>
19
20 * blur.m added (just calls blurDn and then upBlur).
21
222003-08-06 Eero Simoncelli <eero@sesto.cns.nyu.edu>
23
24 * blurDn.m (filt): Forced correct scaling of filters in 1D
25
262003-05-28 Eero Simoncelli <eero@ferrando.cns.nyu.edu>
27
28 * incorporated setPyrBand.m from local code
29
302002-10-01 Eero Simoncelli <eero.simoncelli@nyu.edu>
31
32 * incorporated clip.m from local code
33
342002-09-18 Eero Simoncelli <eero.simoncelli@nyu.edu>
35
36 * pointOp.m: Added the new 'extrap' option for matlab's interp1 to
37 make this m-file version more compatible with the mex version.
38
39Wed Aug 28 2002 Eero Simoncelli <eero.simoncelli@nyu.edu>
40
41 * var2.m: now returns zero (instead of error) for matrix of size 1.
42 * function VECTORIZE renamed to VECTIFY, since it was colliding
43 with a function introduced in standard matlab.
44
45Dec 27 2001 Eero Simoncelli <eero.simoncelli@nyu.edu>
46
47 * Modified calls to upConv in reconSpyr.m and reconSpyrLevs.m so
48 that the returned result is bound. Previously, had relied on the
49 MEX version of upConv to destructively modify the result array,
50 users had been getting errors because they were using the m-file
51 version of upConv.
52
53Wed Sep 19 2001 Eero Simoncelli <eero.simoncelli@nyu.edu>
54
55 * buildSFpyrLevs/reconSFpyrLevs: replace use of "i" with sqrt(-1), to
56 avoid problems if user rebinds it!
57
58Wed Mar 28 10:22:01 2001 Eero Simoncelli <eero.simoncelli@nyu.edu>
59
60 * Moved innerProd.m and all associated MEX files from the
61 matlabLocal source tree into matlabPyrTools.
62 * Added innerProd to Contents.m
63 * Updated/clarified WARNINGS in all *.m files that have MEX versions.
64
65Tue Mar 27 11:21:53 2001 Eero Simoncelli <eero.simoncelli@nyu.edu>
66
67 * Incorporated Windows MEX files (*.dll) into MEX subdirectory.
68 Windows users should either copy these into the main directory,
69 or put the MEX subdirectory in their matlab path.
70
71Fri Mar 23 14:46:16 2001 Eero Simoncelli <eero.simoncelli@nyu.edu>
72
73 * buildSFpyrLevs.m, reconSFpyrLevs.m: shift the raised-cosine
74 lookup table (Xrcos) instead of incrementing the log-radial image
75 (log_rad). THis is more efficient...
76
77Fri Oct 1 19:37:03 1999 Eero Simoncelli <eero.simoncelli@nyu.edu>
78
79 * upConv.m: Did not return correct size result when STOP argument
80 was passed. Thanks to hertzman@mrl.nyu.edu for pointing this out.
81
82Fri Sep 17 15:53:26 1999 Eero Simoncelli <eero.simoncelli@nyu.edu>
83
84 * buildSFpyrLevs.m: Changed lutsize to 1024, giving a slight
85 increase in accuracy.
86
87Thu Feb 25 18:10:38 1999 Eero Simoncelli <eero.simoncelli@nyu.edu>
88
89 * histo1.m: Modified histo.m to be more compatible (but still not
90 exactly the same) as the MEX file version.
91
92Fri Jun 12 21:15:39 1998 Eero Simoncelli <eero.simoncelli@nyu.edu>
93
94 * TUTORIALS pyramids.m upgraded.
95
96Tue Feb 17 13:22:28 1998 Eero Simoncelli <eero.simoncelli@nyu.edu>
97
98 * showIm.m: Dims are now printed followed by the zoom factor.
99
100Mon Oct 13 14:49:51 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
101
102 * mkSquare.m: Modified to do raised-cosine soft threshold
103 transitions.
104
105Tue Oct 7 10:13:51 1997 Eero Simoncelli <eero@chrysothemis.cims.nyu.edu>
106
107 * upConv.m: Argument order was wrong (this function is not used
108 anyway, unless you don't compile the MEX code). - Thanks to
109 farid@psyche.mit.edu for pointing this out.
110
111Thu Sep 25 16:09:49 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
112
113 * MEX/wrap.c: Changed #include <malloc.h> to <stdlib.h>, as
114 suggested by David Brainard. * Incorporated Mac-compiled mex
115 files, courtesy of David Brainard.
116
117Sat Sep 6 16:10:25 1997 Eero Simoncelli <eero@chrysothemis.cims.nyu.edu>
118
119 * MEX/convolve.h: abstracted out type of images with typedef image_type.
120 Added ansi declarations.
121
122Fri Aug 29 13:49:16 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
123
124 ** showIm.m: Modified to behave better under resizing (and printing):
125 resets axis units to "normalized".
126
127Thu Aug 28 22:56:52 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
128
129 ** MEX/edges.c: reflect1, reflect2, repeat, extend upgraded to work
130 properly for non-symmetric filters. reflect2 and extend were also
131 broken for upConv. Added qreflect2 to handle even-length QMF's
132 which broke under the reflect2 modification.
133 * Added example code to TUTORIALS/matlabPyrTools to illustrate the
134 boundary-handling behavior...
135
136Thu Aug 21 13:34:17 1997 Eero Simoncelli <eero@chrysothemis.cims.nyu.edu>
137
138 * var2, skew2, kurt2: modified to return complex values for complex images.
139 * imStats.m: now gives an error for complex args.
140
141Thu Aug 14 15:24:29 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
142
143 * Modified shift.m: negated the meaning of the offset parameter,
144 such that RES=shift(MTX,OFFSET) means RES(POS)=MTX(POS-OFFSET)
145 (this is more intuitive).
146
147Thu Jul 10 17:06:52 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
148
149 * Modified MEX/Makefile-* to be consistent with matlab5:
150 - call mex instead of cmex
151 - use -V4 flag (creating matlab v4 compatible binaries)
152
153 * showIm.m (xlbl_offset): Modified to use "points" units, so that
154 printed images look correct. Still slightly busted for arbitrary figure
155 window sizes and for printing.
156
157 * Modified upConv.c: does not return ANYTHING if you pass a result
158 argument (this had been causing occasional problems with matlab's
159 memory manager).
160
161Mon Jun 30 12:09:30 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
162
163 * reconSFpyr.m (res): now returns real part (oops).
164
165 * reconSpyrLevs.m (maxLev): got rid of superfluous nbands argument
166 (can be calculated from bfilts).
167
168Mon May 26 12:29:54 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
169
170 * showIm.m/pgmWrite.m: Modified 'auto3'-scaling to use a
171 histogram. This gives a significant speedup.
172
173 * fixed a few minor bugs in the TUTORIALS, having to do with
174 matching image sizes to the machine speed...
175
176Sat May 10 17:27:25 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
177
178 * pgmWrite.m: fixed auto-scaling bug. Added new scaling
179 calculations, parallel to those of imShow.
180
181Fri May 9 09:02:56 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
182
183 * buildSFpyr.m: Changed NBANDS argument to be ORDER, which is one
184 less than the number of orientation bands. This is consistent
185 with the derivative order, and the labels on the spNFilters files.
186
187Tue May 6 19:08:18 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
188
189 ** Added buildSFpyr, reconSFpyr: Steerable pyramids constructed
190 in the Fourier domain. Radial functions tile, with a
191 raised-cosine falloff. Angular functions are
192 cos(theta-k\pi/(K+1))^K, where K is the order (number of bands
193 minus 1). Compared to the convolution version:
194 + Reconstruction is exact (within floating point errors)
195 + Can produce any number of orientation bands.
196 - Typically slower.
197 - Boundary-handling must be circular.
198 Could be made much more efficient by taking advantage of symmetries in
199 the fft!
200
201 * Added example usage of Fourier steerable pyramid to TUTORIALS/pyramids.m
202
203 * steer.m: fixed for harmonic lists including zero.
204
205Sun May 4 15:16:10 1997 Eero Simoncelli <eero@ferrando.cns.nyu.edu>
206
207 * MEX/Makefile-linux: created.
208
209 * spyrHt, spyrNumBands: Modified to return 0 for pyramids of height 0.
210
211 * reconWpyr.m: utilize desctructive addition in calls to upConv.
212
213 * reconSpyr.m: Added error check to ensure consistancy between
214 pyramid and filter file. Utilize destructive addition in upConv
215 call on highpass band. Modified to work properly with pyramids of
216 height 0.
217
218Mon Apr 28 13:38:10 1997 Eero Simoncelli <eero@ferrando.cns.nyu.edu>
219
220 * lplot.m: modified to handle complex vectors, use standard MatLab
221 indices, and show minimal axes. Added xrange parameter to allow
222 adjustment of X axis labeling.
223
224Sun Apr 27 20:20:41 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
225
226 * var2, skew2, kurt2: enhanced to work on complex matrices.
227
228Sat Apr 26 11:16:12 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
229
230 * Changed parent directory (and distribution) name:
231 matlabImTools -> matlabPyrTools
232
233 * namedFilter.m: Added two more Daubechies filters, and modified
234 names to match the reference (e.g., daub2 is now a 4-tap filter).
235
236 * Added vectorize.m: trivial function to pack matrix into vector (i.e.,
237 computes mtx(:)).
238
239 * Added upBlur.m: Upsample and blur (parallels blurDn).
240
241Sun Apr 13 14:23:38 1997 Eero Simoncelli <eero@chrysothemis.cims.nyu.edu>
242
243 * TUTORIALS/pyramids.m: Added plots of Fourier spectra for Wavelet bases.
244
245 * make-tar-file: switched from compress to gzip for the
246 distribution tarfile.
247
248 * namedFilter.m: Added a few even-length QMF's from Johnston80.
249
250Fri Apr 11 19:16:21 1997 Eero Simoncelli <eero@chrysothemis.cims.nyu.edu>
251
252 * buildWpyr.m, reconWpyr.m: Modified slightly, so that subsampling
253 lattice is better for even-length filters.
254
255 * TUTORIALS/pyramids.m: Substantially overhauled.
256
257Thu Apr 10 15:20:23 1997 Eero Simoncelli <eero@chrysothemis.cims.nyu.edu>
258
259 * blurDn.m: added this function to downsample an image by a factor
260 2^L.
261
262 * Fixed minor bug in upConv.m: errors in image size checking.
263
264Mon Apr 7 13:25:37 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
265
266 * Changed TUTORIALS/matlabImTools.m to use histo.mex instead of
267 matlab's hist.
268
269Wed Apr 2 13:20:55 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
270
271 ** Incorporated Denis Pelli's ThinkC and MetroWorks projects for
272 Macintosh versions of the MEX code, along with MEX binaries. These
273 are included as an HQX'ed self-extracting archive
274 (Macintosh-MEX.sit.hqx), in the MEX subdirectory.
275
276Tue Apr 1 15:35:31 1997 Eero Simoncelli <eero@chrysothemis.cims.nyu.edu>
277
278 * edges.c: modified by Denis Pelli to support THINK C. * edges.c:
279
280 * histo.c, upConv.c, corrDn.c: minor changes in error message
281 printouts, to work around bugs in THINK C.
282
283 * Included Denis Pelli's MacReadMe file in the MEX subdirectory,
284 which gives instructions for MEX file compilation on a MacIntosh
285 (PPC or 68k).
286
287 * wrap.c, convolve.c, edges.c: added explicit int function
288 declarations, and return values.
289
290 * range2.m/range2.c: A MEX function for fast min/max computation.
291 Adjusted entropy2.m, histo.m, imStats.m, pgmWrite.m, showIm.m,
292 showLpyr.m, showSpyr.m, showWpyr.m to call it.
293
294Thu Mar 27 17:23:05 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
295
296 ** histo.m/histo.c: Added MEX function HISTO, a fast replacement
297 for matlab's HIST function. Modified histoMatch.m, entropy2.m to
298 call it.
299
300 * Changed main directory name to matlabImTools.
301
302 * Added TUTORIALS/README file.
303
304Wed Mar 19 14:19:51 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
305
306 * Changed directory name: MEX_SRC -> MEX
307
308Wed Mar 12 17:00:03 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
309
310 * mkGaussian.m: fixed another (X,Y) bug: both dimensions and
311 cov/mean are now specified in [y,x] order.
312
313Tue Mar 11 19:08:17 1997 Eero Simoncelli <eero@chrysothemis.cims.nyu.edu>
314
315 * showSpyr.m: Fixed a bug that was dropping display of one
316 orientation band when there were more than 2 of them!
317
318Mon Mar 10 19:08:24 1997 Eero Simoncelli <eero@chrysothemis.cims.nyu.edu>
319
320 * Added shift.m
321
322 * makeSteerMtx -> steerDir2HarmMtx
323
324 * Added TUTORIALS/matlab-EPS.m: examples using the code in this
325 distribution.
326
327Sun Mar 9 17:49:18 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
328
329 ** showIm.m:
330 - args: changed order so that NSHADES is last.
331 - TITLES: Can now pass a string for IM, which will be evaluated
332 in the global environment to get the matrix. The string is
333 used as a title. MATLAB v.5 ONLY!!!
334 - Added 'auto3' RANGE value, that scales based on percentiles.
335 THis is more robust to outliers than 'auto2' or 'auto1'.
336
337 * pixelAxes.m: Made a more serious attempt to reverse-engineer
338 Mathworks' image pixelization. It is improved, but still makes
339 occasional errors.
340
341 * Added skew2.m.
342
343Fri Mar 7 10:11:07 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
344
345 * pixelAxes.m: Modified to take an optional
346 ZOOM argument. Fixed dimension ordering bug
347 (positions are reported (x,y), but mtx dims are (y,x)!)
348
349 * showIm.m: Added an optional ZOOM argument.
350
351Thu Mar 6 14:17:19 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
352
353 * Added showLpyr, showWpyr, showSpyr. Modified
354 TUTORIALS/pyramids.m to use them.
355
356 * added pixelAxes.m: Adjusts size (in pixels) of currently
357 displayed image to be a multiple of the matrix dimensions,
358 thus eliminating display aliasing artifacts.
359 This is now called by all the "show" commands.
360
361Mon Mar 3 17:33:25 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
362
363 * Fixed bug in pgmWrite (dimensions were written in reverse order).
364
365 * Fixed bug in showIm (X and Y coords were swapped on label display).
366
367 * Fixed bug in reconLpyr (swapped X and Y coords on int_sz)
368
369 * Changed calls to "reshape" to pass dimensions individually --
370 older version of matlab do not accept the reshape(mtx,[y x]) form.
371
372 * Fixed bug in mkDisc: sz a scalar.
373
374 * Added ifftshift.m
375
376Fri Feb 28 11:07:20 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
377
378 * Re-worked TUTORIALS/pyramids.m
379
380 * buildGpyr and buildLpyr now use 1+maxPyrHt for default height.
381
382 * Fixed buildGpyr to work on 1D signals.
383
384 ** Gaussian/Laplacian/Wavelet pyramid build and recon functions:
385 - work properly with new corrDn/upConv.
386 - use separable convolutions
387 - use destructive modification ability of upConv (less memory
388 allocation)
389
390 * modulateFlipShift -> modulateFlip.
391
392 * added lpyrHt, wpyrHt, spyrHt to return number of levels in a pyramid.
393
394Thu Feb 27 15:39:53 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
395
396 * Changed angular coordinate systems to CLOCKWISE in mkRamp,
397 mkTheta, mkSine, mkSquare. This is unnatural for screen viewing,
398 but consistent with an origin in the upper left corner of the
399 image, which is the way one addresses the underlying matrix.
400
401 * mkSine and mkSquare can now take a frequency vector or the
402 period and direction args
403
404Tue Feb 25 11:58:33 1997 Eero Simoncelli <eero@servilia.cns.nyu.edu>
405
406 ** Rewrote corrDn/upConv C routines:
407 - more efficient
408 - changed START parameters to have [1 1] origin, consistent with
409 matlab
410 - added STOP parameters
411 - upConv allows destructive modification of a result arg
412 - changed order of other params (sorry)
413 - wrote test file conv_test.m
414 * wrote zconv2.m
415
416Wed Aug 19 20:39:15 1996 Eero Simoncelli (eero@tarpon.cis.upenn.edu)
417
418 ** Added "pointOp" function (MUCH faster than interp1).
419 ** Added "histoMatch" function.
420
421Fri Aug 2 00:56:31 1996 Eero Simoncelli (eero@tarpon.cis.upenn.edu)
422
423 * Changed all function/file-names to be of the form "fooBar". *
424 Fixed entropy2.m (busted due to typo).
425
426Original convolution code was written in Spring 1986, and comes from
427OBVIUS (Object-Based Vision and Image Understanding System), an
428interactive image-processing system written in Common Lisp (with calls
429to C code).
430
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/Contents.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/Contents.m
deleted file mode 100755
index d19f067..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/Contents.m
+++ /dev/null
@@ -1,107 +0,0 @@
1% Image and Multi-scale Pyramid Tools
2% Version 1.3, October 2004.
3% Created: Early Spring, 1996. Eero Simoncelli, eero.simoncelli@nyu.edu
4%
5% See README file for brief description.
6% See ChangeLog file for latest modifications.
7% See TUTORIALS subdirectory for demonstrations.
8% Type "help <command-name>" for documentation on individual commands.
9% -----------------------------------------------------------------
10% Synthetic Images (matrices):
11% mkImpulse - Make an image containing an impulse.
12% mkRamp - Make an image containing a ramp function.
13% mkR - Make an image containing distance from the origin.
14% mkAngle - Make an image containing angle about origin.
15% mkDisc - Make an image containing a disk image.
16% mkGaussian - Make an image containing a Gaussian function.
17% mkZonePlate - Make an image containing a zone plate (cos(r^2)).
18% mkAngularSine - Make an image containing an angular sine wave (pinwheel).
19% mkSine - Make an image containing a sine grating.
20% mkSquare - Make an image containing a square grating.
21% mkFract - Make an image containing fractal (1/f) noise.
22%
23% Point Operations:
24% clip - clip values to a range.
25% pointOp - Lookup table (much faster than interp1) [MEX file]
26% histo - Efficient histogram computation [MEX file]
27% histoMatch - Modify matrix elements to match specified histogram stats.
28%
29% Convolution (first two are significantly faster):
30% corrDn - Correlate & downsample with boundary-handling [MEX file]
31% upConv - Upsample & convolve with boundary-handling [MEX file]
32% blurDn - Blur and subsample a signal/image.
33% upBlur - Upsample and blur a signal/image.
34% blur - Multi-scale blurring, calls blurDn and then upBlur.
35% cconv2 - Circular convolution.
36% rconv2 - Convolution with reflected boundaries.
37% zconv2 - Convolution assuming zeros beyond image boundaries.
38%
39% General pyramids:
40% pyrLow - Access lowpass subband from (any type of) pyramid
41% pyrBand - Access a subband from (any type of) pyramid
42% setPyrBand - Insert an image into (any type of) pyramid as a subband
43% pyrBandIndices - Returns indices for given band in a pyramid vector
44% maxPyrHt - compute maximum number of scales in a pyramid
45%
46% Gaussian/Laplacian Pyramids:
47% buildGpyr - Build a Gaussian pyramid of an input signal/image.
48% buildLpyr - Build a Laplacian pyramid of an input signal/image.
49% reconLpyr - Reconstruct (invert) the Laplacian pyramid transform.
50%
51% Separable orthonormal QMF/wavelet Pyramids:
52% buildWpyr - Build a separable wavelet representation of an input signal/image.
53% reconWpyr - Reconstruct (invert) the wavelet transform.
54% wpyrBand - Extract a single band of the wavelet representation.
55% wpyrLev - Extract (packed) subbands at a particular level
56% wpyrHt - Number of levels (height) of a wavelet pyramid.
57%
58% Steerable Pyramids:
59% buildSpyr - Build a steerable pyramid representation of an input image.
60% reconSpyr - Reconstruct (invert) the steerable pyramid transform.
61% buildSFpyr - Build a steerable pyramid representation in the Fourier domain.
62% reconSFpyr - Reconstruct (invert) the (Fourier domain) steerable pyramid transform.
63% spyrBand - Extract a single band from a steerable pyramid.
64% spyrHigh - Highpass residual band.
65% spyrLev - A whole level (i.e., all images at a given scale) of a steerable pyramid.
66% spyrHt - Number of levels (height) of a steerable pyramid.
67% spyrNumBands - Number of orientation bands in a steerable pyramid.
68%
69% Steerable filters / derivatives:
70% imGradient - Compute gradient of image using directionally accurete filters.
71% steer - Steer filters (or responses).
72% steer2HarmMtx - Construct a matrix mapping direcional basis to angular harmonics.
73%
74% Filters:
75% binomialFilter - returns a filter of binomial coefficients.
76% namedFilter - some typical Laplacian/Wavelet pyramid filters
77% spNFilters - Set of Nth order steerable pyramid filters.
78% derivNFiltersS - Matched set of S-tap 1D derivatives, orders 0 to N.
79%
80% Display:
81% showIm - Display a matrix (real or complex) as grayscale image(s).
82% Displays dimensions, subsampling, and range of pixel values.
83% showLpyr - Display a Laplacian pyramid.
84% showWpyr - Display a separable wavelet pyramid.
85% showSpyr - Display a steerable pyramid.
86% lplot - "lollipop" plot.
87% nextFig - Make next figure window current.
88% pixelAxes - Make image display use an integer number of pixels
89% per sample to avoid resampling artifacts.
90%
91% Statistics (for 2D Matrices):
92% range2 - Min and max of image (matrix) [MEX file]
93% mean2 - Sample mean of an image (matrix).
94% var2 - Sample variance of an image (matrix).
95% skew2 - Sample skew (3rd moment / variance^1.5) of an image (matrix).
96% kurt2 - Sample kurtosis (4th moment / variance^2) of an image (matrix).
97% entropy2 - Sample entropy of an image (matrix).
98% imStats - Report sample statistics of an image, or pair of images.
99%
100% Miscellaneous:
101% pgmRead - Load a "pgm" image into a MatLab matrix [try einstein.pgm,feynman.pgm]
102% pgmWrite - Write a MatLab matrix to a "pgm" image file.
103% shift - circular shift a 2D matrix by an arbitrary amount.
104% vectify - pack matrix into column vector (i.e., function to compute mtx(:)).
105% ifftshift - inverse of MatLab's FFTSHIFT (differs for odd-length dimensions)
106% rcosFn - return a lookup table of a raised-cosine threshold fn.
107% innerProd - Compute M'*M efficiently (i.e., do not copy) [MEX file]
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/-MacReadMe b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/-MacReadMe
deleted file mode 100755
index 898dc0c..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/-MacReadMe
+++ /dev/null
@@ -1 +0,0 @@
1MacReadMe How to compile a MEX file for Macintosh (Based on a similar note written by David Brainard and Denis Pelli to accompany the Psychophysics Toolbox.) A MEX file (short for "MATLAB extension") contains code that implements a new MATLAB function, allowing users to use the full power of the C language and the Macintosh hardware and operating system in implementing a new MATLAB function. This document explains how to produce a MEX file that is "fat" (i.e. will run as native code on both 68K and PowerPC Macs) and is compatible with both MATLAB 4 and 5. 1) To produce a MATLAB MEX file with PowerPC code you must have the Metrowerks CodeWarrior C compiler (version 10 or better, abbreviated as CW below). To produce 68K code we still use the Symantec THINK C compiler (version from Symantec C++ 8 CD-ROM release 5), but we will soon be switching to Metrowerks CodeWarrior. (See note A below.) 2) Place a copy of the MATLAB 4:Extern folder, supplied by Mathworks, on your compiler's search path. We suggest that you name the copy "MEX V4". (See notes B and C, below.) 3) Build any of the MEX files simply by opening its project file and asking your compiler to "Build Code Resource" (in THINK C) or to "Make" it (in CW). For each MEX file, e.g. histo.mex, there are two associated projects, e.g. histo.µ for CW, and histo.¹.4 for THINK C. To build a "fat" MEX, that runs native on both 68K and PowerPC, you should first compile in THINK C, and then in CW. (See note A, below.) Denis Pelli April 2, 1997 Notes A) The Mathworks support only the THINK C compiler to make 68K MEX code for MATLAB version 4 and only the CW compiler to make PPC MEX files for MATLAB 4 and both 68K and PPC for MATLAB 5. This archive includes THINK and CW projects. To build a fat MEX file for MATLAB 4, first "make" the THINK C version (e.g. histo.¹.4), producing a file with a .rsrc extension (e.g. histo.µ.rsrc). This is the 68K MEX file. When you then "make" histo.µ, the CW project incorporates the .rsrc file and generates a "fat" MEX file that will run native (i.e. fast) on both 68K and PowerPC. To make a 68K-only MEX file, simply rename, e.g., histo.µ.rsrc to histo.mex after you make the THINK project, and set the file type and creator to match the other MEX files. THINK C is slow and hard to work with. Symantec hasn't significantly upgraded in it many years. There is an error in the math.h header (version from Symantec C++ 8 CD-ROM release 5). We fix that error by some tricky preprocessor defines and undefines in the THINK C Prefix in each of the THINK projects. B) The easiest way to put a folder on your compilerÕs search path is simply to put the folder in the same folder as the compiler itself. If you want to use both CW and THINK C, then put the folder under CW, make an alias of it, and put the alias in THINK C's "Aliases" folder. C) Happily, MATLAB 5 is capable of running both V4 and V5 MEX files. Thus we are currently distributing sources that compile into V4 MEX files. The resulting MEX files run both under V4 and V5. In the future we will drop support for V4 and THINK C. (See note A above.) \ No newline at end of file
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/.AppleDouble/.Parent b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/.AppleDouble/.Parent
deleted file mode 100755
index f242a99..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/.AppleDouble/.Parent
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/.FBCIndex b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/.FBCIndex
deleted file mode 100755
index 848736b..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/.FBCIndex
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/.FBCLockFolder/.FBCSemaphoreFile b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/.FBCLockFolder/.FBCSemaphoreFile
deleted file mode 100755
index ab2c684..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/.FBCLockFolder/.FBCSemaphoreFile
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/Makefile-linux b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/Makefile-linux
deleted file mode 100755
index 726dd31..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/Makefile-linux
+++ /dev/null
@@ -1,39 +0,0 @@
1MLAB = /usr/local/matlab5.1
2
3MXSFX = mexlx
4MEX = ${MLAB}/bin/mex
5
6MFLAGS = -V4
7INC = -I ${MLAB}/extern/include
8LIB = -L ${MLAB}/extern/lib
9
10CC = gcc -Wall -pedantic
11C_OPTIMIZE_SWITCH = -O2 ## For GCC
12CFLAGS = ${C_OPTIMIZE_SWITCH} ${INC} ${LIB}
13
14all: corrDn.${MXSFX} upConv.${MXSFX} pointOp.${MXSFX} \
15 histo.${MXSFX} range2.${MXSFX}
16
17clean:
18 /bin/rm *.o
19
20corrDn.${MXSFX}: corrDn.o wrap.o convolve.o edges.o
21 ${MEX} ${MFLAGS} corrDn.o wrap.o convolve.o edges.o
22
23upConv.${MXSFX}: upConv.o wrap.o convolve.o edges.o
24 ${MEX} ${MFLAGS} upConv.o wrap.o convolve.o edges.o
25
26pointOp.${MXSFX}: pointOp.o
27 ${MEX} ${MFLAGS} pointOp.o
28
29histo.${MXSFX}: histo.o
30 ${MEX} ${MFLAGS} histo.o
31
32range2.${MXSFX}: range2.o
33 ${MEX} ${MFLAGS} range2.o
34
35convolve.o wrap.o edges.o: convolve.h
36
37%.o : %.c
38 ${CC} -c ${CFLAGS} $<
39
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/Makefile-ml6-linux b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/Makefile-ml6-linux
deleted file mode 100755
index f596ad7..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/Makefile-ml6-linux
+++ /dev/null
@@ -1,39 +0,0 @@
1MLAB = /usr/local/matlab6.0
2
3MXSFX = mexglx
4MEX = ${MLAB}/bin/mex
5
6MFLAGS = -V4
7INC = -I ${MLAB}/extern/include
8LIB = -L ${MLAB}/extern/lib
9
10CC = gcc -Wall -pedantic
11C_OPTIMIZE_SWITCH = -O2 ## For GCC
12CFLAGS = ${C_OPTIMIZE_SWITCH} ${INC} ${LIB}
13
14all: corrDn.${MXSFX} upConv.${MXSFX} pointOp.${MXSFX} \
15 histo.${MXSFX} range2.${MXSFX}
16
17clean:
18 /bin/rm *.o
19
20corrDn.${MXSFX}: corrDn.o wrap.o convolve.o edges.o
21 ${MEX} ${MFLAGS} corrDn.o wrap.o convolve.o edges.o
22
23upConv.${MXSFX}: upConv.o wrap.o convolve.o edges.o
24 ${MEX} ${MFLAGS} upConv.o wrap.o convolve.o edges.o
25
26pointOp.${MXSFX}: pointOp.o
27 ${MEX} ${MFLAGS} pointOp.o
28
29histo.${MXSFX}: histo.o
30 ${MEX} ${MFLAGS} histo.o
31
32range2.${MXSFX}: range2.o
33 ${MEX} ${MFLAGS} range2.o
34
35convolve.o wrap.o edges.o: convolve.h
36
37%.o : %.c
38 ${CC} -c ${CFLAGS} $<
39
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/Makefile-osx b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/Makefile-osx
deleted file mode 100755
index 352d15b..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/Makefile-osx
+++ /dev/null
@@ -1,39 +0,0 @@
1MLAB = /share/wotan/matlab13
2
3MXSFX = mexosx
4MEX = ${MLAB}/bin/mex
5
6MFLAGS =
7INC = -I ${MLAB}/extern/include
8LIB = -L ${MLAB}/extern/lib
9
10CC = cc -Wall -pedantic -no-cpp-precomp
11C_OPTIMIZE_SWITCH = -O2 ## For GCC
12CFLAGS = ${C_OPTIMIZE_SWITCH} ${INC} ${LIB}
13
14all: corrDn.${MXSFX} upConv.${MXSFX} pointOp.${MXSFX} \
15 histo.${MXSFX} range2.${MXSFX}
16
17clean:
18 /bin/rm *.o
19
20corrDn.${MXSFX}: corrDn.o wrap.o convolve.o edges.o
21 ${MEX} ${MFLAGS} corrDn.o wrap.o convolve.o edges.o
22
23upConv.${MXSFX}: upConv.o wrap.o convolve.o edges.o
24 ${MEX} ${MFLAGS} upConv.o wrap.o convolve.o edges.o
25
26pointOp.${MXSFX}: pointOp.o
27 ${MEX} ${MFLAGS} pointOp.o
28
29histo.${MXSFX}: histo.o
30 ${MEX} ${MFLAGS} histo.o
31
32range2.${MXSFX}: range2.o
33 ${MEX} ${MFLAGS} range2.o
34
35convolve.o wrap.o edges.o: convolve.h
36
37%.o : %.c
38 ${CC} -c ${CFLAGS} $<
39
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/Makefile-solaris b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/Makefile-solaris
deleted file mode 100755
index 2be2bdb..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/Makefile-solaris
+++ /dev/null
@@ -1,38 +0,0 @@
1MLAB = /export/home/Solaris2/matlab5.1
2
3MXSFX = mexsol
4MEX = ${MLAB}/bin/mex
5
6MFLAGS = -V4
7INC = -I ${MLAB}/extern/include
8LIB = -L ${MLAB}/extern/lib
9
10CC = gcc -Wall -pedantic
11C_OPTIMIZE_SWITCH = -O2 ## For GCC
12CFLAGS = ${C_OPTIMIZE_SWITCH} ${INC} ${LIB}
13
14all: corrDn.${MXSFX} upConv.${MXSFX} pointOp.${MXSFX} \
15 histo.${MXSFX} range2.${MXSFX}
16
17clean:
18 /bin/rm *.o
19
20corrDn.${MXSFX}: corrDn.o wrap.o convolve.o edges.o
21 ${MEX} ${MFLAGS} corrDn.o wrap.o convolve.o edges.o
22
23upConv.${MXSFX}: upConv.o wrap.o convolve.o edges.o
24 ${MEX} ${MFLAGS} upConv.o wrap.o convolve.o edges.o
25
26pointOp.${MXSFX}: pointOp.o
27 ${MEX} ${MFLAGS} pointOp.o
28
29histo.${MXSFX}: histo.o
30 ${MEX} ${MFLAGS} histo.o
31
32range2.${MXSFX}: range2.o
33 ${MEX} ${MFLAGS} range2.o
34
35convolve.o wrap.o edges.o: convolve.h
36
37%.o : %.c
38 ${CC} -c ${CFLAGS} $<
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/Makefile-sun4 b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/Makefile-sun4
deleted file mode 100755
index 432b181..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/Makefile-sun4
+++ /dev/null
@@ -1,39 +0,0 @@
1MLAB = /home/alberich/matlab4
2
3MXSFX = mex4
4MEX = ${MLAB}/bin/cmex
5
6MFLAGS =
7INC = -I ${MLAB}/extern/include
8LIB = -L ${MLAB}/extern/lib/sun4
9
10CC = gcc
11C_OPTIMIZE_SWITCH = -O2 ## For GCC
12CFLAGS = ${C_OPTIMIZE_SWITCH} ${INC} ${LIB}
13
14all: corrDn.${MXSFX} upConv.${MXSFX} pointOp.${MXSFX} \
15 histo.${MXSFX} range2.${MXSFX}
16
17clean:
18 /bin/rm *.o
19
20corrDn.${MXSFX}: corrDn.o wrap.o convolve.o edges.o
21 ${MEX} ${MFLAGS} corrDn.o wrap.o convolve.o edges.o
22
23upConv.${MXSFX}: upConv.o wrap.o convolve.o edges.o
24 ${MEX} ${MFLAGS} upConv.o wrap.o convolve.o edges.o
25
26pointOp.${MXSFX}: pointOp.o
27 ${MEX} ${MFLAGS} pointOp.o
28
29histo.${MXSFX}: histo.o
30 ${MEX} ${MFLAGS} histo.o
31
32range2.${MXSFX}: range2.o
33 ${MEX} ${MFLAGS} range2.o
34
35convolve.o wrap.o edges.o: convolve.h
36
37%.o : %.c
38 ${CC} -c ${CFLAGS} $<
39
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/convolve.c b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/convolve.c
deleted file mode 100755
index 60a11a4..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/convolve.c
+++ /dev/null
@@ -1,325 +0,0 @@
1/*
2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3;;; File: convolve.c
4;;; Author: Eero Simoncelli
5;;; Description: General convolution code for 2D images
6;;; Creation Date: Spring, 1987.
7;;; MODIFICATIONS:
8;;; 10/89: approximately optimized the choice of register vars on SPARCS.
9;;; 6/96: Switched array types to double float.
10;;; 2/97: made more robust and readable. Added STOP arguments.
11;;; 8/97: Bug: when calling internal_reduce with edges in {reflect1,repeat,
12;;; extend} and an even filter dimension. Solution: embed the filter
13;;; in the upper-left corner of a filter with odd Y and X dimensions.
14;;; ----------------------------------------------------------------
15;;; Object-Based Vision and Image Understanding System (OBVIUS),
16;;; Copyright 1988, Vision Science Group, Media Laboratory,
17;;; Massachusetts Institute of Technology.
18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
19*/
20
21#include <stdio.h>
22#include <math.h>
23#include "convolve.h"
24
25/*
26 --------------------------------------------------------------------
27 Correlate FILT with IMAGE, subsampling according to START, STEP, and
28 STOP parameters, with values placed into RESULT array. RESULT
29 dimensions should be ceil((stop-start)/step). TEMP should be a
30 pointer to a temporary double array the size of the filter.
31 EDGES is a string specifying how to handle boundaries -- see edges.c.
32 The convolution is done in 9 sections, where the border sections use
33 specially computed edge-handling filters (see edges.c). The origin
34 of the filter is assumed to be (floor(x_fdim/2), floor(y_fdim/2)).
35------------------------------------------------------------------------ */
36
37/* abstract out the inner product computation */
38#define INPROD(XCNR,YCNR) \
39 { \
40 sum=0.0; \
41 for (im_pos=YCNR*x_dim+XCNR, filt_pos=0, x_filt_stop=x_fdim; \
42 x_filt_stop<=filt_size; \
43 im_pos+=(x_dim-x_fdim), x_filt_stop+=x_fdim) \
44 for (; \
45 filt_pos<x_filt_stop; \
46 filt_pos++, im_pos++) \
47 sum+= image[im_pos]*temp[filt_pos]; \
48 result[res_pos] = sum; \
49 }
50
51int internal_reduce(image, x_dim, y_dim, filt, temp, x_fdim, y_fdim,
52 x_start, x_step, x_stop, y_start, y_step, y_stop,
53 result, edges)
54 register image_type *image, *temp;
55 register int x_fdim, x_dim;
56 register image_type *result;
57 register int x_step, y_step;
58 int x_start, y_start;
59 int x_stop, y_stop;
60 image_type *filt;
61 int y_dim, y_fdim;
62 char *edges;
63 {
64 register double sum;
65 register int filt_pos, im_pos, x_filt_stop;
66 register int x_pos, filt_size = x_fdim*y_fdim;
67 register int y_pos, res_pos;
68 register int y_ctr_stop = y_dim - ((y_fdim==1)?0:y_fdim);
69 register int x_ctr_stop = x_dim - ((x_fdim==1)?0:x_fdim);
70 register int x_res_dim = (x_stop-x_start+x_step-1)/x_step;
71 int x_ctr_start = ((x_fdim==1)?0:1);
72 int y_ctr_start = ((y_fdim==1)?0:1);
73 int x_fmid = x_fdim/2;
74 int y_fmid = y_fdim/2;
75 int base_res_pos;
76 fptr reflect = edge_function(edges); /* look up edge-handling function */
77
78 if (!reflect) return(-1);
79
80 /* shift start/stop coords to filter upper left hand corner */
81 x_start -= x_fmid; y_start -= y_fmid;
82 x_stop -= x_fmid; y_stop -= y_fmid;
83
84 if (x_stop < x_ctr_stop) x_ctr_stop = x_stop;
85 if (y_stop < y_ctr_stop) y_ctr_stop = y_stop;
86
87 for (res_pos=0, y_pos=y_start; /* TOP ROWS */
88 y_pos<y_ctr_start;
89 y_pos+=y_step)
90 {
91 for (x_pos=x_start; /* TOP-LEFT CORNER */
92 x_pos<x_ctr_start;
93 x_pos+=x_step, res_pos++)
94 {
95 (*reflect)(filt,x_fdim,y_fdim,x_pos-1,y_pos-1,temp,REDUCE);
96 INPROD(0,0)
97 }
98
99 (*reflect)(filt,x_fdim,y_fdim,0,y_pos-1,temp,REDUCE);
100 for (; /* TOP EDGE */
101 x_pos<x_ctr_stop;
102 x_pos+=x_step, res_pos++)
103 INPROD(x_pos,0)
104
105 for (; /* TOP-RIGHT CORNER */
106 x_pos<x_stop;
107 x_pos+=x_step, res_pos++)
108 {
109 (*reflect)(filt,x_fdim,y_fdim,x_pos-x_ctr_stop+1,y_pos-1,temp,REDUCE);
110 INPROD(x_ctr_stop,0)
111 }
112 } /* end TOP ROWS */
113
114 y_ctr_start = y_pos; /* hold location of top */
115 for (base_res_pos=res_pos, x_pos=x_start; /* LEFT EDGE */
116 x_pos<x_ctr_start;
117 x_pos+=x_step, base_res_pos++)
118 {
119 (*reflect)(filt,x_fdim,y_fdim,x_pos-1,0,temp,REDUCE);
120 for (y_pos=y_ctr_start, res_pos=base_res_pos;
121 y_pos<y_ctr_stop;
122 y_pos+=y_step, res_pos+=x_res_dim)
123 INPROD(0,y_pos)
124 }
125
126 (*reflect)(filt,x_fdim,y_fdim,0,0,temp,REDUCE);
127 for (; /* CENTER */
128 x_pos<x_ctr_stop;
129 x_pos+=x_step, base_res_pos++)
130 for (y_pos=y_ctr_start, res_pos=base_res_pos;
131 y_pos<y_ctr_stop;
132 y_pos+=y_step, res_pos+=x_res_dim)
133 INPROD(x_pos,y_pos)
134
135 for (; /* RIGHT EDGE */
136 x_pos<x_stop;
137 x_pos+=x_step, base_res_pos++)
138 {
139 (*reflect)(filt,x_fdim,y_fdim,x_pos-x_ctr_stop+1,0,temp,REDUCE);
140 for (y_pos=y_ctr_start, res_pos=base_res_pos;
141 y_pos<y_ctr_stop;
142 y_pos+=y_step, res_pos+=x_res_dim)
143 INPROD(x_ctr_stop,y_pos)
144 }
145
146 for (res_pos-=(x_res_dim-1);
147 y_pos<y_stop; /* BOTTOM ROWS */
148 y_pos+=y_step)
149 {
150 for (x_pos=x_start; /* BOTTOM-LEFT CORNER */
151 x_pos<x_ctr_start;
152 x_pos+=x_step, res_pos++)
153 {
154 (*reflect)(filt,x_fdim,y_fdim,x_pos-1,y_pos-y_ctr_stop+1,temp,REDUCE);
155 INPROD(0,y_ctr_stop)
156 }
157
158 (*reflect)(filt,x_fdim,y_fdim,0,y_pos-y_ctr_stop+1,temp,REDUCE);
159 for (; /* BOTTOM EDGE */
160 x_pos<x_ctr_stop;
161 x_pos+=x_step, res_pos++)
162 INPROD(x_pos,y_ctr_stop)
163
164 for (; /* BOTTOM-RIGHT CORNER */
165 x_pos<x_stop;
166 x_pos+=x_step, res_pos++)
167 {
168 (*reflect)(filt,x_fdim,y_fdim,x_pos-x_ctr_stop+1,y_pos-y_ctr_stop+1,temp,REDUCE);
169 INPROD(x_ctr_stop,y_ctr_stop)
170 }
171 } /* end BOTTOM */
172 return(0);
173 } /* end of internal_reduce */
174
175
176/*
177 --------------------------------------------------------------------
178 Upsample IMAGE according to START,STEP, and STOP parameters and then
179 convolve with FILT, adding values into RESULT array. IMAGE
180 dimensions should be ceil((stop-start)/step). See
181 description of internal_reduce (above).
182
183 WARNING: this subroutine destructively modifies the RESULT array!
184 ------------------------------------------------------------------------ */
185
186/* abstract out the inner product computation */
187#define INPROD2(XCNR,YCNR) \
188 { \
189 val = image[im_pos]; \
190 for (res_pos=YCNR*x_dim+XCNR, filt_pos=0, x_filt_stop=x_fdim; \
191 x_filt_stop<=filt_size; \
192 res_pos+=(x_dim-x_fdim), x_filt_stop+=x_fdim) \
193 for (; \
194 filt_pos<x_filt_stop; \
195 filt_pos++, res_pos++) \
196 result[res_pos] += val*temp[filt_pos]; \
197 }
198
199int internal_expand(image,filt,temp,x_fdim,y_fdim,
200 x_start,x_step,x_stop,y_start,y_step,y_stop,
201 result,x_dim,y_dim,edges)
202 register image_type *result, *temp;
203 register int x_fdim, x_dim;
204 register int x_step, y_step;
205 register image_type *image;
206 int x_start, y_start;
207 image_type *filt;
208 int y_fdim, y_dim;
209 char *edges;
210 {
211 register double val;
212 register int filt_pos, res_pos, x_filt_stop;
213 register int x_pos, filt_size = x_fdim*y_fdim;
214 register int y_pos, im_pos;
215 register int x_ctr_stop = x_dim - ((x_fdim==1)?0:x_fdim);
216 int y_ctr_stop = (y_dim - ((y_fdim==1)?0:y_fdim));
217 int x_ctr_start = ((x_fdim==1)?0:1);
218 int y_ctr_start = ((y_fdim==1)?0:1);
219 int x_fmid = x_fdim/2;
220 int y_fmid = y_fdim/2;
221 int base_im_pos, x_im_dim = (x_stop-x_start+x_step-1)/x_step;
222 fptr reflect = edge_function(edges); /* look up edge-handling function */
223
224 if (!reflect) return(-1);
225
226 /* shift start/stop coords to filter upper left hand corner */
227 x_start -= x_fmid; y_start -= y_fmid;
228 x_stop -= x_fmid; y_stop -= y_fmid;
229
230 if (x_stop < x_ctr_stop) x_ctr_stop = x_stop;
231 if (y_stop < y_ctr_stop) y_ctr_stop = y_stop;
232
233 for (im_pos=0, y_pos=y_start; /* TOP ROWS */
234 y_pos<y_ctr_start;
235 y_pos+=y_step)
236 {
237 for (x_pos=x_start; /* TOP-LEFT CORNER */
238 x_pos<x_ctr_start;
239 x_pos+=x_step, im_pos++)
240 {
241 (*reflect)(filt,x_fdim,y_fdim,x_pos-1,y_pos-1,temp,EXPAND);
242 INPROD2(0,0)
243 }
244
245 (*reflect)(filt,x_fdim,y_fdim,0,y_pos-1,temp,EXPAND);
246 for (; /* TOP EDGE */
247 x_pos<x_ctr_stop;
248 x_pos+=x_step, im_pos++)
249 INPROD2(x_pos,0)
250
251 for (; /* TOP-RIGHT CORNER */
252 x_pos<x_stop;
253 x_pos+=x_step, im_pos++)
254 {
255 (*reflect)(filt,x_fdim,y_fdim,x_pos-x_ctr_stop+1,y_pos-1,temp,EXPAND);
256 INPROD2(x_ctr_stop,0)
257 }
258 } /* end TOP ROWS */
259
260 y_ctr_start = y_pos; /* hold location of top */
261 for (base_im_pos=im_pos, x_pos=x_start; /* LEFT EDGE */
262 x_pos<x_ctr_start;
263 x_pos+=x_step, base_im_pos++)
264 {
265 (*reflect)(filt,x_fdim,y_fdim,x_pos-1,0,temp,EXPAND);
266 for (y_pos=y_ctr_start, im_pos=base_im_pos;
267 y_pos<y_ctr_stop;
268 y_pos+=y_step, im_pos+=x_im_dim)
269 INPROD2(0,y_pos)
270 }
271
272 (*reflect)(filt,x_fdim,y_fdim,0,0,temp,EXPAND);
273 for (; /* CENTER */
274 x_pos<x_ctr_stop;
275 x_pos+=x_step, base_im_pos++)
276 for (y_pos=y_ctr_start, im_pos=base_im_pos;
277 y_pos<y_ctr_stop;
278 y_pos+=y_step, im_pos+=x_im_dim)
279 INPROD2(x_pos,y_pos)
280
281 for (; /* RIGHT EDGE */
282 x_pos<x_stop;
283 x_pos+=x_step, base_im_pos++)
284 {
285 (*reflect)(filt,x_fdim,y_fdim,x_pos-x_ctr_stop+1,0,temp,EXPAND);
286 for (y_pos=y_ctr_start, im_pos=base_im_pos;
287 y_pos<y_ctr_stop;
288 y_pos+=y_step, im_pos+=x_im_dim)
289 INPROD2(x_ctr_stop,y_pos)
290 }
291
292 for (im_pos-=(x_im_dim-1);
293 y_pos<y_stop; /* BOTTOM ROWS */
294 y_pos+=y_step)
295 {
296 for (x_pos=x_start; /* BOTTOM-LEFT CORNER */
297 x_pos<x_ctr_start;
298 x_pos+=x_step, im_pos++)
299 {
300 (*reflect)(filt,x_fdim,y_fdim,x_pos-1,y_pos-y_ctr_stop+1,temp,EXPAND);
301 INPROD2(0,y_ctr_stop)
302 }
303
304 (*reflect)(filt,x_fdim,y_fdim,0,y_pos-y_ctr_stop+1,temp,EXPAND);
305 for (; /* BOTTOM EDGE */
306 x_pos<x_ctr_stop;
307 x_pos+=x_step, im_pos++)
308 INPROD2(x_pos,y_ctr_stop)
309
310 for (; /* BOTTOM-RIGHT CORNER */
311 x_pos<x_stop;
312 x_pos+=x_step, im_pos++)
313 {
314 (*reflect)(filt,x_fdim,y_fdim,x_pos-x_ctr_stop+1,y_pos-y_ctr_stop+1,temp,EXPAND);
315 INPROD2(x_ctr_stop,y_ctr_stop)
316 }
317 } /* end BOTTOM */
318 return(0);
319 } /* end of internal_expand */
320
321
322/* Local Variables: */
323/* buffer-read-only: t */
324/* End: */
325
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/convolve.h b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/convolve.h
deleted file mode 100755
index 48d55f7..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/convolve.h
+++ /dev/null
@@ -1,55 +0,0 @@
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 <stdio.h>
15#include <stdlib.h>
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
26typedef int (*fptr)();
27
28typedef struct
29 {
30 char *name;
31 fptr func;
32 } EDGE_HANDLER;
33
34typedef double image_type;
35
36fptr edge_function(char *edges);
37int 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);
42int 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);
47int 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);
52int 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);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/corrDn.c b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/corrDn.c
deleted file mode 100755
index c74df1f..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/corrDn.c
+++ /dev/null
@@ -1,145 +0,0 @@
1/*
2RES = corrDn(IM, FILT, EDGES, STEP, START, STOP);
3 >>> See corrDn.m for documentation <<<
4 This is a matlab interface to the internal_reduce function.
5 EPS, 7/96.
6*/
7
8#define V4_COMPAT
9#include <matrix.h> /* Matlab matrices */
10#include <mex.h>
11
12#include "convolve.h"
13
14#define notDblMtx(it) (!mxIsNumeric(it) || !mxIsDouble(it) || mxIsSparse(it) || mxIsComplex(it))
15
16void mexFunction(int nlhs, /* Num return vals on lhs */
17 mxArray *plhs[], /* Matrices on lhs */
18 int nrhs, /* Num args on rhs */
19 const mxArray *prhs[] /* Matrices on rhs */
20 )
21 {
22 double *image,*filt, *temp, *result;
23 int x_fdim, y_fdim, x_idim, y_idim;
24 int x_rdim, y_rdim;
25 int x_start = 1;
26 int x_step = 1;
27 int y_start = 1;
28 int y_step = 1;
29 int x_stop, y_stop;
30 mxArray *arg;
31 double *mxMat;
32 char edges[15] = "reflect1";
33
34 if (nrhs<2) mexErrMsgTxt("requres at least 2 args.");
35
36 /* ARG 1: IMAGE */
37 arg = prhs[0];
38 if notDblMtx(arg) mexErrMsgTxt("IMAGE arg must be a non-sparse double float matrix.");
39 image = mxGetPr(arg);
40 x_idim = (int) mxGetM(arg); /* X is inner index! */
41 y_idim = (int) mxGetN(arg);
42
43 /* ARG 2: FILTER */
44 arg = prhs[1];
45 if notDblMtx(arg) mexErrMsgTxt("FILTER arg must be non-sparse double float matrix.");
46 filt = mxGetPr(arg);
47 x_fdim = (int) mxGetM(arg);
48 y_fdim = (int) mxGetN(arg);
49
50 if ((x_fdim > x_idim) || (y_fdim > y_idim))
51 {
52 mexPrintf("Filter: [%d %d], Image: [%d %d]\n",x_fdim,y_fdim,x_idim,y_idim);
53 mexErrMsgTxt("FILTER dimensions larger than IMAGE dimensions.");
54 }
55
56 /* ARG 3 (optional): EDGES */
57 if (nrhs>2)
58 {
59 if (!mxIsChar(prhs[2]))
60 mexErrMsgTxt("EDGES arg must be a string.");
61 mxGetString(prhs[2],edges,15);
62 }
63
64 /* ARG 4 (optional): STEP */
65 if (nrhs>3)
66 {
67 arg = prhs[3];
68 if notDblMtx(arg) mexErrMsgTxt("STEP arg must be a double float matrix.");
69 if (mxGetM(arg) * mxGetN(arg) != 2)
70 mexErrMsgTxt("STEP arg must contain two elements.");
71 mxMat = mxGetPr(arg);
72 x_step = (int) mxMat[0];
73 y_step = (int) mxMat[1];
74 if ((x_step<1) || (y_step<1))
75 mexErrMsgTxt("STEP values must be greater than zero.");
76 }
77
78 /* ARG 5 (optional): START */
79 if (nrhs>4)
80 {
81 arg = prhs[4];
82 if notDblMtx(arg) mexErrMsgTxt("START arg must be a double float matrix.");
83 if (mxGetM(arg) * mxGetN(arg) != 2)
84 mexErrMsgTxt("START arg must contain two elements.");
85 mxMat = mxGetPr(arg);
86 x_start = (int) mxMat[0];
87 y_start = (int) mxMat[1];
88 if ((x_start<1) || (x_start>x_idim) ||
89 (y_start<1) || (y_start>y_idim))
90 mexErrMsgTxt("START values must lie between 1 and the image dimensions.");
91 }
92 x_start--; /* convert from Matlab to standard C indexes */
93 y_start--;
94
95 /* ARG 6 (optional): STOP */
96 if (nrhs>5)
97 {
98 if notDblMtx(prhs[5]) mexErrMsgTxt("STOP arg must be double float matrix.");
99 if (mxGetM(prhs[5]) * mxGetN(prhs[5]) != 2)
100 mexErrMsgTxt("STOP arg must contain two elements.");
101 mxMat = mxGetPr(prhs[5]);
102 x_stop = (int) mxMat[0];
103 y_stop = (int) mxMat[1];
104 if ((x_stop<x_start) || (x_stop>x_idim) ||
105 (y_stop<y_start) || (y_stop>y_idim))
106 mexErrMsgTxt("STOP values must lie between START and the image dimensions.");
107 }
108 else
109 {
110 x_stop = x_idim;
111 y_stop = y_idim;
112 }
113
114 x_rdim = (x_stop-x_start+x_step-1) / x_step;
115 y_rdim = (y_stop-y_start+y_step-1) / y_step;
116
117 /* mxFreeMatrix(plhs[0]); */
118 plhs[0] = (mxArray *) mxCreateDoubleMatrix(x_rdim,y_rdim,mxREAL);
119 if (plhs[0] == NULL) mexErrMsgTxt("Cannot allocate result matrix");
120 result = mxGetPr(plhs[0]);
121
122 temp = mxCalloc(x_fdim*y_fdim, sizeof(double));
123 if (temp == NULL)
124 mexErrMsgTxt("Cannot allocate necessary temporary space");
125
126 /*
127 printf("i(%d, %d), f(%d, %d), r(%d, %d), X(%d, %d, %d), Y(%d, %d, %d), %s\n",
128 x_idim,y_idim,x_fdim,y_fdim,x_rdim,y_rdim,
129 x_start,x_step,x_stop,y_start,y_step,y_stop,edges);
130 */
131
132 if (strcmp(edges,"circular") == 0)
133 internal_wrap_reduce(image, x_idim, y_idim, filt, x_fdim, y_fdim,
134 x_start, x_step, x_stop, y_start, y_step, y_stop,
135 result);
136 else internal_reduce(image, x_idim, y_idim, filt, temp, x_fdim, y_fdim,
137 x_start, x_step, x_stop, y_start, y_step, y_stop,
138 result, edges);
139
140 mxFree((char *) temp);
141 return;
142 }
143
144
145
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/edges-orig.c b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/edges-orig.c
deleted file mode 100755
index 1f6a98b..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/edges-orig.c
+++ /dev/null
@@ -1,494 +0,0 @@
1/*
2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3;;; File: edges.c
4;;; Author: Eero Simoncelli
5;;; Description: Boundary handling routines for use with convolve.c
6;;; Creation Date: Spring 1987.
7;;; MODIFIED, 6/96, to operate on double float arrays.
8;;; MODIFIED by dgp, 4/1/97, to support THINK C.
9;;; ----------------------------------------------------------------
10;;; Object-Based Vision and Image Understanding System (OBVIUS),
11;;; Copyright 1988, Vision Science Group, Media Laboratory,
12;;; Massachusetts Institute of Technology.
13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14*/
15
16/*
17This file contains functions which determine how edges are to be
18handled when performing convolutions of images with linear filters.
19Any edge handling function which is local and linear may be defined,
20except (unfortunately) constants cannot be added. So to treat the
21edges as if the image is surrounded by a gray field, you must paste it
22into a gray image, convolve, and crop it out...
23The main convolution function is called internal_filter and is defined
24in the file convolve.c. The idea is that the convolution function
25calls the edge handling function which computes a new filter based on
26the old filter and the distance to the edge of the image. For
27example, reflection is done by reflecting the filter through the
28appropriate axis and summing. Currently defined functions are listed
29below.
30*/
31
32/*
33#define DEBUG
34*/
35
36#include <stdio.h>
37#include <math.h>
38#include <string.h>
39#include "convolve.h"
40
41#define sgn(a) ( ((a)>0)?1:(((a)<0)?-1:0) )
42#define clip(a,mn,mx) ( ((a)<(mn))?(mn):(((a)>=(mx))?(mx-1):(a)) )
43
44int reflect1(), reflect2(), repeat(), zero(), Extend(), nocompute();
45int ereflect(), predict();
46
47/* Lookup table matching a descriptive string to the edge-handling function */
48#if !THINK_C
49 static EDGE_HANDLER edge_foos[] =
50 {
51 { "dont-compute", nocompute }, /* zero output for filter touching edge */
52 { "zero", zero }, /* zero outside of image */
53 { "repeat", repeat }, /* repeat edge pixel */
54 { "reflect1", reflect1 }, /* reflect about edge pixels */
55 { "reflect2", reflect2 }, /* reflect image, including edge pixels */
56 { "extend", Extend }, /* extend (reflect & invert) */
57 { "predict", predict }, /* predict based on portion covered by filt */
58 { "ereflect", ereflect }, /* orthogonal QMF reflection */
59 };
60#else
61 /*
62 This is really stupid, but THINK C won't allow initialization of static variables in
63 a code resource with string addresses. So we do it this way.
64 The 68K code for a MATLAB 4 MEX file can only be created by THINK C.
65 However, for MATLAB 5, we'll be able to use Metrowerks CodeWarrior for both 68K and PPC, so this
66 cludge can be dropped when we drop support for MATLAB 4.
67 Denis Pelli, 4/1/97.
68 */
69 static EDGE_HANDLER edge_foos[8];
70
71 void InitializeTable(EDGE_HANDLER edge_foos[])
72 {
73 static int i=0;
74
75 if(i>0) return;
76 edge_foos[i].name="dont-compute";
77 edge_foos[i++].func=nocompute;
78 edge_foos[i].name="zero";
79 edge_foos[i++].func=zero;
80 edge_foos[i].name="repeat";
81 edge_foos[i++].func=repeat;
82 edge_foos[i].name="reflect1";
83 edge_foos[i++].func=reflect1;
84 edge_foos[i].name="reflect2";
85 edge_foos[i++].func=reflect2;
86 edge_foos[i].name="extend";
87 edge_foos[i++].func=Extend;
88 edge_foos[i].name="predict";
89 edge_foos[i++].func=predict;
90 edge_foos[i].name="ereflect";
91 edge_foos[i++].func=ereflect;
92 }
93#endif
94
95/*
96Function looks up an edge handler id string in the structure above, and
97returns the associated function
98*/
99fptr edge_function(char *edges)
100 {
101 int i;
102
103#if THINK_C
104 InitializeTable(edge_foos);
105#endif
106 for (i = 0; i<sizeof(edge_foos)/sizeof(EDGE_HANDLER); i++)
107 if (strcmp(edges,edge_foos[i].name) == 0)
108 return(edge_foos[i].func);
109 printf("Error: '%s' is not the name of a valid edge-handler!\n",edges);
110 for (i=0; i<sizeof(edge_foos)/sizeof(EDGE_HANDLER); i++)
111 {
112 if (i==0) printf(" Options are: ");
113 else printf(", ");
114 printf("%s",edge_foos[i].name);
115 }
116 printf("\n");
117 return(0);
118 }
119
120/*
121---------------- EDGE HANDLER ARGUMENTS ------------------------
122filt - array of filter taps.
123x_dim, y_dim - x and y dimensions of filt.
124x_pos - position of filter relative to the horizontal image edges. Negative
125 values indicate left edge, positive indicate right edge. Zero
126 indicates that the filter is not touching either edge. An absolute
127 value of 1 indicates that the edge tap of the filter is over the
128 edge pixel of the image.
129y_pos - analogous to x_pos.
130result - array where the resulting filter will go. The edge
131 of this filter will be aligned with the image for application...
132f_or_e - equal to one of the two constants EXPAND or FILTER.
133--------------------------------------------------------------------
134*/
135
136
137/* --------------------------------------------------------------------
138nocompute() - Return zero for values where filter hangs over the edge.
139*/
140
141int nocompute(filt,x_dim,y_dim,x_pos,y_pos,result,f_or_e)
142 register double *filt, *result;
143 register int x_dim;
144 int y_dim, x_pos, y_pos, f_or_e;
145 {
146 register int i;
147 register int size = x_dim*y_dim;
148
149 if ( (x_pos>1) OR (x_pos<-1) OR (y_pos>1) OR (y_pos<-1) )
150 for (i=0; i<size; i++) result[i] = 0.0;
151 else
152 for (i=0; i<size; i++) result[i] = filt[i];
153 return(0);
154 }
155
156/* --------------------------------------------------------------------
157zero() - Zero outside of image. Discontinuous, but adds zero energy. */
158
159int zero(filt,x_dim,y_dim,x_pos,y_pos,result,f_or_e)
160 register double *filt, *result;
161 register int x_dim;
162 int y_dim, x_pos, y_pos, f_or_e;
163 {
164 register int y_filt,x_filt, y_res,x_res;
165 int filt_sz = x_dim*y_dim;
166 int x_start = ((x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0));
167 int y_start = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0));
168 int i;
169
170 for (i=0; i<filt_sz; i++) result[i] = 0.0;
171
172 for (y_filt=0, y_res=y_start;
173 y_filt<filt_sz;
174 y_filt+=x_dim, y_res+=x_dim)
175 if ((y_res >= 0) AND (y_res < filt_sz))
176 for (x_filt=y_filt, x_res=x_start;
177 x_filt<y_filt+x_dim;
178 x_filt++, x_res++)
179 if ((x_res >= 0) AND (x_res < x_dim))
180 result[y_res+x_res] = filt[x_filt];
181 return(0);
182 }
183
184/* --------------------------------------------------------------------
185repeat() - repeat edge pixel. Continuous, but content is usually
186different from image.
187*/
188
189int repeat(filt,x_dim,y_dim,x_pos,y_pos,result,f_or_e)
190 register double *filt, *result;
191 register int x_dim;
192 int y_dim, x_pos, y_pos, f_or_e;
193 {
194 register int y_filt,x_filt, y_res,x_res;
195 int filt_sz = x_dim*y_dim;
196 int x_start = ((x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0));
197 int y_start = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0));
198 int i;
199
200 for (i=0; i<filt_sz; i++) result[i] = 0.0;
201
202 for (y_filt=0, y_res=y_start;
203 y_filt<filt_sz;
204 y_filt+=x_dim, y_res+=x_dim)
205 for (x_filt=y_filt, x_res=x_start;
206 x_filt<y_filt+x_dim;
207 x_filt++, x_res++)
208 result[((y_res>=0)?((y_res<filt_sz)?y_res:(filt_sz-x_dim)):0)
209 + ((x_res>=0)?((x_res<x_dim)?x_res:(x_dim-1)):0)]
210 += filt[x_filt];
211 return(0);
212 }
213
214/* --------------------------------------------------------------------
215reflect2() - "Normal" image reflection. The edge pixel is repeated,
216then the next pixel, etc. Continuous, attempting to maintain
217"similar" content, but discontinuous first derivative.
218*/
219
220int reflect2(filt,x_dim,y_dim,x_pos,y_pos,result,f_or_e)
221 register double *filt, *result;
222 register int x_dim;
223 int y_dim, x_pos, y_pos, f_or_e;
224 {
225 register int y_filt,x_filt, y_edge,x_edge;
226 register int x_base = (x_pos>0)?(x_dim-1):0;
227 register int y_base = (y_pos>0)?(x_dim*(y_dim-1)):0;
228 int filt_sz = x_dim*y_dim;
229 int x_edge_dist = (x_pos>0)?(x_pos-x_dim-1):(x_pos+1);
230 int y_edge_dist = x_dim * ((y_pos>0)?(y_pos-y_dim-1):(y_pos+1));
231 int i;
232
233 #ifdef DEBUG
234 printf("(%d,%d) ",y_pos,x_pos);
235 if (x_pos==0) printf("\n");
236 #endif
237
238 for (i=0; i<filt_sz; i++) result[i] = 0.0;
239
240 for (y_filt=0, y_edge=y_edge_dist;
241 y_filt<filt_sz;
242 y_filt+=x_dim, y_edge+=x_dim)
243 {
244 if (y_edge IS 0) y_edge+=x_dim;
245 for (x_filt=y_filt, x_edge=x_edge_dist;
246 x_filt<y_filt+x_dim;
247 x_filt++, x_edge++)
248 {
249 if (x_edge IS 0) x_edge++;
250 result[ABS(y_base-ABS(y_edge)+x_dim) + ABS(x_base-ABS(x_edge)+1)]
251 += filt[x_filt];
252 }
253 }
254 return(0);
255 }
256
257/* --------------------------------------------------------------------
258reflect1() - Reflection through the edge pixels. This is the right thing
259to do if you are subsampling by 2, since it maintains parity (even
260pixels positions remain even, odd ones remain odd). (note: procedure differs
261depending on f_or_e parameter). */
262
263int reflect1(filt,x_dim,y_dim,x_pos,y_pos,result,f_or_e)
264 register double *filt, *result;
265 register int x_dim;
266 int y_dim, x_pos, y_pos, f_or_e;
267 {
268 int filt_sz = x_dim*y_dim;
269 register int x_start = 0, y_start = 0, x_stop = x_dim, y_stop = filt_sz;
270 register int y_filt,x_filt, y_edge,x_edge;
271 register int x_base = (x_pos>0)?(x_dim-1):0;
272 register int y_base = (y_pos>0)?(x_dim*(y_dim-1)):0;
273 int x_edge_dist = (x_pos>0)?(x_pos-x_dim):((x_pos<0)?(x_pos+1):0);
274 int y_edge_dist = x_dim * ((y_pos>0)?(y_pos-y_dim):((y_pos<0)?(y_pos+1):0));
275 int i;
276 int mx_pos = (x_dim/2)+1;
277 int my_pos = (y_dim/2)+1;
278
279 #ifdef DEBUG
280 printf("(%d,%d) ",y_pos,x_pos);
281 if (x_pos==0) printf("\n");
282 #endif
283
284 for (i=0; i<filt_sz; i++) result[i] = 0.0;
285
286 /* if EXPAND and filter is centered on image edge, do not reflect */
287 if (f_or_e IS EXPAND)
288 {
289 if (x_pos IS mx_pos) x_stop = (x_dim+1)/2;
290 else if (x_pos IS -mx_pos) { x_start = x_dim/2; x_edge_dist = 0; }
291
292 if (y_pos IS my_pos) y_stop = x_dim*((y_dim+1)/2);
293 else if (y_pos IS -my_pos) { y_start = x_dim*(y_dim/2); y_edge_dist = 0;}
294 }
295
296 /* reflect at boundary of image */
297 for (y_filt=y_start, y_edge=y_edge_dist;
298 y_filt<y_stop;
299 y_filt+=x_dim, y_edge+=x_dim)
300 for (x_filt=y_filt+x_start, x_edge=x_edge_dist;
301 x_filt<y_filt+x_stop;
302 x_filt++, x_edge++)
303 result[ABS(y_base-ABS(y_edge)) + ABS(x_base-ABS(x_edge))]
304 += filt[x_filt];
305
306 /* if EXPAND and filter is not centered on image edge, mult edge by 2 */
307 if (f_or_e IS EXPAND)
308 {
309 if ( (ABS(x_pos) ISNT mx_pos) AND (x_pos ISNT 0) )
310 for (y_filt=x_base; y_filt<filt_sz; y_filt+=x_dim)
311 result[y_filt] += result[y_filt];
312 if ( (ABS(y_pos) ISNT my_pos) AND (y_pos ISNT 0) )
313 for (x_filt=y_base; x_filt<y_base+x_dim; x_filt++)
314 result[x_filt] += result[x_filt];
315 }
316 return(0);
317 }
318
319/* --------------------------------------------------------------------
320Extend() - Extend image by reflecting and inverting about edge pixel
321value. Maintains continuity in intensity AND first derivative (but
322not higher derivs).
323*/
324
325int Extend(filt,x_dim,y_dim,x_pos,y_pos,result,f_or_e)
326 register double *filt, *result;
327 register int x_dim;
328 int y_dim, x_pos, y_pos, f_or_e;
329 {
330 int filt_sz = x_dim*y_dim;
331 register int x_start = 0, y_start = 0, x_stop = x_dim, y_stop = filt_sz;
332 register int y_filt,x_filt, y_edge,x_edge;
333 register int x_base = (x_pos>0)?(x_dim-1):0;
334 register int y_base = (y_pos>0)?(x_dim*(y_dim-1)):0;
335 int x_edge_dist = (x_pos>0)?(x_pos-x_dim):((x_pos<-1)?(x_pos+1):0);
336 int y_edge_dist = x_dim * ((y_pos>0)?(y_pos-y_dim):((y_pos<-1)?(y_pos+1):0));
337 int i;
338 int mx_pos = (x_dim/2)+1;
339 int my_pos = (y_dim/2)+1;
340
341 for (i=0; i<filt_sz; i++) result[i] = 0.0;
342
343 /* if EXPAND and filter is centered on image edge, do not reflect */
344 if (f_or_e IS EXPAND)
345 {
346 if (x_pos IS mx_pos) x_stop = (x_dim+1)/2;
347 else if (x_pos IS -mx_pos) { x_start = x_dim/2; x_edge_dist = 0; }
348
349 if (y_pos IS my_pos) y_stop = x_dim*((y_dim+1)/2);
350 else if (y_pos IS -my_pos) { y_start = x_dim*(y_dim/2); y_edge_dist = 0;}
351 }
352
353 /* reflect at boundary of image */
354 for (y_filt=y_start, y_edge=y_edge_dist;
355 y_filt<y_stop;
356 y_filt+=x_dim, y_edge+=x_dim)
357 for (x_filt=y_filt+x_start, x_edge=x_edge_dist;
358 x_filt<y_filt+x_stop;
359 x_filt++, x_edge++)
360 if (((!y_base AND (sgn(y_edge) IS -1)) /* y overhanging */
361 OR
362 (y_base AND (sgn(y_edge) IS 1)))
363 ISNT /* XOR */
364 ((!x_base AND (sgn(x_edge) IS -1)) /* x overhanging */
365 OR
366 (x_base AND (sgn(x_edge) IS 1))))
367 {
368 result[ABS(y_base-ABS(y_edge)) + ABS(x_base-ABS(x_edge))]
369 -= filt[x_filt];
370 result[clip(y_base+y_edge,0,y_dim) + clip(x_base+x_edge,0,x_dim)]
371 += filt[x_filt] + filt[x_filt];
372 }
373 else result[ABS(y_base-ABS(y_edge)) + ABS(x_base-ABS(x_edge))]
374 += filt[x_filt];
375 return(0);
376 }
377
378/* --------------------------------------------------------------------
379predict() - Simple prediction. Like zero, but multiplies the result
380by the reciprocal of the percentage of filter being used. (i.e. if
38150% of the filter is hanging over the edge of the image, multiply the
382taps being used by 2). */
383
384int predict(filt,x_dim,y_dim,x_pos,y_pos,result,f_or_e)
385 register double *filt, *result;
386 register int x_dim;
387 int y_dim, x_pos, y_pos, f_or_e;
388 {
389 register int y_filt,x_filt, y_res,x_res;
390 register double taps_used = 0.0; /* int *** */
391 register double fraction = 0.0;
392 int filt_sz = x_dim*y_dim;
393 int x_start = ((x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0));
394 int y_start = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0));
395 int i;
396
397 for (i=0; i<filt_sz; i++) result[i] = 0.0;
398
399 for (y_filt=0, y_res=y_start;
400 y_filt<filt_sz;
401 y_filt+=x_dim, y_res+=x_dim)
402 if ((y_res >= 0) AND (y_res < filt_sz))
403 for (x_filt=y_filt, x_res=x_start;
404 x_filt<y_filt+x_dim;
405 x_filt++, x_res++)
406 if ((x_res >= 0) AND (x_res < x_dim))
407 {
408 result[y_res+x_res] = filt[x_filt];
409 taps_used += ABS(filt[x_filt]);
410 }
411 printf("TU: %f\n",taps_used);
412 if (f_or_e IS FILTER)
413 {
414 /* fraction = ( (double) filt_sz ) / ( (double) taps_used ); */
415 for (i=0; i<filt_sz; i++) fraction += ABS(filt[i]);
416 fraction = ( fraction / taps_used );
417 for (i=0; i<filt_sz; i++) result[i] *= fraction;
418 }
419 return(0);
420 }
421
422
423/* --------------------------------------------------------------------
424Reflect, multiplying tap of filter which is at the edge of the image
425by root 2. This maintains orthogonality of odd-length linear-phase
426QMF filters, but it is not useful for most applications, since it
427alters the DC level. */
428
429int ereflect(filt,x_dim,y_dim,x_pos,y_pos,result,f_or_e)
430 register double *filt, *result;
431 register int x_dim;
432 int y_dim, x_pos, y_pos, f_or_e;
433 {
434 register int y_filt,x_filt, y_edge,x_edge;
435 register int x_base = (x_pos>0)?(x_dim-1):0;
436 register int y_base = x_dim * ( (y_pos>0)?(y_dim-1):0 );
437 int filt_sz = x_dim*y_dim;
438 int x_edge_dist = (x_pos>1)?(x_pos-x_dim):((x_pos<-1)?(x_pos+1):0);
439 int y_edge_dist = x_dim * ( (y_pos>1)?(y_pos-y_dim):((y_pos<-1)?(y_pos+1):0) );
440 int i;
441 double norm,onorm;
442
443 for (i=0; i<filt_sz; i++) result[i] = 0.0;
444
445 /* reflect at boundary */
446 for (y_filt=0, y_edge=y_edge_dist;
447 y_filt<filt_sz;
448 y_filt+=x_dim, y_edge+=x_dim)
449 for (x_filt=y_filt, x_edge=x_edge_dist;
450 x_filt<y_filt+x_dim;
451 x_filt++, x_edge++)
452 result[ABS(y_base-ABS(y_edge)) + ABS(x_base-ABS(x_edge))]
453 += filt[x_filt];
454
455 /* now multiply edge by root 2 */
456 if (x_pos ISNT 0)
457 for (y_filt=x_base; y_filt<filt_sz; y_filt+=x_dim)
458 result[y_filt] *= ROOT2;
459 if (y_pos ISNT 0)
460 for (x_filt=y_base; x_filt<y_base+x_dim; x_filt++)
461 result[x_filt] *= ROOT2;
462
463 /* now normalize to norm of original filter */
464 for (norm=0.0,i=0; i<filt_sz; i++)
465 norm += (result[i]*result[i]);
466 norm=sqrt(norm);
467
468 for (onorm=0.0,i=0; i<filt_sz; i++)
469 onorm += (filt[i]*filt[i]);
470 onorm = sqrt(onorm);
471
472 norm = norm/onorm;
473 for (i=0; i<filt_sz; i++)
474 result[i] /= norm;
475 return(0);
476 }
477
478
479/* ------- printout stuff for testing ------------------------------
480 printf("Xpos: %d, Ypos: %d", x_pos, y_pos);
481 for (y_filt=0; y_filt<y_dim; y_filt++)
482 {
483 printf("\n");
484 for (x_filt=0; x_filt<x_dim; x_filt++)
485 printf("%6.1f", result[y_filt*x_dim+x_filt]);
486 }
487 printf("\n");
488*/
489
490
491
492/* Local Variables: */
493/* buffer-read-only: t */
494/* End: */
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/edges.c b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/edges.c
deleted file mode 100755
index 98b377d..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/edges.c
+++ /dev/null
@@ -1,647 +0,0 @@
1/*
2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3;;; File: edges.c
4;;; Author: Eero Simoncelli
5;;; Description: Boundary handling routines for use with convolve.c
6;;; Creation Date: Spring 1987.
7;;; MODIFIED, 6/96, to operate on double float arrays.
8;;; MODIFIED by dgp, 4/1/97, to support THINK C.
9;;; MODIFIED, 8/97: reflect1, reflect2, repeat, extend upgraded to
10;;; work properly for non-symmetric filters. Added qreflect2 to handle
11;;; even-length QMF's which broke under the reflect2 modification.
12;;; ----------------------------------------------------------------
13;;; Object-Based Vision and Image Understanding System (OBVIUS),
14;;; Copyright 1988, Vision Science Group, Media Laboratory,
15;;; Massachusetts Institute of Technology.
16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17*/
18
19/* This file contains functions which determine how edges are to be
20handled when performing convolutions of images with linear filters.
21Any edge handling function which is local and linear may be defined,
22except (unfortunately) constants cannot be added. So to treat the
23edges as if the image is surrounded by a gray field, you must paste it
24into a gray image, convolve, and crop it out... The main convolution
25functions are called internal_reduce and internal_expand and are
26defined in the file convolve.c. The idea is that the convolution
27function calls the edge handling function which computes a new filter
28based on the old filter and the distance to the edge of the image.
29For example, reflection is done by reflecting the filter through the
30appropriate axis and summing. Currently defined functions are listed
31below.
32*/
33
34
35#include <stdio.h>
36#include <math.h>
37#include <string.h>
38#include "convolve.h"
39
40#define sgn(a) ( ((a)>0)?1:(((a)<0)?-1:0) )
41#define clip(a,mn,mx) ( ((a)<(mn))?(mn):(((a)>=(mx))?(mx-1):(a)) )
42
43int reflect1(), reflect2(), qreflect2(), repeat(), zero(), Extend(), nocompute();
44int ereflect(), predict();
45
46/* Lookup table matching a descriptive string to the edge-handling function */
47#if !THINK_C
48 static EDGE_HANDLER edge_foos[] =
49 {
50 { "dont-compute", nocompute }, /* zero output for filter touching edge */
51 { "zero", zero }, /* zero outside of image */
52 { "repeat", repeat }, /* repeat edge pixel */
53 { "reflect1", reflect1 }, /* reflect about edge pixels */
54 { "reflect2", reflect2 }, /* reflect image, including edge pixels */
55 { "qreflect2", qreflect2 }, /* reflect image, including edge pixels
56 for even-length QMF decompositions */
57 { "extend", Extend }, /* extend (reflect & invert) */
58 { "ereflect", ereflect }, /* orthogonal QMF reflection */
59 };
60#else
61 /*
62 This is really stupid, but THINK C won't allow initialization of static variables in
63 a code resource with string addresses. So we do it this way.
64 The 68K code for a MATLAB 4 MEX file can only be created by THINK C.
65 However, for MATLAB 5, we'll be able to use Metrowerks CodeWarrior for both 68K and PPC, so this
66 cludge can be dropped when we drop support for MATLAB 4.
67 Denis Pelli, 4/1/97.
68 */
69 static EDGE_HANDLER edge_foos[8];
70
71 void InitializeTable(EDGE_HANDLER edge_foos[])
72 {
73 static int i=0;
74
75 if(i>0) return;
76 edge_foos[i].name="dont-compute";
77 edge_foos[i++].func=nocompute;
78 edge_foos[i].name="zero";
79 edge_foos[i++].func=zero;
80 edge_foos[i].name="repeat";
81 edge_foos[i++].func=repeat;
82 edge_foos[i].name="reflect1";
83 edge_foos[i++].func=reflect1;
84 edge_foos[i].name="reflect2";
85 edge_foos[i++].func=reflect2;
86 edge_foos[i].name="qreflect2";
87 edge_foos[i++].func=qreflect2;
88 edge_foos[i].name="extend";
89 edge_foos[i++].func=Extend;
90 edge_foos[i].name="ereflect";
91 edge_foos[i++].func=ereflect;
92 }
93#endif
94
95/*
96Function looks up an edge handler id string in the structure above, and
97returns the associated function
98*/
99fptr edge_function(char *edges)
100 {
101 int i;
102
103#if THINK_C
104 InitializeTable(edge_foos);
105#endif
106 for (i = 0; i<sizeof(edge_foos)/sizeof(EDGE_HANDLER); i++)
107 if (strcmp(edges,edge_foos[i].name) IS 0)
108 return(edge_foos[i].func);
109 printf("Error: '%s' is not the name of a valid edge-handler!\n",edges);
110 for (i=0; i<sizeof(edge_foos)/sizeof(EDGE_HANDLER); i++)
111 {
112 if (i IS 0) printf(" Options are: ");
113 else printf(", ");
114 printf("%s",edge_foos[i].name);
115 }
116 printf("\n");
117 return(0);
118 }
119
120/*
121---------------- EDGE HANDLER ARGUMENTS ------------------------
122filt - array of filter taps.
123x_dim, y_dim - x and y dimensions of filt.
124x_pos - position of filter relative to the horizontal image edges. Negative
125 values indicate left edge, positive indicate right edge. Zero
126 indicates that the filter is not touching either edge. An absolute
127 value of 1 indicates that the edge tap of the filter is over the
128 edge pixel of the image.
129y_pos - analogous to x_pos.
130result - array where the resulting filter will go. The edge
131 of this filter will be aligned with the image for application...
132r_or_e - equal to one of the two constants EXPAND or REDUCE.
133--------------------------------------------------------------------
134*/
135
136
137/* --------------------------------------------------------------------
138nocompute() - Return zero for values where filter hangs over the edge.
139*/
140
141int nocompute(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e)
142 register double *filt, *result;
143 register int x_dim;
144 int y_dim, x_pos, y_pos, r_or_e;
145 {
146 register int i;
147 register int size = x_dim*y_dim;
148
149 if ( (x_pos>1) OR (x_pos<-1) OR (y_pos>1) OR (y_pos<-1) )
150 for (i=0; i<size; i++) result[i] = 0.0;
151 else
152 for (i=0; i<size; i++) result[i] = filt[i];
153
154 return(0);
155 }
156
157/* --------------------------------------------------------------------
158zero() - Zero outside of image. Discontinuous, but adds zero energy. */
159
160int zero(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e)
161 register double *filt, *result;
162 register int x_dim;
163 int y_dim, x_pos, y_pos, r_or_e;
164 {
165 register int y_filt,x_filt, y_res,x_res;
166 int filt_sz = x_dim*y_dim;
167 int x_start = ((x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0));
168 int y_start = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0));
169 int i;
170
171 for (i=0; i<filt_sz; i++) result[i] = 0.0;
172
173 for (y_filt=0, y_res=y_start;
174 y_filt<filt_sz;
175 y_filt+=x_dim, y_res+=x_dim)
176 if ((y_res >= 0) AND (y_res < filt_sz))
177 for (x_filt=y_filt, x_res=x_start;
178 x_filt<y_filt+x_dim;
179 x_filt++, x_res++)
180 if ((x_res >= 0) AND (x_res < x_dim))
181 result[y_res+x_res] = filt[x_filt];
182 return(0);
183 }
184
185
186/* --------------------------------------------------------------------
187reflect1() - Reflection through the edge pixels. Continuous, but
188discontinuous first derivative. This is the right thing to do if you
189are subsampling by 2, since it maintains parity (even pixels positions
190remain even, odd ones remain odd).
191*/
192
193int reflect1(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e)
194 register double *filt, *result;
195 register int x_dim;
196 int y_dim, x_pos, y_pos, r_or_e;
197 {
198 int filt_sz = x_dim*y_dim;
199 register int y_filt,x_filt, y_res, x_res;
200 register int x_base = (x_pos>0)?(x_dim-1):0;
201 register int y_base = x_dim * ((y_pos>0)?(y_dim-1):0);
202 int x_overhang = (x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0);
203 int y_overhang = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0));
204 int i;
205 int mx_pos = (x_pos<0)?(x_dim/2):((x_dim-1)/2);
206 int my_pos = x_dim * ((y_pos<0)?(y_dim/2):((y_dim-1)/2));
207
208 for (i=0; i<filt_sz; i++) result[i] = 0.0;
209
210 if (r_or_e IS REDUCE)
211 for (y_filt=0, y_res=y_overhang-y_base;
212 y_filt<filt_sz;
213 y_filt+=x_dim, y_res+=x_dim)
214 for (x_filt=y_filt, x_res=x_overhang-x_base;
215 x_filt<y_filt+x_dim;
216 x_filt++, x_res++)
217 result[ABS(y_base-ABS(y_res)) + ABS(x_base-ABS(x_res))]
218 += filt[x_filt];
219 else {
220 y_overhang = ABS(y_overhang);
221 x_overhang = ABS(x_overhang);
222 for (y_res=y_base, y_filt = y_base-y_overhang;
223 y_filt > y_base-filt_sz;
224 y_filt-=x_dim, y_res-=x_dim)
225 {
226 for (x_res=x_base, x_filt=x_base-x_overhang;
227 x_filt > x_base-x_dim;
228 x_res--, x_filt--)
229 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)];
230 if ((x_overhang ISNT mx_pos) AND (x_pos ISNT 0))
231 for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang;
232 x_filt > x_base-x_dim;
233 x_res--, x_filt--)
234 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)];
235 }
236 if ((y_overhang ISNT my_pos) AND (y_pos ISNT 0))
237 for (y_res=y_base, y_filt = y_base-2*my_pos+y_overhang;
238 y_filt > y_base-filt_sz;
239 y_filt-=x_dim, y_res-=x_dim)
240 {
241 for (x_res=x_base, x_filt=x_base-x_overhang;
242 x_filt > x_base-x_dim;
243 x_res--, x_filt--)
244 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)];
245 if ((x_overhang ISNT mx_pos) AND (x_pos ISNT 0))
246 for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang;
247 x_filt > x_base-x_dim;
248 x_res--, x_filt--)
249 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)];
250 }
251 }
252
253 return(0);
254 }
255
256/* --------------------------------------------------------------------
257reflect2() - Reflect image at boundary. The edge pixel is repeated,
258then the next pixel, etc. Continuous, but discontinuous first
259derivative.
260*/
261
262int reflect2(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e)
263 register double *filt, *result;
264 register int x_dim;
265 int y_dim, x_pos, y_pos, r_or_e;
266 {
267 int filt_sz = x_dim*y_dim;
268 register int y_filt,x_filt, y_res, x_res;
269 register int x_base = (x_pos>0)?(x_dim-1):0;
270 register int y_base = x_dim * ((y_pos>0)?(y_dim-1):0);
271 int x_overhang = (x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0);
272 int y_overhang = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0));
273 int i;
274 int mx_pos = (x_pos<0)?(x_dim/2):((x_dim-1)/2);
275 int my_pos = x_dim * ((y_pos<0)?(y_dim/2):((y_dim-1)/2));
276
277 for (i=0; i<filt_sz; i++) result[i] = 0.0;
278
279 if (r_or_e IS REDUCE)
280 for (y_filt=0, y_res = (y_overhang-y_base) - ((y_pos>0)?x_dim:0);
281 y_filt<filt_sz;
282 y_filt+=x_dim, y_res+=x_dim)
283 {
284 if (y_res IS 0) y_res+=x_dim;
285 for (x_filt=y_filt, x_res = (x_overhang-x_base) - ((x_pos>0)?1:0);
286 x_filt<y_filt+x_dim;
287 x_filt++, x_res++)
288 {
289 if (x_res IS 0) x_res++;
290 result[ABS(y_base-ABS(y_res)+x_dim) + ABS(x_base-ABS(x_res)+1)]
291 += filt[x_filt];
292 }
293 }
294 else {
295 y_overhang = ABS(y_overhang);
296 x_overhang = ABS(x_overhang);
297 for (y_res=y_base, y_filt = y_base-y_overhang;
298 y_filt > y_base-filt_sz;
299 y_filt-=x_dim, y_res-=x_dim)
300 {
301 for (x_res=x_base, x_filt=x_base-x_overhang;
302 x_filt > x_base-x_dim;
303 x_res--, x_filt--)
304 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)];
305 if (x_pos ISNT 0)
306 for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang-1;
307 x_filt > x_base-x_dim;
308 x_res--, x_filt--)
309 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)];
310 }
311 if (y_pos ISNT 0)
312 for (y_res=y_base, y_filt = y_base-2*my_pos+y_overhang-x_dim;
313 y_filt > y_base-filt_sz;
314 y_filt-=x_dim, y_res-=x_dim)
315 {
316 for (x_res=x_base, x_filt=x_base-x_overhang;
317 x_filt > x_base-x_dim;
318 x_res--, x_filt--)
319 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)];
320 if (x_pos ISNT 0)
321 for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang-1;
322 x_filt > x_base-x_dim;
323 x_res--, x_filt--)
324 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)];
325 }
326 }
327
328 return(0);
329 }
330
331
332/* --------------------------------------------------------------------
333qreflect2() - Modified version of reflect2 that works properly for
334even-length QMF filters.
335*/
336
337int qreflect2(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e)
338 double *filt, *result;
339 int x_dim, y_dim, x_pos, y_pos, r_or_e;
340 {
341 reflect2(filt,x_dim,y_dim,x_pos,y_pos,result,0);
342 return(0);
343 }
344
345/* --------------------------------------------------------------------
346repeat() - repeat edge pixel. Continuous, with discontinuous first
347derivative.
348*/
349
350int repeat(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e)
351 register double *filt, *result;
352 register int x_dim;
353 int y_dim, x_pos, y_pos, r_or_e;
354 {
355 register int y_filt,x_filt, y_res,x_res, y_tmp, x_tmp;
356 register int x_base = (x_pos>0)?(x_dim-1):0;
357 register int y_base = x_dim * ((y_pos>0)?(y_dim-1):0);
358 int x_overhang = ((x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0));
359 int y_overhang = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0));
360 int filt_sz = x_dim*y_dim;
361 int mx_pos = (x_dim/2);
362 int my_pos = x_dim * (y_dim/2);
363 int i;
364
365 for (i=0; i<filt_sz; i++) result[i] = 0.0;
366
367 if (r_or_e IS REDUCE)
368 for (y_filt=0, y_res=y_overhang;
369 y_filt<filt_sz;
370 y_filt+=x_dim, y_res+=x_dim)
371 for (x_filt=y_filt, x_res=x_overhang;
372 x_filt<y_filt+x_dim;
373 x_filt++, x_res++)
374 /* Clip the index: */
375 result[((y_res>=0)?((y_res<filt_sz)?y_res:(filt_sz-x_dim)):0)
376 + ((x_res>=0)?((x_res<x_dim)?x_res:(x_dim-1)):0)]
377 += filt[x_filt];
378 else {
379 if ((y_base-y_overhang) ISNT my_pos)
380 for (y_res=y_base, y_filt=y_base-ABS(y_overhang);
381 y_filt > y_base-filt_sz;
382 y_filt-=x_dim, y_res-=x_dim)
383 if ((x_base-x_overhang) ISNT mx_pos)
384 for (x_res=x_base, x_filt=x_base-ABS(x_overhang);
385 x_filt > x_base-x_dim;
386 x_res--, x_filt--)
387 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)];
388 else /* ((x_base-x_overhang) IS mx_pos) */
389 for (x_res=x_base, x_filt=x_base-ABS(x_overhang);
390 x_filt > x_base-x_dim;
391 x_filt--, x_res--)
392 for(x_tmp=x_filt; x_tmp > x_base-x_dim; x_tmp--)
393 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_tmp)];
394 else /* ((y_base-y_overhang) IS my_pos) */
395 for (y_res=y_base, y_filt=y_base-ABS(y_overhang);
396 y_filt > y_base-filt_sz;
397 y_filt-=x_dim, y_res-=x_dim)
398 for (y_tmp=y_filt; y_tmp > y_base-filt_sz; y_tmp-=x_dim)
399 if ((x_base-x_overhang) ISNT mx_pos)
400 for (x_res=x_base, x_filt=x_base-ABS(x_overhang);
401 x_filt > x_base-x_dim;
402 x_filt--, x_res--)
403 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_tmp)+ABS(x_filt)];
404 else /* ((x_base-x_overhang) IS mx_pos) */
405 for (x_res=x_base, x_filt=x_base-ABS(x_overhang);
406 x_filt > x_base-x_dim;
407 x_filt--, x_res--)
408 for (x_tmp=x_filt; x_tmp > x_base-x_dim; x_tmp--)
409 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_tmp)+ABS(x_tmp)];
410 } /* End, if r_or_e IS EXPAND */
411
412 return(0);
413 }
414
415/* --------------------------------------------------------------------
416extend() - Extend image by reflecting and inverting about edge pixel
417value. Maintains continuity in intensity AND first derivative (but
418not higher derivs).
419*/
420
421int Extend(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e)
422 register double *filt, *result;
423 register int x_dim;
424 int y_dim, x_pos, y_pos, r_or_e;
425 {
426 int filt_sz = x_dim*y_dim;
427 register int y_filt,x_filt, y_res,x_res, y_tmp, x_tmp;
428 register int x_base = (x_pos>0)?(x_dim-1):0;
429 register int y_base = x_dim * ((y_pos>0)?(y_dim-1):0);
430 int x_overhang = (x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0);
431 int y_overhang = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0));
432 int mx_pos = (x_pos<0)?(x_dim/2):((x_dim-1)/2);
433 int my_pos = x_dim * ((y_pos<0)?(y_dim/2):((y_dim-1)/2));
434 int i;
435
436 for (i=0; i<filt_sz; i++) result[i] = 0.0;
437
438 /* Modeled on reflect1() */
439 if (r_or_e IS REDUCE)
440 for (y_filt=0, y_res=y_overhang;
441 y_filt<filt_sz;
442 y_filt+=x_dim, y_res+=x_dim)
443 if ((y_res>=0) AND (y_res<filt_sz))
444 for (x_filt=y_filt, x_res=x_overhang;
445 x_filt<y_filt+x_dim;
446 x_filt++, x_res++)
447 if ((x_res>=0) AND (x_res<x_dim))
448 result[y_res+x_res] += filt[x_filt];
449 else
450 {
451 result[y_res+ABS(x_base-ABS(x_res-x_base))] -= filt[x_filt];
452 result[y_res+x_base] += 2*filt[x_filt];
453 }
454 else
455 for (x_filt=y_filt, x_res=x_overhang;
456 x_filt<y_filt+x_dim;
457 x_filt++, x_res++)
458 if ((x_res>=0) AND (x_res<x_dim))
459 {
460 result[ABS(y_base-ABS(y_res-y_base))+x_res] -= filt[x_filt];
461 result[y_base+x_res] += 2*filt[x_filt];
462 }
463 else
464 {
465 result[ABS(y_base-ABS(y_res-y_base))+ABS(x_base-ABS(x_res-x_base))]
466 -= filt[x_filt];
467 result[y_base+x_base] += 2*filt[x_filt];
468 }
469 else { /* r_or_e ISNT REDUCE */
470 y_overhang = ABS(y_overhang);
471 x_overhang = ABS(x_overhang);
472 for (y_res=y_base, y_filt = y_base-y_overhang;
473 y_filt > y_base-filt_sz;
474 y_filt-=x_dim, y_res-=x_dim)
475 {
476 for (x_res=x_base, x_filt=x_base-x_overhang;
477 x_filt > x_base-x_dim;
478 x_res--, x_filt--)
479 result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)];
480 if (x_pos ISNT 0)
481 if (x_overhang ISNT mx_pos)
482 for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang;
483 x_filt > x_base-x_dim;
484 x_res--, x_filt--)
485 result[ABS(y_res)+ABS(x_res)] -= filt[ABS(y_filt)+ABS(x_filt)];
486 else /* x_overhang IS mx_pos */
487 for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang-1;
488 x_filt > x_base-x_dim;
489 x_res--, x_filt--)
490 for (x_tmp=x_filt; x_tmp > x_base-x_dim; x_tmp--)
491 result[ABS(y_res)+ABS(x_res)] += 2*filt[ABS(y_filt)+ABS(x_tmp)];
492 }
493 if (y_pos ISNT 0)
494 if (y_overhang ISNT my_pos)
495 for (y_res=y_base, y_filt = y_base-2*my_pos+y_overhang;
496 y_filt > y_base-filt_sz;
497 y_filt-=x_dim, y_res-=x_dim)
498 {
499 for (x_res=x_base, x_filt=x_base-x_overhang;
500 x_filt > x_base-x_dim;
501 x_res--, x_filt--)
502 result[ABS(y_res)+ABS(x_res)] -= filt[ABS(y_filt)+ABS(x_filt)];
503 if ((x_pos ISNT 0) AND (x_overhang ISNT mx_pos))
504 for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang;
505 x_filt > x_base-x_dim;
506 x_res--, x_filt--)
507 result[ABS(y_res)+ABS(x_res)] -= filt[ABS(y_filt)+ABS(x_filt)];
508 }
509 else /* y_overhang IS my_pos */
510 for (y_res=y_base, y_filt = y_base-2*my_pos+y_overhang-x_dim;
511 y_filt > y_base-filt_sz;
512 y_res-=x_dim, y_filt-=x_dim)
513 for (y_tmp=y_filt; y_tmp > y_base-filt_sz; y_tmp-=x_dim)
514 {
515 for (x_res=x_base, x_filt=x_base-x_overhang;
516 x_filt > x_base-x_dim;
517 x_res--, x_filt--)
518 result[ABS(y_res)+ABS(x_res)] += 2*filt[ABS(y_tmp)+ABS(x_filt)];
519 if ((x_pos ISNT 0) AND (x_overhang IS mx_pos))
520 for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang-1;
521 x_filt > x_base-x_dim;
522 x_res--, x_filt--)
523 for (x_tmp=x_filt; x_tmp > x_base-x_dim; x_tmp--)
524 result[ABS(y_res)+ABS(x_res)] += 2*filt[ABS(y_tmp)+ABS(x_tmp)];
525 }
526 } /* r_or_e ISNT REDUCE */
527
528 return(0);
529 }
530
531/* --------------------------------------------------------------------
532predict() - Simple prediction. Like zero, but multiplies the result
533by the reciprocal of the percentage of filter being used. (i.e. if
53450% of the filter is hanging over the edge of the image, multiply the
535taps being used by 2). */
536
537int predict(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e)
538 register double *filt, *result;
539 register int x_dim;
540 int y_dim, x_pos, y_pos, r_or_e;
541 {
542 register int y_filt,x_filt, y_res,x_res;
543 register double taps_used = 0.0; /* int *** */
544 register double fraction = 0.0;
545 int filt_sz = x_dim*y_dim;
546 int x_start = ((x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0));
547 int y_start = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0));
548 int i;
549
550 for (i=0; i<filt_sz; i++) result[i] = 0.0;
551
552 for (y_filt=0, y_res=y_start;
553 y_filt<filt_sz;
554 y_filt+=x_dim, y_res+=x_dim)
555 if ((y_res >= 0) AND (y_res < filt_sz))
556 for (x_filt=y_filt, x_res=x_start;
557 x_filt<y_filt+x_dim;
558 x_filt++, x_res++)
559 if ((x_res >= 0) AND (x_res < x_dim))
560 {
561 result[y_res+x_res] = filt[x_filt];
562 taps_used += ABS(filt[x_filt]);
563 }
564
565 if (r_or_e IS REDUCE)
566 {
567 /* fraction = ( (double) filt_sz ) / ( (double) taps_used ); */
568 for (i=0; i<filt_sz; i++) fraction += ABS(filt[i]);
569 fraction = ( fraction / taps_used );
570 for (i=0; i<filt_sz; i++) result[i] *= fraction;
571 }
572 return(0);
573 }
574
575
576/* --------------------------------------------------------------------
577Reflect, multiplying tap of filter which is at the edge of the image
578by root 2. This maintains orthogonality of odd-length linear-phase
579QMF filters, but it is not useful for most applications, since it
580alters the DC level. */
581
582int ereflect(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e)
583 register double *filt, *result;
584 register int x_dim;
585 int y_dim, x_pos, y_pos, r_or_e;
586 {
587 register int y_filt,x_filt, y_res,x_res;
588 register int x_base = (x_pos>0)?(x_dim-1):0;
589 register int y_base = x_dim * ((y_pos>0)?(y_dim-1):0);
590 int filt_sz = x_dim*y_dim;
591 int x_overhang = (x_pos>1)?(x_pos-x_dim):((x_pos<-1)?(x_pos+1):0);
592 int y_overhang = x_dim * ( (y_pos>1)?(y_pos-y_dim):((y_pos<-1)?(y_pos+1):0) );
593 int i;
594 double norm,onorm;
595
596 for (i=0; i<filt_sz; i++) result[i] = 0.0;
597
598 /* reflect at boundary */
599 for (y_filt=0, y_res=y_overhang;
600 y_filt<filt_sz;
601 y_filt+=x_dim, y_res+=x_dim)
602 for (x_filt=y_filt, x_res=x_overhang;
603 x_filt<y_filt+x_dim;
604 x_filt++, x_res++)
605 result[ABS(y_base-ABS(y_res)) + ABS(x_base-ABS(x_res))]
606 += filt[x_filt];
607
608 /* now multiply edge by root 2 */
609 if (x_pos ISNT 0)
610 for (y_filt=x_base; y_filt<filt_sz; y_filt+=x_dim)
611 result[y_filt] *= ROOT2;
612 if (y_pos ISNT 0)
613 for (x_filt=y_base; x_filt<y_base+x_dim; x_filt++)
614 result[x_filt] *= ROOT2;
615
616 /* now normalize to norm of original filter */
617 for (norm=0.0,i=0; i<filt_sz; i++)
618 norm += (result[i]*result[i]);
619 norm=sqrt(norm);
620
621 for (onorm=0.0,i=0; i<filt_sz; i++)
622 onorm += (filt[i]*filt[i]);
623 onorm = sqrt(onorm);
624
625 norm = norm/onorm;
626 for (i=0; i<filt_sz; i++)
627 result[i] /= norm;
628 return(0);
629 }
630
631
632/* ------- printout stuff for testing ------------------------------
633 printf("Xpos: %d, Ypos: %d", x_pos, y_pos);
634 for (y_filt=0; y_filt<y_dim; y_filt++)
635 {
636 printf("\n");
637 for (x_filt=0; x_filt<x_dim; x_filt++)
638 printf("%6.1f", result[y_filt*x_dim+x_filt]);
639 }
640 printf("\n");
641*/
642
643
644
645/* Local Variables: */
646/* buffer-read-only: t */
647/* End: */
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/histo.c b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/histo.c
deleted file mode 100755
index 43a99c7..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/histo.c
+++ /dev/null
@@ -1,140 +0,0 @@
1/*
2[N, X] = histo(MTX, NBINS_OR_BINSIZE, BIN_CENTER)
3 >>> See histo.m for documentation <<<
4 EPS, ported from OBVIUS, 3/97.
5*/
6
7#define V4_COMPAT
8#include <matrix.h> /* Matlab matrices */
9#include <mex.h>
10
11#include <stddef.h> /* NULL */
12#include <math.h> /* ceil */
13
14#define notDblMtx(it) (!mxIsNumeric(it) || !mxIsDouble(it) || mxIsSparse(it) || mxIsComplex(it))
15
16#define PAD 0.49999 /* A hair below 1/2, to avoid roundoff errors */
17#define MAXBINS 20000
18
19void mexFunction(int nlhs, /* Num return vals on lhs */
20 mxArray *plhs[], /* Matrices on lhs */
21 int nrhs, /* Num args on rhs */
22 const mxArray *prhs[] /* Matrices on rhs */
23 )
24 {
25 register double temp;
26 register int binnum, i, size;
27 register double *im, binsize;
28 register double origin, *hist, mn, mx, mean;
29 register int nbins;
30 double *bincenters;
31 mxArray *arg;
32 double *mxMat;
33
34 if (nrhs < 1 ) mexErrMsgTxt("requires at least 1 argument.");
35
36 /* ARG 1: MATRIX */
37 arg = prhs[0];
38 if notDblMtx(arg) mexErrMsgTxt("MTX arg must be a real non-sparse matrix.");
39 im = mxGetPr(arg);
40 size = (int) mxGetM(arg) * mxGetN(arg);
41
42 /* FIND min, max, mean values of MTX */
43 mn = *im; mx = *im; binsize = 0;
44 for (i=1; i<size; i++)
45 {
46 temp = im[i];
47 if (temp < mn)
48 mn = temp;
49 else if (temp > mx)
50 mx = temp;
51 binsize += temp;
52 }
53 mean = binsize / size;
54
55 /* ARG 3: BIN_CENTER */
56 if (nrhs > 2)
57 {
58 arg = prhs[2];
59 if notDblMtx(arg) mexErrMsgTxt("BIN_CENTER arg must be a real scalar.");
60 if (mxGetM(arg) * mxGetN(arg) != 1)
61 mexErrMsgTxt("BIN_CENTER must be a real scalar.");
62 mxMat= mxGetPr(arg);
63 origin = *mxMat;
64 }
65 else
66 origin = mean;
67
68 /* ARG 2: If positive, NBINS. If negative, -BINSIZE. */
69 if (nrhs > 1)
70 {
71 arg = prhs[1];
72 if notDblMtx(arg) mexErrMsgTxt("NBINS_OR_BINSIZE arg must be a real scalar.");
73 if (mxGetM(arg) * mxGetN(arg) != 1)
74 mexErrMsgTxt("NBINS_OR_BINSIZE must be a real scalar.");
75 mxMat= mxGetPr(arg);
76 binsize = *mxMat;
77 }
78 else
79 {
80 binsize = 101; /* DEFAULT: 101 bins */
81 }
82
83 /* --------------------------------------------------
84 Adjust origin, binsize, nbins such that
85 mx <= origin + (nbins-1)*binsize + PAD*binsize
86 mn >= origin - PAD*binsize
87 -------------------------------------------------- */
88 if (binsize < 0) /* user specified BINSIZE */
89 {
90 binsize = -binsize;
91 origin -= binsize * ceil((origin-mn-PAD*binsize)/binsize);
92 nbins = (int) ceil((mx-origin-PAD*binsize)/binsize) + 1;
93 }
94 else /* user specified NBINS */
95 {
96 nbins = (int) (binsize + 0.5); /* round to int */
97 if (nbins == 0)
98 mexErrMsgTxt("NBINS must be greater than zero.");
99 binsize = (mx-mn)/(nbins-1+2*PAD); /* start with lower bound */
100 i = ceil((origin-mn-binsize/2)/binsize);
101 if ( mn < (origin-i*binsize-PAD*binsize) )
102 binsize = (origin-mn)/(i+PAD);
103 else if ( mx > (origin+(nbins-1-i)*binsize+PAD*binsize) )
104 binsize = (mx-origin)/((nbins-1-i)+PAD);
105 origin -= binsize * ceil((origin-mn-PAD*binsize)/binsize);
106 }
107
108 if (nbins > MAXBINS)
109 {
110 mexPrintf("nbins: %d, MAXBINS: %d\n",nbins,MAXBINS);
111 mexErrMsgTxt("Number of histo bins has exceeded maximum");
112 }
113
114 /* Allocate hist and xvals */
115 plhs[0] = (mxArray *) mxCreateDoubleMatrix(1,nbins,mxREAL);
116 if (plhs[0] == NULL) mexErrMsgTxt("Error allocating result matrix");
117 hist = mxGetPr(plhs[0]);
118
119 if (nlhs > 1)
120 {
121 plhs[1] = (mxArray *) mxCreateDoubleMatrix(1,nbins,mxREAL);
122 if (plhs[1] == NULL) mexErrMsgTxt("Error allocating result matrix");
123 bincenters = mxGetPr(plhs[1]);
124 for (i=0, temp=origin; i<nbins; i++, temp+=binsize)
125 bincenters[i] = temp;
126 }
127
128 for (i=0; i<size; i++)
129 {
130 binnum = (int) ((im[i] - origin)/binsize + 0.5);
131 if ((binnum < nbins) && (binnum >= 0))
132 (hist[binnum]) += 1.0;
133 else
134 printf("HISTO warning: value %f outside of range [%f,%f]\n",
135 im[i], origin-0.5*binsize, origin+(nbins-0.5)*binsize);
136 }
137
138 return;
139 }
140
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.c b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.c
deleted file mode 100755
index 8fa1224..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.c
+++ /dev/null
@@ -1,52 +0,0 @@
1/*
2RES = innerProd(MAT);
3 Computes mat'*mat
4 Odelia Schwartz, 8/97.
5*/
6
7#define V4_COMPAT
8#include <matrix.h>
9
10#include <stdio.h>
11#include <ctype.h>
12#include <math.h>
13#include <strings.h>
14#include <stdlib.h>
15
16void mexFunction(int nlhs, /* Num return vals on lhs */
17 mxArray *plhs[], /* Matrices on lhs */
18 int nrhs, /* Num args on rhs */
19 const mxArray *prhs[] /* Matrices on rhs */
20 )
21{
22 register double *res, *mat, tmp;
23 register int len, wid, i, k, j, jlen, ilen, imat, jmat;
24 mxArray *arg;
25
26 /* get matrix input argument */
27 /* should be matrix in which num rows >= num columns */
28 arg=prhs[0];
29 mat= mxGetPr(arg);
30 len = (int) mxGetM(arg);
31 wid = (int) mxGetN(arg);
32 if ( wid > len )
33 printf("innerProd: Warning: width %d is greater than length %d.\n",wid,len);
34 plhs[0] = (mxArray *) mxCreateDoubleMatrix(wid,wid,mxREAL);
35 if (plhs[0] == NULL)
36 mexErrMsgTxt(sprintf("Error allocating %dx%d result matrix",wid,wid));
37 res = mxGetPr(plhs[0]);
38
39 for(i=0, ilen=0; i<wid; i++, ilen+=len)
40 {
41 for(j=i, jlen=ilen; j<wid; j++, jlen+=len)
42 {
43 tmp = 0.0;
44 for(k=0, imat=ilen, jmat=jlen; k<len; k++, imat++, jmat++)
45 tmp += mat[imat]*mat[jmat];
46 res[i*wid+j] = tmp;
47 res[j*wid+i] = tmp;
48 }
49 }
50 return;
51
52}
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.dll b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.dll
deleted file mode 100755
index 40ac896..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.dll
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.mexglx b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.mexglx
deleted file mode 100755
index 749a5b5..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.mexglx
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.mexlx b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.mexlx
deleted file mode 100755
index 151b08f..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.mexlx
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.mexmac b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.mexmac
deleted file mode 100755
index 6e11fcd..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.mexmac
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.mexsol b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.mexsol
deleted file mode 100755
index d761ed8..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/innerProd.mexsol
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/pointOp.c b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/pointOp.c
deleted file mode 100755
index 6ffcb45..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/pointOp.c
+++ /dev/null
@@ -1,126 +0,0 @@
1/*
2RES = pointOp(IM, LUT, ORIGIN, INCREMENT, WARNINGS)
3 >>> See pointOp.m for documentation <<<
4 EPS, ported from OBVIUS, 7/96.
5*/
6
7#define V4_COMPAT
8#include <matrix.h> /* Matlab matrices */
9#include <mex.h>
10
11#include <stddef.h> /* NULL */
12
13#define notDblMtx(it) (!mxIsNumeric(it) || !mxIsDouble(it) || mxIsSparse(it) || mxIsComplex(it))
14
15void internal_pointop();
16
17void mexFunction(int nlhs, /* Num return vals on lhs */
18 mxArray *plhs[], /* Matrices on lhs */
19 int nrhs, /* Num args on rhs */
20 const mxArray *prhs[] /* Matrices on rhs */
21 )
22 {
23 double *image, *lut, *res;
24 double origin, increment;
25 int x_dim, y_dim, lx_dim, ly_dim;
26 int warnings = 1;
27 mxArray *arg;
28 double *mxMat;
29
30 if (nrhs < 4 ) mexErrMsgTxt("requres at least 4 args.");
31
32 /* ARG 1: IMAGE */
33 arg = prhs[0];
34 if notDblMtx(arg) mexErrMsgTxt("IMAGE arg must be a real non-sparse matrix.");
35 image = mxGetPr(arg);
36 x_dim = (int) mxGetM(arg); /* X is inner index! */
37 y_dim = (int) mxGetN(arg);
38
39 /* ARG 2: Lookup table */
40 arg = prhs[1];
41 if notDblMtx(arg) mexErrMsgTxt("LUT arg must be a real non-sparse matrix.");
42 lut = mxGetPr(arg);
43 lx_dim = (int) mxGetM(arg); /* X is inner index! */
44 ly_dim = (int) mxGetN(arg);
45 if ( (lx_dim != 1) && (ly_dim != 1) )
46 mexErrMsgTxt("Lookup table must be a row or column vector.");
47
48 /* ARG 3: ORIGIN */
49 arg = prhs[2];
50 if notDblMtx(arg) mexErrMsgTxt("ORIGIN arg must be a real scalar.");
51 if (mxGetM(arg) * mxGetN(arg) != 1)
52 mexErrMsgTxt("ORIGIN arg must be a real scalar.");
53 mxMat = mxGetPr(arg);
54 origin = *mxMat;
55
56 /* ARG 4: INCREMENT */
57 arg = prhs[3];
58 if notDblMtx(arg) mexErrMsgTxt("INCREMENT arg must be a real scalar.");
59 if (mxGetM(arg) * mxGetN(arg) != 1)
60 mexErrMsgTxt("INCREMENT arg must be a real scalar.");
61 mxMat = mxGetPr(arg);
62 increment = *mxMat;
63
64 /* ARG 5: WARNINGS */
65 if (nrhs>4)
66 {
67 arg = prhs[4];
68 if notDblMtx(arg) mexErrMsgTxt("WARINGS arg must be a real scalar.");
69 if (mxGetM(arg) * mxGetN(arg) != 1)
70 mexErrMsgTxt("WARNINGS arg must be a real scalar.");
71 mxMat = mxGetPr(arg);
72 warnings = (int) *mxMat;
73 }
74
75 plhs[0] = (mxArray *) mxCreateDoubleMatrix(x_dim,y_dim,mxREAL);
76 if (plhs[0] == NULL) mexErrMsgTxt("Cannot allocate result matrix");
77 res = mxGetPr(plhs[0]);
78
79 internal_pointop(image, res, x_dim*y_dim, lut, lx_dim*ly_dim,
80 origin, increment, warnings);
81 return;
82 }
83
84
85/* Use linear interpolation on a lookup table.
86 Taken from OBVIUS. EPS, Spring, 1987.
87 */
88void internal_pointop (im, res, size, lut, lutsize, origin, increment, warnings)
89 register double *im, *res, *lut;
90 register double origin, increment;
91 register int size, lutsize, warnings;
92 {
93 register int i, index;
94 register double pos;
95 register int l_unwarned = warnings;
96 register int r_unwarned = warnings;
97
98 lutsize = lutsize - 2; /* Maximum index value */
99 if (increment > 0)
100 for (i=0; i<size; i++)
101 {
102 pos = (im[i] - origin) / increment;
103 index = (int) pos; /* Floor */
104 if (index < 0)
105 {
106 index = 0;
107 if (l_unwarned)
108 {
109 mexPrintf("Warning: Extrapolating to left of lookup table...\n");
110 l_unwarned = 0;
111 }
112 }
113 else if (index > lutsize)
114 {
115 index = lutsize;
116 if (r_unwarned)
117 {
118 mexPrintf("Warning: Extrapolating to right of lookup table...\n");
119 r_unwarned = 0;
120 }
121 }
122 res[i] = lut[index] + (lut[index+1] - lut[index]) * (pos - index);
123 }
124 else
125 for (i=0; i<size; i++) res[i] = *lut;
126 }
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/range2.c b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/range2.c
deleted file mode 100755
index b84f4e1..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/range2.c
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2[MIN, MAX] = range2(MTX)
3 >>> See range2.m for documentation <<<
4 EPS, 3/97.
5*/
6
7#define V4_COMPAT
8#include <matrix.h> /* Matlab matrices */
9#include <mex.h>
10
11#include <stddef.h> /* NULL */
12
13#define notDblMtx(it) (!mxIsNumeric(it) || !mxIsDouble(it) || mxIsSparse(it) || mxIsComplex(it))
14
15void mexFunction(int nlhs, /* Num return vals on lhs */
16 mxArray *plhs[], /* Matrices on lhs */
17 int nrhs, /* Num args on rhs */
18 const mxArray *prhs[] /* Matrices on rhs */
19 )
20 {
21 register double temp, mn, mx;
22 register double *mtx;
23 register int i, size;
24 mxArray *arg;
25
26 if (nrhs != 1) mexErrMsgTxt("requires 1 argument.");
27
28 /* ARG 1: MATRIX */
29 arg = prhs[0];
30 if notDblMtx(arg) mexErrMsgTxt("MTX arg must be a real non-sparse matrix.");
31 mtx = mxGetPr(arg);
32 size = (int) mxGetM(arg) * mxGetN(arg);
33
34 /* FIND min, max values of MTX */
35 mn = *mtx; mx = *mtx;
36 for (i=1; i<size; i++)
37 {
38 temp = mtx[i];
39 if (temp < mn)
40 mn = temp;
41 else if (temp > mx)
42 mx = temp;
43 }
44
45 plhs[0] = (mxArray *) mxCreateDoubleMatrix(1,1,mxREAL);
46 if (plhs[0] == NULL) mexErrMsgTxt("Error allocating result matrix");
47 plhs[1] = (mxArray *) mxCreateDoubleMatrix(1,1,mxREAL);
48 if (plhs[1] == NULL) mexErrMsgTxt("Error allocating result matrix");
49 mtx = mxGetPr(plhs[0]);
50 mtx[0] = mn;
51 mtx = mxGetPr(plhs[1]);
52 mtx[0] = mx;
53
54 return;
55 }
56
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/upConv.c b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/upConv.c
deleted file mode 100755
index 3708f8a..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/upConv.c
+++ /dev/null
@@ -1,195 +0,0 @@
1/*
2RES = upConv(IM, FILT, EDGES, STEP, START, STOP, RES);
3 >>> See upConv.m for documentation <<<
4 This is a matlab interface to the internal_expand function.
5 EPS, 7/96.
6*/
7
8#define V4_COMPAT
9#include <matrix.h> /* Matlab matrices */
10#include <mex.h>
11
12#include "convolve.h"
13
14#define notDblMtx(it) (!mxIsNumeric(it) || !mxIsDouble(it) || mxIsSparse(it) || mxIsComplex(it))
15
16void mexFunction(int nlhs, /* Num return vals on lhs */
17 mxArray *plhs[], /* Matrices on lhs */
18 int nrhs, /* Num args on rhs */
19 const mxArray *prhs[] /* Matrices on rhs */
20 )
21 {
22 double *image,*filt, *temp, *result, *orig_filt;
23 int x_fdim, y_fdim, x_idim, y_idim;
24 int orig_x = 0, orig_y, x, y;
25 int x_rdim, y_rdim;
26 int x_start = 1;
27 int x_step = 1;
28 int y_start = 1;
29 int y_step = 1;
30 int x_stop, y_stop;
31 mxArray *arg;
32 double *mxMat;
33 char edges[15] = "reflect1";
34
35 if (nrhs<2) mexErrMsgTxt("requres at least 2 args.");
36
37 /* ARG 1: IMAGE */
38 arg = prhs[0];
39 if notDblMtx(arg) mexErrMsgTxt("IMAGE arg must be a non-sparse double float matrix.");
40 image = mxGetPr(arg);
41 x_idim = (int) mxGetM(arg); /* X is inner index! */
42 y_idim = (int) mxGetN(arg);
43
44 /* ARG 2: FILTER */
45 arg = prhs[1];
46 if notDblMtx(arg) mexErrMsgTxt("FILTER arg must be non-sparse double float matrix."); filt = mxGetPr(arg);
47 x_fdim = (int) mxGetM(arg);
48 y_fdim = (int) mxGetN(arg);
49
50 /* ARG 3 (optional): EDGES */
51 if (nrhs>2)
52 {
53 if (!mxIsChar(prhs[2]))
54 mexErrMsgTxt("EDGES arg must be a string.");
55 mxGetString(prhs[2],edges,15);
56 }
57
58 /* ARG 4 (optional): STEP */
59 if (nrhs>3)
60 {
61 arg = prhs[3];
62 if notDblMtx(arg) mexErrMsgTxt("STEP arg must be double float matrix.");
63 if (mxGetM(arg) * mxGetN(arg) != 2)
64 mexErrMsgTxt("STEP arg must contain two elements.");
65 mxMat = mxGetPr(arg);
66 x_step = (int) mxMat[0];
67 y_step = (int) mxMat[1];
68 if ((x_step<1) || (y_step<1))
69 mexErrMsgTxt("STEP values must be greater than zero.");
70 }
71
72 /* ARG 5 (optional): START */
73 if (nrhs>4)
74 {
75 arg = prhs[4];
76 if notDblMtx(arg) mexErrMsgTxt("START arg must be double float matrix.");
77 if (mxGetM(arg) * mxGetN(arg) != 2)
78 mexErrMsgTxt("START arg must contain two elements.");
79 mxMat = mxGetPr(arg);
80 x_start = (int) mxMat[0];
81 y_start = (int) mxMat[1];
82 if ((x_start<1) || (y_start<1))
83 mexErrMsgTxt("START values must be greater than zero.");
84 }
85 x_start--; /* convert to standard C indexes */
86 y_start--;
87
88 /* ARG 6 (optional): STOP */
89 if (nrhs>5)
90 {
91 if notDblMtx(prhs[5]) mexErrMsgTxt("STOP arg must be double float matrix.");
92 if (mxGetM(prhs[5]) * mxGetN(prhs[5]) != 2)
93 mexErrMsgTxt("STOP arg must contain two elements.");
94 mxMat = mxGetPr(prhs[5]);
95 x_stop = (int) mxMat[0];
96 y_stop = (int) mxMat[1];
97 if ((x_stop<x_start) || (y_stop<y_start))
98 mexErrMsgTxt("STOP values must be greater than START values.");
99 }
100 else
101 { /* default: make res dims a multiple of STEP size */
102 x_stop = x_step * ((x_start/x_step) + x_idim);
103 y_stop = y_step * ((y_start/y_step) + y_idim);
104 }
105
106 /* ARG 6 (optional): RESULT image */
107 if (nrhs>6)
108 {
109 arg = prhs[6];
110 if notDblMtx(arg) mexErrMsgTxt("RES arg must be double float matrix.");
111
112 /* 7/10/97: Returning one of the args causes problems with Matlab's memory
113 manager, so we don't return anything if the result image is passed */
114 /* plhs[0] = arg; */
115 result = mxGetPr(arg);
116 x_rdim = (int) mxGetM(arg); /* X is inner index! */
117 y_rdim = (int) mxGetN(arg);
118 if ((x_stop>x_rdim) || (y_stop>y_rdim))
119 mexErrMsgTxt("STOP values must within image dimensions.");
120 }
121 else
122 {
123 x_rdim = x_stop;
124 y_rdim = y_stop;
125 /* x_rdim = x_step * ((x_stop+x_step-1)/x_step);
126 y_rdim = y_step * ((y_stop+y_step-1)/y_step); */
127
128 plhs[0] = (mxArray *) mxCreateDoubleMatrix(x_rdim,y_rdim,mxREAL);
129 if (plhs[0] == NULL) mexErrMsgTxt("Cannot allocate result matrix");
130 result = mxGetPr(plhs[0]);
131 }
132
133 if ( (((x_stop-x_start+x_step-1) / x_step) != x_idim) ||
134 (((y_stop-y_start+y_step-1) / y_step) != y_idim) )
135 {
136 mexPrintf("Im dims: [%d %d]\n",x_idim,y_idim);
137 mexPrintf("Start: [%d %d]\n",x_start,y_start);
138 mexPrintf("Step: [%d %d]\n",x_step,y_step);
139 mexPrintf("Stop: [%d %d]\n",x_stop,y_stop);
140 mexPrintf("Res dims: [%d %d]\n",x_rdim,y_rdim);
141 mexErrMsgTxt("Image sizes and upsampling args are incompatible!");
142 }
143
144 /* upConv has a bug for even-length kernels when using the
145 reflect1, extend, or repeat edge-handlers */
146 if ((!strcmp(edges,"reflect1") || !strcmp(edges,"extend") || !strcmp(edges,"repeat"))
147 &&
148 ((x_fdim%2 == 0) || (y_fdim%2 == 0)))
149 {
150 orig_filt = filt;
151 orig_x = x_fdim;
152 orig_y = y_fdim;
153 x_fdim = 2*(orig_x/2)+1;
154 y_fdim = 2*(orig_y/2)+1;
155 filt = mxCalloc(x_fdim*y_fdim, sizeof(double));
156 if (filt == NULL)
157 mexErrMsgTxt("Cannot allocate necessary temporary space");
158 for (y=0; y<orig_y; y++)
159 for (x=0; x<orig_x; x++)
160 filt[y*x_fdim + x] = orig_filt[y*orig_x + x];
161 }
162
163 if ((x_fdim > x_rdim) || (y_fdim > y_rdim))
164 {
165 mexPrintf("Filter: [%d %d], ",x_fdim,y_fdim);
166 mexPrintf("Result: [%d %d]\n",x_rdim,y_rdim);
167 mexErrMsgTxt("FILTER dimensions larger than RESULT dimensions.");
168 }
169
170 temp = mxCalloc(x_fdim*y_fdim, sizeof(double));
171 if (temp == NULL)
172 mexErrMsgTxt("Cannot allocate necessary temporary space");
173
174 /*
175 printf("(%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), %s\n",
176 x_idim,y_idim,x_fdim,y_fdim,x_rdim,y_rdim,
177 x_start,x_step,y_start,y_step,edges);
178 */
179
180 if (strcmp(edges,"circular") == 0)
181 internal_wrap_expand(image, filt, x_fdim, y_fdim,
182 x_start, x_step, x_stop, y_start, y_step, y_stop,
183 result, x_rdim, y_rdim);
184 else internal_expand(image, filt, temp, x_fdim, y_fdim,
185 x_start, x_step, x_stop, y_start, y_step, y_stop,
186 result, x_rdim, y_rdim, edges);
187
188 if (orig_x) mxFree((char *) filt);
189 mxFree((char *) temp);
190
191 return;
192 }
193
194
195
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/wrap.c b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/wrap.c
deleted file mode 100755
index a081123..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/wrap.c
+++ /dev/null
@@ -1,281 +0,0 @@
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 <stdlib.h>
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<x_filt_stop; \
41 filt_pos++, x_im++) \
42 sum += imval[YIND][XIND] * filt[filt_pos]; \
43 result[res_pos] = sum; \
44 }
45
46int internal_wrap_reduce(image, x_dim, y_dim, filt, x_fdim, y_fdim,
47 x_start, x_step, x_stop, y_start, y_step, y_stop,
48 result)
49 register image_type *filt, *result;
50 register int x_dim, y_dim, x_fdim, y_fdim;
51 image_type *image;
52 int x_start, x_step, x_stop, y_start, y_step, y_stop;
53 {
54 register double sum;
55 register int filt_size = x_fdim*y_fdim;
56 image_type **imval;
57 register int filt_pos, x_im, y_im, x_filt_stop;
58 register int x_pos, y_pos, res_pos;
59 int x_ctr_stop = x_dim - x_fdim + 1;
60 int y_ctr_stop = y_dim - y_fdim + 1;
61 int x_ctr_start = 0;
62 int y_ctr_start = 0;
63 int x_fmid = x_fdim/2;
64 int y_fmid = y_fdim/2;
65
66 /* shift start/stop coords to filter upper left hand corner */
67 x_start -= x_fmid; y_start -= y_fmid;
68 x_stop -= x_fmid; y_stop -= y_fmid;
69
70 if (x_stop < x_ctr_stop) x_ctr_stop = x_stop;
71 if (y_stop < y_ctr_stop) y_ctr_stop = y_stop;
72
73 /* Set up pointer array for rows */
74 imval = (image_type **) malloc(y_dim*sizeof(image_type *));
75 if (imval IS NULL)
76 {
77 printf("INTERNAL_WRAP: Failed to allocate temp array!");
78 return(-1);
79 }
80 for (y_pos=y_im=0;y_pos<y_dim;y_pos++,y_im+=x_dim)
81 imval[y_pos] = (image+y_im);
82
83 for (res_pos=0, y_pos=y_start; /* TOP ROWS */
84 y_pos<y_ctr_start;
85 y_pos+=y_step)
86 {
87 for (x_pos=x_start;
88 x_pos<x_ctr_start;
89 x_pos+=x_step, res_pos++)
90 INPROD(y_pos+y_dim, y_im%y_dim, x_pos+x_dim, x_im%x_dim)
91
92 for (;
93 x_pos<x_ctr_stop;
94 x_pos+=x_step, res_pos++)
95 INPROD(y_pos+y_dim, y_im%y_dim, x_pos, x_im)
96
97 for (;
98 x_pos<x_stop;
99 x_pos+=x_step, res_pos++)
100 INPROD(y_pos+y_dim, y_im%y_dim, x_pos, x_im%x_dim)
101 } /* end TOP ROWS */
102
103 for (; /* MID ROWS */
104 y_pos<y_ctr_stop;
105 y_pos+=y_step)
106 {
107 for (x_pos=x_start;
108 x_pos<x_ctr_start;
109 x_pos+=x_step, res_pos++)
110 INPROD(y_pos, y_im, x_pos+x_dim, x_im%x_dim)
111
112 for (; /* CENTER SECTION */
113 x_pos<x_ctr_stop;
114 x_pos+=x_step, res_pos++)
115 INPROD(y_pos, y_im, x_pos, x_im)
116
117 for (;
118 x_pos<x_stop;
119 x_pos+=x_step, res_pos++)
120 INPROD(y_pos, y_im, x_pos, x_im%x_dim)
121 } /* end MID ROWS */
122
123 for (; /* BOTTOM ROWS */
124 y_pos<y_stop;
125 y_pos+=y_step)
126 {
127 for (x_pos=x_start;
128 x_pos<x_ctr_start;
129 x_pos+=x_step, res_pos++)
130 INPROD(y_pos, y_im%y_dim, x_pos+x_dim, x_im%x_dim)
131
132 for (;
133 x_pos<x_ctr_stop;
134 x_pos+=x_step, res_pos++)
135 INPROD(y_pos, y_im%y_dim, x_pos, x_im)
136
137 for (;
138 x_pos<x_stop;
139 x_pos+=x_step, res_pos++)
140 INPROD(y_pos, y_im%y_dim, x_pos, x_im%x_dim)
141 } /* end BOTTOM ROWS */
142
143 free ((image_type **) imval);
144
145 return(0);
146 } /* end of internal_wrap_reduce */
147
148
149
150/*
151 --------------------------------------------------------------------
152 Performs upsampling (padding with zeros) followed by convolution of
153 FILT with IMAGE (a.k.a. EXPAND in Burt&Adelson81). The operations
154 are combined to avoid unnecessary multiplication of filter samples
155 with zeros in the upsampled image. The convolution is done in 9
156 sections so that mod operation is not performed unnecessarily.
157 Arguments are described in the comment above internal_wrap_reduce.
158
159 WARNING: this subroutine destructively modifes the RESULT image, so
160 the user must zero the result before invocation!
161 -------------------------------------------------------------------- */
162
163/* abstract out the inner product computation */
164#define INPROD2(YSTART,YIND,XSTART,XIND) \
165 { \
166 val = image[im_pos]; \
167 for (y_res=YSTART, filt_pos=0, x_filt_stop=x_fdim; \
168 x_filt_stop<=filt_size; \
169 y_res++, x_filt_stop+=x_fdim) \
170 for (x_res=XSTART; \
171 filt_pos<x_filt_stop; \
172 filt_pos++, x_res++) \
173 imval[YIND][XIND] += val * filt[filt_pos]; \
174 }
175
176int internal_wrap_expand(image, filt, x_fdim, y_fdim,
177 x_start, x_step, x_stop, y_start, y_step, y_stop,
178 result, x_dim, y_dim)
179 register image_type *filt, *result;
180 register int x_fdim, y_fdim, x_dim, y_dim;
181 image_type *image;
182 int x_start, x_step, x_stop, y_start, y_step, y_stop;
183 {
184 register double val;
185 register int filt_size = x_fdim*y_fdim;
186 image_type **imval;
187 register int filt_pos, x_res, y_res, x_filt_stop;
188 register int x_pos, y_pos, im_pos;
189 int x_ctr_stop = x_dim - x_fdim + 1;
190 int y_ctr_stop = y_dim - y_fdim + 1;
191 int x_ctr_start = 0;
192 int y_ctr_start = 0;
193 int x_fmid = x_fdim/2;
194 int y_fmid = y_fdim/2;
195
196 /* shift start/stop coords to filter upper left hand corner */
197 x_start -= x_fmid; y_start -= y_fmid;
198 x_stop -= x_fmid; y_stop -= y_fmid;
199
200 if (x_stop < x_ctr_stop) x_ctr_stop = x_stop;
201 if (y_stop < y_ctr_stop) y_ctr_stop = y_stop;
202
203 /* Set up pointer array for rows */
204 imval = (image_type **) malloc(y_dim*sizeof(image_type *));
205 if (imval IS NULL)
206 {
207 printf("INTERNAL_WRAP: Failed to allocate temp array!");
208 return(-1);
209 }
210 for (y_pos=y_res=0;y_pos<y_dim;y_pos++,y_res+=x_dim)
211 imval[y_pos] = (result+y_res);
212
213 for (im_pos=0, y_pos=y_start; /* TOP ROWS */
214 y_pos<y_ctr_start;
215 y_pos+=y_step)
216 {
217 for (x_pos=x_start;
218 x_pos<x_ctr_start;
219 x_pos+=x_step, im_pos++)
220 INPROD2(y_pos+y_dim, y_res%y_dim, x_pos+x_dim, x_res%x_dim)
221
222 for (;
223 x_pos<x_ctr_stop;
224 x_pos+=x_step, im_pos++)
225 INPROD2(y_pos+y_dim, y_res%y_dim, x_pos, x_res)
226
227 for (;
228 x_pos<x_stop;
229 x_pos+=x_step, im_pos++)
230 INPROD2(y_pos+y_dim, y_res%y_dim, x_pos, x_res%x_dim)
231 } /* end TOP ROWS */
232
233 for (; /* MID ROWS */
234 y_pos<y_ctr_stop;
235 y_pos+=y_step)
236 {
237 for (x_pos=x_start;
238 x_pos<x_ctr_start;
239 x_pos+=x_step, im_pos++)
240 INPROD2(y_pos, y_res, x_pos+x_dim, x_res%x_dim)
241
242 for (; /* CENTER SECTION */
243 x_pos<x_ctr_stop;
244 x_pos+=x_step, im_pos++)
245 INPROD2(y_pos, y_res, x_pos, x_res)
246
247 for (;
248 x_pos<x_stop;
249 x_pos+=x_step, im_pos++)
250 INPROD2(y_pos, y_res, x_pos, x_res%x_dim)
251 } /* end MID ROWS */
252
253 for (; /* BOTTOM ROWS */
254 y_pos<y_stop;
255 y_pos+=y_step)
256 {
257 for (x_pos=x_start;
258 x_pos<x_ctr_start;
259 x_pos+=x_step, im_pos++)
260 INPROD2(y_pos, y_res%y_dim, x_pos+x_dim, x_res%x_dim)
261
262 for (;
263 x_pos<x_ctr_stop;
264 x_pos+=x_step, im_pos++)
265 INPROD2(y_pos, y_res%y_dim, x_pos, x_res)
266
267 for (;
268 x_pos<x_stop;
269 x_pos+=x_step, im_pos++)
270 INPROD2(y_pos, y_res%y_dim, x_pos, x_res%x_dim)
271 } /* end BOTTOM ROWS */
272
273 free ((image_type **) imval);
274 return(0);
275 } /* end of internal_wrap_expand */
276
277
278
279/* Local Variables: */
280/* buffer-read-only: t */
281/* End: */
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/README b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/README
deleted file mode 100755
index 8f339f3..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/README
+++ /dev/null
@@ -1,55 +0,0 @@
1This package contains some MatLab tools for multi-scale image
2processing. Briefly, the tools include:
3 - Recursive multi-scale image decompositions (pyramids), including
4 Laplacian pyramids, QMFs, Wavelets, and steerable pyramids. These
5 operate on 1D or 2D signals of arbitrary dimension. Data
6 structures are compatible with the MatLab wavelet toolbox.
7 - Fast 2D convolution routines, with subsampling and boundary-handling.
8 - Fast point-operations, histograms, histogram-matching.
9 - Fast synthetic image generation: sine gratings, zone plates, fractals, etc.
10 - Display routines for images and pyramids. These include several
11 auto-scaling options, rounding to integer zoom factors to avoid
12 resampling artifacts, and useful labeling (dimensions and gray-range).
13
14The package is available as a gnu-zipped UNIX "tar" file,
15accessible from the web page:
16 http://www.cns.nyu.edu/~lcv/software.html
17
18The code works in Matlab versions 4.2 and higher, and has been fully tested
19on Linux and Macintosh OSX platforms (it should, however, port easily to
20others). To use the code (these lines are for UNIX):
21 1) gunzip matlabPyrTools.tar.gz # unpack g'zipped file
22 2) tar tvf matlabPyrTools.tar # view contents
23 3) tar xvf matlabPyrTools.tar # extract contents
24 4) rm matlabPyrTools.tar # delete tarfile
25 5) Run matlab, and execute:
26 path(<pathname-of-matlabPyrTools>, path);
27 help matlabPyrTools
28
29A few functions are actually MEX interfaces to C code. These are
30contained in the subdirectory called MEX. The MEX files have been
31tested on Sun (Solaris), LinuX on a Pentium platform, and Macintosh
32OSX on a PowerPC, but should not be difficult to compile on most other
33platforms. Source code is included in the MEX directory, as well as
34Make files. I've included pre-compiled versions for a number of
35platforms (Solaris,Linux,Mac,Windows). To make sure these are in your
36matlab path, you can do *one* of the following:
37 1) Create a symbolic link (or macintosh "alias") for the relavent files
38 in the main matlabPyrTools directory, or
39 2) Copy the relavent files into the main matlabPyrTools directory, or
40 3) Put the MEX subdirectory in your matlab path.
41
42Some example script files showing usage of the code are in the
43directory <dir>/TUTORIALS. There is a README file in that directory
44describing the contents.
45
46Incremental changes to the code are documented in the ChangeLog file.
47
48Comments/Suggestions/Bugs to:
49 Eero P. Simoncelli
50 Associate Professor,
51 Center for Neural Science, and
52 Courant Institute for Mathematical Sciences
53 New York University
54 eero.simoncelli@nyu.edu
55 http://www.cns.nyu.edu/~eero/
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/TUTORIALS/README b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/TUTORIALS/README
deleted file mode 100755
index 06960a4..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/TUTORIALS/README
+++ /dev/null
@@ -1,18 +0,0 @@
1
2This directory contains some Matlab script files that serve to give
3example usage of this code, and also to explain some of the
4representations and algorithms.
5
6The files are NOT meant to be executed from the MatLab prompt (like many
7of the MatLab demos). You should instead read through the comments,
8executing the subsequent pieces of code. This gives you a chance to
9explore as you go...
10
11matlabPyrTools.m - Example usage of the code in the distribution.
12
13pyramids.m - An introduction to multi-scale pyramid representations,
14 covering Laplacian, QMF/Wavelet, and Steerable pyramids. The
15 file assumes a knowledge of linear systems, matrix algebra,
16 and 2D Fourier transforms.
17
18more to come....
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/TUTORIALS/matlabPyrTools.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/TUTORIALS/matlabPyrTools.m
deleted file mode 100755
index 44c27ce..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/TUTORIALS/matlabPyrTools.m
+++ /dev/null
@@ -1,145 +0,0 @@
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%%% Some examples using the tools in this distribution.
3%%% Eero Simoncelli, 2/97.
4%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5
6%% Add directory to path (YOU'LL NEED TO ADJUST THIS):
7path('/lcv/matlab/lib/matlabPyrTools',path);
8
9%% Load an image, and downsample to a size appropriate for the machine speed.
10oim = pgmRead('einstein.pgm');
11tic; corrDn(oim,[1 1; 1 1]/4,'reflect1',[2 2]); time = toc;
12imSubSample = min(max(floor(log2(time)/2+3),0),2);
13im = blurDn(oim, imSubSample,'qmf9');
14clear oim;
15
16%%% ShowIm:
17%% 3 types of automatic graylevel scaling, 2 types of automatic
18%% sizing, with or without title and Range information.
19help showIm
20clf; showIm(im,'auto1','auto','Al')
21clf; showIm('im','auto2')
22clf; showIm(im,'auto3',2)
23
24%%% Statistics:
25mean2(im)
26var2(im)
27skew2(im)
28kurt2(im)
29entropy2(im)
30imStats(im)
31
32%%% Synthetic images. First pick some parameters:
33sz = 200;
34dir = 2*pi*rand(1)
35slope = 10*rand(1)-5
36int = 10*rand(1)-5;
37orig = round(1+(sz-1)*rand(2,1));
38expt = 0.8+rand(1)
39ampl = 1+5*rand(1)
40ph = 2*pi*rand(1)
41per = 20
42twidth = 7
43
44clf;
45showIm(mkRamp(sz,dir,slope,int,orig));
46showIm(mkImpulse(sz,orig,ampl));
47showIm(mkR(sz,expt,orig));
48showIm(mkAngle(sz,dir));
49showIm(mkDisc(sz,sz/4,orig,twidth));
50showIm(mkGaussian(sz,(sz/6)^2,orig,ampl));
51showIm(mkZonePlate(sz,ampl,ph));
52showIm(mkAngularSine(sz,3,ampl,ph,orig));
53showIm(mkSine(sz,per,dir,ampl,ph,orig));
54showIm(mkSquare(sz,per,dir,ampl,ph,orig,twidth));
55showIm(mkFract(sz,expt));
56
57
58%%% Point operations (lookup tables):
59[Xtbl,Ytbl] = rcosFn(20, 25, [-1 1]);
60plot(Xtbl,Ytbl);
61showIm(pointOp(mkR(100,1,[70,30]), Ytbl, Xtbl(1), Xtbl(2)-Xtbl(1), 0));
62
63
64%%% histogram Modification/matching:
65[N,X] = histo(im, 150);
66[mn, mx] = range2(im);
67matched = histoMatch(rand(size(im)), N, X);
68showIm(im + sqrt(-1)*matched);
69[Nm,Xm] = histo(matched,150);
70nextFig(2,1);
71 subplot(1,2,1); plot(X,N); axis([mn mx 0 max(N)]);
72 subplot(1,2,2); plot(Xm,Nm); axis([mn mx 0 max(N)]);
73nextFig(2,-1);
74
75%%% Convolution routines:
76
77%% Compare speed of convolution/downsampling routines:
78noise = rand(400); filt = rand(10);
79tic; res1 = corrDn(noise,filt(10:-1:1,10:-1:1),'reflect1',[2 2]); toc;
80tic; ires = rconv2(noise,filt); res2 = ires(1:2:400,1:2:400); toc;
81imStats(res1,res2)
82
83%% Display image and extension of left and top boundaries:
84fsz = [9 9];
85fmid = ceil((fsz+1)/2);
86imsz = [16 16];
87
88% pick one:
89im = eye(imsz);
90im = mkRamp(imsz,pi/6);
91im = mkSquare(imsz,6,pi/6);
92
93% pick one:
94edges='reflect1';
95edges='reflect2';
96edges='repeat';
97edges='extend';
98edges='zero';
99edges='circular';
100edges='dont-compute';
101
102filt = mkImpulse(fsz,[1 1]);
103showIm(corrDn(im,filt,edges));
104line([0,0,imsz(2),imsz(2),0]+fmid(2)-0.5, ...
105 [0,imsz(1),imsz(1),0,0]+fmid(1)-0.5);
106title(sprintf('Edges = %s',edges));
107
108%%% Multi-scale pyramids (see pyramids.m for more examples,
109%%% and explanations):
110
111%% A Laplacian pyramid:
112[pyr,pind] = buildLpyr(im);
113showLpyr(pyr,pind);
114
115res = reconLpyr(pyr, pind); % full reconstruction
116imStats(im,res); % essentially perfect
117
118res = reconLpyr(pyr, pind, [2 3]); %reconstruct 2nd and 3rd levels only
119showIm(res);
120
121%% Wavelet/QMF pyramids:
122filt = 'qmf9'; edges = 'reflect1';
123filt = 'haar'; edges = 'qreflect2';
124filt = 'qmf12'; edges = 'qreflect2';
125filt = 'daub3'; edges = 'circular';
126
127[pyr,pind] = buildWpyr(im, 5-imSubSample, filt, edges);
128showWpyr(pyr,pind,'auto2');
129
130res = reconWpyr(pyr, pind, filt, edges);
131clf; showIm(im + i*res);
132imStats(im,res);
133
134res = reconWpyr(pyr, pind, filt, edges, 'all', [2]); %vertical only
135clf; showIm(res);
136
137%% Steerable pyramid:
138[pyr,pind] = buildSpyr(im,4-imSubSample,'sp3Filters');
139showSpyr(pyr,pind);
140
141%% Steerable pyramid, constructed in frequency domain:
142[pyr,pind] = buildSFpyr(im,5-imSubSample,4); %5 orientation bands
143showSpyr(pyr,pind);
144res = reconSFpyr(pyr,pind);
145imStats(im,res);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/TUTORIALS/pyramids.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/TUTORIALS/pyramids.m
deleted file mode 100755
index 2123c69..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/TUTORIALS/pyramids.m
+++ /dev/null
@@ -1,903 +0,0 @@
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%%% IMAGE PYRAMID TUTORIAL
3%%%
4%%% A brief introduction to multi-scale pyramid decompositions for image
5%%% processing. You should go through this, reading the comments, and
6%%% executing the corresponding MatLab instructions. This file assumes
7%%% a basic familiarity with matrix algebra, with linear systems and Fourier
8%%% theory, and with MatLab. If you don't understand a particular
9%%% function call, execute "help <functionName>" to see documentation.
10%%%
11%%% EPS, 6/96.
12%%% Based on the original OBVIUS tutorial.
13%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14
15%% Determine a subsampling factor for images, based on machine speed:
16oim = pgmRead('einstein.pgm');
17tic; corrDn(oim,[1 1; 1 1]/4,'reflect1',[2 2]); time = toc;
18imSubSample = min(max(floor(log2(time)/2+3),0),2);
19im = blurDn(oim, imSubSample,'qmf9');
20clear oim;
21clf; showIm(im, 'auto2', 'auto', 'im');
22
23%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
24
25%%% LAPLACIAN PYRAMIDS:
26
27%% Images may be decomposed into information at different scales.
28%% Blurring eliminates the fine scales (detail):
29
30binom5 = binomialFilter(5);
31lo_filt = binom5*binom5';
32blurred = rconv2(im,lo_filt);
33subplot(1,2,1); showIm(im, 'auto2', 'auto', 'im');
34subplot(1,2,2); showIm(blurred, 'auto2', 'auto', 'blurred');
35
36%% Subtracting the blurred image from the original leaves ONLY the
37%% fine scale detail:
38fine0 = im - blurred;
39subplot(1,2,1); showIm(fine0, 'auto2', 'auto', 'fine0');
40
41%% The blurred and fine images contain all the information found in
42%% the original image. Trivially, adding the blurred image to the
43%% fine scale detail will reconstruct the original. We can compare
44%% the original image to the sum of blurred and fine using the
45%% "imStats" function, which reports on the statistics of the
46%% difference between it's arguments:
47imStats(im, blurred+fine0);
48
49%% Since the filter is a lowpass filter, we might want to subsample
50%% the blurred image. This may cause some aliasing (depends on the
51%% filter), but the decomposition structure given above will still be
52%% possible. The corrDn function correlates (same as convolution, but
53%% flipped filter) and downsamples in a single operation (for
54%% efficiency). The string 'reflect1' tells the function to handle
55%% boundaries by reflecting the image about the edge pixels. Notice
56%% that the blurred1 image is half the size (in each dimension) of the
57%% original image.
58lo_filt = 2*binom5*binom5'; %construct a separable 2D filter
59blurred1 = corrDn(im,lo_filt,'reflect1',[2 2]);
60subplot(1,2,2); showIm(blurred1,'auto2','auto','blurred1');
61
62%% Now, to extract fine scale detail, we must interpolate the image
63%% back up to full size before subtracting it from the original. The
64%% upConv function does upsampling (padding with zeros between
65%% samples) followed by convolution. This can be done using the
66%% lowpass filter that was applied before subsampling or it can be
67%% done with a different filter.
68fine1 = im - upConv(blurred1,lo_filt,'reflect1',[2 2],[1 1],size(im));
69subplot(1,2,1); showIm(fine1,'auto2','auto','fine1');
70
71%% We now have a technique that takes an image, computes two new
72%% images (blurred1 and fine1) containing the coarse scale information
73%% and the fine scale information. We can also (trivially)
74%% reconstruct the original from these two (even if the subsampling of
75%% the blurred1 image caused aliasing):
76
77recon = fine1 + upConv(blurred1,lo_filt,'reflect1',[2 2],[1 1],size(im));
78imStats(im, recon);
79
80%% Thus, we have described an INVERTIBLE linear transform that maps an
81%% input image to the two images blurred1 and fine1. The inverse
82%% transformation maps blurred1 and fine1 to the result. This is
83%% depicted graphically with a system diagram:
84%%
85%% IM --> blur/down2 ---------> BLURRED1 --> up2/blur --> add --> RECON
86%% | | ^
87%% | | |
88%% | V |
89%% | up2/blur |
90%% | | |
91%% | | |
92%% | V |
93%% --------------> subtract --> FINE1 -------------------
94%%
95%% Note that the number of samples in the representation (i.e., total
96%% samples in BLURRED1 and FINE1) is 1.5 times the number of samples
97%% in the original IM. Thus, this representation is OVERCOMPLETE.
98
99%% Often, we will want further subdivisions of scale. We can
100%% decompose the (coarse-scale) BLURRED1 image into medium coarse and
101%% very coarse images by applying the same splitting technique:
102blurred2 = corrDn(blurred1,lo_filt,'reflect1',[2 2]);
103showIm(blurred2)
104
105fine2 = blurred1 - upConv(blurred2,lo_filt,'reflect1',[2 2],[1 1],size(blurred1));
106showIm(fine2)
107
108%% Since blurred2 and fine2 can be used to reconstruct blurred1, and
109%% blurred1 and fine1 can be used to reconstruct the original image,
110%% the set of THREE images (also known as "subbands") {blurred2,
111%% fine2, fine1} constitute a complete representation of the original
112%% image. Note that the three subbands are displayed at the same size,
113%% but they are actually three different sizes.
114
115subplot(1,3,1); showIm(fine1,'auto2',2^(imSubSample-1),'fine1');
116subplot(1,3,2); showIm(fine2,'auto2',2^(imSubSample),'fine2');
117subplot(1,3,3); showIm(blurred2,'auto2',2^(imSubSample+1),'blurred2');
118
119%% It is useful to consider exactly what information is stored in each
120%% of the pyramid subbands. The reconstruction process involves
121%% recursively interpolating these images and then adding them to the
122%% image at the next finer scale. To see the contribution of ONE of
123%% the representation images (say blurred2) to the reconstruction, we
124%% imagine filling all the other subbands with zeros and then
125%% following our reconstruction procedure. For the blurred2 subband,
126%% this is equivalent to simply calling upConv twice:
127blurred2_full = upConv(upConv(blurred2,lo_filt,'reflect1',[2 2],[1 1],size(blurred1)),...
128 lo_filt,'reflect1',[2 2],[1 1],size(im));
129subplot(1,3,3); showIm(blurred2_full,'auto2',2^(imSubSample-1),'blurred2-full');
130
131%% For the fine2 subband, this is equivalent to calling upConv once:
132fine2_full = upConv(fine2,lo_filt,'reflect1',[2 2],[1 1],size(im));
133subplot(1,3,2); showIm(fine2_full,'auto2',2^(imSubSample-1),'fine2-full');
134
135%% If we did everything correctly, we should be able to add together
136%% these three full-size images to reconstruct the original image:
137recon = blurred2_full + fine2_full + fine1;
138imStats(im, recon)
139
140%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
141
142%%% FUNCTIONS for CONSTRUCTING/MANIPULATING LAPLACIAN PYRAMIDS
143
144%% We can continue this process, recursively splitting off finer and
145%% finer details from the blurred image (like peeling off the outer
146%% layers of an onion). The resulting data structure is known as a
147%% "Laplacian Pyramid". To make things easier, we have written a
148%% MatLab function called buildLpyr to construct this object. The
149%% function returns two items: a long vector containing the subbands
150%% of the pyramid, and an index matrix that is used to access these
151%% subbands. The display routine showLpyr shows all the subbands of the
152%% pyramid, at the their correct relative sizes. It should now be
153%% clearer why these data structures are called "pyramids".
154[pyr,pind] = buildLpyr(im,5-imSubSample);
155showLpyr(pyr,pind);
156
157%% There are also "accessor" functions for pulling out a single subband:
158showIm(pyrBand(pyr,pind,2));
159
160%% The reconLpyr function allows you to reconstruct from a laplacian pyramid.
161%% The third (optional) arg allows you to select any subset of pyramid bands
162%% (default is to use ALL of them).
163clf; showIm(reconLpyr(pyr,pind,[1 3]),'auto2','auto','bands 1 and 3 only');
164
165fullres = reconLpyr(pyr,pind);
166showIm(fullres,'auto2','auto','Full reconstruction');
167imStats(im,fullres);
168
169%% buildLpyr uses 5-tap filters by default for building Laplacian
170%% pyramids. You can specify other filters:
171namedFilter('binom3')
172[pyr3,pind3] = buildLpyr(im,5-imSubSample,'binom3');
173showLpyr(pyr3,pind3);
174fullres3 = reconLpyr(pyr3,pind3,'all','binom3');
175imStats(im,fullres3);
176
177%% Here we build a "Laplacian" pyramid using random filters. filt1 is
178%% used with the downsampling operations and filt2 is used with the
179%% upsampling operations. We normalize the filters for display
180%% purposes. Of course, these filters are (almost certainly) not very
181%% "Gaussian", and the subbands of such a pyramid will be garbage!
182%% Nevertheless, it is a simple property of the Laplacian pyramid that
183%% we can use ANY filters and we will still be able to reconstruct
184%% perfectly.
185
186filt1 = rand(1,5); filt1 = sqrt(2)*filt1/sum(filt1)
187filt2 = rand(1,3); filt2 = sqrt(2)*filt2/sum(filt2)
188[pyrr,pindr] = buildLpyr(im,5-imSubSample,filt1,filt2);
189showLpyr(pyrr,pindr);
190fullresr = reconLpyr(pyrr,pindr,'all',filt2);
191imStats(im,fullresr);
192
193%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
194
195%%% ALIASING in the Gaussian and Laplacian pyramids:
196
197%% Unless one is careful, the subsampling operations will introduce aliasing
198%% artifacts in these pyramid transforms. This is true even though the
199%% Laplacian pyramid can be used to reconstruct the original image perfectly.
200%% When reconstructing, the pyramid is designed in such a way that these
201%% aliasing artifacts cancel out. So it's not a problem if the only thing we
202%% want to do is reconstruct. However, it can be a serious problem if we
203%% intend to process each of the subbands independently.
204
205%% One way to see the consequences of the aliasing artifacts is by
206%% examining variations that occur when the input is shifted. We
207%% choose an image and shift it by some number of pixels. Then blur
208%% (filter-downsample-upsample-filter) the original image and blur the
209%% shifted image. If there's no aliasing, then the blur and shift
210%% operations should commute (i.e.,
211%% shift-filter-downsample-upsample-filter is the same as
212%% filter-downsample-upsample-filter-shift). Try this for 2 different
213%% filters (by replacing 'binom3' with 'binom5' or 'binom7' below),
214%% and you'll see that the aliasing is much worse for the 3 tap
215%% filter.
216
217sig = 100*randn([1 16]);
218sh = [0 7]; %shift amount
219lev = 2; % level of pyramid to look at
220flt = 'binom3'; %filter to use:
221
222shiftIm = shift(sig,sh);
223[pyr,pind] = buildLpyr(shiftIm, lev, flt, flt, 'circular');
224shiftBlur = reconLpyr(pyr, pind, lev, flt, 'circular');
225
226[pyr,pind] = buildLpyr(sig, lev, flt, flt, 'circular');
227res = reconLpyr(pyr, pind, lev, flt, 'circular');
228blurShift = shift(res,sh);
229
230subplot(2,1,1); r = showIm(shiftBlur,'auto2','auto','shiftBlur');
231subplot(2,1,2); showIm(blurShift,r,'auto','blurShift');
232imStats(blurShift,shiftBlur);
233
234%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
235
236%%% PROJECTION and BASIS functions:
237
238%% An invertible, linear transform can be characterized in terms
239%% of a set of PROJECTION and BASIS functions. In matlab matrix
240%% notation:
241%
242%% c = P' * x
243%% x = B * c
244%
245%% where x is an input, c are the transform coefficients, P and B
246%% are matrices. The columns of P are the projection functions (the
247%% input is projected onto the the columns of P to get each successive
248%% transform coefficient). The columns of B are the basis
249%% functions (x is a linear combination of the columns of B).
250
251%% Since the Laplacian pyramid is a linear transform, we can ask: what
252%% are its BASIS functions? We consider these in one dimension for
253%% simplicity. The BASIS function corresponding to a given
254%% coefficient tells us how much that coefficient contributes to each
255%% pixel in the reconstructed image. We can construct a single basis
256%% function by setting one sample of one subband equal to 1.0 (and all
257%% others to zero) and reconstructing. To build the entire matrix, we
258%% have to do this for every sample of every subband:
259sz = min(round(48/(sqrt(2)^imSubSample)),36);
260sig = zeros(sz,1);
261[pyr,pind] = buildLpyr(sig);
262basis = zeros(sz,size(pyr,1));
263for n=1:size(pyr,1)
264 pyr = zeros(size(pyr));
265 pyr(n) = 1;
266 basis(:,n) = reconLpyr(pyr,pind);
267end
268clf; showIm(basis)
269
270%% The columns of the basis matrix are the basis functions. The
271%% matrix is short and fat, corresponding to the fact that the
272%% representation is OVERCOMPLETE. Below, we plot the middle one from
273%% each subband, starting with the finest scale. Note that all of
274%% these basis functions are lowpass (Gaussian-like) functions.
275locations = round(sz * (2 - 3./2.^[1:max(4,size(pind,1))]))+1;
276for lev=1:size(locations,2)
277 subplot(2,2,lev);
278 showIm(basis(:,locations(lev)));
279 axis([0 sz 0 1.1]);
280end
281
282%% Now, we'd also like see the inverse (we'll them PROJECTION)
283%% functions. We need to ask how much of each sample of the input
284%% image contributes to a given pyramid coefficient. Thus, the matrix
285%% is constructed by building pyramids on the set of images with
286%% impulses at each possible location. The rows of this matrix are
287%% the projection functions.
288projection = zeros(size(pyr,1),sz);
289for pos=1:sz
290 [pyr,pind] = buildLpyr(mkImpulse([1 sz], [1 pos]));
291 projection(:,pos) = pyr;
292end
293clf; showIm(projection);
294
295%% Building a pyramid corresponds to multiplication by the projection
296%% matrix. Reconstructing from this pyramid corresponds to
297%% multiplication by the basis matrix. Thus, the product of the two
298%% matrices (in this order) should be the identity matrix:
299showIm(basis*projection);
300
301%% We can plot a few example projection functions at different scales.
302%% Note that all of the projection functions are bandpass functions,
303%% except for the coarsest subband which is lowpass.
304for lev=1:size(locations,2)
305 subplot(2,2,lev);
306 showIm(projection(locations(lev),:));
307 axis([0 sz -0.3 0.8]);
308end
309
310%% Now consider the frequency response of these functions, plotted over the
311%% range [-pi,pi]:
312for lev=1:size(locations,2)
313 subplot(2,2,lev);
314 proj = projection(locations(lev),:);
315 plot(pi*[-32:31]/32,fftshift(abs(fft(proj',64))));
316 axis([-pi pi -0.1 3]);
317end
318
319%% The first projection function is highpass, and the second is bandpass. Both
320%% of these look something like the Laplacian (2nd derivative) of a Gaussian.
321%% The last is lowpass, as are the basis functions. Thus, the basic operation
322%% used to create each level of the pyramid involves a simple highpass/lowpass
323%% split.
324
325%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
326
327%%% QMF/WAVELET PYRAMIDS.
328
329%% Two things about Laplacian pyramids are a bit unsatisfactory.
330%% First, there are more pixels (coefficients) in the representation
331%% than in the original image. Specifically, the 1-dimensional
332%% transform is overcomplete by a factor of 4/3, and the 2-dimensional
333%% transform is overcomplete by a factor of 2. Secondly, the
334%% "bandpass" images (fineN) do not segregate information according to
335%% orientation.
336
337%% There are other varieties of pyramid. One type that arose in the
338%% speech coding community is based on a particular pairs of filters
339%% known as a "Quadrature Mirror Filters" or QMFs. These are closely
340%% related to Wavelets (essentially, they are approximate wavelet
341%% filters).
342
343%% Recall that the Laplacian pyramid is formed by simple hi/low
344%% splitting at each level. The lowpass band is subsampled by a
345%% factor of 2, but the highpass band is NOT subsampled. In the QMF
346%% pyramid, we apply two filters (hi- and lo- pass) and subsample BOTH
347%% by a factor of 2, thus eliminating the excess coefficients of the
348%% Laplacian pyramid.
349
350%% The two filters must have a specific relationship to each
351%% other. In particular, let n be an index for the filter samples.
352%% The highpass filter may be constructed from the lowpass filter by
353%% (1) modulating (multiplying) by (-1)^n (equivalent to shifting by
354%% pi in the Fourier domain), (2) flipping (i.e., reversing the order
355%% of the taps), (3) spatially shifting by one sample. Try to
356%% convince yourself that the resulting filters will always be
357%% orthogonal to each other (i.e., their inner products will be zero)
358%% when shifted by any multiple of two.
359
360%% The function modulateFlip performs the first two of these operations. The
361%% third (spatial shifting) step is built into the convolution code.
362flo = namedFilter('qmf9')';
363fhi = modulateFlip(flo)';
364subplot(2,1,1); lplot(flo); axis([0 10 -0.5 1.0]); title('lowpass');
365subplot(2,1,2); lplot(fhi); axis([0 10 -0.5 1.0]); title('highpass');
366
367%% In the Fourier domain, these filters are (approximately)
368%% "power-complementary": the sum of their squared power spectra is
369%% (approximately) a constant. But note that neither is a perfect
370%% bandlimiter (i.e., a sinc function), and thus subsampling by a
371%% factor of 2 will cause aliasing in each of the subbands. See below
372%% for a discussion of the effect of this aliasing.
373
374%% Plot the two frequency responses:
375freq = pi*[-32:31]/32;
376subplot(2,1,1);
377plot(freq,fftshift(abs(fft(flo,64))),'--',freq,fftshift(abs(fft(fhi,64))),'-');
378axis([-pi pi 0 1.5]); title('FFT magnitudes');
379subplot(2,1,2);
380plot(freq,fftshift(abs(fft(flo,64)).^2)+fftshift(abs(fft(fhi,64)).^2));
381axis([-pi pi 0 2.2]); title('Sum of squared magnitudes');
382
383%% We can split an input signal into two bands as follows:
384sig = mkFract([1,64],1.6);
385subplot(2,1,1); showIm(sig,'auto1','auto','sig');
386lo1 = corrDn(sig,flo,'reflect1',[1 2],[1 1]);
387hi1 = corrDn(sig,fhi,'reflect1',[1 2],[1 2]);
388subplot(2,1,2);
389showIm(lo1,'auto1','auto','low and high bands'); hold on; plot(hi1,'--r'); hold off;
390
391%% Notice that the two subbands are half the size of the original
392%% image, due to the subsampling by a factor of 2. One subtle point:
393%% the highpass and lowpass bands are subsampled on different
394%% lattices: the lowpass band retains the odd-numbered samples and the
395%% highpass band retains the even-numbered samples. This was the
396%% 1-sample shift relating the high and lowpass kernels (mentioned
397%% above). We've used the 'reflect1' to handle boundaries, which
398%% works properly for symmetric odd-length QMFs.
399
400%% We can reconstruct the original image by interpolating these two subbands
401%% USING THE SAME FILTERS:
402reconlo = upConv(lo1,flo,'reflect1',[1 2]);
403reconhi = upConv(hi1,fhi,'reflect1',[1 2],[1 2]);
404subplot(2,1,2); showIm(reconlo+reconhi,'auto1','auto','reconstructed');
405imStats(sig,reconlo+reconhi);
406
407%% We have described an INVERTIBLE linear transform that maps an input
408%% image to the two images lo1 and hi1. The inverse transformation
409%% maps these two images to the result. This is depicted graphically
410%% with a system diagram:
411%%
412%% IM ---> flo/down2 --> LO1 --> up2/flo --> add --> RECON
413%% | ^
414%% | |
415%% | |
416%% -> fhi/down2 --> HI1 --> up2/fhi -----
417%%
418%% Note that the number of samples in the representation (i.e., total
419%% samples in LO1 and HI1) is equal to the number of samples in the
420%% original IM. Thus, this representation is exactly COMPLETE, or
421%% "critically sampled".
422
423%% So we've fixed one of the problems that we had with Laplacian
424%% pyramid. But the system diagram above places strong constraints on
425%% the filters. In particular, for these filters the reconstruction
426%% is no longer perfect. Turns out there are NO
427%% perfect-reconstruction symmetric filters that are
428%% power-complementary, except for the trivial case [1] and the
429%% nearly-trivial case [1 1]/sqrt(2).
430
431%% Let's consider the projection functions of this 2-band splitting
432%% operation. We can construct these by applying the transform to
433%% impulse input signals, for all possible impulse locations. The
434%% rows of the following matrix are the projection functions for each
435%% coefficient in the transform.
436M = [corrDn(eye(32),flo','circular',[1 2]), ...
437 corrDn(eye(32),fhi','circular',[1 2],[1 2])]';
438clf; showIm(M,'auto1','auto','M');
439
440%% The transform matrix is composed of two sub-matrices. The top half
441%% contains the lowpass kernel, shifted by increments of 2 samples.
442%% The bottom half contains the highpass. Now we compute the inverse
443%% of this matrix:
444M_inv = inv(M);
445showIm(M_inv,'auto1','auto','M_inv');
446
447%% The inverse is (very close to) the transpose of the original
448%% matrix! In other words, the transform is orthonormal.
449imStats(M_inv',M);
450
451%% This also points out a nice relationship between the corrDn and
452%% upConv functions, and the matrix representation. corrDn is
453%% equivalent to multiplication by a matrix with copies of the filter
454%% on the ROWS, translated in multiples of the downsampling factor.
455%% upConv is equivalent to multiplication by a matrix with copies of
456%% the filter on the COLUMNS, translated by the upsampling factor.
457
458%% As in the Laplacian pyramid, we can recursively apply this QMF
459%% band-splitting operation to the lowpass band:
460lo2 = corrDn(lo1,flo,'reflect1',[1 2]);
461hi2 = corrDn(lo1,fhi,'reflect1',[1 2],[1 2]);
462
463%% The representation of the original signal is now comprised of the
464%% three subbands {hi1, hi2, lo2} (we don't hold onto lo1, because it
465%% can be reconstructed from lo2 and hi2). Note that hi1 is at 1/2
466%% resolution, and hi2 and lo2 are at 1/4 resolution: The total number
467%% of samples in these three subbands is thus equal to the number of
468%% samples in the original signal.
469imnames=['hi1'; 'hi2'; 'lo2'];
470for bnum=1:3
471 band = eval(imnames(bnum,:));
472 subplot(3,1,bnum); showIm(band); ylabel(imnames(bnum,:));
473 axis([1 size(band,2) 1.1*min(lo2) 1.1*max(lo2)]);
474end
475
476%% Reconstruction proceeds as with the Laplacian pyramid: combine lo2 and hi2
477%% to reconstruct lo1, which is then combined with hi1 to reconstruct the
478%% original signal:
479recon_lo1 = upConv(hi2,fhi,'reflect1',[1 2],[1 2]) + ...
480 upConv(lo2,flo,'reflect1',[1 2],[1 1]);
481reconstructed = upConv(hi1,fhi,'reflect1',[1 2],[1 2]) + ...
482 upConv(recon_lo1,flo,'reflect1',[1 2],[1 1]);
483imStats(sig,reconstructed);
484
485%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
486
487%%% FUNCTIONS for CONSTRUCTING/MANIPULATING QMF/Wavelet PYRAMIDS
488
489%% To make things easier, we have bundled these qmf operations and
490%% data structures into an object in MATLAB.
491
492sig = mkFract([1 64], 1.5);
493[pyr,pind] = buildWpyr(sig);
494showWpyr(pyr,pind);
495
496nbands = size(pind,1);
497for b = 1:nbands
498 subplot(nbands,1,b); lplot(pyrBand(pyr,pind,b));
499end
500
501res = reconWpyr(pyr,pind);
502imStats(sig,res);
503
504%% Now for 2D, we use separable filters. There are 4 ways to apply the two
505%% filters to the input image (followed by the relavent subsampling operation):
506%% (1) lowpass in both x and y
507%% (2) lowpass in x and highpass in y
508%% (3) lowpass in y and highpass in x
509%% (4) highpass in both x and y.
510%% The pyramid is built by recursively subdividing the first of these bands
511%% into four new subbands.
512
513%% First, we'll take a look at some of the basis functions.
514sz = 40;
515zim = zeros(sz);
516flo = 'qmf9'; edges = 'reflect1';
517[pyr,pind] = buildWpyr(zim);
518
519% Put an impulse into the middle of each band:
520for lev=1:size(pind,1)
521 mid = sum(prod(pind(1:lev-1,:)'));
522 mid = mid + floor(pind(lev,2)/2)*pind(lev,1) + floor(pind(lev,1)/2) + 1;
523 pyr(mid,1) = 1;
524end
525
526% And take a look at the reconstruction of each band:
527for lnum=1:wpyrHt(pind)+1
528 for bnum=1:3
529 subplot(wpyrHt(pind)+1,3,(wpyrHt(pind)+1-lnum)*3+bnum);
530 showIm(reconWpyr(pyr, pind, flo, edges, lnum, bnum),'auto1',2,0);
531 end
532end
533
534%% Note that the first column contains horizontally oriented basis functions at
535%% different scales. The second contains vertically oriented basis functions.
536%% The third contains both diagonals (a checkerboard pattern). The bottom row
537%% shows (3 identical images of) a lowpass basis function.
538
539%% Now look at the corresponding Fourier transform magnitudes (these
540%% are plotted over the frequency range [-pi, pi] ):
541nextFig(2,1);
542freq = 2 * pi * [-sz/2:(sz/2-1)]/sz;
543for lnum=1:wpyrHt(pind)+1
544 for bnum=1:3
545 subplot(wpyrHt(pind)+1,3,(wpyrHt(pind)+1-lnum)*3+bnum);
546 basisFn = reconWpyr(pyr, pind, flo, edges, lnum, bnum);
547 basisFmag = fftshift(abs(fft2(basisFn,sz,sz)));
548 imagesc(freq,freq,basisFmag);
549 axis('square'); axis('xy'); colormap('gray');
550 end
551end
552nextFig(2,-1);
553
554%% The filters at a given scale sum to a squarish annular region:
555sumSpectra = zeros(sz);
556lnum = 2;
557for bnum=1:3
558 basisFn = reconWpyr(pyr, pind, flo, edges, lnum, bnum);
559 basisFmag = fftshift(abs(fft2(basisFn,sz,sz)));
560 sumSpectra = basisFmag.^2 + sumSpectra;
561end
562clf; imagesc(freq,freq,sumSpectra); axis('square'); axis('xy'); title('one scale');
563
564%% Now decompose an image:
565[pyr,pind] = buildWpyr(im);
566
567%% View all of the subbands (except lowpass), scaled to be the same size
568%% (requires a big figure window):
569nlevs = wpyrHt(pind);
570for lnum=1:nlevs
571 for bnum=1:3
572 subplot(nlevs,3,(lnum-1)*3+bnum);
573 showIm(wpyrBand(pyr,pind,lnum,bnum), 'auto2', 2^(lnum+imSubSample-2));
574 end
575end
576
577%% In addition to the bands shown above, there's a lowpass residual:
578nextFig(2,1);
579clf; showIm(pyrLow(pyr,pind));
580nextFig(2,-1);
581
582% Alternatively, display the pyramid with the subbands shown at their
583% correct relative sizes:
584clf; showWpyr(pyr, pind);
585
586%% The reconWpyr function can be used to reconstruct the entire pyramid:
587reconstructed = reconWpyr(pyr,pind);
588imStats(im,reconstructed);
589
590%% As with Laplacian pyramids, you can specify sub-levels and subbands
591%% to be included in the reconstruction. For example:
592clf
593showIm(reconWpyr(pyr,pind,'qmf9','reflect1',[1:wpyrHt(pind)],[1])); %Horizontal only
594showIm(reconWpyr(pyr,pind,'qmf9','reflect1',[2,3])); %two middle scales
595
596%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
597
598%%% PERFECT RECONSTRUCTION: HAAR AND DEBAUCHIES WAVELETS
599
600%% The symmetric QMF filters used above are not perfectly orthogonal.
601%% In fact, it's impossible to construct a symmetric filter of size
602%% greater than 2 that is perfectly orthogonal to shifted copies
603%% (shifted by multiples of 2) of itself. For example, consider a
604%% symmetric kernel of length 3. Shift by two and the right end of
605%% the original kernel is aligned with the left end of the shifted
606%% one. Thus, the inner product of these two will be the square of
607%% the end tap, which will be non-zero.
608
609%% However, one can easily create wavelet filters of length 2 that
610%% will do the job. This is the oldest known wavelet, known as the
611%% "Haar". The two kernels are [1,1]/sqrt(2) and [1,-1]/sqrt(2).
612%% These are trivially seen to be orthogonal to each other, and shifts
613%% by multiples of two are also trivially orthogonal. The projection
614%% functions of the Haar transform are in the rows of the following
615%% matrix, constructed by applying the transform to impulse input
616%% signals, for all possible impulse locations:
617
618haarLo = namedFilter('haar')
619haarHi = modulateFlip(haarLo)
620subplot(2,1,1); lplot(haarLo); axis([0 3 -1 1]); title('lowpass');
621subplot(2,1,2); lplot(haarHi); axis([0 3 -1 1]); title('highpass');
622
623M = [corrDn(eye(32), haarLo, 'reflect1', [2 1], [2 1]); ...
624 corrDn(eye(32), haarHi, 'reflect1', [2 1], [2 1])];
625clf; showIm(M)
626showIm(M*M') %identity!
627
628%% As before, the filters are power-complementary (although the
629%% frequency isolation is rather poor, and thus the subbands will be
630%% heavily aliased):
631plot(pi*[-32:31]/32,abs(fft(haarLo,64)).^2,'--',...
632 pi*[-32:31]/32,abs(fft(haarHi,64)).^2,'-');
633
634sig = mkFract([1,64],0.5);
635[pyr,pind] = buildWpyr(sig,4,'haar','reflect1');
636showWpyr(pyr,pind);
637
638%% check perfect reconstruction:
639res = reconWpyr(pyr,pind, 'haar', 'reflect1');
640imStats(sig,res)
641
642%% If you want perfect reconstruction, but don't like the Haar
643%% transform, there's another option: drop the symmetry requirement.
644%% Ingrid Daubechies developed one of the earliest sets of such
645%% perfect-reconstruction wavelets. The simplest of these is of
646%% length 4:
647
648daub_lo = namedFilter('daub2');
649daub_hi = modulateFlip(daub_lo);
650
651%% The daub_lo filter is constructed to be orthogonal to 2shifted
652%% copy of itself. For example:
653[daub_lo;0;0]'*[0;0;daub_lo]
654
655M = [corrDn(eye(32), daub_lo, 'circular', [2 1], [2 1]); ...
656 corrDn(eye(32), daub_hi, 'circular', [2 1], [2 1])];
657clf; showIm(M)
658showIm(M*M') % identity!
659
660%% Again, they're power complementary:
661plot(pi*[-32:31]/32,abs(fft(daub_lo,64)).^2,'--',...
662 pi*[-32:31]/32,abs(fft(daub_hi,64)).^2,'-');
663
664%% The sum of the power spectra is again flat
665plot(pi*[-32:31]/32,...
666 fftshift(abs(fft(daub_lo,64)).^2)+fftshift(abs(fft(daub_hi,64)).^2));
667
668%% Make a pyramid using the same code as before (except that we can't
669%% use reflected boundaries with asymmetric filters):
670[pyr,pind] = buildWpyr(sig, maxPyrHt(size(sig),size(daub_lo)), daub_lo, 'circular');
671showWpyr(pyr,pind,'indep1');
672
673res = reconWpyr(pyr,pind, daub_lo,'circular');
674imStats(sig,res);
675
676%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
677
678%%% ALIASING IN WAVELET TRANSFORMS
679
680%% All of these orthonormal pyramid/wavelet transforms have a lot
681%% of aliasing in the subbands. You can see that in the frequency
682%% response plots since the frequency response of each filter
683%% covers well more than half the frequency domain. The aliasing
684%% can have serious consequences...
685
686%% Get one of the basis functions of the 2D Daubechies wavelet transform:
687[pyr,pind] = buildWpyr(zeros(1,64),4,daub_lo,'circular');
688lev = 3;
689pyr(1+sum(pind(1:lev-1,2))+pind(lev,2)/2,1) = 1;
690sig = reconWpyr(pyr,pind, daub_lo,'circular');
691clf; lplot(sig)
692
693%% Since the basis functions are orthonormal, building a pyramid using this
694%% input will yield a single non-zero coefficient.
695[pyr,pind] = buildWpyr(sig, 4, daub_lo, 'circular');
696figure(1);
697nbands = size(pind,1)
698for b=1:nbands
699 subplot(nbands,1,b); lplot(pyrBand(pyr,pind,b));
700 axis([1 size(pyrBand(pyr,pind,b),2) -0.3 1.3]);
701end
702
703%% Now shift the input by one sample and re-build the pyramid.
704shifted_sig = [0,sig(1:size(sig,2)-1)];
705[spyr,spind] = buildWpyr(shifted_sig, 4, daub_lo, 'circular');
706
707%% Plot each band of the unshifted and shifted decomposition
708nextFig(2);
709nbands = size(spind,1)
710for b=1:nbands
711 subplot(nbands,1,b); lplot(pyrBand(spyr,spind,b));
712 axis([1 size(pyrBand(spyr,spind,b),2) -0.3 1.3]);
713end
714nextFig(2,-1);
715
716%% In the third band, we expected the coefficients to move around
717%% because the signal was shifted. But notice that in the original
718%% signal decomposition, the other bands were filled with zeros.
719%% After the shift, they have significant content. Although these
720%% subbands are supposed to represent information at different scales,
721%% their content also depends on the relative POSITION of the input
722%% signal.
723
724%% This problem is not unique to the Daubechies transform. The same
725%% is true for the QMF transform. Try it... In fact, the same kind
726%% of problem occurs for almost any orthogonal pyramid transform (the
727%% only exception is the limiting case in which the filter is a sinc
728%% function).
729
730%% Orthogonal pyramid transforms are not shift-invariant. Although
731%% orthogonality may be an important property for some applications
732%% (e.g., data compression), orthogonal pyramid transforms are
733%% generally not so good for image analysis.
734
735%% The overcompleteness of the Laplacian pyramid turns out to be a
736%% good thing in the end. By using an overcomplete representation
737%% (and by choosing the filters properly to avoid aliasing as much as
738%% possible), you end up with a representation that is useful for
739%% image analysis.
740
741%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
742
743%%% The "STEERABLE PYRAMID"
744
745%% The steerable pyramid is a multi-scale representation that is
746%% translation-invariant, but that also includes representation of
747%% orientation. Furthermore, the representation of orientation is
748%% designed to be rotation-invariant. The basis/projection functions
749%% are oriented (steerable) filters, localized in space and frequency.
750%% It is overcomplete to avoid aliasing. And it is "self-inverting"
751%% (like the QMF/Wavelet transform): the projection functions and
752%% basis functions are identical. The mathematical phrase for a
753%% transform obeying this property is "tight frame".
754
755%% The system diagram for the steerable pyramid (described in the
756%% reference given below) is as follows:
757%
758% IM ---> fhi0 -----------------> H0 ---------------- fhi0 ---> RESULT
759% | |
760% | |
761% |-> flo0 ---> fl1/down2 --> L1 --> up2/fl1 ---> flo0 -|
762% | |
763% |----> fb0 -----> B0 ----> fb0 ---|
764% | |
765% |----> fb1 -----> B1 ----> fb1 ---|
766% . .
767% . .
768% |----> fbK -----> BK ----> fbK ---|
769%
770%% The filters {fhi0,flo0} are used to initially split the image into
771%% a highpass residual band H0 and a lowpass subband. This lowpass
772%% band is then split into a low(er)pass band L1 and K+1 oriented
773%% subbands {B0,B1,...,BK}. The representatation is substantially
774%% overcomplete. The pyramid is built by recursively splitting the
775%% lowpass band (L1) using the inner portion of the diagram (i.e.,
776%% using the filters {fl1,fb0,fb1,...,fbK}). The resulting transform is
777%% overcomplete by a factor of 4k/3.
778
779%% The scale tuning of the filters is constrained by the recursive
780%% system diagram. The orientation tuning is constrained by requiring
781%% the property of steerability. A set of filters form a steerable
782%% basis if they 1) are rotated copies of each other, and 2) a copy of
783%% the filter at any orientation may be computed as a linear
784%% combination of the basis filters. The simplest examples of
785%% steerable filters is a set of N+1 Nth-order directional
786%% derivatives.
787
788%% Choose a filter set (options are 'sp0Filters', 'sp1Filters',
789%% 'sp3Filters', 'sp5Filters'):
790filts = 'sp3Filters';
791[lo0filt,hi0filt,lofilt,bfilts,steermtx,harmonics] = eval(filts);
792fsz = round(sqrt(size(bfilts,1))); fsz = [fsz fsz];
793nfilts = size(bfilts,2);
794nrows = floor(sqrt(nfilts));
795
796%% Look at the oriented bandpass filters:
797for f = 1:nfilts
798 subplot(nrows,ceil(nfilts/nrows),f);
799 showIm(conv2(reshape(bfilts(:,f),fsz),lo0filt));
800end
801
802%% Try "steering" to a new orientation (new_ori in degrees):
803new_ori = 360*rand(1)
804clf; showIm(conv2(reshape(steer(bfilts, new_ori*pi/180 ), fsz), lo0filt));
805
806%% Look at Fourier transform magnitudes:
807lo0 = fftshift(abs(fft2(lo0filt,64,64)));
808fsum = zeros(size(lo0));
809for f = 1:size(bfilts,2)
810 subplot(nrows,ceil(nfilts/nrows),f);
811 flt = reshape(bfilts(:,f),fsz);
812 freq = lo0 .* fftshift(abs(fft2(flt,64,64)));
813 fsum = fsum + freq.^2;
814 showIm(freq);
815end
816
817%% The filters sum to a smooth annular ring:
818clf; showIm(fsum);
819
820%% build a Steerable pyramid:
821[pyr,pind] = buildSpyr(im, 4-imSubSample, filts);
822
823%% Look at first (vertical) bands, different scales:
824for s = 1:min(4,spyrHt(pind))
825 band = spyrBand(pyr,pind,s,1);
826 subplot(2,2,s); showIm(band);
827end
828
829%% look at all orientation bands at one level (scale):
830for b = 1:spyrNumBands(pind)
831 band = spyrBand(pyr,pind,1,b);
832 subplot(nrows,ceil(nfilts/nrows),b);
833 showIm(band);
834end
835
836%% To access the high-pass and low-pass bands:
837low = pyrLow(pyr,pind);
838showIm(low);
839high = spyrHigh(pyr,pind);
840showIm(high);
841
842%% Display the whole pyramid (except for the highpass residual band),
843%% with images shown at proper relative sizes:
844showSpyr(pyr,pind);
845
846%% Spin a level of the pyramid, interpolating (steering to)
847%% intermediate orienations:
848
849[lev,lind] = spyrLev(pyr,pind,2);
850lev2 = reshape(lev,prod(lind(1,:)),size(bfilts,2));
851figure(1); subplot(1,1,1); showIm(spyrBand(pyr,pind,2,1));
852M = moviein(16);
853for frame = 1:16
854 steered_im = steer(lev2, 2*pi*(frame-1)/16, harmonics, steermtx);
855 showIm(reshape(steered_im, lind(1,:)),'auto2');
856 M(:,frame) = getframe;
857end
858
859%% Show the movie 3 times:
860movie(M,3);
861
862%% Reconstruct. Note that the filters are not perfect, although they are good
863%% enough for most applications.
864res = reconSpyr(pyr, pind, filts);
865showIm(im + i * res);
866imStats(im,res);
867
868%% As with previous pyramids, you can select subsets of the levels
869%% and orientation bands to be included in the reconstruction. For example:
870
871%% All levels (including highpass and lowpass residuals), one orientation:
872clf; showIm(reconSpyr(pyr,pind,filts,'reflect1','all', [1]));
873
874%% Without the highpass and lowpass:
875clf; showIm(reconSpyr(pyr,pind,filts,'reflect1',[1:spyrHt(pind)], [1]));
876
877%% We also provide an implementation of the Steerable pyramid in the
878%% Frequency domain. The advantages are perfect-reconstruction
879%% (within floating-point error), and any number of orientation
880%% bands. The disadvantages are that it is typically slower, and the
881%% boundary handling is always circular.
882
883[pyr,pind] = buildSFpyr(im,4,4); % 4 levels, 5 orientation bands
884showSpyr(pyr,pind);
885res = reconSFpyr(pyr,pind);
886imStats(im,res); % nearly perfect
887
888%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
889% The steerable pyramid transform given above is described in:
890%
891% E P Simoncelli and W T Freeman.
892% The Steerable Pyramid: A Flexible Architecture for Multi-Scale
893% Derivative Computation. IEEE Second Int'l Conf on Image Processing.
894% Washington DC, October 1995.
895%
896% Online access:
897% Abstract: http://www.cis.upenn.edu/~eero/ABSTRACTS/simoncelli95b-abstract.html
898% Full (PostScript): ftp://ftp.cis.upenn.edu/pub/eero/simoncelli95b.ps.Z
899%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
900
901%% Local Variables:
902%% buffer-read-only: t
903%% End:
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/binomialFilter.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/binomialFilter.m
deleted file mode 100755
index e5670c7..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/binomialFilter.m
+++ /dev/null
@@ -1,18 +0,0 @@
1% KERNEL = binomialFilter(size)
2%
3% Returns a vector of binomial coefficients of order (size-1) .
4
5% Eero Simoncelli, 2/97.
6
7function [kernel] = binomialFilter(sz)
8
9if (sz < 2)
10 error('size argument must be larger than 1');
11end
12
13kernel = [0.5 0.5]';
14
15for n=1:sz-2
16 kernel = conv([0.5 0.5]', kernel);
17end
18
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/blur.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/blur.m
deleted file mode 100755
index f993d09..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/blur.m
+++ /dev/null
@@ -1,28 +0,0 @@
1% RES = blur(IM, LEVELS, FILT)
2%
3% Blur an image, by filtering and downsampling LEVELS times
4% (default=1), followed by upsampling and filtering LEVELS times. The
5% blurring is done with filter kernel specified by FILT (default =
6% 'binom5'), which can be a string (to be passed to namedFilter), a
7% vector (applied separably as a 1D convolution kernel in X and Y), or
8% a matrix (applied as a 2D convolution kernel). The downsampling is
9% always by 2 in each direction.
10
11% Eero Simoncelli, 3/04.
12
13function res = blur(im, nlevs, filt)
14
15%------------------------------------------------------------
16%% OPTIONAL ARGS:
17
18if (exist('nlevs') ~= 1)
19 nlevs = 1;
20end
21
22if (exist('filt') ~= 1)
23 filt = 'binom5';
24end
25
26%------------------------------------------------------------
27
28res = upBlur(blurDn(im,nlevs,filt)); \ No newline at end of file
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/blurDn.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/blurDn.m
deleted file mode 100755
index 8120c04..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/blurDn.m
+++ /dev/null
@@ -1,59 +0,0 @@
1% RES = blurDn(IM, LEVELS, FILT)
2%
3% Blur and downsample an image. The blurring is done with filter
4% kernel specified by FILT (default = 'binom5'), which can be a string
5% (to be passed to namedFilter), a vector (applied separably as a 1D
6% convolution kernel in X and Y), or a matrix (applied as a 2D
7% convolution kernel). The downsampling is always by 2 in each
8% direction.
9%
10% The procedure is applied recursively LEVELS times (default=1).
11
12% Eero Simoncelli, 3/97.
13
14function res = blurDn(im, nlevs, filt)
15
16%------------------------------------------------------------
17%% OPTIONAL ARGS:
18
19if (exist('nlevs') ~= 1)
20 nlevs = 1;
21end
22
23if (exist('filt') ~= 1)
24 filt = 'binom5';
25end
26
27%------------------------------------------------------------
28
29if isstr(filt)
30 filt = namedFilter(filt);
31end
32
33filt = filt/sum(filt(:));
34
35if nlevs > 1
36 im = blurDn(im,nlevs-1,filt);
37end
38
39if (nlevs >= 1)
40 if (any(size(im)==1))
41 if (~any(size(filt)==1))
42 error('Cant apply 2D filter to 1D signal');
43 end
44 if (size(im,2)==1)
45 filt = filt(:);
46 else
47 filt = filt(:)';
48 end
49 res = corrDn(im,filt,'reflect1',(size(im)~=1)+1);
50 elseif (any(size(filt)==1))
51 filt = filt(:);
52 res = corrDn(im,filt,'reflect1',[2 1]);
53 res = corrDn(res,filt','reflect1',[1 2]);
54 else
55 res = corrDn(im,filt,'reflect1',[2 2]);
56 end
57else
58 res = im;
59end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildGpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildGpyr.m
deleted file mode 100755
index 3f3d07b..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildGpyr.m
+++ /dev/null
@@ -1,82 +0,0 @@
1% [PYR, INDICES] = buildGpyr(IM, HEIGHT, FILT, EDGES)
2%
3% Construct a Gaussian pyramid on matrix IM.
4%
5% HEIGHT (optional) specifies the number of pyramid levels to build. Default
6% is 1+maxPyrHt(size(IM),size(FILT)).
7% You can also specify 'auto' to use this value.
8%
9% FILT (optional) can be a string naming a standard filter (see
10% namedFilter), or a vector which will be used for (separable)
11% convolution. Default = 'binom5'. EDGES specifies edge-handling, and
12% defaults to 'reflect1' (see corrDn).
13%
14% PYR is a vector containing the N pyramid subbands, ordered from fine
15% to coarse. INDICES is an Nx2 matrix containing the sizes of
16% each subband. This is compatible with the MatLab Wavelet toolbox.
17
18% Eero Simoncelli, 6/96.
19
20function [pyr,pind] = buildGpyr(im, ht, filt, edges)
21
22if (nargin < 1)
23 error('First argument (IM) is required');
24end
25
26im_sz = size(im);
27
28%------------------------------------------------------------
29%% OPTIONAL ARGS:
30
31if (exist('filt') ~= 1)
32 filt = 'binom5';
33end
34
35if isstr(filt)
36 filt = namedFilter(filt);
37end
38
39if ( (size(filt,1) > 1) & (size(filt,2) > 1) )
40 error('FILT should be a 1D filter (i.e., a vector)');
41else
42 filt = filt(:);
43end
44
45max_ht = 1 + maxPyrHt(im_sz, size(filt,1));
46if ( (exist('ht') ~= 1) | (ht == 'auto') )
47 ht = max_ht;
48else
49 if (ht > max_ht)
50 error(sprintf('Cannot build pyramid higher than %d levels.',max_ht));
51 end
52end
53
54if (exist('edges') ~= 1)
55 edges= 'reflect1';
56end
57
58%------------------------------------------------------------
59
60if (ht <= 1)
61
62 pyr = im(:);
63 pind = im_sz;
64
65else
66
67 if (im_sz(2) == 1)
68 lo2 = corrDn(im, filt, edges, [2 1], [1 1]);
69 elseif (im_sz(1) == 1)
70 lo2 = corrDn(im, filt', edges, [1 2], [1 1]);
71 else
72 lo = corrDn(im, filt', edges, [1 2], [1 1]);
73 lo2 = corrDn(lo, filt, edges, [2 1], [1 1]);
74 end
75
76 [npyr,nind] = buildGpyr(lo2, ht-1, filt, edges);
77
78 pyr = [im(:); npyr];
79 pind = [im_sz; nind];
80
81end
82
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildLpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildLpyr.m
deleted file mode 100755
index facb0f3..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildLpyr.m
+++ /dev/null
@@ -1,109 +0,0 @@
1% [PYR, INDICES] = buildLpyr(IM, HEIGHT, FILT1, FILT2, EDGES)
2%
3% Construct a Laplacian pyramid on matrix (or vector) IM.
4%
5% HEIGHT (optional) specifies the number of pyramid levels to build. Default
6% is 1+maxPyrHt(size(IM),size(FILT)). You can also specify 'auto' to
7% use this value.
8%
9% FILT1 (optional) can be a string naming a standard filter (see
10% namedFilter), or a vector which will be used for (separable)
11% convolution. Default = 'binom5'. FILT2 specifies the "expansion"
12% filter (default = filt1). EDGES specifies edge-handling, and
13% defaults to 'reflect1' (see corrDn).
14%
15% PYR is a vector containing the N pyramid subbands, ordered from fine
16% to coarse. INDICES is an Nx2 matrix containing the sizes of
17% each subband. This is compatible with the MatLab Wavelet toolbox.
18
19% Eero Simoncelli, 6/96.
20
21function [pyr,pind] = buildLpyr(im, ht, filt1, filt2, edges)
22
23if (nargin < 1)
24 error('First argument (IM) is required');
25end
26
27im_sz = size(im);
28
29%------------------------------------------------------------
30%% OPTIONAL ARGS:
31
32if (exist('filt1') ~= 1)
33 filt1 = 'binom5';
34end
35
36if isstr(filt1)
37 filt1 = namedFilter(filt1);
38end
39
40if ( (size(filt1,1) > 1) & (size(filt1,2) > 1) )
41 error('FILT1 should be a 1D filter (i.e., a vector)');
42else
43 filt1 = filt1(:);
44end
45
46if (exist('filt2') ~= 1)
47 filt2 = filt1;
48end
49
50if isstr(filt2)
51 filt2 = namedFilter(filt2);
52end
53
54if ( (size(filt2,1) > 1) & (size(filt2,2) > 1) )
55 error('FILT2 should be a 1D filter (i.e., a vector)');
56else
57 filt2 = filt2(:);
58end
59
60max_ht = 1 + maxPyrHt(im_sz, max(size(filt1,1), size(filt2,1)));
61if ( (exist('ht') ~= 1) | (ht == 'auto') )
62 ht = max_ht;
63else
64 if (ht > max_ht)
65 error(sprintf('Cannot build pyramid higher than %d levels.',max_ht));
66 end
67end
68
69if (exist('edges') ~= 1)
70 edges= 'reflect1';
71end
72
73%------------------------------------------------------------
74
75if (ht <= 1)
76
77 pyr = im(:);
78 pind = im_sz;
79
80else
81
82 if (im_sz(2) == 1)
83 lo2 = corrDn(im, filt1, edges, [2 1], [1 1]);
84 elseif (im_sz(1) == 1)
85 lo2 = corrDn(im, filt1', edges, [1 2], [1 1]);
86 else
87 lo = corrDn(im, filt1', edges, [1 2], [1 1]);
88 int_sz = size(lo);
89 lo2 = corrDn(lo, filt1, edges, [2 1], [1 1]);
90 end
91
92 [npyr,nind] = buildLpyr(lo2, ht-1, filt1, filt2, edges);
93
94 if (im_sz(1) == 1)
95 hi2 = upConv(lo2, filt2', edges, [1 2], [1 1], im_sz);
96 elseif (im_sz(2) == 1)
97 hi2 = upConv(lo2, filt2, edges, [2 1], [1 1], im_sz);
98 else
99 hi = upConv(lo2, filt2, edges, [2 1], [1 1], int_sz);
100 hi2 = upConv(hi, filt2', edges, [1 2], [1 1], im_sz);
101 end
102
103 hi2 = im - hi2;
104
105 pyr = [hi2(:); npyr];
106 pind = [im_sz; nind];
107
108end
109
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSCFpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSCFpyr.m
deleted file mode 100755
index 101b6d2..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSCFpyr.m
+++ /dev/null
@@ -1,90 +0,0 @@
1% [PYR, INDICES, STEERMTX, HARMONICS] = buildSCFpyr(IM, HEIGHT, ORDER, TWIDTH)
2%
3% This is a modified version of buildSFpyr, that constructs a
4% complex-valued steerable pyramid using Hilbert-transform pairs
5% of filters. Note that the imaginary parts will *not* be steerable.
6%
7% To reconstruct from this representation, either call reconSFpyr
8% on the real part of the pyramid, *or* call reconSCFpyr which will
9% use both real and imaginary parts (forcing analyticity).
10%
11% Description of this transform appears in: Portilla & Simoncelli,
12% Int'l Journal of Computer Vision, 40(1):49-71, Oct 2000.
13% Further information: http://www.cns.nyu.edu/~eero/STEERPYR/
14
15% Original code: Eero Simoncelli, 5/97.
16% Modified by Javier Portilla to return complex (quadrature pair) channels,
17% 9/97.
18
19function [pyr,pind,steermtx,harmonics] = buildSCFpyr(im, ht, order, twidth)
20
21%-----------------------------------------------------------------
22%% DEFAULTS:
23
24max_ht = floor(log2(min(size(im)))) - 2;
25
26if (exist('ht') ~= 1)
27 ht = max_ht;
28else
29 if (ht > max_ht)
30 error(sprintf('Cannot build pyramid higher than %d levels.',max_ht));
31 end
32end
33
34if (exist('order') ~= 1)
35 order = 3;
36elseif ((order > 15) | (order < 0))
37 fprintf(1,'Warning: ORDER must be an integer in the range [0,15]. Truncating.\n');
38 order = min(max(order,0),15);
39else
40 order = round(order);
41end
42nbands = order+1;
43
44if (exist('twidth') ~= 1)
45 twidth = 1;
46elseif (twidth <= 0)
47 fprintf(1,'Warning: TWIDTH must be positive. Setting to 1.\n');
48 twidth = 1;
49end
50
51%-----------------------------------------------------------------
52%% Steering stuff:
53
54if (mod((nbands),2) == 0)
55 harmonics = [0:(nbands/2)-1]'*2 + 1;
56else
57 harmonics = [0:(nbands-1)/2]'*2;
58end
59
60steermtx = steer2HarmMtx(harmonics, pi*[0:nbands-1]/nbands, 'even');
61
62%-----------------------------------------------------------------
63
64dims = size(im);
65ctr = ceil((dims+0.5)/2);
66
67[xramp,yramp] = meshgrid( ([1:dims(2)]-ctr(2))./(dims(2)/2), ...
68 ([1:dims(1)]-ctr(1))./(dims(1)/2) );
69angle = atan2(yramp,xramp);
70log_rad = sqrt(xramp.^2 + yramp.^2);
71log_rad(ctr(1),ctr(2)) = log_rad(ctr(1),ctr(2)-1);
72log_rad = log2(log_rad);
73
74%% Radial transition function (a raised cosine in log-frequency):
75[Xrcos,Yrcos] = rcosFn(twidth,(-twidth/2),[0 1]);
76Yrcos = sqrt(Yrcos);
77
78YIrcos = sqrt(1.0 - Yrcos.^2);
79lo0mask = pointOp(log_rad, YIrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
80imdft = fftshift(fft2(im));
81lo0dft = imdft .* lo0mask;
82
83[pyr,pind] = buildSCFpyrLevs(lo0dft, log_rad, Xrcos, Yrcos, angle, ht, nbands);
84
85hi0mask = pointOp(log_rad, Yrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
86hi0dft = imdft .* hi0mask;
87hi0 = ifft2(ifftshift(hi0dft));
88
89pyr = [real(hi0(:)) ; pyr];
90pind = [size(hi0); pind];
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSCFpyrLevs.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSCFpyrLevs.m
deleted file mode 100755
index bd75695..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSCFpyrLevs.m
+++ /dev/null
@@ -1,73 +0,0 @@
1% [PYR, INDICES] = buildSCFpyrLevs(LODFT, LOGRAD, XRCOS, YRCOS, ANGLE, HEIGHT, NBANDS)
2%
3% Recursive function for constructing levels of a steerable pyramid. This
4% is called by buildSCFpyr, and is not usually called directly.
5
6% Original code: Eero Simoncelli, 5/97.
7% Modified by Javier Portilla to generate complex bands in 9/97.
8
9function [pyr,pind] = buildSCFpyrLevs(lodft,log_rad,Xrcos,Yrcos,angle,ht,nbands);
10
11if (ht <= 0)
12
13 lo0 = ifft2(ifftshift(lodft));
14 pyr = real(lo0(:));
15 pind = size(lo0);
16
17else
18
19 bands = zeros(prod(size(lodft)), nbands);
20 bind = zeros(nbands,2);
21
22% log_rad = log_rad + 1;
23 Xrcos = Xrcos - log2(2); % shift origin of lut by 1 octave.
24
25 lutsize = 1024;
26 Xcosn = pi*[-(2*lutsize+1):(lutsize+1)]/lutsize; % [-2*pi:pi]
27 order = nbands-1;
28 %% divide by sqrt(sum_(n=0)^(N-1) cos(pi*n/N)^(2(N-1)) )
29 %% Thanks to Patrick Teo for writing this out :)
30 const = (2^(2*order))*(factorial(order)^2)/(nbands*factorial(2*order));
31
32%
33% Ycosn = sqrt(const) * (cos(Xcosn)).^order;
34%
35 % analityc version: only take one lobe
36 alfa= mod(pi+Xcosn,2*pi)-pi;
37 Ycosn = 2*sqrt(const) * (cos(Xcosn).^order) .* (abs(alfa)<pi/2);
38
39 himask = pointOp(log_rad, Yrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
40
41 for b = 1:nbands
42 anglemask = pointOp(angle, Ycosn, Xcosn(1)+pi*(b-1)/nbands, Xcosn(2)-Xcosn(1));
43 banddft = ((-i)^(nbands-1)) .* lodft .* anglemask .* himask;
44 band = ifft2(ifftshift(banddft));
45
46% bands(:,b) = real(band(:));
47 % analytic version: full complex value
48 bands(:,b)=band(:);
49 bind(b,:) = size(band);
50 end
51
52 dims = size(lodft);
53 ctr = ceil((dims+0.5)/2);
54 lodims = ceil((dims-0.5)/2);
55 loctr = ceil((lodims+0.5)/2);
56 lostart = ctr-loctr+1;
57 loend = lostart+lodims-1;
58
59 log_rad = log_rad(lostart(1):loend(1),lostart(2):loend(2));
60 angle = angle(lostart(1):loend(1),lostart(2):loend(2));
61 lodft = lodft(lostart(1):loend(1),lostart(2):loend(2));
62 YIrcos = abs(sqrt(1.0 - Yrcos.^2));
63 lomask = pointOp(log_rad, YIrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
64
65 lodft = lomask .* lodft;
66
67 [npyr,nind] = buildSCFpyrLevs(lodft, log_rad, Xrcos, Yrcos, angle, ht-1, nbands);
68
69 pyr = [bands(:); npyr];
70 pind = [bind; nind];
71
72end
73
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSFpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSFpyr.m
deleted file mode 100755
index ae67206..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSFpyr.m
+++ /dev/null
@@ -1,102 +0,0 @@
1% [PYR, INDICES, STEERMTX, HARMONICS] = buildSFpyr(IM, HEIGHT, ORDER, TWIDTH)
2%
3% Construct a steerable pyramid on matrix IM, in the Fourier domain.
4% This is similar to buildSpyr, except that:
5%
6% + Reconstruction is exact (within floating point errors)
7% + It can produce any number of orientation bands.
8% - Typically slower, especially for non-power-of-two sizes.
9% - Boundary-handling is circular.
10%
11% HEIGHT (optional) specifies the number of pyramid levels to build. Default
12% is maxPyrHt(size(IM),size(FILT));
13%
14% The squared radial functions tile the Fourier plane, with a raised-cosine
15% falloff. Angular functions are cos(theta-k\pi/(K+1))^K, where K is
16% the ORDER (one less than the number of orientation bands, default= 3).
17%
18% TWIDTH is the width of the transition region of the radial lowpass
19% function, in octaves (default = 1, which gives a raised cosine for
20% the bandpass filters).
21%
22% PYR is a vector containing the N pyramid subbands, ordered from fine
23% to coarse. INDICES is an Nx2 matrix containing the sizes of
24% each subband. This is compatible with the MatLab Wavelet toolbox.
25% See the function STEER for a description of STEERMTX and HARMONICS.
26
27% Eero Simoncelli, 5/97.
28% See http://www.cns.nyu.edu/~eero/STEERPYR/ for more
29% information about the Steerable Pyramid image decomposition.
30
31function [pyr,pind,steermtx,harmonics] = buildSFpyr(im, ht, order, twidth)
32
33%-----------------------------------------------------------------
34%% DEFAULTS:
35
36max_ht = floor(log2(min(size(im)))) - 2;
37
38if (exist('ht') ~= 1)
39 ht = max_ht;
40else
41 if (ht > max_ht)
42 error(sprintf('Cannot build pyramid higher than %d levels.',max_ht));
43 end
44end
45
46if (exist('order') ~= 1)
47 order = 3;
48elseif ((order > 15) | (order < 0))
49 fprintf(1,'Warning: ORDER must be an integer in the range [0,15]. Truncating.\n');
50 order = min(max(order,0),15);
51else
52 order = round(order);
53end
54nbands = order+1;
55
56if (exist('twidth') ~= 1)
57 twidth = 1;
58elseif (twidth <= 0)
59 fprintf(1,'Warning: TWIDTH must be positive. Setting to 1.\n');
60 twidth = 1;
61end
62
63%-----------------------------------------------------------------
64%% Steering stuff:
65
66if (mod((nbands),2) == 0)
67 harmonics = [0:(nbands/2)-1]'*2 + 1;
68else
69 harmonics = [0:(nbands-1)/2]'*2;
70end
71
72steermtx = steer2HarmMtx(harmonics, pi*[0:nbands-1]/nbands, 'even');
73
74%-----------------------------------------------------------------
75
76dims = size(im);
77ctr = ceil((dims+0.5)/2);
78
79[xramp,yramp] = meshgrid( ([1:dims(2)]-ctr(2))./(dims(2)/2), ...
80 ([1:dims(1)]-ctr(1))./(dims(1)/2) );
81angle = atan2(yramp,xramp);
82log_rad = sqrt(xramp.^2 + yramp.^2);
83log_rad(ctr(1),ctr(2)) = log_rad(ctr(1),ctr(2)-1);
84log_rad = log2(log_rad);
85
86%% Radial transition function (a raised cosine in log-frequency):
87[Xrcos,Yrcos] = rcosFn(twidth,(-twidth/2),[0 1]);
88Yrcos = sqrt(Yrcos);
89
90YIrcos = sqrt(1.0 - Yrcos.^2);
91lo0mask = pointOp(log_rad, YIrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
92imdft = fftshift(fft2(im));
93lo0dft = imdft .* lo0mask;
94
95[pyr,pind] = buildSFpyrLevs(lo0dft, log_rad, Xrcos, Yrcos, angle, ht, nbands);
96
97hi0mask = pointOp(log_rad, Yrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
98hi0dft = imdft .* hi0mask;
99hi0 = ifft2(ifftshift(hi0dft));
100
101pyr = [real(hi0(:)) ; pyr];
102pind = [size(hi0); pind];
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSFpyrLevs.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSFpyrLevs.m
deleted file mode 100755
index 472d861..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSFpyrLevs.m
+++ /dev/null
@@ -1,63 +0,0 @@
1% [PYR, INDICES] = buildSFpyrLevs(LODFT, LOGRAD, XRCOS, YRCOS, ANGLE, HEIGHT, NBANDS)
2%
3% Recursive function for constructing levels of a steerable pyramid. This
4% is called by buildSFpyr, and is not usually called directly.
5
6% Eero Simoncelli, 5/97.
7
8function [pyr,pind] = buildSFpyrLevs(lodft,log_rad,Xrcos,Yrcos,angle,ht,nbands);
9
10if (ht <= 0)
11
12 lo0 = ifft2(ifftshift(lodft));
13 pyr = real(lo0(:));
14 pind = size(lo0);
15
16else
17
18 bands = zeros(prod(size(lodft)), nbands);
19 bind = zeros(nbands,2);
20
21% log_rad = log_rad + 1;
22 Xrcos = Xrcos - log2(2); % shift origin of lut by 1 octave.
23
24 lutsize = 1024;
25 Xcosn = pi*[-(2*lutsize+1):(lutsize+1)]/lutsize; % [-2*pi:pi]
26 order = nbands-1;
27 %% divide by sqrt(sum_(n=0)^(N-1) cos(pi*n/N)^(2(N-1)) )
28 %% Thanks to Patrick Teo for writing this out :)
29 const = (2^(2*order))*(factorial(order)^2)/(nbands*factorial(2*order));
30 Ycosn = sqrt(const) * (cos(Xcosn)).^order;
31 himask = pointOp(log_rad, Yrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
32
33 for b = 1:nbands
34 anglemask = pointOp(angle, Ycosn, Xcosn(1)+pi*(b-1)/nbands, Xcosn(2)-Xcosn(1));
35 banddft = ((-sqrt(-1))^(nbands-1)) .* lodft .* anglemask .* himask;
36 band = ifft2(ifftshift(banddft));
37
38 bands(:,b) = real(band(:));
39 bind(b,:) = size(band);
40 end
41
42 dims = size(lodft);
43 ctr = ceil((dims+0.5)/2);
44 lodims = ceil((dims-0.5)/2);
45 loctr = ceil((lodims+0.5)/2);
46 lostart = ctr-loctr+1;
47 loend = lostart+lodims-1;
48
49 log_rad = log_rad(lostart(1):loend(1),lostart(2):loend(2));
50 angle = angle(lostart(1):loend(1),lostart(2):loend(2));
51 lodft = lodft(lostart(1):loend(1),lostart(2):loend(2));
52 YIrcos = abs(sqrt(1.0 - Yrcos.^2));
53 lomask = pointOp(log_rad, YIrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
54
55 lodft = lomask .* lodft;
56
57 [npyr,nind] = buildSFpyrLevs(lodft, log_rad, Xrcos, Yrcos, angle, ht-1, nbands);
58
59 pyr = [bands(:); npyr];
60 pind = [bind; nind];
61
62end
63
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSpyr.m
deleted file mode 100755
index b2bead6..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSpyr.m
+++ /dev/null
@@ -1,61 +0,0 @@
1% [PYR, INDICES, STEERMTX, HARMONICS] = buildSpyr(IM, HEIGHT, FILTFILE, EDGES)
2%
3% Construct a steerable pyramid on matrix IM.
4%
5% HEIGHT (optional) specifies the number of pyramid levels to build. Default
6% is maxPyrHt(size(IM),size(FILT)).
7% You can also specify 'auto' to use this value.
8%
9% FILTFILE (optional) should be a string referring to an m-file that
10% returns the rfilters. (examples: 'sp0Filters', 'sp1Filters',
11% 'sp3Filters','sp5Filters'. default = 'sp1Filters'). EDGES specifies
12% edge-handling, and defaults to 'reflect1' (see corrDn).
13%
14% PYR is a vector containing the N pyramid subbands, ordered from fine
15% to coarse. INDICES is an Nx2 matrix containing the sizes of
16% each subband. This is compatible with the MatLab Wavelet toolbox.
17% See the function STEER for a description of STEERMTX and HARMONICS.
18
19% Eero Simoncelli, 6/96.
20% See http://www.cis.upenn.edu/~eero/steerpyr.html for more
21% information about the Steerable Pyramid image decomposition.
22
23function [pyr,pind,steermtx,harmonics] = buildSpyr(im, ht, filtfile, edges)
24
25%-----------------------------------------------------------------
26%% DEFAULTS:
27
28if (exist('filtfile') ~= 1)
29 filtfile = 'sp1Filters';
30end
31
32if (exist('edges') ~= 1)
33 edges= 'reflect1';
34end
35
36if (isstr(filtfile) & (exist(filtfile) == 2))
37 [lo0filt,hi0filt,lofilt,bfilts,steermtx,harmonics] = eval(filtfile);
38else
39 fprintf(1,'\nUse buildSFpyr for pyramids with arbitrary numbers of orientation bands.\n');
40 error('FILTFILE argument must be the name of an M-file containing SPYR filters.');
41end
42
43max_ht = maxPyrHt(size(im), size(lofilt,1));
44if ( (exist('ht') ~= 1) | (ht == 'auto') )
45 ht = max_ht;
46else
47 if (ht > max_ht)
48 error(sprintf('Cannot build pyramid higher than %d levels.',max_ht));
49 end
50end
51
52%-----------------------------------------------------------------
53
54hi0 = corrDn(im, hi0filt, edges);
55lo0 = corrDn(im, lo0filt, edges);
56
57[pyr,pind] = buildSpyrLevs(lo0, ht, lofilt, bfilts, edges);
58
59pyr = [hi0(:) ; pyr];
60pind = [size(hi0); pind];
61
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSpyrLevs.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSpyrLevs.m
deleted file mode 100755
index 4c00077..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildSpyrLevs.m
+++ /dev/null
@@ -1,37 +0,0 @@
1% [PYR, INDICES] = buildSpyrLevs(LOIM, HEIGHT, LOFILT, BFILTS, EDGES)
2%
3% Recursive function for constructing levels of a steerable pyramid. This
4% is called by buildSpyr, and is not usually called directly.
5
6% Eero Simoncelli, 6/96.
7
8function [pyr,pind] = buildSpyrLevs(lo0,ht,lofilt,bfilts,edges);
9
10if (ht <= 0)
11
12 pyr = lo0(:);
13 pind = size(lo0);
14
15else
16
17 % Assume square filters:
18 bfiltsz = round(sqrt(size(bfilts,1)));
19
20 bands = zeros(prod(size(lo0)),size(bfilts,2));
21 bind = zeros(size(bfilts,2),2);
22
23 for b = 1:size(bfilts,2)
24 filt = reshape(bfilts(:,b),bfiltsz,bfiltsz);
25 band = corrDn(lo0, filt, edges);
26 bands(:,b) = band(:);
27 bind(b,:) = size(band);
28 end
29
30 lo = corrDn(lo0, lofilt, edges, [2 2], [1 1]);
31
32 [npyr,nind] = buildSpyrLevs(lo, ht-1, lofilt, bfilts, edges);
33
34 pyr = [bands(:); npyr];
35 pind = [bind; nind];
36
37end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildWpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildWpyr.m
deleted file mode 100755
index 22ae32f..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/buildWpyr.m
+++ /dev/null
@@ -1,100 +0,0 @@
1% [PYR, INDICES] = buildWpyr(IM, HEIGHT, FILT, EDGES)
2%
3% Construct a separable orthonormal QMF/wavelet pyramid on matrix (or vector) IM.
4%
5% HEIGHT (optional) specifies the number of pyramid levels to build. Default
6% is maxPyrHt(IM,FILT). You can also specify 'auto' to use this value.
7%
8% FILT (optional) can be a string naming a standard filter (see
9% namedFilter), or a vector which will be used for (separable)
10% convolution. Filter can be of even or odd length, but should be symmetric.
11% Default = 'qmf9'. EDGES specifies edge-handling, and
12% defaults to 'reflect1' (see corrDn).
13%
14% PYR is a vector containing the N pyramid subbands, ordered from fine
15% to coarse. INDICES is an Nx2 matrix containing the sizes of
16% each subband. This is compatible with the MatLab Wavelet toolbox.
17
18% Eero Simoncelli, 6/96.
19
20function [pyr,pind] = buildWpyr(im, ht, filt, edges)
21
22if (nargin < 1)
23 error('First argument (IM) is required');
24end
25
26%------------------------------------------------------------
27%% OPTIONAL ARGS:
28
29if (exist('filt') ~= 1)
30 filt = 'qmf9';
31end
32
33if (exist('edges') ~= 1)
34 edges= 'reflect1';
35end
36
37if isstr(filt)
38 filt = namedFilter(filt);
39end
40
41if ( (size(filt,1) > 1) & (size(filt,2) > 1) )
42 error('FILT should be a 1D filter (i.e., a vector)');
43else
44 filt = filt(:);
45end
46
47hfilt = modulateFlip(filt);
48
49% Stagger sampling if filter is odd-length:
50if (mod(size(filt,1),2) == 0)
51 stag = 2;
52else
53 stag = 1;
54end
55
56im_sz = size(im);
57
58max_ht = maxPyrHt(im_sz, size(filt,1));
59if ( (exist('ht') ~= 1) | (ht == 'auto') )
60 ht = max_ht;
61else
62 if (ht > max_ht)
63 error(sprintf('Cannot build pyramid higher than %d levels.',max_ht));
64 end
65end
66
67if (ht <= 0)
68
69 pyr = im(:);
70 pind = im_sz;
71
72else
73
74 if (im_sz(2) == 1)
75 lolo = corrDn(im, filt, edges, [2 1], [stag 1]);
76 hihi = corrDn(im, hfilt, edges, [2 1], [2 1]);
77 elseif (im_sz(1) == 1)
78 lolo = corrDn(im, filt', edges, [1 2], [1 stag]);
79 hihi = corrDn(im, hfilt', edges, [1 2], [1 2]);
80 else
81 lo = corrDn(im, filt, edges, [2 1], [stag 1]);
82 hi = corrDn(im, hfilt, edges, [2 1], [2 1]);
83 lolo = corrDn(lo, filt', edges, [1 2], [1 stag]);
84 lohi = corrDn(hi, filt', edges, [1 2], [1 stag]); % horizontal
85 hilo = corrDn(lo, hfilt', edges, [1 2], [1 2]); % vertical
86 hihi = corrDn(hi, hfilt', edges, [1 2], [1 2]); % diagonal
87 end
88
89 [npyr,nind] = buildWpyr(lolo, ht-1, filt, edges);
90
91 if ((im_sz(1) == 1) | (im_sz(2) == 1))
92 pyr = [hihi(:); npyr];
93 pind = [size(hihi); nind];
94 else
95 pyr = [lohi(:); hilo(:); hihi(:); npyr];
96 pind = [size(lohi); size(hilo); size(hihi); nind];
97 end
98
99end
100
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/cconv2.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/cconv2.m
deleted file mode 100755
index efba438..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/cconv2.m
+++ /dev/null
@@ -1,50 +0,0 @@
1% RES = CCONV2(MTX1, MTX2, CTR)
2%
3% Circular convolution of two matrices. Result will be of size of
4% LARGER vector.
5%
6% The origin of the smaller matrix is assumed to be its center.
7% For even dimensions, the origin is determined by the CTR (optional)
8% argument:
9% CTR origin
10% 0 DIM/2 (default)
11% 1 (DIM/2)+1
12
13% Eero Simoncelli, 6/96. Modified 2/97.
14
15function c = cconv2(a,b,ctr)
16
17if (exist('ctr') ~= 1)
18 ctr = 0;
19end
20
21if (( size(a,1) >= size(b,1) ) & ( size(a,2) >= size(b,2) ))
22 large = a; small = b;
23elseif (( size(a,1) <= size(b,1) ) & ( size(a,2) <= size(b,2) ))
24 large = b; small = a;
25else
26 error('one arg must be larger than the other in both dimensions!');
27end
28
29ly = size(large,1);
30lx = size(large,2);
31sy = size(small,1);
32sx = size(small,2);
33
34%% These values are the index of the small mtx that falls on the
35%% border pixel of the large matrix when computing the first
36%% convolution response sample:
37sy2 = floor((sy+ctr+1)/2);
38sx2 = floor((sx+ctr+1)/2);
39
40% pad:
41clarge = [ ...
42 large(ly-sy+sy2+1:ly,lx-sx+sx2+1:lx), large(ly-sy+sy2+1:ly,:), ...
43 large(ly-sy+sy2+1:ly,1:sx2-1); ...
44 large(:,lx-sx+sx2+1:lx), large, large(:,1:sx2-1); ...
45 large(1:sy2-1,lx-sx+sx2+1:lx), ...
46 large(1:sy2-1,:), ...
47 large(1:sy2-1,1:sx2-1) ];
48
49c = conv2(clarge,small,'valid');
50
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/clip.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/clip.m
deleted file mode 100755
index 28804f3..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/clip.m
+++ /dev/null
@@ -1,32 +0,0 @@
1% [RES] = clip(IM, MINVALorRANGE, MAXVAL)
2%
3% Clip values of matrix IM to lie between minVal and maxVal:
4% RES = max(min(IM,MAXVAL),MINVAL)
5% The first argument can also specify both min and max, as a 2-vector.
6% If only one argument is passed, the range defaults to [0,1].
7
8function res = clip(im, minValOrRange, maxVal)
9
10if (exist('minValOrRange') ~= 1)
11 minVal = 0;
12 maxVal = 1;
13elseif (length(minValOrRange) == 2)
14 minVal = minValOrRange(1);
15 maxVal = minValOrRange(2);
16elseif (length(minValOrRange) == 1)
17 minVal = minValOrRange;
18 if (exist('maxVal') ~= 1)
19 maxVal=minVal+1;
20 end
21else
22 error('MINVAL must be a scalar or a 2-vector');
23end
24
25if ( maxVal < minVal )
26 error('MAXVAL should be less than MINVAL');
27end
28
29res = im;
30res(find(im < minVal)) = minVal;
31res(find(im > maxVal)) = maxVal;
32
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/corrDn.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/corrDn.m
deleted file mode 100755
index afe09d2..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/corrDn.m
+++ /dev/null
@@ -1,63 +0,0 @@
1% RES = corrDn(IM, FILT, EDGES, STEP, START, STOP)
2%
3% Compute correlation of matrices IM with FILT, followed by
4% downsampling. These arguments should be 1D or 2D matrices, and IM
5% must be larger (in both dimensions) than FILT. The origin of filt
6% is assumed to be floor(size(filt)/2)+1.
7%
8% EDGES is a string determining boundary handling:
9% 'circular' - Circular convolution
10% 'reflect1' - Reflect about the edge pixels
11% 'reflect2' - Reflect, doubling the edge pixels
12% 'repeat' - Repeat the edge pixels
13% 'zero' - Assume values of zero outside image boundary
14% 'extend' - Reflect and invert
15% 'dont-compute' - Zero output when filter overhangs input boundaries
16%
17% Downsampling factors are determined by STEP (optional, default=[1 1]),
18% which should be a 2-vector [y,x].
19%
20% The window over which the convolution occurs is specfied by START
21% (optional, default=[1,1], and STOP (optional, default=size(IM)).
22%
23% NOTE: this operation corresponds to multiplication of a signal
24% vector by a matrix whose rows contain copies of the FILT shifted by
25% multiples of STEP. See upConv.m for the operation corresponding to
26% the transpose of this matrix.
27
28% Eero Simoncelli, 6/96, revised 2/97.
29
30function res = corrDn(im, filt, edges, step, start, stop)
31
32%% NOTE: THIS CODE IS NOT ACTUALLY USED! (MEX FILE IS CALLED INSTEAD)
33
34fprintf(1,'WARNING: You should compile the MEX version of "corrDn.c",\n found in the MEX subdirectory of matlabPyrTools, and put it in your matlab path. It is MUCH faster, and provides more boundary-handling options.\n');
35
36%------------------------------------------------------------
37%% OPTIONAL ARGS:
38
39if (exist('edges') == 1)
40 if (strcmp(edges,'reflect1') ~= 1)
41 warning('Using REFLECT1 edge-handling (use MEX code for other options).');
42 end
43end
44
45if (exist('step') ~= 1)
46 step = [1,1];
47end
48
49if (exist('start') ~= 1)
50 start = [1,1];
51end
52
53if (exist('stop') ~= 1)
54 stop = size(im);
55end
56
57%------------------------------------------------------------
58
59% Reverse order of taps in filt, to do correlation instead of convolution
60filt = filt(size(filt,1):-1:1,size(filt,2):-1:1);
61
62tmp = rconv2(im,filt);
63res = tmp(start(1):step(1):stop(1),start(2):step(2):stop(2));
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/einstein.pgm b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/einstein.pgm
deleted file mode 100755
index 99b974c..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/einstein.pgm
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/entropy2.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/entropy2.m
deleted file mode 100755
index 68a2a9f..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/entropy2.m
+++ /dev/null
@@ -1,31 +0,0 @@
1% E = ENTROPY2(MTX,BINSIZE)
2%
3% Compute the first-order sample entropy of MTX. Samples of VEC are
4% first discretized. Optional argument BINSIZE controls the
5% discretization, and defaults to 256/(max(VEC)-min(VEC)).
6%
7% NOTE: This is a heavily biased estimate of entropy when you
8% don't have much data.
9
10% Eero Simoncelli, 6/96.
11
12function res = entropy2(mtx,binsize)
13
14%% Ensure it's a vector, not a matrix.
15vec = mtx(:);
16[mn,mx] = range2(vec);
17
18if (exist('binsize') == 1)
19 nbins = max((mx-mn)/binsize, 1);
20else
21 nbins = 256;
22end
23
24[bincount,bins] = histo(vec,nbins);
25
26%% Collect non-zero bins:
27H = bincount(find(bincount));
28H = H/sum(H);
29
30res = -sum(H .* log2(H));
31
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/factorial.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/factorial.m
deleted file mode 100755
index 9255f43..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/factorial.m
+++ /dev/null
@@ -1,16 +0,0 @@
1%% RES = factorial(NUM)
2%
3% Factorial function that works on matrices (matlab's does not).
4
5% EPS, 11/02
6
7function res = factorial(num)
8
9res = ones(size(num));
10
11ind = find(num > 0);
12if ( ~isempty(ind) )
13 subNum = num(ind);
14 res(ind) = subNum .* factorial(subNum-1);
15end
16
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/feynman.pgm b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/feynman.pgm
deleted file mode 100755
index 7d14101..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/feynman.pgm
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/histo.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/histo.m
deleted file mode 100755
index 3366301..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/histo.m
+++ /dev/null
@@ -1,58 +0,0 @@
1% [N,X] = histo(MTX, nbinsOrBinsize, binCenter);
2%
3% Compute a histogram of (all) elements of MTX. N contains the histogram
4% counts, X is a vector containg the centers of the histogram bins.
5%
6% nbinsOrBinsize (optional, default = 101) specifies either
7% the number of histogram bins, or the negative of the binsize.
8%
9% binCenter (optional, default = mean2(MTX)) specifies a center position
10% for (any one of) the histogram bins.
11%
12% How does this differ from MatLab's HIST function? This function:
13% - allows uniformly spaced bins only.
14% +/- operates on all elements of MTX, instead of columnwise.
15% + is much faster (approximately a factor of 80 on my machine).
16% + allows specification of number of bins OR binsize. Default=101 bins.
17% + allows (optional) specification of binCenter.
18
19% Eero Simoncelli, 3/97.
20
21function [N, X] = histo(mtx, nbins, binCtr)
22
23%% NOTE: THIS CODE IS NOT ACTUALLY USED! (MEX FILE IS CALLED INSTEAD)
24
25fprintf(1,'WARNING: You should compile the MEX version of "histo.c",\n found in the MEX subdirectory of matlabPyrTools, and put it in your matlab path. It is MUCH faster.\n');
26
27mtx = mtx(:);
28
29%------------------------------------------------------------
30%% OPTIONAL ARGS:
31
32[mn,mx] = range2(mtx);
33
34if (exist('binCtr') ~= 1)
35 binCtr = mean(mtx);
36end
37
38if (exist('nbins') == 1)
39 if (nbins < 0)
40 binSize = -nbins;
41 else
42 binSize = ((mx-mn)/nbins);
43 tmpNbins = round((mx-binCtr)/binSize) - round((mn-binCtr)/binSize);
44 if (tmpNbins ~= nbins)
45 warning('Using %d bins instead of requested number (%d)',tmpNbins,nbins);
46 end
47 end
48else
49 binSize = ((mx-mn)/101);
50end
51
52firstBin = binCtr + binSize*round( (mn-binCtr)/binSize );
53
54tmpNbins = round((mx-binCtr)/binSize) - round((mn-binCtr)/binSize);
55
56bins = firstBin + binSize*[0:tmpNbins];
57
58[N, X] = hist(mtx, bins);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/histoMatch.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/histoMatch.m
deleted file mode 100755
index ab82782..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/histoMatch.m
+++ /dev/null
@@ -1,35 +0,0 @@
1% RES = histoMatch(MTX, N, X)
2%
3% Modify elements of MTX so that normalized histogram matches that
4% specified by vectors X and N, where N contains the histogram counts
5% and X the histogram bin positions (see histo).
6
7% Eero Simoncelli, 7/96.
8
9function res = histoMatch(mtx, N, X)
10
11if ( exist('histo') == 3 )
12 [oN, oX] = histo(mtx(:), size(X(:),1));
13else
14 [oN, oX] = hist(mtx(:), size(X(:),1));
15end
16
17oStep = oX(2) - oX(1);
18oC = [0, cumsum(oN)]/sum(oN);
19oX = [oX(1)-oStep/2, oX+oStep/2];
20
21N = N(:)';
22X = X(:)';
23N = N + mean(N)/(1e8); %% HACK: no empty bins ensures nC strictly monotonic
24
25nStep = X(2) - X(1);
26nC = [0, cumsum(N)]/sum(N);
27nX = [X(1)-nStep/2, X+nStep/2];
28
29nnX = interp1(nC, nX, oC, 'linear');
30
31if ( exist('pointOp') == 3 )
32 res = pointOp(mtx, nnX, oX(1), oStep);
33else
34 res = reshape(interp1(oX, nnX, mtx(:)),size(mtx,1),size(mtx,2));
35end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/ifftshift.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/ifftshift.m
deleted file mode 100755
index 2ade297..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/ifftshift.m
+++ /dev/null
@@ -1,15 +0,0 @@
1% [RES] = ifftshift (MTX)
2%
3% Inverse of MatLab's FFTSHIFT. That is,
4% ifftshift(fftshift(MTX)) = MTX
5% for any size MTX.
6
7% Eero Simoncelli, 2/97.
8
9function [res] = ifftshift(mtx)
10
11sz = size(mtx);
12DC = ceil((sz+1)./2); % location of DC term in a matlab fft.
13
14res = [mtx(DC(1):sz(1), DC(2):sz(2)) , mtx(DC(1):sz(1), 1:DC(2)-1); ...
15 mtx(1:DC(1)-1, DC(2):sz(2)) , mtx(1:DC(1)-1, 1:DC(2)-1)];
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/imGradient.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/imGradient.m
deleted file mode 100755
index 23187e3..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/imGradient.m
+++ /dev/null
@@ -1,48 +0,0 @@
1% [dx, dy] = imGradient(im, edges)
2%
3% Compute the gradient of the image using smooth derivative filters
4% optimized for accurate direction estimation. Coordinate system
5% corresponds to standard pixel indexing: X axis points rightward. Y
6% axis points downward. EDGES specify boundary handling (see corrDn
7% for options).
8
9% EPS, 1997.
10% original filters from Int'l Conf Image Processing, 1994.
11% updated filters 10/2003.
12% Added to matlabPyrTools 10/2004.
13
14function [dx, dy] = imGradient(im, edges)
15
16%% 1D smoothing and differentiation kernels.
17%% See Farid & Simoncelli, IEEE Trans Image Processing, 13(4):496-508, April 2004.
18
19if (exist('edges') ~= 1)
20 edges = 'dont-compute';
21end
22
23gp = [0.037659 0.249153 0.426375 0.249153 0.037659]';
24gd = [-0.109604 -0.276691 0.000000 0.276691 0.109604]';
25
26dx = corrDn(corrDn(im, gp, edges), gd', edges);
27dy = corrDn(corrDn(im, gd, edges), gp', edges);
28
29return
30
31%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32%%% TEST:
33
34%%Make a ramp with random slope and direction
35dir = 2*pi*rand - pi;
36slope = 10*rand;
37
38sz = 32
39im = mkRamp(sz, dir, slope);
40[dx,dy] = imGradient(im);
41showIm(dx + sqrt(-1)*dy);
42
43ctr = (sz*sz/2)+sz/2;
44slopeEst = sqrt(dx(ctr).^2 + dy(ctr).^2);
45dirEst = atan2(dy(ctr), dx(ctr));
46
47[slope, slopeEst]
48[dir, dirEst]
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/imStats.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/imStats.m
deleted file mode 100755
index 3d79b4c..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/imStats.m
+++ /dev/null
@@ -1,41 +0,0 @@
1% imStats(IM1,IM2)
2%
3% Report image (matrix) statistics.
4% When called on a single image IM1, report min, max, mean, stdev,
5% and kurtosis.
6% When called on two images (IM1 and IM2), report min, max, mean,
7% stdev of the difference, and also SNR (relative to IM1).
8
9% Eero Simoncelli, 6/96.
10
11function [] = imStats(im1,im2)
12
13if (~isreal(im1))
14 error('Args must be real-valued matrices');
15end
16
17if (exist('im2') == 1)
18 difference = im1 - im2;
19 [mn,mx] = range2(difference);
20 mean = mean2(difference);
21 v = var2(difference,mean);
22 if (v < realmin)
23 snr = Inf;
24 else
25 snr = 10 * log10(var2(im1)/v);
26 end
27 fprintf(1, 'Difference statistics:\n');
28 fprintf(1, ' Range: [%c, %c]\n',mn,mx);
29 fprintf(1, ' Mean: %f, Stdev (rmse): %f, SNR (dB): %f\n',...
30 mean,sqrt(v),snr);
31else
32 [mn,mx] = range2(im1);
33 mean = mean2(im1);
34 var = var2(im1);
35 stdev = sqrt(real(var))+sqrt(imag(var));
36 kurt = kurt2(im1, mean, stdev^2);
37 fprintf(1, 'Image statistics:\n');
38 fprintf(1, ' Range: [%f, %f]\n',mn,mx);
39 fprintf(1, ' Mean: %f, Stdev: %f, Kurtosis: %f\n',mean,stdev,kurt);
40end
41
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/innerProd.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/innerProd.m
deleted file mode 100755
index da82321..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/innerProd.m
+++ /dev/null
@@ -1,12 +0,0 @@
1% RES = innerProd(MTX)
2%
3% Compute (MTX' * MTX) efficiently (i.e., without copying the matrix)
4
5function res = innerProd(mtx)
6
7fprintf(1,['WARNING: You should compile the MEX version of' ...
8 ' "innerProd.c",\n found in the MEX subdirectory' ...
9 ' of matlabPyrTools, and put it in your matlab path.' ...
10 ' It is MUCH faster and requires less memory.\n']);
11
12res = mtx' * mtx;
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/kurt2.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/kurt2.m
deleted file mode 100755
index 8351eb4..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/kurt2.m
+++ /dev/null
@@ -1,24 +0,0 @@
1% K = KURT2(MTX,MEAN,VAR)
2%
3% Sample kurtosis (fourth moment divided by squared variance)
4% of a matrix. Kurtosis of a Gaussian distribution is 3.
5% MEAN (optional) and VAR (optional) make the computation faster.
6
7% Eero Simoncelli, 6/96.
8
9function res = kurt2(mtx, mn, v)
10
11if (exist('mn') ~= 1)
12 mn = mean(mean(mtx));
13end
14
15if (exist('v') ~= 1)
16 v = var2(mtx,mn);
17end
18
19if (isreal(mtx))
20 res = mean(mean(abs(mtx-mn).^4)) / (v^2);
21else
22 res = mean(mean(real(mtx-mn).^4)) / (real(v)^2) + ...
23 i*mean(mean(imag(mtx-mn).^4)) / (imag(v)^2);
24end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/lplot.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/lplot.m
deleted file mode 100755
index 3c67d8b..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/lplot.m
+++ /dev/null
@@ -1,43 +0,0 @@
1% lplot(VEC, XRANGE)
2%
3% Plot VEC, a vector, in "lollipop" format.
4% XRANGE (optional, default = [1,length(VEC)]), should be a 2-vector
5% specifying the X positions (for labeling purposes) of the first and
6% last sample of VEC.
7
8% Mark Liberman, Linguistics Dept, UPenn, 1994.
9
10function lplot(x,xrange)
11
12if (exist('xrange') ~= 1)
13 xrange = [1,length(x)];
14end
15
16msize = size(x);
17if ( msize(2) == 1)
18 x = x';
19elseif (msize(1) ~= 1)
20 error('First arg must be a vector');
21end
22
23if (~isreal(x))
24 fprintf(1,'Warning: Imaginary part of signal ignored\n');
25 x = abs(x);
26end
27
28N = length(x);
29index = xrange(1) + (xrange(2)-xrange(1))*[0:(N-1)]/(N-1)
30xinc = index(2)-index(1);
31
32xx = [zeros(1,N);x;zeros(1,N)];
33indexis = [index;index;index];
34xdiscrete = [0 xx(:)' 0];
35idiscrete = [index(1)-xinc indexis(:)' index(N)+xinc];
36
37[mn,mx] = range2(xdiscrete);
38ypad = (mx-mn)/12; % MAGIC NUMBER: graph padding
39
40plot(idiscrete, xdiscrete, index, x, 'o');
41axis([index(1)-xinc, index(N)+xinc, mn-ypad, mx+ypad]);
42
43return
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/lpyrHt.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/lpyrHt.m
deleted file mode 100755
index d6834d7..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/lpyrHt.m
+++ /dev/null
@@ -1,11 +0,0 @@
1% [HEIGHT] = lpyrHt(INDICES)
2%
3% Compute height of Laplacian pyramid with given its INDICES matrix.
4% See buildLpyr.m
5
6% Eero Simoncelli, 6/96.
7
8function [ht] = lpyrHt(pind)
9
10% Don't count lowpass residual band
11ht = size(pind,1)-1;
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/maxPyrHt.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/maxPyrHt.m
deleted file mode 100755
index 84bcf29..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/maxPyrHt.m
+++ /dev/null
@@ -1,25 +0,0 @@
1% HEIGHT = maxPyrHt(IMSIZE, FILTSIZE)
2%
3% Compute maximum pyramid height for given image and filter sizes.
4% Specifically: the number of corrDn operations that can be sequentially
5% performed when subsampling by a factor of 2.
6
7% Eero Simoncelli, 6/96.
8
9function height = maxPyrHt(imsz, filtsz)
10
11imsz = imsz(:);
12filtsz = filtsz(:);
13
14if any(imsz == 1) % 1D image
15 imsz = prod(imsz);
16 filtsz = prod(filtsz);
17elseif any(filtsz == 1) % 2D image, 1D filter
18 filtsz = [filtsz(1); filtsz(1)];
19end
20
21if any(imsz < filtsz)
22 height = 0;
23else
24 height = 1 + maxPyrHt( floor(imsz/2), filtsz );
25end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mean2.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mean2.m
deleted file mode 100755
index 177f7ac..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mean2.m
+++ /dev/null
@@ -1,7 +0,0 @@
1% M = MEAN2(MTX)
2%
3% Sample mean of a matrix.
4
5function res = mean2(mtx)
6
7res = mean(mean(mtx));
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkAngle.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkAngle.m
deleted file mode 100755
index bd54f8d..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkAngle.m
+++ /dev/null
@@ -1,32 +0,0 @@
1% IM = mkAngle(SIZE, PHASE, ORIGIN)
2%
3% Compute a matrix of dimension SIZE (a [Y X] 2-vector, or a scalar)
4% containing samples of the polar angle (in radians, CW from the
5% X-axis, ranging from -pi to pi), relative to angle PHASE (default =
6% 0), about ORIGIN pixel (default = (size+1)/2).
7
8% Eero Simoncelli, 6/96.
9
10function [res] = mkAngle(sz, phase, origin)
11
12sz = sz(:);
13if (size(sz,1) == 1)
14 sz = [sz,sz];
15end
16
17% -----------------------------------------------------------------
18% OPTIONAL args:
19
20if (exist('origin') ~= 1)
21 origin = (sz+1)/2;
22end
23
24% -----------------------------------------------------------------
25
26[xramp,yramp] = meshgrid( [1:sz(2)]-origin(2), [1:sz(1)]-origin(1) );
27
28res = atan2(yramp,xramp);
29
30if (exist('phase') == 1)
31 res = mod(res+(pi-phase),2*pi)-pi;
32end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkAngularSine.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkAngularSine.m
deleted file mode 100755
index f5238cc..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkAngularSine.m
+++ /dev/null
@@ -1,42 +0,0 @@
1% IM = mkAngularSine(SIZE, HARMONIC, AMPL, PHASE, ORIGIN)
2%
3% Make an angular sinusoidal image:
4% AMPL * sin( HARMONIC*theta + PHASE),
5% where theta is the angle about the origin.
6% SIZE specifies the matrix size, as for zeros().
7% AMPL (default = 1) and PHASE (default = 0) are optional.
8
9% Eero Simoncelli, 2/97.
10
11function [res] = mkAngularSine(sz, harmonic, ampl, ph, origin)
12
13sz = sz(:);
14if (size(sz,1) == 1)
15 sz = [sz,sz];
16end
17
18mxsz = max(sz(1),sz(2));
19
20%------------------------------------------------------------
21%% OPTIONAL ARGS:
22
23if (exist('harmonic') ~= 1)
24 harmonic = 1;
25end
26
27if (exist('ampl') ~= 1)
28 ampl = 1;
29end
30
31if (exist('ph') ~= 1)
32 ph = 0;
33end
34
35if (exist('origin') ~= 1)
36 origin = (sz+1)/2;
37end
38
39%------------------------------------------------------------
40
41res = ampl * sin(harmonic*mkAngle(sz,ph,origin) + ph);
42
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkDisc.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkDisc.m
deleted file mode 100755
index 33e7d6d..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkDisc.m
+++ /dev/null
@@ -1,61 +0,0 @@
1% IM = mkDisc(SIZE, RADIUS, ORIGIN, TWIDTH, VALS)
2%
3% Make a "disk" image. SIZE specifies the matrix size, as for
4% zeros(). RADIUS (default = min(size)/4) specifies the radius of
5% the disk. ORIGIN (default = (size+1)/2) specifies the
6% location of the disk center. TWIDTH (in pixels, default = 2)
7% specifies the width over which a soft threshold transition is made.
8% VALS (default = [0,1]) should be a 2-vector containing the
9% intensity value inside and outside the disk.
10
11% Eero Simoncelli, 6/96.
12
13function [res] = mkDisc(sz, rad, origin, twidth, vals)
14
15if (nargin < 1)
16 error('Must pass at least a size argument');
17end
18
19sz = sz(:);
20if (size(sz,1) == 1)
21 sz = [sz sz];
22end
23
24%------------------------------------------------------------
25% OPTIONAL ARGS:
26
27if (exist('rad') ~= 1)
28 rad = min(sz(1),sz(2))/4;
29end
30
31if (exist('origin') ~= 1)
32 origin = (sz+1)./2;
33end
34
35if (exist('twidth') ~= 1)
36 twidth = 2;
37end
38
39if (exist('vals') ~= 1)
40 vals = [1,0];
41end
42
43%------------------------------------------------------------
44
45res = mkR(sz,1,origin);
46
47if (abs(twidth) < realmin)
48 res = vals(2) + (vals(1) - vals(2)) * (res <= rad);
49else
50 [Xtbl,Ytbl] = rcosFn(twidth, rad, [vals(1), vals(2)]);
51 res = pointOp(res, Ytbl, Xtbl(1), Xtbl(2)-Xtbl(1), 0);
52%
53% OLD interp1 VERSION:
54% res = res(:);
55% Xtbl(1) = min(res);
56% Xtbl(size(Xtbl,2)) = max(res);
57% res = reshape(interp1(Xtbl,Ytbl,res), sz(1), sz(2));
58%
59end
60
61
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkFract.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkFract.m
deleted file mode 100755
index af95cd5..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkFract.m
+++ /dev/null
@@ -1,36 +0,0 @@
1% IM = mkFract(SIZE, FRACT_DIM)
2%
3% Make a matrix of dimensions SIZE (a [Y X] 2-vector, or a scalar)
4% containing fractal (pink) noise with power spectral density of the
5% form: 1/f^(5-2*FRACT_DIM). Image variance is normalized to 1.0.
6% FRACT_DIM defaults to 1.0
7
8% Eero Simoncelli, 6/96.
9
10%% TODO: Verify that this matches Mandelbrot defn of fractal dimension.
11%% Make this more efficient!
12
13function res = mkFract(dims, fract_dim)
14
15if (exist('fract_dim') ~= 1)
16 fract_dim = 1.0;
17end
18
19res = randn(dims);
20fres = fft2(res);
21
22sz = size(res);
23ctr = ceil((sz+1)./2);
24
25shape = ifftshift(mkR(sz, -(2.5-fract_dim), ctr));
26shape(1,1) = 1; %%DC term
27
28fres = shape .* fres;
29fres = ifft2(fres);
30
31if (max(max(abs(imag(fres)))) > 1e-10)
32 error('Symmetry error in creating fractal');
33else
34 res = real(fres);
35 res = res / sqrt(var2(res));
36end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkGaussian.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkGaussian.m
deleted file mode 100755
index fa8a554..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkGaussian.m
+++ /dev/null
@@ -1,58 +0,0 @@
1% IM = mkGaussian(SIZE, COVARIANCE, MEAN, AMPLITUDE)
2%
3% Compute a matrix with dimensions SIZE (a [Y X] 2-vector, or a
4% scalar) containing a Gaussian function, centered at pixel position
5% specified by MEAN (default = (size+1)/2), with given COVARIANCE (can
6% be a scalar, 2-vector, or 2x2 matrix. Default = (min(size)/6)^2),
7% and AMPLITUDE. AMPLITUDE='norm' (default) will produce a
8% probability-normalized function. All but the first argument are
9% optional.
10
11% Eero Simoncelli, 6/96.
12
13function [res] = mkGaussian(sz, cov, mn, ampl)
14
15sz = sz(:);
16if (size(sz,1) == 1)
17 sz = [sz,sz];
18end
19
20%------------------------------------------------------------
21%% OPTIONAL ARGS:
22
23if (exist('cov') ~= 1)
24 cov = (min(sz(1),sz(2))/6)^2;
25end
26
27if (exist('mn') ~= 1)
28 mn = (sz+1)/2;
29end
30
31if (exist('ampl') ~= 1)
32 ampl = 'norm';
33end
34
35%------------------------------------------------------------
36
37[xramp,yramp] = meshgrid([1:sz(2)]-mn(2),[1:sz(1)]-mn(1));
38
39if (sum(size(cov)) == 2) % scalar
40 if (strcmp(ampl,'norm'))
41 ampl = 1/(2*pi*cov(1));
42 end
43 e = (xramp.^2 + yramp.^2)/(-2 * cov);
44elseif (sum(size(cov)) == 3) % a 2-vector
45 if (strcmp(ampl,'norm'))
46 ampl = 1/(2*pi*sqrt(cov(1)*cov(2)));
47 end
48 e = xramp.^2/(-2 * cov(2)) + yramp.^2/(-2 * cov(1));
49else
50 if (strcmp(ampl,'norm'))
51 ampl = 1/(2*pi*sqrt(det(cov)));
52 end
53 cov = -inv(cov)/2;
54 e = cov(2,2)*xramp.^2 + (cov(1,2)+cov(2,1))*(xramp.*yramp) ...
55 + cov(1,1)*yramp.^2;
56end
57
58res = ampl .* exp(e);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkImpulse.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkImpulse.m
deleted file mode 100755
index 9844ee8..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkImpulse.m
+++ /dev/null
@@ -1,25 +0,0 @@
1% IM = mkImpulse(SIZE, ORIGIN, AMPLITUDE)
2%
3% Compute a matrix of dimension SIZE (a [Y X] 2-vector, or a scalar)
4% containing a single non-zero entry, at position ORIGIN (defaults to
5% ceil(size/2)), of value AMPLITUDE (defaults to 1).
6
7% Eero Simoncelli, 6/96.
8
9function [res] = mkImpulse(sz, origin, amplitude)
10
11sz = sz(:)';
12if (size(sz,2) == 1)
13 sz = [sz sz];
14end
15
16if (exist('origin') ~= 1)
17 origin = ceil(sz/2);
18end
19
20if (exist('amplitude') ~= 1)
21 amplitude = 1;
22end
23
24res = zeros(sz);
25res(origin(1),origin(2)) = amplitude;
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkR.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkR.m
deleted file mode 100755
index a1e8448..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkR.m
+++ /dev/null
@@ -1,32 +0,0 @@
1% IM = mkR(SIZE, EXPT, ORIGIN)
2%
3% Compute a matrix of dimension SIZE (a [Y X] 2-vector, or a scalar)
4% containing samples of a radial ramp function, raised to power EXPT
5% (default = 1), with given ORIGIN (default = (size+1)/2, [1 1] =
6% upper left). All but the first argument are optional.
7
8% Eero Simoncelli, 6/96.
9
10function [res] = mkR(sz, expt, origin)
11
12sz = sz(:);
13if (size(sz,1) == 1)
14 sz = [sz,sz];
15end
16
17% -----------------------------------------------------------------
18% OPTIONAL args:
19
20if (exist('expt') ~= 1)
21 expt = 1;
22end
23
24if (exist('origin') ~= 1)
25 origin = (sz+1)/2;
26end
27
28% -----------------------------------------------------------------
29
30[xramp,yramp] = meshgrid( [1:sz(2)]-origin(2), [1:sz(1)]-origin(1) );
31
32res = (xramp.^2 + yramp.^2).^(expt/2);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkRamp.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkRamp.m
deleted file mode 100755
index dd37164..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkRamp.m
+++ /dev/null
@@ -1,47 +0,0 @@
1% IM = mkRamp(SIZE, DIRECTION, SLOPE, INTERCEPT, ORIGIN)
2%
3% Compute a matrix of dimension SIZE (a [Y X] 2-vector, or a scalar)
4% containing samples of a ramp function, with given gradient DIRECTION
5% (radians, CW from X-axis, default = 0), SLOPE (per pixel, default =
6% 1), and a value of INTERCEPT (default = 0) at the ORIGIN (default =
7% (size+1)/2, [1 1] = upper left). All but the first argument are
8% optional.
9
10% Eero Simoncelli, 6/96. 2/97: adjusted coordinate system.
11
12function [res] = mkRamp(sz, dir, slope, intercept, origin)
13
14sz = sz(:);
15if (size(sz,1) == 1)
16 sz = [sz,sz];
17end
18
19% -----------------------------------------------------------------
20% OPTIONAL args:
21
22if (exist('dir') ~= 1)
23 dir = 0;
24end
25
26if (exist('slope') ~= 1)
27 slope = 1;
28end
29
30if (exist('intercept') ~= 1)
31 intercept = 0;
32end
33
34if (exist('origin') ~= 1)
35 origin = (sz+1)/2;
36end
37
38% -----------------------------------------------------------------
39
40xinc = slope*cos(dir);
41yinc = slope*sin(dir);
42
43[xramp,yramp] = meshgrid( xinc*([1:sz(2)]-origin(2)), ...
44 yinc*([1:sz(1)]-origin(1)) );
45
46res = intercept + xramp + yramp;
47
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkSine.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkSine.m
deleted file mode 100755
index 147eb01..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkSine.m
+++ /dev/null
@@ -1,67 +0,0 @@
1% IM = mkSine(SIZE, PERIOD, DIRECTION, AMPLITUDE, PHASE, ORIGIN)
2% or
3% IM = mkSine(SIZE, FREQ, AMPLITUDE, PHASE, ORIGIN)
4%
5% Compute a matrix of dimension SIZE (a [Y X] 2-vector, or a scalar)
6% containing samples of a 2D sinusoid, with given PERIOD (in pixels),
7% DIRECTION (radians, CW from X-axis, default = 0), AMPLITUDE (default
8% = 1), and PHASE (radians, relative to ORIGIN, default = 0). ORIGIN
9% defaults to the center of the image.
10%
11% In the second form, FREQ is a 2-vector of frequencies (radians/pixel).
12
13% Eero Simoncelli, 6/96.
14
15function [res] = mkSine(sz, per_freq, dir_amp, amp_phase, phase_orig, orig)
16
17%------------------------------------------------------------
18%% OPTIONAL ARGS:
19
20if (prod(size(per_freq)) == 2)
21 frequency = norm(per_freq);
22 direction = atan2(per_freq(1),per_freq(2));
23 if (exist('dir_amp') == 1)
24 amplitude = dir_amp;
25 else
26 amplitude = 1;
27 end
28 if (exist('amp_phase') == 1)
29 phase = amp_phase;
30 else
31 phase = 0;
32 end
33 if (exist('phase_orig') == 1)
34 origin = phase_orig;
35 end
36 if (exist('orig') == 1)
37 error('Too many arguments for (second form) of mkSine');
38 end
39else
40 frequency = 2*pi/per_freq;
41 if (exist('dir_amp') == 1)
42 direction = dir_amp;
43 else
44 direction = 0;
45 end
46 if (exist('amp_phase') == 1)
47 amplitude = amp_phase;
48 else
49 amplitude = 1;
50 end
51 if (exist('phase_orig') == 1)
52 phase = phase_orig;
53 else
54 phase = 0;
55 end
56 if (exist('orig') == 1)
57 origin = orig;
58 end
59end
60
61%------------------------------------------------------------
62
63if (exist('origin') == 1)
64 res = amplitude*sin(mkRamp(sz, direction, frequency, phase, origin));
65else
66 res = amplitude*sin(mkRamp(sz, direction, frequency, phase));
67end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkSquare.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkSquare.m
deleted file mode 100755
index 84ef466..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkSquare.m
+++ /dev/null
@@ -1,89 +0,0 @@
1% IM = mkSquare(SIZE, PERIOD, DIRECTION, AMPLITUDE, PHASE, ORIGIN, TWIDTH)
2% or
3% IM = mkSine(SIZE, FREQ, AMPLITUDE, PHASE, ORIGIN, TWIDTH)
4%
5% Compute a matrix of dimension SIZE (a [Y X] 2-vector, or a scalar)
6% containing samples of a 2D square wave, with given PERIOD (in
7% pixels), DIRECTION (radians, CW from X-axis, default = 0), AMPLITUDE
8% (default = 1), and PHASE (radians, relative to ORIGIN, default = 0).
9% ORIGIN defaults to the center of the image. TWIDTH specifies width
10% of raised-cosine edges on the bars of the grating (default =
11% min(2,period/3)).
12%
13% In the second form, FREQ is a 2-vector of frequencies (radians/pixel).
14
15% Eero Simoncelli, 6/96.
16
17% TODO: Add duty cycle.
18
19function [res] = mkSquare(sz, per_freq, dir_amp, amp_phase, phase_orig, orig_twidth, twidth)
20
21%------------------------------------------------------------
22%% OPTIONAL ARGS:
23
24if (prod(size(per_freq)) == 2)
25 frequency = norm(per_freq);
26 direction = atan2(per_freq(1),per_freq(2));
27 if (exist('dir_amp') == 1)
28 amplitude = dir_amp;
29 else
30 amplitude = 1;
31 end
32 if (exist('amp_phase') == 1)
33 phase = amp_phase;
34 else
35 phase = 0;
36 end
37 if (exist('phase_orig') == 1)
38 origin = phase_orig;
39 end
40 if (exist('orig_twidth') == 1)
41 transition = orig_twidth;
42 else
43 transition = min(2,2*pi/(3*frequency));
44 end
45 if (exist('twidth') == 1)
46 error('Too many arguments for (second form) of mkSine');
47 end
48else
49 frequency = 2*pi/per_freq;
50 if (exist('dir_amp') == 1)
51 direction = dir_amp;
52 else
53 direction = 0;
54 end
55 if (exist('amp_phase') == 1)
56 amplitude = amp_phase;
57 else
58 amplitude = 1;
59 end
60 if (exist('phase_orig') == 1)
61 phase = phase_orig;
62 else
63 phase = 0;
64 end
65 if (exist('orig_twidth') == 1)
66 origin = orig_twidth;
67 end
68 if (exist('twidth') == 1)
69 transition = twidth;
70 else
71 transition = min(2,2*pi/(3*frequency));
72 end
73
74end
75
76%------------------------------------------------------------
77
78if (exist('origin') == 1)
79 res = mkRamp(sz, direction, frequency, phase, origin) - pi/2;
80else
81 res = mkRamp(sz, direction, frequency, phase) - pi/2;
82end
83
84[Xtbl,Ytbl] = rcosFn(transition*frequency,pi/2,[-amplitude amplitude]);
85
86res = pointOp(abs(mod(res+pi, 2*pi)-pi),Ytbl,Xtbl(1),Xtbl(2)-Xtbl(1),0);
87
88% OLD threshold version:
89%res = amplitude * (mod(res,2*pi) < pi);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkZonePlate.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkZonePlate.m
deleted file mode 100755
index 2b6a4a5..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkZonePlate.m
+++ /dev/null
@@ -1,33 +0,0 @@
1% IM = mkZonePlate(SIZE, AMPL, PHASE)
2%
3% Make a "zone plate" image:
4% AMPL * cos( r^2 + PHASE)
5% SIZE specifies the matrix size, as for zeros().
6% AMPL (default = 1) and PHASE (default = 0) are optional.
7
8% Eero Simoncelli, 6/96.
9
10function [res] = mkZonePlate(sz, ampl, ph)
11
12sz = sz(:);
13if (size(sz,1) == 1)
14 sz = [sz,sz];
15end
16
17mxsz = max(sz(1),sz(2));
18
19%------------------------------------------------------------
20%% OPTIONAL ARGS:
21
22if (exist('ampl') ~= 1)
23 ampl = 1;
24end
25
26if (exist('ph') ~= 1)
27 ph = 0;
28end
29
30%------------------------------------------------------------
31
32res = ampl * cos( (pi/mxsz) * mkR(sz,2) + ph );
33
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mod.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mod.m
deleted file mode 100755
index 21167e5..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mod.m
+++ /dev/null
@@ -1,14 +0,0 @@
1% M = mod(A,B)
2%
3% Modulus operator: returns A mod B.
4% Works on matrics, vectors or scalars.
5%
6% NOTE: This function is a Matlab-5 builtin, but was missing from Matlab-4.
7
8% Eero Simoncelli, 7/96.
9
10function m = mod(a,n)
11
12m = a - n .* floor(a./n);
13return;
14
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/modulateFlip.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/modulateFlip.m
deleted file mode 100755
index eb27303..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/modulateFlip.m
+++ /dev/null
@@ -1,19 +0,0 @@
1% [HFILT] = modulateFlipShift(LFILT)
2%
3% QMF/Wavelet highpass filter construction: modulate by (-1)^n,
4% reverse order (and shift by one, which is handled by the convolution
5% routines). This is an extension of the original definition of QMF's
6% (e.g., see Simoncelli90).
7
8% Eero Simoncelli, 7/96.
9
10function [hfilt] = modulateFlipShift(lfilt)
11
12lfilt = lfilt(:);
13
14sz = size(lfilt,1);
15sz2 = ceil(sz/2);
16
17ind = [sz:-1:1]';
18
19hfilt = lfilt(ind) .* (-1).^(ind-sz2);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/namedFilter.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/namedFilter.m
deleted file mode 100755
index 0689dbc..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/namedFilter.m
+++ /dev/null
@@ -1,71 +0,0 @@
1% KERNEL = NAMED_FILTER(NAME)
2%
3% Some standard 1D filter kernels. These are scaled such that
4% their L2-norm is 1.0.
5%
6% binomN - binomial coefficient filter of order N-1
7% haar: - Haar wavelet.
8% qmf8, qmf12, qmf16 - Symmetric Quadrature Mirror Filters [Johnston80]
9% daub2,daub3,daub4 - Daubechies wavelet [Daubechies88].
10% qmf5, qmf9, qmf13: - Symmetric Quadrature Mirror Filters [Simoncelli88,Simoncelli90]
11%
12% See bottom of file for full citations.
13
14% Eero Simoncelli, 6/96.
15
16function [kernel] = named_filter(name)
17
18if strcmp(name(1:min(5,size(name,2))), 'binom')
19 kernel = sqrt(2) * binomialFilter(str2num(name(6:size(name,2))));
20elseif strcmp(name,'qmf5')
21 kernel = [-0.076103 0.3535534 0.8593118 0.3535534 -0.076103]';
22elseif strcmp(name,'qmf9')
23 kernel = [0.02807382 -0.060944743 -0.073386624 0.41472545 0.7973934 ...
24 0.41472545 -0.073386624 -0.060944743 0.02807382]';
25elseif strcmp(name,'qmf13')
26 kernel = [-0.014556438 0.021651438 0.039045125 -0.09800052 ...
27 -0.057827797 0.42995453 0.7737113 0.42995453 -0.057827797 ...
28 -0.09800052 0.039045125 0.021651438 -0.014556438]';
29elseif strcmp(name,'qmf8')
30 kernel = sqrt(2) * [0.00938715 -0.07065183 0.06942827 0.4899808 ...
31 0.4899808 0.06942827 -0.07065183 0.00938715 ]';
32elseif strcmp(name,'qmf12')
33 kernel = sqrt(2) * [-0.003809699 0.01885659 -0.002710326 -0.08469594 ...
34 0.08846992 0.4843894 0.4843894 0.08846992 -0.08469594 -0.002710326 ...
35 0.01885659 -0.003809699 ]';
36elseif strcmp(name,'qmf16')
37 kernel = sqrt(2) * [0.001050167 -0.005054526 -0.002589756 0.0276414 -0.009666376 ...
38 -0.09039223 0.09779817 0.4810284 0.4810284 0.09779817 -0.09039223 -0.009666376 ...
39 0.0276414 -0.002589756 -0.005054526 0.001050167 ]';
40elseif strcmp(name,'haar')
41 kernel = [1 1]' / sqrt(2);
42elseif strcmp(name,'daub2')
43 kernel = [0.482962913145 0.836516303738 0.224143868042 -0.129409522551]';
44elseif strcmp(name,'daub3')
45 kernel = [0.332670552950 0.806891509311 0.459877502118 -0.135011020010 ...
46 -0.085441273882 0.035226291882]';
47elseif strcmp(name,'daub4')
48 kernel = [0.230377813309 0.714846570553 0.630880767930 -0.027983769417 ...
49 -0.187034811719 0.030841381836 0.032883011667 -0.010597401785]';
50elseif strcmp(name,'gauss5') % for backward-compatibility
51 kernel = sqrt(2) * [0.0625 0.25 0.375 0.25 0.0625]';
52elseif strcmp(name,'gauss3') % for backward-compatibility
53 kernel = sqrt(2) * [0.25 0.5 0.25]';
54else
55 error(sprintf('Bad filter name: %s\n',name));
56end
57
58% [Johnston80] - J D Johnston, "A filter family designed for use in quadrature
59% mirror filter banks", Proc. ICASSP, pp 291-294, 1980.
60%
61% [Daubechies88] - I Daubechies, "Orthonormal bases of compactly supported wavelets",
62% Commun. Pure Appl. Math, vol. 42, pp 909-996, 1988.
63%
64% [Simoncelli88] - E P Simoncelli, "Orthogonal sub-band image transforms",
65% PhD Thesis, MIT Dept. of Elec. Eng. and Comp. Sci. May 1988.
66% Also available as: MIT Media Laboratory Vision and Modeling Technical
67% Report #100.
68%
69% [Simoncelli90] - E P Simoncelli and E H Adelson, "Subband image coding",
70% Subband Transforms, chapter 4, ed. John W Woods, Kluwer Academic
71% Publishers, Norwell, MA, 1990, pp 143--192.
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/nextFig.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/nextFig.m
deleted file mode 100755
index e0ac73f..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/nextFig.m
+++ /dev/null
@@ -1,19 +0,0 @@
1% nextFig (MAXFIGS, SKIP)
2%
3% Make figure number mod((GCF+SKIP), MAXFIGS) the current figure.
4% MAXFIGS is optional, and defaults to 2.
5% SKIP is optional, and defaults to 1.
6
7% Eero Simoncelli, 2/97.
8
9function nextFig(maxfigs, skip)
10
11if (exist('maxfigs') ~= 1)
12 maxfigs = 2;
13end
14
15if (exist('skip') ~= 1)
16 skip = 1;
17end
18
19figure(1+mod(gcf-1+skip,maxfigs));
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pgmRead.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pgmRead.m
deleted file mode 100755
index 86c3b62..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pgmRead.m
+++ /dev/null
@@ -1,59 +0,0 @@
1% IM = pgmRead( FILENAME )
2%
3% Load a pgm image into a MatLab matrix.
4% This format is accessible from the XV image browsing utility.
5% Only works for 8bit gray images (raw or ascii)
6
7% Hany Farid, Spring '96. Modified by Eero Simoncelli, 6/96.
8
9function im = pgmRead( fname );
10
11[fid,msg] = fopen( fname, 'r' );
12
13if (fid == -1)
14 error(msg);
15end
16
17%%% First line contains ID string:
18%%% "P1" = ascii bitmap, "P2" = ascii greymap,
19%%% "P3" = ascii pixmap, "P4" = raw bitmap,
20%%% "P5" = raw greymap, "P6" = raw pixmap
21TheLine = fgetl(fid);
22format = TheLine;
23
24if ~((format(1:2) == 'P2') | (format(1:2) == 'P5'))
25 error('PGM file must be of type P2 or P5');
26end
27
28%%% Any number of comment lines
29TheLine = fgetl(fid);
30while TheLine(1) == '#'
31 TheLine = fgetl(fid);
32end
33
34%%% dimensions
35sz = sscanf(TheLine,'%d',2);
36xdim = sz(1);
37ydim = sz(2);
38sz = xdim * ydim;
39
40%%% Maximum pixel value
41TheLine = fgetl(fid);
42maxval = sscanf(TheLine, '%d',1);
43
44%%im = zeros(dim,1);
45if (format(2) == '2')
46 [im,count] = fscanf(fid,'%d',sz);
47else
48 [im,count] = fread(fid,sz,'uchar');
49end
50
51fclose(fid);
52
53if (count == sz)
54 im = reshape( im, xdim, ydim )';
55else
56 fprintf(1,'Warning: File ended early!');
57 im = reshape( [im ; zeros(sz-count,1)], xdim, ydim)';
58end
59
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pgmWrite.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pgmWrite.m
deleted file mode 100755
index 09c14c9..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pgmWrite.m
+++ /dev/null
@@ -1,120 +0,0 @@
1% RANGE = pgmWrite(MTX, FILENAME, RANGE, TYPE, COMMENT)
2%
3% Write a MatLab matrix to a pgm (graylevel image) file.
4% This format is accessible from the XV image browsing utility.
5%
6% RANGE (optional) is a 2-vector specifying the values that map to
7% black and white, respectively. Passing a value of 'auto' (default)
8% sets RANGE=[min,max] (as in MatLab's imagesc). 'auto2' sets
9% RANGE=[mean-2*stdev, mean+2*stdev]. 'auto3' sets
10% RANGE=[p1-(p2-p1)/8, p2+(p2-p1)/8], where p1 is the 10th percentile
11% value of the sorted MATRIX samples, and p2 is the 90th percentile
12% value.
13%
14% TYPE (optional) should be 'raw' or 'ascii'. Defaults to 'raw'.
15
16% Hany Farid, Spring '96. Modified by Eero Simoncelli, 6/96.
17
18function range = pgmWrite(mtx, fname, range, type, comment );
19
20[fid,msg] = fopen( fname, 'w' );
21
22if (fid == -1)
23 error(msg);
24end
25
26%------------------------------------------------------------
27%% optional ARGS:
28
29if (exist('range') ~= 1)
30 range = 'auto';
31end
32
33if (exist('type') ~= 1)
34 type = 'raw';
35end
36%------------------------------------------------------------
37
38%% Automatic range calculation:
39if (strcmp(range,'auto1') | strcmp(range,'auto'))
40 [mn,mx] = range2(mtx);
41 range = [mn,mx];
42
43elseif strcmp(range,'auto2')
44 stdev = sqrt(var2(mtx));
45 av = mean2(mtx);
46 range = [av-2*stdev,av+2*stdev]; % MAGIC NUMBER: 2 stdevs
47
48elseif strcmp(range, 'auto3')
49 percentile = 0.1; % MAGIC NUMBER: 0<p<0.5
50 [N,X] = histo(mtx);
51 binsz = X(2)-X(1);
52 N = N+1e-10; % Ensure cumsum will be monotonic for call to interp1
53 cumN = [0, cumsum(N)]/sum(N);
54 cumX = [X(1)-binsz, X] + (binsz/2);
55 ctrRange = interp1(cumN,cumX, [percentile, 1-percentile]);
56 range = mean(ctrRange) + (ctrRange-mean(ctrRange))/(1-2*percentile);
57
58elseif isstr(range)
59 error(sprintf('Bad RANGE argument: %s',range))
60
61end
62
63if ((range(2) - range(1)) <= eps)
64 range(1) = range(1) - 0.5;
65 range(2) = range(2) + 0.5;
66end
67
68
69%%% First line contains ID string:
70%%% "P1" = ascii bitmap, "P2" = ascii greymap,
71%%% "P3" = ascii pixmap, "P4" = raw bitmap,
72%%% "P5" = raw greymap, "P6" = raw pixmap
73if strcmp(type,'raw')
74 fprintf(fid,'P5\n');
75 format = 5;
76elseif strcmp(type,'ascii')
77 fprintf(fid,'P2\n');
78 format = 2;
79else
80 error(sprintf('PGMWRITE: Bad type argument: %s',type));
81end
82
83fprintf(fid,'# MatLab PGMWRITE file, saved %s\n',date);
84
85if (exist('comment') == 1)
86 fprintf(fid,'# %s\n', comment);
87end
88
89%%% dimensions
90fprintf(fid,'%d %d\n',size(mtx,2),size(mtx,1));
91
92%%% Maximum pixel value
93fprintf(fid,'255\n');
94
95
96%% MatLab's "fprintf" floors when writing floats, so we compute
97%% (mtx-r1)*255/(r2-r1)+0.5
98mult = (255 / (range(2)-range(1)));
99mtx = (mult * mtx) + (0.5 - mult * range(1));
100
101mtx = max(-0.5+eps,min(255.5-eps,mtx));
102
103if (format == 2)
104 count = fprintf(fid,'%d ',mtx');
105elseif (format == 5)
106 count = fwrite(fid,mtx','uchar');
107end
108
109fclose(fid);
110
111if (count ~= size(mtx,1)*size(mtx,2))
112 fprintf(1,'Warning: File output terminated early!');
113end
114
115%%% TEST:
116% foo = 257*rand(100)-1;
117% pgmWrite(foo,'foo.pgm',[0 255]);
118% foo2=pgmRead('foo.pgm');
119% size(find((foo2-round(foo))~=0))
120% foo(find((foo2-round(foo))~=0))
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pixelAxes.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pixelAxes.m
deleted file mode 100755
index f88210d..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pixelAxes.m
+++ /dev/null
@@ -1,70 +0,0 @@
1% [ZOOM] = pixelAxes(DIMS, ZOOM)
2%
3% Set the axes of the current plot to cover a multiple of DIMS pixels,
4% thereby eliminating screen aliasing artifacts when displaying an
5% image of size DIMS.
6%
7% ZOOM (optional, default='same') expresses the desired number of
8% samples displayed per screen pixel. It should be a scalar, which
9% will be rounded to the nearest integer, or 1 over an integer. It
10% may also be the string 'same' or 'auto', in which case the value is chosen so
11% as to produce an image closest in size to the currently displayed
12% image. It may also be the string 'full', in which case the image is
13% made as large as possible while still fitting in the window.
14
15% Eero Simoncelli, 2/97.
16
17function [zoom] = pixelAxes(dims, zoom)
18
19%------------------------------------------------------------
20%% OPTIONAL ARGS:
21
22if (exist('zoom') ~= 1)
23 zoom = 'same';
24end
25
26%% Reverse dimension order, since Figure Positions reported as (x,y).
27dims = dims(2:-1:1);
28
29%% Use MatLab's axis function to force square pixels, etc:
30axis('image');
31ax = gca;
32
33oldunits = get(ax,'Units');
34
35if strcmp(zoom,'full');
36 set(ax,'Units','normalized');
37 set(ax,'Position',[0 0 1 1]);
38 zoom = 'same';
39end
40
41set(ax,'Units','pixels');
42pos = get(ax,'Position');
43ctr = pos(1:2)+pos(3:4)/2;
44
45if (strcmp(zoom,'same') | strcmp(zoom,'auto'))
46 %% HACK: enlarge slightly so that floor doesn't round down
47 zoom = min( pos(3:4) ./ (dims - 1) );
48elseif isstr(zoom)
49 error(sprintf('Bad ZOOM argument: %s',zoom));
50end
51
52%% Force zoom value to be an integer, or inverse integer.
53if (zoom < 0.75)
54 zoom = 1/ceil(1/zoom);
55 %% Round upward, subtracting 0.5 to avoid floating point errors.
56 newsz = ceil(zoom*(dims-0.5));
57else
58 zoom = floor(zoom + 0.001); % Avoid floating pt errors
59 if (zoom < 1.5) % zoom=1
60 zoom = 1;
61 newsz = dims + 0.5;
62 else
63 newsz = zoom*(dims-1) + mod(zoom,2);
64 end
65end
66
67set(ax,'Position', [floor(ctr-newsz/2)+0.5, newsz] )
68
69% Restore units
70set(ax,'Units',oldunits);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pointOp.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pointOp.m
deleted file mode 100755
index 890e60a..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pointOp.m
+++ /dev/null
@@ -1,28 +0,0 @@
1% RES = pointOp(IM, LUT, ORIGIN, INCREMENT, WARNINGS)
2%
3% Apply a point operation, specified by lookup table LUT, to image IM.
4% LUT must be a row or column vector, and is assumed to contain
5% (equi-spaced) samples of the function. ORIGIN specifies the
6% abscissa associated with the first sample, and INCREMENT specifies the
7% spacing between samples. Between-sample values are estimated via
8% linear interpolation. If WARNINGS is non-zero, the function prints
9% a warning whenever the lookup table is extrapolated.
10%
11% This function is much faster than MatLab's interp1, and allows
12% extrapolation beyond the lookup table domain. The drawbacks are
13% that the lookup table must be equi-spaced, and the interpolation is
14% linear.
15
16% Eero Simoncelli, 8/96.
17
18function res = pointOp(im, lut, origin, increment, warnings)
19
20%% NOTE: THIS CODE IS NOT ACTUALLY USED! (MEX FILE IS CALLED INSTEAD)
21
22fprintf(1,'WARNING: You should compile the MEX version of "pointOp.c",\n found in the MEX subdirectory of matlabPyrTools, and put it in your matlab path. It is MUCH faster.\n');
23
24X = origin + increment*[0:size(lut(:),1)-1];
25Y = lut(:);
26
27res = reshape(interp1(X, Y, im(:), 'linear', 'extrap'),size(im));
28
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pwd2path.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pwd2path.m
deleted file mode 100755
index 15aecf0..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pwd2path.m
+++ /dev/null
@@ -1,6 +0,0 @@
1% PWD2PATH()
2%
3% add current working directory (pwd) to path.
4
5P = path;
6path(pwd,P);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pyrBand.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pyrBand.m
deleted file mode 100755
index 1fb6461..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pyrBand.m
+++ /dev/null
@@ -1,11 +0,0 @@
1% RES = pyrBand(PYR, INDICES, BAND_NUM)
2%
3% Access a subband from a pyramid (gaussian, laplacian, QMF/wavelet,
4% or steerable). Subbands are numbered consecutively, from finest
5% (highest spatial frequency) to coarsest (lowest spatial frequency).
6
7% Eero Simoncelli, 6/96.
8
9function res = pyrBand(pyr, pind, band)
10
11res = reshape( pyr(pyrBandIndices(pind,band)), pind(band,1), pind(band,2) );
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pyrBandIndices.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pyrBandIndices.m
deleted file mode 100755
index f94c217..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pyrBandIndices.m
+++ /dev/null
@@ -1,24 +0,0 @@
1% RES = pyrBandIndices(INDICES, BAND_NUM)
2%
3% Return indices for accessing a subband from a pyramid
4% (gaussian, laplacian, QMF/wavelet, steerable).
5
6% Eero Simoncelli, 6/96.
7
8function indices = pyrBandIndices(pind,band)
9
10if ((band > size(pind,1)) | (band < 1))
11 error(sprintf('BAND_NUM must be between 1 and number of pyramid bands (%d).', ...
12 size(pind,1)));
13end
14
15if (size(pind,2) ~= 2)
16 error('INDICES must be an Nx2 matrix indicating the size of the pyramid subbands');
17end
18
19ind = 1;
20for l=1:band-1
21 ind = ind + prod(pind(l,:));
22end
23
24indices = ind:ind+prod(pind(band,:))-1;
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pyrLow.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pyrLow.m
deleted file mode 100755
index 290e806..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/pyrLow.m
+++ /dev/null
@@ -1,12 +0,0 @@
1% RES = pyrLow(PYR, INDICES)
2%
3% Access the lowpass subband from a pyramid
4% (gaussian, laplacian, QMF/wavelet, steerable).
5
6% Eero Simoncelli, 6/96.
7
8function res = pyrLow(pyr,pind)
9
10band = size(pind,1);
11
12res = reshape( pyr(pyrBandIndices(pind,band)), pind(band,1), pind(band,2) );
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/range2.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/range2.m
deleted file mode 100755
index 1709a0e..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/range2.m
+++ /dev/null
@@ -1,18 +0,0 @@
1% [MIN, MAX] = range2(MTX)
2%
3% Compute minimum and maximum values of MTX, returning them as a 2-vector.
4
5% Eero Simoncelli, 3/97.
6
7function [mn, mx] = range2(mtx)
8
9%% NOTE: THIS CODE IS NOT ACTUALLY USED! (MEX FILE IS CALLED INSTEAD)
10
11fprintf(1,'WARNING: You should compile the MEX version of "range2.c",\n found in the MEX subdirectory of matlabPyrTools, and put it in your matlab path. It is MUCH faster.\n');
12
13if (~isreal(mtx))
14 error('MTX must be real-valued');
15end
16
17mn = min(min(mtx));
18mx = max(max(mtx));
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/rconv2.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/rconv2.m
deleted file mode 100755
index 0c12490..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/rconv2.m
+++ /dev/null
@@ -1,50 +0,0 @@
1% RES = RCONV2(MTX1, MTX2, CTR)
2%
3% Convolution of two matrices, with boundaries handled via reflection
4% about the edge pixels. Result will be of size of LARGER matrix.
5%
6% The origin of the smaller matrix is assumed to be its center.
7% For even dimensions, the origin is determined by the CTR (optional)
8% argument:
9% CTR origin
10% 0 DIM/2 (default)
11% 1 (DIM/2)+1
12
13% Eero Simoncelli, 6/96.
14
15function c = rconv2(a,b,ctr)
16
17if (exist('ctr') ~= 1)
18 ctr = 0;
19end
20
21if (( size(a,1) >= size(b,1) ) & ( size(a,2) >= size(b,2) ))
22 large = a; small = b;
23elseif (( size(a,1) <= size(b,1) ) & ( size(a,2) <= size(b,2) ))
24 large = b; small = a;
25else
26 error('one arg must be larger than the other in both dimensions!');
27end
28
29ly = size(large,1);
30lx = size(large,2);
31sy = size(small,1);
32sx = size(small,2);
33
34%% These values are one less than the index of the small mtx that falls on
35%% the border pixel of the large matrix when computing the first
36%% convolution response sample:
37sy2 = floor((sy+ctr-1)/2);
38sx2 = floor((sx+ctr-1)/2);
39
40% pad with reflected copies
41clarge = [
42 large(sy-sy2:-1:2,sx-sx2:-1:2), large(sy-sy2:-1:2,:), ...
43 large(sy-sy2:-1:2,lx-1:-1:lx-sx2); ...
44 large(:,sx-sx2:-1:2), large, large(:,lx-1:-1:lx-sx2); ...
45 large(ly-1:-1:ly-sy2,sx-sx2:-1:2), ...
46 large(ly-1:-1:ly-sy2,:), ...
47 large(ly-1:-1:ly-sy2,lx-1:-1:lx-sx2) ];
48
49c = conv2(clarge,small,'valid');
50
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/rcosFn.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/rcosFn.m
deleted file mode 100755
index 5dac344..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/rcosFn.m
+++ /dev/null
@@ -1,45 +0,0 @@
1% [X, Y] = rcosFn(WIDTH, POSITION, VALUES)
2%
3% Return a lookup table (suitable for use by INTERP1)
4% containing a "raised cosine" soft threshold function:
5%
6% Y = VALUES(1) + (VALUES(2)-VALUES(1)) *
7% cos^2( PI/2 * (X - POSITION + WIDTH)/WIDTH )
8%
9% WIDTH is the width of the region over which the transition occurs
10% (default = 1). POSITION is the location of the center of the
11% threshold (default = 0). VALUES (default = [0,1]) specifies the
12% values to the left and right of the transition.
13
14% Eero Simoncelli, 7/96.
15
16function [X, Y] = rcosFn(width,position,values)
17
18%------------------------------------------------------------
19% OPTIONAL ARGS:
20
21if (exist('width') ~= 1)
22 width = 1;
23end
24
25if (exist('position') ~= 1)
26 position = 0;
27end
28
29if (exist('values') ~= 1)
30 values = [0,1];
31end
32
33%------------------------------------------------------------
34
35sz = 256; %% arbitrary!
36
37X = pi * [-sz-1:1] / (2*sz);
38
39Y = values(1) + (values(2)-values(1)) * cos(X).^2;
40
41% Make sure end values are repeated, for extrapolation...
42Y(1) = Y(2);
43Y(sz+3) = Y(sz+2);
44
45X = position + (2*width/pi) * (X + pi/4);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconLpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconLpyr.m
deleted file mode 100755
index cddcc12..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconLpyr.m
+++ /dev/null
@@ -1,83 +0,0 @@
1% RES = reconLpyr(PYR, INDICES, LEVS, FILT2, EDGES)
2%
3% Reconstruct image from Laplacian pyramid, as created by buildLpyr.
4%
5% PYR is a vector containing the N pyramid subbands, ordered from fine
6% to coarse. INDICES is an Nx2 matrix containing the sizes of
7% each subband. This is compatible with the MatLab Wavelet toolbox.
8%
9% LEVS (optional) should be a list of levels to include, or the string
10% 'all' (default). The finest scale is number 1. The lowpass band
11% corresponds to lpyrHt(INDICES)+1.
12%
13% FILT2 (optional) can be a string naming a standard filter (see
14% namedFilter), or a vector which will be used for (separable)
15% convolution. Default = 'binom5'. EDGES specifies edge-handling,
16% and defaults to 'reflect1' (see corrDn).
17
18% Eero Simoncelli, 6/96
19
20function res = reconLpyr(pyr, ind, levs, filt2, edges)
21
22if (nargin < 2)
23 error('First two arguments (PYR, INDICES) are required');
24end
25
26%%------------------------------------------------------------
27%% DEFAULTS:
28
29if (exist('levs') ~= 1)
30 levs = 'all';
31end
32
33if (exist('filt2') ~= 1)
34 filt2 = 'binom5';
35end
36
37if (exist('edges') ~= 1)
38 edges= 'reflect1';
39end
40%%------------------------------------------------------------
41
42maxLev = 1+lpyrHt(ind);
43if strcmp(levs,'all')
44 levs = [1:maxLev]';
45else
46 if (any(levs > maxLev))
47 error(sprintf('Level numbers must be in the range [1, %d].', maxLev));
48 end
49 levs = levs(:);
50end
51
52if isstr(filt2)
53 filt2 = namedFilter(filt2);
54end
55
56filt2 = filt2(:);
57res_sz = ind(1,:);
58
59if any(levs > 1)
60
61 int_sz = [ind(1,1), ind(2,2)];
62
63 nres = reconLpyr( pyr(prod(res_sz)+1:size(pyr,1)), ...
64 ind(2:size(ind,1),:), levs-1, filt2, edges);
65
66 if (res_sz(1) == 1)
67 res = upConv(nres, filt2', edges, [1 2], [1 1], res_sz);
68 elseif (res_sz(2) == 1)
69 res = upConv(nres, filt2, edges, [2 1], [1 1], res_sz);
70 else
71 hi = upConv(nres, filt2, edges, [2 1], [1 1], int_sz);
72 res = upConv(hi, filt2', edges, [1 2], [1 1], res_sz);
73 end
74
75else
76
77 res = zeros(res_sz);
78
79end
80
81if any(levs == 1)
82 res = res + pyrBand(pyr,ind,1);
83end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconSCFpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconSCFpyr.m
deleted file mode 100755
index a86f03d..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconSCFpyr.m
+++ /dev/null
@@ -1,87 +0,0 @@
1% RES = reconSCFpyr(PYR, INDICES, LEVS, BANDS, TWIDTH)
2%
3% The inverse of buildSCFpyr: Reconstruct image from its complex steerable pyramid representation,
4% in the Fourier domain.
5%
6% The image is reconstructed by forcing the complex subbands to be analytic
7% (zero on half of the 2D Fourier plane, as they are supossed to be unless
8% they have being modified), and reconstructing from the real part of those
9% analytic subbands. That is equivalent to compute the Hilbert transforms of
10% the imaginary parts of the subbands, average them with their real
11% counterparts, and then reconstructing from the resulting real subbands.
12%
13% PYR is a vector containing the N pyramid subbands, ordered from fine
14% to coarse. INDICES is an Nx2 matrix containing the sizes of
15% each subband. This is compatible with the MatLab Wavelet toolbox.
16%
17% LEVS (optional) should be a list of levels to include, or the string
18% 'all' (default). 0 corresonds to the residual highpass subband.
19% 1 corresponds to the finest oriented scale. The lowpass band
20% corresponds to number spyrHt(INDICES)+1.
21%
22% BANDS (optional) should be a list of bands to include, or the string
23% 'all' (default). 1 = vertical, rest proceeding anti-clockwise.
24%
25% TWIDTH is the width of the transition region of the radial lowpass
26% function, in octaves (default = 1, which gives a raised cosine for
27% the bandpass filters).
28
29% Javier Portilla, 7/04, basing on Eero Simoncelli's Matlab Pyrtools code
30% and our common code on texture synthesis (textureSynthesis.m).
31
32function res = reconSCFpyr(pyr, indices, levs, bands, twidth)
33
34%%------------------------------------------------------------
35%% DEFAULTS:
36
37if ~exist('levs'),
38 levs = 'all';
39end
40
41if ~exist('bands')
42 bands = 'all';
43end
44
45if ~exist('twidth'),
46 twidth = 1;
47elseif (twidth <= 0)
48 fprintf(1,'Warning: TWIDTH must be positive. Setting to 1.\n');
49 twidth = 1;
50end
51
52%%------------------------------------------------------------
53
54
55pind = indices;
56Nsc = log2(pind(1,1)/pind(end,1));
57Nor = (size(pind,1)-2)/Nsc;
58
59for nsc = 1:Nsc,
60 firstBnum = (nsc-1)*Nor+2;
61
62%% Re-create analytic subbands
63 dims = pind(firstBnum,:);
64 ctr = ceil((dims+0.5)/2);
65 ang = mkAngle(dims, 0, ctr);
66 ang(ctr(1),ctr(2)) = -pi/2;
67 for nor = 1:Nor,
68 nband = (nsc-1)*Nor+nor+1;
69 ind = pyrBandIndices(pind,nband);
70 ch = pyrBand(pyr, pind, nband);
71 ang0 = pi*(nor-1)/Nor;
72 xang = mod(ang-ang0+pi, 2*pi) - pi;
73 amask = 2*(abs(xang) < pi/2) + (abs(xang) == pi/2);
74 amask(ctr(1),ctr(2)) = 1;
75 amask(:,1) = 1;
76 amask(1,:) = 1;
77 amask = fftshift(amask);
78 ch = ifft2(amask.*fft2(ch)); % "Analytic" version
79 %f = 1.000008; % With this factor the reconstruction SNR goes up around 6 dB!
80 f = 1;
81 ch = f*0.5*real(ch); % real part
82 pyr(ind) = ch;
83 end % nor
84end % nsc
85
86res = reconSFpyr(pyr, indices, levs, bands, twidth);
87
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconSFpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconSFpyr.m
deleted file mode 100755
index 0e3109e..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconSFpyr.m
+++ /dev/null
@@ -1,108 +0,0 @@
1% RES = reconSFpyr(PYR, INDICES, LEVS, BANDS, TWIDTH)
2%
3% Reconstruct image from its steerable pyramid representation, in the Fourier
4% domain, as created by buildSFpyr.
5%
6% PYR is a vector containing the N pyramid subbands, ordered from fine
7% to coarse. INDICES is an Nx2 matrix containing the sizes of
8% each subband. This is compatible with the MatLab Wavelet toolbox.
9%
10% LEVS (optional) should be a list of levels to include, or the string
11% 'all' (default). 0 corresonds to the residual highpass subband.
12% 1 corresponds to the finest oriented scale. The lowpass band
13% corresponds to number spyrHt(INDICES)+1.
14%
15% BANDS (optional) should be a list of bands to include, or the string
16% 'all' (default). 1 = vertical, rest proceeding anti-clockwise.
17%
18% TWIDTH is the width of the transition region of the radial lowpass
19% function, in octaves (default = 1, which gives a raised cosine for
20% the bandpass filters).
21
22%%% MODIFIED VERSION, 7/04, uses different lookup table for radial frequency!
23
24% Eero Simoncelli, 5/97.
25
26function res = reconSFpyr(pyr, pind, levs, bands, twidth)
27
28%%------------------------------------------------------------
29%% DEFAULTS:
30
31if (exist('levs') ~= 1)
32 levs = 'all';
33end
34
35if (exist('bands') ~= 1)
36 bands = 'all';
37end
38
39if (exist('twidth') ~= 1)
40 twidth = 1;
41elseif (twidth <= 0)
42 fprintf(1,'Warning: TWIDTH must be positive. Setting to 1.\n');
43 twidth = 1;
44end
45
46%%------------------------------------------------------------
47
48nbands = spyrNumBands(pind);
49
50maxLev = 1+spyrHt(pind);
51if strcmp(levs,'all')
52 levs = [0:maxLev]';
53else
54 if (any(levs > maxLev) | any(levs < 0))
55 error(sprintf('Level numbers must be in the range [0, %d].', maxLev));
56 end
57 levs = levs(:);
58end
59
60if strcmp(bands,'all')
61 bands = [1:nbands]';
62else
63 if (any(bands < 1) | any(bands > nbands))
64 error(sprintf('Band numbers must be in the range [1,3].', nbands));
65 end
66 bands = bands(:);
67end
68
69%----------------------------------------------------------------------
70
71dims = pind(1,:);
72ctr = ceil((dims+0.5)/2);
73
74[xramp,yramp] = meshgrid( ([1:dims(2)]-ctr(2))./(dims(2)/2), ...
75 ([1:dims(1)]-ctr(1))./(dims(1)/2) );
76angle = atan2(yramp,xramp);
77log_rad = sqrt(xramp.^2 + yramp.^2);
78log_rad(ctr(1),ctr(2)) = log_rad(ctr(1),ctr(2)-1);
79log_rad = log2(log_rad);
80
81%% Radial transition function (a raised cosine in log-frequency):
82[Xrcos,Yrcos] = rcosFn(twidth,(-twidth/2),[0 1]);
83Yrcos = sqrt(Yrcos);
84YIrcos = sqrt(abs(1.0 - Yrcos.^2));
85
86if (size(pind,1) == 2)
87 if (any(levs==1))
88 resdft = fftshift(fft2(pyrBand(pyr,pind,2)));
89 else
90 resdft = zeros(pind(2,:));
91 end
92else
93 resdft = reconSFpyrLevs(pyr(1+prod(pind(1,:)):size(pyr,1)), ...
94 pind(2:size(pind,1),:), ...
95 log_rad, Xrcos, Yrcos, angle, nbands, levs, bands);
96end
97
98lo0mask = pointOp(log_rad, YIrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
99resdft = resdft .* lo0mask;
100
101%% residual highpass subband
102if any(levs == 0)
103 hi0mask = pointOp(log_rad, Yrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
104 hidft = fftshift(fft2(subMtx(pyr, pind(1,:))));
105 resdft = resdft + hidft .* hi0mask;
106end
107
108res = real(ifft2(ifftshift(resdft)));
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconSFpyrLevs.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconSFpyrLevs.m
deleted file mode 100755
index 420f278..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconSFpyrLevs.m
+++ /dev/null
@@ -1,69 +0,0 @@
1% RESDFT = reconSFpyrLevs(PYR,INDICES,LOGRAD,XRCOS,YRCOS,ANGLE,NBANDS,LEVS,BANDS)
2%
3% Recursive function for reconstructing levels of a steerable pyramid
4% representation. This is called by reconSFpyr, and is not usually
5% called directly.
6
7% Eero Simoncelli, 5/97.
8
9function resdft = reconSFpyrLevs(pyr,pind,log_rad,Xrcos,Yrcos,angle,nbands,levs,bands);
10
11lo_ind = nbands+1;
12dims = pind(1,:);
13ctr = ceil((dims+0.5)/2);
14
15% log_rad = log_rad + 1;
16Xrcos = Xrcos - log2(2); % shift origin of lut by 1 octave.
17
18if any(levs > 1)
19
20 lodims = ceil((dims-0.5)/2);
21 loctr = ceil((lodims+0.5)/2);
22 lostart = ctr-loctr+1;
23 loend = lostart+lodims-1;
24 nlog_rad = log_rad(lostart(1):loend(1),lostart(2):loend(2));
25 nangle = angle(lostart(1):loend(1),lostart(2):loend(2));
26
27 if (size(pind,1) > lo_ind)
28 nresdft = reconSFpyrLevs( pyr(1+sum(prod(pind(1:lo_ind-1,:)')):size(pyr,1)),...
29 pind(lo_ind:size(pind,1),:), ...
30 nlog_rad, Xrcos, Yrcos, nangle, nbands,levs-1, bands);
31 else
32 nresdft = fftshift(fft2(pyrBand(pyr,pind,lo_ind)));
33 end
34
35 YIrcos = sqrt(abs(1.0 - Yrcos.^2));
36 lomask = pointOp(nlog_rad, YIrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
37
38 resdft = zeros(dims);
39 resdft(lostart(1):loend(1),lostart(2):loend(2)) = nresdft .* lomask;
40
41else
42
43 resdft = zeros(dims);
44
45end
46
47
48if any(levs == 1)
49
50 lutsize = 1024;
51 Xcosn = pi*[-(2*lutsize+1):(lutsize+1)]/lutsize; % [-2*pi:pi]
52 order = nbands-1;
53 %% divide by sqrt(sum_(n=0)^(N-1) cos(pi*n/N)^(2(N-1)) )
54 const = (2^(2*order))*(factorial(order)^2)/(nbands*factorial(2*order));
55 Ycosn = sqrt(const) * (cos(Xcosn)).^order;
56 himask = pointOp(log_rad, Yrcos, Xrcos(1), Xrcos(2)-Xrcos(1),0);
57
58 ind = 1;
59 for b = 1:nbands
60 if any(bands == b)
61 anglemask = pointOp(angle,Ycosn,Xcosn(1)+pi*(b-1)/nbands,Xcosn(2)-Xcosn(1));
62 band = reshape(pyr(ind:ind+prod(dims)-1), dims(1), dims(2));
63 banddft = fftshift(fft2(band));
64 resdft = resdft + (sqrt(-1))^(nbands-1) * banddft.*anglemask.*himask;
65 end
66 ind = ind + prod(dims);
67 end
68end
69
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconSpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconSpyr.m
deleted file mode 100755
index 270009d..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconSpyr.m
+++ /dev/null
@@ -1,96 +0,0 @@
1% RES = reconSpyr(PYR, INDICES, FILTFILE, EDGES, LEVS, BANDS)
2%
3% Reconstruct image from its steerable pyramid representation, as created
4% by buildSpyr.
5%
6% PYR is a vector containing the N pyramid subbands, ordered from fine
7% to coarse. INDICES is an Nx2 matrix containing the sizes of
8% each subband. This is compatible with the MatLab Wavelet toolbox.
9%
10% FILTFILE (optional) should be a string referring to an m-file that returns
11% the rfilters. examples: sp0Filters, sp1Filters, sp3Filters
12% (default = 'sp1Filters').
13% EDGES specifies edge-handling, and defaults to 'reflect1' (see
14% corrDn).
15%
16% LEVS (optional) should be a list of levels to include, or the string
17% 'all' (default). 0 corresonds to the residual highpass subband.
18% 1 corresponds to the finest oriented scale. The lowpass band
19% corresponds to number spyrHt(INDICES)+1.
20%
21% BANDS (optional) should be a list of bands to include, or the string
22% 'all' (default). 1 = vertical, rest proceeding anti-clockwise.
23
24% Eero Simoncelli, 6/96.
25
26function res = reconSpyr(pyr, pind, filtfile, edges, levs, bands)
27
28%%------------------------------------------------------------
29%% DEFAULTS:
30
31if (exist('filtfile') ~= 1)
32 filtfile = 'sp1Filters';
33end
34
35if (exist('edges') ~= 1)
36 edges= 'reflect1';
37end
38
39if (exist('levs') ~= 1)
40 levs = 'all';
41end
42
43if (exist('bands') ~= 1)
44 bands = 'all';
45end
46
47%%------------------------------------------------------------
48
49if (isstr(filtfile) & (exist(filtfile) == 2))
50 [lo0filt,hi0filt,lofilt,bfilts,steermtx,harmonics] = eval(filtfile);
51 nbands = spyrNumBands(pind);
52 if ((nbands > 0) & (size(bfilts,2) ~= nbands))
53 error('Number of pyramid bands is inconsistent with filter file');
54 end
55else
56 error('filtfile argument must be the name of an M-file containing SPYR filters.');
57end
58
59maxLev = 1+spyrHt(pind);
60if strcmp(levs,'all')
61 levs = [0:maxLev]';
62else
63 if (any(levs > maxLev) | any(levs < 0))
64 error(sprintf('Level numbers must be in the range [0, %d].', maxLev));
65 end
66 levs = levs(:);
67end
68
69if strcmp(bands,'all')
70 bands = [1:nbands]';
71else
72 if (any(bands < 1) | any(bands > nbands))
73 error(sprintf('Band numbers must be in the range [1,3].', nbands));
74 end
75 bands = bands(:);
76end
77
78if (spyrHt(pind) == 0)
79 if (any(levs==1))
80 res1 = pyrBand(pyr,pind,2);
81 else
82 res1 = zeros(pind(2,:));
83 end
84else
85 res1 = reconSpyrLevs(pyr(1+prod(pind(1,:)):size(pyr,1)), ...
86 pind(2:size(pind,1),:), ...
87 lofilt, bfilts, edges, levs, bands);
88end
89
90res = upConv(res1, lo0filt, edges);
91
92%% residual highpass subband
93if any(levs == 0)
94 upConv( subMtx(pyr, pind(1,:)), hi0filt, edges, [1 1], [1 1], size(res), res);
95end
96
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconSpyrLevs.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconSpyrLevs.m
deleted file mode 100755
index f8e456c..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconSpyrLevs.m
+++ /dev/null
@@ -1,46 +0,0 @@
1% RES = reconSpyrLevs(PYR,INDICES,LOFILT,BFILTS,EDGES,LEVS,BANDS)
2%
3% Recursive function for reconstructing levels of a steerable pyramid
4% representation. This is called by reconSpyr, and is not usually
5% called directly.
6
7% Eero Simoncelli, 6/96.
8
9function res = reconSpyrLevs(pyr,pind,lofilt,bfilts,edges,levs,bands);
10
11nbands = size(bfilts,2);
12lo_ind = nbands+1;
13res_sz = pind(1,:);
14
15% Assume square filters:
16bfiltsz = round(sqrt(size(bfilts,1)));
17
18if any(levs > 1)
19
20 if (size(pind,1) > lo_ind)
21 nres = reconSpyrLevs( pyr(1+sum(prod(pind(1:lo_ind-1,:)')):size(pyr,1)), ...
22 pind(lo_ind:size(pind,1),:), ...
23 lofilt, bfilts, edges, levs-1, bands);
24 else
25 nres = pyrBand(pyr,pind,lo_ind); % lowpass subband
26 end
27
28 res = upConv(nres, lofilt, edges, [2 2], [1 1], res_sz);
29
30else
31
32 res = zeros(res_sz);
33
34end
35
36if any(levs == 1)
37 ind = 1;
38 for b = 1:nbands
39 if any(bands == b)
40 bfilt = reshape(bfilts(:,b), bfiltsz, bfiltsz);
41 upConv(reshape(pyr(ind:ind+prod(res_sz)-1), res_sz(1), res_sz(2)), ...
42 bfilt, edges, [1 1], [1 1], res_sz, res);
43 end
44 ind = ind + prod(res_sz);
45 end
46end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconWpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconWpyr.m
deleted file mode 100755
index fc31226..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/reconWpyr.m
+++ /dev/null
@@ -1,148 +0,0 @@
1% RES = reconWpyr(PYR, INDICES, FILT, EDGES, LEVS, BANDS)
2%
3% Reconstruct image from its separable orthonormal QMF/wavelet pyramid
4% representation, as created by buildWpyr.
5%
6% PYR is a vector containing the N pyramid subbands, ordered from fine
7% to coarse. INDICES is an Nx2 matrix containing the sizes of
8% each subband. This is compatible with the MatLab Wavelet toolbox.
9%
10% FILT (optional) can be a string naming a standard filter (see
11% namedFilter), or a vector which will be used for (separable)
12% convolution. Default = 'qmf9'. EDGES specifies edge-handling,
13% and defaults to 'reflect1' (see corrDn).
14%
15% LEVS (optional) should be a vector of levels to include, or the string
16% 'all' (default). 1 corresponds to the finest scale. The lowpass band
17% corresponds to wpyrHt(INDICES)+1.
18%
19% BANDS (optional) should be a vector of bands to include, or the string
20% 'all' (default). 1=horizontal, 2=vertical, 3=diagonal. This is only used
21% for pyramids of 2D images.
22
23% Eero Simoncelli, 6/96.
24
25function res = reconWpyr(pyr, ind, filt, edges, levs, bands)
26
27if (nargin < 2)
28 error('First two arguments (PYR INDICES) are required');
29end
30
31%%------------------------------------------------------------
32%% OPTIONAL ARGS:
33
34if (exist('filt') ~= 1)
35 filt = 'qmf9';
36end
37
38if (exist('edges') ~= 1)
39 edges= 'reflect1';
40end
41
42if (exist('levs') ~= 1)
43 levs = 'all';
44end
45
46if (exist('bands') ~= 1)
47 bands = 'all';
48end
49
50%%------------------------------------------------------------
51
52maxLev = 1+wpyrHt(ind);
53if strcmp(levs,'all')
54 levs = [1:maxLev]';
55else
56 if (any(levs > maxLev))
57 error(sprintf('Level numbers must be in the range [1, %d].', maxLev));
58 end
59 levs = levs(:);
60end
61
62if strcmp(bands,'all')
63 bands = [1:3]';
64else
65 if (any(bands < 1) | any(bands > 3))
66 error('Band numbers must be in the range [1,3].');
67 end
68 bands = bands(:);
69end
70
71if isstr(filt)
72 filt = namedFilter(filt);
73end
74
75filt = filt(:);
76hfilt = modulateFlip(filt);
77
78%% For odd-length filters, stagger the sampling lattices:
79if (mod(size(filt,1),2) == 0)
80 stag = 2;
81else
82 stag = 1;
83end
84
85%% Compute size of result image: assumes critical sampling (boundaries correct)
86res_sz = ind(1,:);
87if (res_sz(1) == 1)
88 loind = 2;
89 res_sz(2) = sum(ind(:,2));
90elseif (res_sz(2) == 1)
91 loind = 2;
92 res_sz(1) = sum(ind(:,1));
93else
94 loind = 4;
95 res_sz = ind(1,:) + ind(2,:); %%horizontal + vertical bands.
96 hres_sz = [ind(1,1), res_sz(2)];
97 lres_sz = [ind(2,1), res_sz(2)];
98end
99
100
101%% First, recursively collapse coarser scales:
102if any(levs > 1)
103
104 if (size(ind,1) > loind)
105 nres = reconWpyr( pyr(1+sum(prod(ind(1:loind-1,:)')):size(pyr,1)), ...
106 ind(loind:size(ind,1),:), filt, edges, levs-1, bands);
107 else
108 nres = pyrBand(pyr, ind, loind); % lowpass subband
109 end
110
111 if (res_sz(1) == 1)
112 res = upConv(nres, filt', edges, [1 2], [1 stag], res_sz);
113 elseif (res_sz(2) == 1)
114 res = upConv(nres, filt, edges, [2 1], [stag 1], res_sz);
115 else
116 ires = upConv(nres, filt', edges, [1 2], [1 stag], lres_sz);
117 res = upConv(ires, filt, edges, [2 1], [stag 1], res_sz);
118 end
119
120else
121
122 res = zeros(res_sz);
123
124end
125
126
127%% Add in reconstructed bands from this level:
128if any(levs == 1)
129 if (res_sz(1) == 1)
130 upConv(pyrBand(pyr,ind,1), hfilt', edges, [1 2], [1 2], res_sz, res);
131 elseif (res_sz(2) == 1)
132 upConv(pyrBand(pyr,ind,1), hfilt, edges, [2 1], [2 1], res_sz, res);
133 else
134 if any(bands == 1) % horizontal
135 ires = upConv(pyrBand(pyr,ind,1),filt',edges,[1 2],[1 stag],hres_sz);
136 upConv(ires,hfilt,edges,[2 1],[2 1],res_sz,res); %destructively modify res
137 end
138 if any(bands == 2) % vertical
139 ires = upConv(pyrBand(pyr,ind,2),hfilt',edges,[1 2],[1 2],lres_sz);
140 upConv(ires,filt,edges,[2 1],[stag 1],res_sz,res); %destructively modify res
141 end
142 if any(bands == 3) % diagonal
143 ires = upConv(pyrBand(pyr,ind,3),hfilt',edges,[1 2],[1 2],hres_sz);
144 upConv(ires,hfilt,edges,[2 1],[2 1],res_sz,res); %destructively modify res
145 end
146 end
147end
148
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/setPyrBand.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/setPyrBand.m
deleted file mode 100755
index baa9f77..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/setPyrBand.m
+++ /dev/null
@@ -1,32 +0,0 @@
1% NEWPYR = setPyrBand(PYR, INDICES, BAND, BAND_NUM)
2%
3% Insert an image (BAND) into a pyramid (gaussian, laplacian, QMF/wavelet,
4% or steerable). Subbands are numbered consecutively, from finest
5% (highest spatial frequency) to coarsest (lowest spatial frequency).
6
7% Eero Simoncelli, 1/03.
8
9function pyr = pyrBand(pyr, pind, band, bandNum)
10
11%% Check: PIND a valid index matrix?
12if ( ~(ndims(pind) == 2) | ~(size(pind,2) == 2) | ~all(pind==round(pind)) )
13 pind
14 error('pyrTools:badArg',...
15 'PIND argument is not an Nbands X 2 matrix of integers');
16end
17
18%% Check: PIND consistent with size of PYR?
19if ( length(pyr) ~= sum(prod(pind,2)) )
20 error('pyrTools:badPyr',...
21 'Pyramid data vector length is inconsistent with index matrix PIND');
22end
23
24%% Check: size of BAND consistent with desired BANDNUM?
25if (~all(size(band) == pind(bandNum,:)))
26 size(band)
27 pind(bandNum,:)
28 error('pyrTools:badArg',...
29 'size of BAND to be inserted is inconsistent with BAND_NUM');
30end
31
32pyr(pyrBandIndices(pind,bandNum)) = vectify(band);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/shift.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/shift.m
deleted file mode 100755
index 497297e..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/shift.m
+++ /dev/null
@@ -1,15 +0,0 @@
1% [RES] = shift(MTX, OFFSET)
2%
3% Circular shift 2D matrix samples by OFFSET (a [Y,X] 2-vector),
4% such that RES(POS) = MTX(POS-OFFSET).
5
6function res = shift(mtx, offset)
7
8dims = size(mtx);
9
10offset = mod(-offset,dims);
11
12res = [ mtx(offset(1)+1:dims(1), offset(2)+1:dims(2)), ...
13 mtx(offset(1)+1:dims(1), 1:offset(2)); ...
14 mtx(1:offset(1), offset(2)+1:dims(2)), ...
15 mtx(1:offset(1), 1:offset(2)) ];
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/showIm.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/showIm.m
deleted file mode 100755
index a9e2bd1..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/showIm.m
+++ /dev/null
@@ -1,221 +0,0 @@
1% RANGE = showIm (MATRIX, RANGE, ZOOM, LABEL, NSHADES )
2%
3% Display a MatLab MATRIX as a grayscale image in the current figure,
4% inside the current axes. If MATRIX is complex, the real and imaginary
5% parts are shown side-by-side, with the same grayscale mapping.
6%
7% If MATRIX is a string, it should be the name of a variable bound to a
8% MATRIX in the base (global) environment. This matrix is displayed as an
9% image, with the title set to the string.
10%
11% RANGE (optional) is a 2-vector specifying the values that map to
12% black and white, respectively. Passing a value of 'auto' (default)
13% sets RANGE=[min,max] (as in MatLab's imagesc). 'auto2' sets
14% RANGE=[mean-2*stdev, mean+2*stdev]. 'auto3' sets
15% RANGE=[p1-(p2-p1)/8, p2+(p2-p1)/8], where p1 is the 10th percentile
16% value of the sorted MATRIX samples, and p2 is the 90th percentile
17% value.
18%
19% ZOOM specifies the number of matrix samples per screen pixel. It
20% will be rounded to an integer, or 1 divided by an integer. A value
21% of 'same' or 'auto' (default) causes the zoom value to be chosen
22% automatically to fit the image into the current axes. A value of
23% 'full' fills the axis region (leaving no room for labels). See
24% pixelAxes.m.
25%
26% If LABEL (optional, default = 1, unless zoom='full') is non-zero, the range
27% of values that are mapped into the gray colormap and the dimensions
28% (size) of the matrix and zoom factor are printed below the image. If label
29% is a string, it is used as a title.
30%
31% NSHADES (optional) specifies the number of gray shades, and defaults
32% to the size of the current colormap.
33
34% Eero Simoncelli, 6/96.
35
36%%TODO: should use "newplot"
37
38function range = showIm( im, range, zoom, label, nshades );
39
40%------------------------------------------------------------
41%% OPTIONAL ARGS:
42
43if (nargin < 1)
44 error('Requires at least one input argument.');
45end
46
47MLv = version;
48
49if isstr(im)
50 if (strcmp(MLv(1),'4'))
51 error('Cannot pass string arg for MATRIX in MatLab version 4.x');
52 end
53 label = im;
54 im = evalin('base',im);
55end
56
57if (exist('range') ~= 1)
58 range = 'auto1';
59end
60
61if (exist('nshades') ~= 1)
62 nshades = size(colormap,1);
63end
64nshades = max( nshades, 2 );
65
66if (exist('zoom') ~= 1)
67 zoom = 'auto';
68end
69
70if (exist('label') ~= 1)
71 if strcmp(zoom,'full')
72 label = 0; % no labeling
73 else
74 label = 1; % just print grayrange & dims
75 end
76end
77
78%------------------------------------------------------------
79
80%% Automatic range calculation:
81if (strcmp(range,'auto1') | strcmp(range,'auto'))
82 if isreal(im)
83 [mn,mx] = range2(im);
84 else
85 [mn1,mx1] = range2(real(im));
86 [mn2,mx2] = range2(imag(im));
87 mn = min(mn1,mn2);
88 mx = max(mx1,mx2);
89 end
90 if any(size(im)==1)
91 pad = (mx-mn)/12; % MAGIC NUMBER: graph padding
92 range = [mn-pad, mx+pad];
93 else
94 range = [mn,mx];
95 end
96
97elseif strcmp(range,'auto2')
98 if isreal(im)
99 stdev = sqrt(var2(im));
100 av = mean2(im);
101 else
102 stdev = sqrt((var2(real(im)) + var2(imag(im)))/2);
103 av = (mean2(real(im)) + mean2(imag(im)))/2;
104 end
105 range = [av-2*stdev,av+2*stdev]; % MAGIC NUMBER: 2 stdevs
106
107elseif strcmp(range, 'auto3')
108 percentile = 0.1; % MAGIC NUMBER: 0<p<0.5
109 [N,X] = histo(im);
110 binsz = X(2)-X(1);
111 N = N+1e-10; % Ensure cumsum will be monotonic for call to interp1
112 cumN = [0, cumsum(N)]/sum(N);
113 cumX = [X(1)-binsz, X] + (binsz/2);
114 ctrRange = interp1(cumN,cumX, [percentile, 1-percentile]);
115 range = mean(ctrRange) + (ctrRange-mean(ctrRange))/(1-2*percentile);
116
117elseif isstr(range)
118 error(sprintf('Bad RANGE argument: %s',range))
119
120end
121
122if ((range(2) - range(1)) <= eps)
123 range(1) = range(1) - 0.5;
124 range(2) = range(2) + 0.5;
125end
126
127
128if isreal(im)
129 factor=1;
130else
131 factor = 1+sqrt(-1);
132end
133
134xlbl_offset = 0; % default value
135
136if (~any(size(im)==1))
137 %% MatLab's "image" rounds when mapping to the colormap, so we compute
138 %% (im-r1)*(nshades-1)/(r2-r1) + 1.5
139 mult = ((nshades-1) / (range(2)-range(1)));
140 d_im = (mult * im) + factor*(1.5 - range(1)*mult);
141end
142
143if isreal(im)
144 if (any(size(im)==1))
145 hh = plot( im);
146 axis([1, prod(size(im)), range]);
147 else
148 hh = image( d_im );
149 axis('off');
150 zoom = pixelAxes(size(d_im),zoom);
151 end
152else
153 if (any(size(im)==1))
154 subplot(2,1,1);
155 hh = plot(real(im));
156 axis([1, prod(size(im)), range]);
157 subplot(2,1,2);
158 hh = plot(imag(im));
159 axis([1, prod(size(im)), range]);
160 else
161 subplot(1,2,1);
162 hh = image(real(d_im));
163 axis('off'); zoom = pixelAxes(size(d_im),zoom);
164 ax = gca; orig_units = get(ax,'Units');
165 set(ax,'Units','points');
166 pos1 = get(ax,'Position');
167 set(ax,'Units',orig_units);
168 subplot(1,2,2);
169 hh = image(imag(d_im));
170 axis('off'); zoom = pixelAxes(size(d_im),zoom);
171 ax = gca; orig_units = get(ax,'Units');
172 set(ax,'Units','points');
173 pos2 = get(ax,'Position');
174 set(ax,'Units',orig_units);
175 xlbl_offset = (pos1(1)-pos2(1))/2;
176 end
177end
178
179if ~any(size(im)==1)
180 colormap(gray(nshades));
181end
182
183if ((label ~= 0))
184 if isstr(label)
185 title(label);
186 h = get(gca,'Title');
187 orig_units = get(h,'Units');
188 set(h,'Units','points');
189 pos = get(h,'Position');
190 pos(1:2) = pos(1:2) + [xlbl_offset, -3]; % MAGIC NUMBER: y pixel offset
191 set(h,'Position',pos);
192 set(h,'Units',orig_units);
193 end
194
195 if (~any(size(im)==1))
196 if (zoom > 1)
197 zformat = sprintf('* %d',round(zoom));
198 else
199 zformat = sprintf('/ %d',round(1/zoom));
200 end
201 if isreal(im)
202 format=[' Range: [%.3g, %.3g] \n Dims: [%d, %d] ', zformat];
203 else
204 format=['Range: [%.3g, %.3g] ---- Dims: [%d, %d]', zformat];
205 end
206 xlabel(sprintf(format, range(1), range(2), size(im,1), size(im,2)));
207 h = get(gca,'Xlabel');
208 set(h,'FontSize', 9); % MAGIC NUMBER: font size!!!
209
210 orig_units = get(h,'Units');
211 set(h,'Units','points');
212 pos = get(h,'Position');
213 pos(1:2) = pos(1:2) + [xlbl_offset, 10]; % MAGIC NUMBER: y offset in points
214 set(h,'Position',pos);
215 set(h,'Units',orig_units);
216
217 set(h,'Visible','on'); % axis('image') turned the xlabel off...
218 end
219end
220
221return;
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/showLpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/showLpyr.m
deleted file mode 100755
index 0d85f9d..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/showLpyr.m
+++ /dev/null
@@ -1,202 +0,0 @@
1% RANGE = showLpyr (PYR, INDICES, RANGE, GAP, LEVEL_SCALE_FACTOR)
2%
3% Display a Laplacian (or Gaussian) pyramid, specified by PYR and
4% INDICES (see buildLpyr), in the current figure.
5%
6% RANGE is a 2-vector specifying the values that map to black and
7% white, respectively. These values are scaled by
8% LEVEL_SCALE_FACTOR^(lev-1) for bands at each level. Passing a value
9% of 'auto1' sets RANGE to the min and max values of MATRIX. 'auto2'
10% sets RANGE to 3 standard deviations below and above 0.0. In both of
11% these cases, the lowpass band is independently scaled. A value of
12% 'indep1' sets the range of each subband independently, as in a call
13% to showIm(subband,'auto1'). Similarly, 'indep2' causes each subband
14% to be scaled independently as if by showIm(subband,'indep2').
15% The default value for RANGE is 'auto1' for 1D images, and 'auto2' for
16% 2D images.
17%
18% GAP (optional, default=1) specifies the gap in pixels to leave
19% between subbands (2D images only).
20%
21% LEVEL_SCALE_FACTOR indicates the relative scaling between pyramid
22% levels. This should be set to the sum of the kernel taps of the
23% lowpass filter used to construct the pyramid (default assumes
24% L2-normalalized filters, using a value of 2 for 2D images, sqrt(2) for
25% 1D images).
26
27% Eero Simoncelli, 2/97.
28
29function [range] = showLpyr(pyr, pind, range, gap, scale);
30
31% Determine 1D or 2D pyramid:
32if ((pind(1,1) == 1) | (pind(1,2) ==1))
33 oned = 1;
34else
35 oned = 0;
36end
37
38%------------------------------------------------------------
39%% OPTIONAL ARGS:
40
41if (exist('range') ~= 1)
42 if (oned==1)
43 range = 'auto1';
44 else
45 range = 'auto2';
46 end
47end
48
49if (exist('gap') ~= 1)
50 gap = 1;
51end
52
53if (exist('scale') ~= 1)
54 if (oned == 1)
55 scale = sqrt(2);
56 else
57 scale = 2;
58 end
59end
60
61%------------------------------------------------------------
62
63nind = size(pind,1);
64
65%% Auto range calculations:
66if strcmp(range,'auto1')
67 range = zeros(nind,1);
68 mn = 0.0; mx = 0.0;
69 for bnum = 1:(nind-1)
70 band = pyrBand(pyr,pind,bnum)/(scale^(bnum-1));
71 range(bnum) = scale^(bnum-1);
72 [bmn,bmx] = range2(band);
73 mn = min(mn, bmn); mx = max(mx, bmx);
74 end
75 if (oned == 1)
76 pad = (mx-mn)/12; % *** MAGIC NUMBER!!
77 mn = mn-pad; mx = mx+pad;
78 end
79 range = range * [mn mx]; % outer product
80 band = pyrLow(pyr,pind);
81 [mn,mx] = range2(band);
82 if (oned == 1)
83 pad = (mx-mn)/12; % *** MAGIC NUMBER!!
84 mn = mn-pad; mx = mx+pad;
85 end
86 range(nind,:) = [mn, mx];
87
88elseif strcmp(range,'indep1')
89 range = zeros(nind,2);
90 for bnum = 1:nind
91 band = pyrBand(pyr,pind,bnum);
92 [mn,mx] = range2(band);
93 if (oned == 1)
94 pad = (mx-mn)/12; % *** MAGIC NUMBER!!
95 mn = mn-pad; mx = mx+pad;
96 end
97 range(bnum,:) = [mn mx];
98 end
99
100elseif strcmp(range,'auto2')
101 range = zeros(nind,1);
102 sqsum = 0; numpixels = 0;
103 for bnum = 1:(nind-1)
104 band = pyrBand(pyr,pind,bnum)/(scale^(bnum-1));
105 sqsum = sqsum + sum(sum(band.^2));
106 numpixels = numpixels + prod(size(band));
107 range(bnum) = scale^(bnum-1);
108 end
109 stdev = sqrt(sqsum/(numpixels-1));
110 range = range * [ -3*stdev 3*stdev ]; % outer product
111 band = pyrLow(pyr,pind);
112 av = mean2(band); stdev = sqrt(var2(band));
113 range(nind,:) = [av-2*stdev,av+2*stdev];
114
115elseif strcmp(range,'indep2')
116 range = zeros(nind,2);
117 for bnum = 1:(nind-1)
118 band = pyrBand(pyr,pind,bnum);
119 stdev = sqrt(var2(band));
120 range(bnum,:) = [ -3*stdev 3*stdev ];
121 end
122 band = pyrLow(pyr,pind);
123 av = mean2(band); stdev = sqrt(var2(band));
124 range(nind,:) = [av-2*stdev,av+2*stdev];
125
126elseif isstr(range)
127 error(sprintf('Bad RANGE argument: %s',range))
128
129elseif ((size(range,1) == 1) & (size(range,2) == 2))
130 scales = scale.^[0:nind-1];
131 range = scales(:) * range; % outer product
132 band = pyrLow(pyr,pind);
133 range(nind,:) = range(nind,:) + mean2(band) - mean(range(nind,:));
134
135end
136
137%% Clear Figure
138clf;
139
140if (oned == 1)
141
142 %%%%% 1D signal:
143 for bnum=1:nind
144 band = pyrBand(pyr,pind,bnum);
145 subplot(nind,1,nind-bnum+1);
146 plot(band);
147 axis([1, prod(size(band)), range(bnum,:)]);
148 end
149
150else
151
152 %%%%% 2D signal:
153 colormap(gray);
154 cmap = get(gcf,'Colormap');
155 nshades = size(cmap,1);
156
157 % Find background color index:
158 clr = get(gcf,'Color');
159 bg = 1;
160 dist = norm(cmap(bg,:)-clr);
161 for n = 1:nshades
162 ndist = norm(cmap(n,:)-clr);
163 if (ndist < dist)
164 dist = ndist;
165 bg = n;
166 end
167 end
168
169 %% Compute positions of subbands:
170 llpos = ones(nind,2);
171 dir = [-1 -1];
172 ctr = [pind(1,1)+1+gap 1];
173 sz = [0 0];
174 for bnum = 1:nind
175 prevsz = sz;
176 sz = pind(bnum,:);
177
178 % Determine center position of new band:
179 ctr = ctr + gap*dir/2 + dir.* floor((prevsz+(dir>0))/2);
180 dir = dir * [0 -1; 1 0]; % ccw rotation
181 ctr = ctr + gap*dir/2 + dir.* floor((sz+(dir<0))/2);
182 llpos(bnum,:) = ctr - floor(sz./2);
183 end
184
185 %% Make position list positive, and allocate appropriate image:
186 llpos = llpos - ones(nind,1)*min(llpos) + 1;
187 urpos = llpos + pind - 1;
188 d_im = bg + zeros(max(urpos));
189
190 %% Paste bands into image, (im-r1)*(nshades-1)/(r2-r1) + 1.5
191 for bnum=1:nind
192 mult = (nshades-1) / (range(bnum,2)-range(bnum,1));
193 d_im(llpos(bnum,1):urpos(bnum,1), llpos(bnum,2):urpos(bnum,2)) = ...
194 mult*pyrBand(pyr,pind,bnum) + (1.5-mult*range(bnum,1));
195 end
196
197 hh = image(d_im);
198 axis('off');
199 pixelAxes(size(d_im),'full');
200 set(hh,'UserData',range);
201
202end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/showSpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/showSpyr.m
deleted file mode 100755
index da85715..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/showSpyr.m
+++ /dev/null
@@ -1,188 +0,0 @@
1% RANGE = showSpyr (PYR, INDICES, RANGE, GAP, LEVEL_SCALE_FACTOR)
2%
3% Display a steerable pyramid, specified by PYR and INDICES
4% (see buildSpyr), in the current figure. The highpass band is not shown.
5%
6% RANGE is a 2-vector specifying the values that map to black and
7% white, respectively. These values are scaled by
8% LEVEL_SCALE_FACTOR^(lev-1) for bands at each level. Passing a value
9% of 'auto1' sets RANGE to the min and max values of MATRIX. 'auto2'
10% sets RANGE to 3 standard deviations below and above 0.0. In both of
11% these cases, the lowpass band is independently scaled. A value of
12% 'indep1' sets the range of each subband independently, as in a call
13% to showIm(subband,'auto1'). Similarly, 'indep2' causes each subband
14% to be scaled independently as if by showIm(subband,'indep2').
15% The default value for RANGE is 'auto2'.
16%
17% GAP (optional, default=1) specifies the gap in pixels to leave
18% between subbands.
19%
20% LEVEL_SCALE_FACTOR indicates the relative scaling between pyramid
21% levels. This should be set to the sum of the kernel taps of the
22% lowpass filter used to construct the pyramid (default is 2, which is
23% correct for L2-normalized filters.
24
25% Eero Simoncelli, 2/97.
26
27function [range] = showSpyr(pyr, pind, range, gap, scale);
28
29nbands = spyrNumBands(pind);
30
31%------------------------------------------------------------
32%% OPTIONAL ARGS:
33
34if (exist('range') ~= 1)
35 range = 'auto2';
36end
37
38if (exist('gap') ~= 1)
39 gap = 1;
40end
41
42if (exist('scale') ~= 1)
43 scale = 2;
44end
45
46%------------------------------------------------------------
47
48ht = spyrHt(pind);
49nind = size(pind,1);
50
51%% Auto range calculations:
52if strcmp(range,'auto1')
53 range = ones(nind,1);
54 band = spyrHigh(pyr,pind);
55 [mn,mx] = range2(band);
56 for lnum = 1:ht
57 for bnum = 1:nbands
58 band = spyrBand(pyr,pind,lnum,bnum)/(scale^(lnum-1));
59 range((lnum-1)*nbands+bnum+1) = scale^(lnum-1);
60 [bmn,bmx] = range2(band);
61 mn = min(mn, bmn);
62 mx = max(mx, bmx);
63 end
64 end
65 range = range * [mn mx]; % outer product
66 band = pyrLow(pyr,pind);
67 [mn,mx] = range2(band);
68 range(nind,:) = [mn, mx];
69
70elseif strcmp(range,'indep1')
71 range = zeros(nind,2);
72 for bnum = 1:nind
73 band = pyrBand(pyr,pind,bnum);
74 [mn,mx] = range2(band);
75 range(bnum,:) = [mn mx];
76 end
77
78elseif strcmp(range,'auto2')
79 range = ones(nind,1);
80 band = spyrHigh(pyr,pind);
81 sqsum = sum(sum(band.^2)); numpixels = prod(size(band));
82 for lnum = 1:ht
83 for bnum = 1:nbands
84 band = spyrBand(pyr,pind,lnum,bnum)/(scale^(lnum-1));
85 sqsum = sqsum + sum(sum(band.^2));
86 numpixels = numpixels + prod(size(band));
87 range((lnum-1)*nbands+bnum+1) = scale^(lnum-1);
88 end
89 end
90 stdev = sqrt(sqsum/(numpixels-1));
91 range = range * [ -3*stdev 3*stdev ]; % outer product
92 band = pyrLow(pyr,pind);
93 av = mean2(band); stdev = sqrt(var2(band));
94 range(nind,:) = [av-2*stdev,av+2*stdev];
95
96elseif strcmp(range,'indep2')
97 range = zeros(nind,2);
98 for bnum = 1:(nind-1)
99 band = pyrBand(pyr,pind,bnum);
100 stdev = sqrt(var2(band));
101 range(bnum,:) = [ -3*stdev 3*stdev ];
102 end
103 band = pyrLow(pyr,pind);
104 av = mean2(band); stdev = sqrt(var2(band));
105 range(nind,:) = [av-2*stdev,av+2*stdev];
106
107elseif isstr(range)
108 error(sprintf('Bad RANGE argument: %s',range))
109
110elseif ((size(range,1) == 1) & (size(range,2) == 2))
111 scales = scale.^[0:(ht-1)];
112 scales = ones(nbands,1) * scales; %outer product
113 scales = [1; scales(:); scale^ht]; %tack on highpass and lowpass
114 range = scales * range; % outer product
115 band = pyrLow(pyr,pind);
116 range(nind,:) = range(nind,:) + mean2(band) - mean(range(nind,:));
117
118end
119
120% CLEAR FIGURE:
121clf;
122
123colormap(gray);
124cmap = get(gcf,'Colormap');
125nshades = size(cmap,1);
126
127% Find background color index:
128clr = get(gcf,'Color');
129bg = 1;
130dist = norm(cmap(bg,:)-clr);
131for n = 1:nshades
132 ndist = norm(cmap(n,:)-clr);
133 if (ndist < dist)
134 dist = ndist;
135 bg = n;
136 end
137end
138
139%% Compute positions of subbands:
140llpos = ones(nind,2);
141
142if (nbands == 2)
143 ncols = 1; nrows = 2;
144else
145 ncols = ceil((nbands+1)/2); nrows = ceil(nbands/2);
146end
147relpos = [ (1-nrows):0, zeros(1,(ncols-1)); ...
148 zeros(1,nrows), -1:-1:(1-ncols) ]';
149if (nbands > 1)
150 mvpos = [-1 -1];
151else
152 mvpos = [0 -1];
153end
154basepos = [0 0];
155
156for lnum = 1:ht
157 ind1 = (lnum-1)*nbands + 2;
158 sz = pind(ind1,:)+gap;
159 basepos = basepos + mvpos .* sz;
160 if (nbands < 5) % to align edges...
161 sz = sz + gap*(ht-lnum+1);
162 end
163 llpos(ind1:ind1+nbands-1,:) = relpos * diag(sz) + ones(nbands,1)*basepos;
164end
165
166% lowpass band
167sz = pind(nind-1,:)+gap;
168basepos = basepos + mvpos .* sz;
169llpos(nind,:) = basepos;
170
171%% Make position list positive, and allocate appropriate image:
172llpos = llpos - ones(nind,1)*min(llpos) + 1;
173llpos(1,:) = [1 1];
174urpos = llpos + pind - 1;
175d_im = bg + zeros(max(urpos));
176
177%% Paste bands into image, (im-r1)*(nshades-1)/(r2-r1) + 1.5
178for bnum=2:nind
179 mult = (nshades-1) / (range(bnum,2)-range(bnum,1));
180 d_im(llpos(bnum,1):urpos(bnum,1), llpos(bnum,2):urpos(bnum,2)) = ...
181 mult*pyrBand(pyr,pind,bnum) + (1.5-mult*range(bnum,1));
182end
183
184hh = image(d_im);
185axis('off');
186pixelAxes(size(d_im),'full');
187set(hh,'UserData',range);
188
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/showWpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/showWpyr.m
deleted file mode 100755
index 510e395..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/showWpyr.m
+++ /dev/null
@@ -1,204 +0,0 @@
1% RANGE = showWpyr (PYR, INDICES, RANGE, GAP, LEVEL_SCALE_FACTOR)
2%
3% Display a separable QMF/wavelet pyramid, specified by PYR and INDICES
4% (see buildWpyr), in the current figure.
5%
6% RANGE is a 2-vector specifying the values that map to black and
7% white, respectively. These values are scaled by
8% LEVEL_SCALE_FACTOR^(lev-1) for bands at each level. Passing a value
9% of 'auto1' sets RANGE to the min and max values of MATRIX. 'auto2'
10% sets RANGE to 3 standard deviations below and above 0.0. In both of
11% these cases, the lowpass band is independently scaled. A value of
12% 'indep1' sets the range of each subband independently, as in a call
13% to showIm(subband,'auto1'). Similarly, 'indep2' causes each subband
14% to be scaled independently as if by showIm(subband,'indep2').
15% The default value for RANGE is 'auto1' for 1D images, and 'auto2' for
16% 2D images.
17%
18% GAP (optional, default=1) specifies the gap in pixels to leave
19% between subbands (2D images only).
20%
21% LEVEL_SCALE_FACTOR indicates the relative scaling between pyramid
22% levels. This should be set to the sum of the kernel taps of the
23% lowpass filter used to construct the pyramid (default assumes
24% L2-normalized filters, using a value of 2 for 2D images, sqrt(2) for
25% 1D images).
26
27% Eero Simoncelli, 2/97.
28
29function [range] = showWpyr(pyr, pind, range, gap, scale);
30
31% Determine 1D or 2D pyramid:
32if ((pind(1,1) == 1) | (pind(1,2) ==1))
33 nbands = 1;
34else
35 nbands = 3;
36end
37
38%------------------------------------------------------------
39%% OPTIONAL ARGS:
40
41if (exist('range') ~= 1)
42 if (nbands==1)
43 range = 'auto1';
44 else
45 range = 'auto2';
46 end
47end
48
49if (exist('gap') ~= 1)
50 gap = 1;
51end
52
53if (exist('scale') ~= 1)
54 if (nbands == 1)
55 scale = sqrt(2);
56 else
57 scale = 2;
58 end
59end
60
61%------------------------------------------------------------
62
63ht = wpyrHt(pind);
64nind = size(pind,1);
65
66%% Auto range calculations:
67if strcmp(range,'auto1')
68 range = zeros(nind,1);
69 mn = 0.0; mx = 0.0;
70 for lnum = 1:ht
71 for bnum = 1:nbands
72 band = wpyrBand(pyr,pind,lnum,bnum)/(scale^(lnum-1));
73 range((lnum-1)*nbands+bnum) = scale^(lnum-1);
74 [bmn,bmx] = range2(band);
75 mn = min(mn, bmn); mx = max(mx, bmx);
76 end
77 end
78 if (nbands == 1)
79 pad = (mx-mn)/12; % *** MAGIC NUMBER!!
80 mn = mn-pad; mx = mx+pad;
81 end
82 range = range * [mn mx]; % outer product
83 band = pyrLow(pyr,pind);
84 [mn,mx] = range2(band);
85 if (nbands == 1)
86 pad = (mx-mn)/12; % *** MAGIC NUMBER!!
87 mn = mn-pad; mx = mx+pad;
88 end
89 range(nind,:) = [mn, mx];
90
91elseif strcmp(range,'indep1')
92 range = zeros(nind,2);
93 for bnum = 1:nind
94 band = pyrBand(pyr,pind,bnum);
95 [mn,mx] = range2(band);
96 if (nbands == 1)
97 pad = (mx-mn)/12; % *** MAGIC NUMBER!!
98 mn = mn-pad; mx = mx+pad;
99 end
100 range(bnum,:) = [mn mx];
101 end
102
103elseif strcmp(range,'auto2')
104 range = zeros(nind,1);
105 sqsum = 0; numpixels = 0;
106 for lnum = 1:ht
107 for bnum = 1:nbands
108 band = wpyrBand(pyr,pind,lnum,bnum)/(scale^(lnum-1));
109 sqsum = sqsum + sum(sum(band.^2));
110 numpixels = numpixels + prod(size(band));
111 range((lnum-1)*nbands+bnum) = scale^(lnum-1);
112 end
113 end
114 stdev = sqrt(sqsum/(numpixels-1));
115 range = range * [ -3*stdev 3*stdev ]; % outer product
116 band = pyrLow(pyr,pind);
117 av = mean2(band); stdev = sqrt(var2(band));
118 range(nind,:) = [av-2*stdev,av+2*stdev];
119
120elseif strcmp(range,'indep2')
121 range = zeros(nind,2);
122 for bnum = 1:(nind-1)
123 band = pyrBand(pyr,pind,bnum);
124 stdev = sqrt(var2(band));
125 range(bnum,:) = [ -3*stdev 3*stdev ];
126 end
127 band = pyrLow(pyr,pind);
128 av = mean2(band); stdev = sqrt(var2(band));
129 range(nind,:) = [av-2*stdev,av+2*stdev];
130
131elseif isstr(range)
132 error(sprintf('Bad RANGE argument: %s',range))
133
134elseif ((size(range,1) == 1) & (size(range,2) == 2))
135 scales = scale.^[0:ht];
136 if (nbands ~= 1)
137 scales = [scales; scales; scales];
138 end
139 range = scales(:) * range; % outer product
140 band = pyrLow(pyr,pind);
141 range(nind,:) = range(nind,:) + mean2(band) - mean(range(nind,:));
142
143end
144
145% CLEAR FIGURE:
146clf;
147
148if (nbands == 1)
149
150 %%%%% 1D signal:
151 for bnum=1:nind
152 band = pyrBand(pyr,pind,bnum);
153 subplot(nind,1,nind-bnum+1);
154 plot(band);
155 axis([1, prod(size(band)), range(bnum,:)]);
156 end
157
158else
159
160 %%%%% 2D signal:
161 colormap(gray);
162 cmap = get(gcf,'Colormap');
163 nshades = size(cmap,1);
164
165 % Find background color index:
166 clr = get(gcf,'Color');
167 bg = 1;
168 dist = norm(cmap(bg,:)-clr);
169 for n = 1:nshades
170 ndist = norm(cmap(n,:)-clr);
171 if (ndist < dist)
172 dist = ndist;
173 bg = n;
174 end
175 end
176
177 %% Compute positions of subbands:
178 llpos = ones(nind,2);
179 for lnum = 1:ht
180 ind1 = nbands*(lnum-1) + 1;
181 xpos = pind(ind1,2) + 1 + gap*(ht-lnum+1);
182 ypos = pind(ind1+1,1) + 1 + gap*(ht-lnum+1);
183 llpos(ind1:ind1+2,:) = [ypos 1; 1 xpos; ypos xpos];
184 end
185 llpos(nind,:) = [1 1]; %lowpass
186
187 %% Make position list positive, and allocate appropriate image:
188 llpos = llpos - ones(nind,1)*min(llpos) + 1;
189 urpos = llpos + pind - 1;
190 d_im = bg + zeros(max(urpos));
191
192 %% Paste bands into image, (im-r1)*(nshades-1)/(r2-r1) + 1.5
193 for bnum=1:nind
194 mult = (nshades-1) / (range(bnum,2)-range(bnum,1));
195 d_im(llpos(bnum,1):urpos(bnum,1), llpos(bnum,2):urpos(bnum,2)) = ...
196 mult*pyrBand(pyr,pind,bnum) + (1.5-mult*range(bnum,1));
197 end
198
199 hh = image(d_im);
200 axis('off');
201 pixelAxes(size(d_im),'full');
202 set(hh,'UserData',range);
203
204end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/skew2.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/skew2.m
deleted file mode 100755
index 623d6ca..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/skew2.m
+++ /dev/null
@@ -1,21 +0,0 @@
1% S = SKEW2(MTX,MEAN,VAR)
2%
3% Sample skew (third moment divided by variance^3/2) of a matrix.
4% MEAN (optional) and VAR (optional) make the computation faster.
5
6function res = skew2(mtx, mn, v)
7
8if (exist('mn') ~= 1)
9 mn = mean2(mtx);
10end
11
12if (exist('v') ~= 1)
13 v = var2(mtx,mn);
14end
15
16if (isreal(mtx))
17 res = mean(mean((mtx-mn).^3)) / (v^(3/2));
18else
19 res = mean(mean(real(mtx-mn).^3)) / (real(v)^(3/2)) + ...
20 i * mean(mean(imag(mtx-mn).^3)) / (imag(v)^(3/2));
21end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/sp0Filters.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/sp0Filters.m
deleted file mode 100755
index 6b25e36..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/sp0Filters.m
+++ /dev/null
@@ -1,72 +0,0 @@
1% Steerable pyramid filters. Transform described in:
2%
3% @INPROCEEDINGS{Simoncelli95b,
4% TITLE = "The Steerable Pyramid: A Flexible Architecture for
5% Multi-Scale Derivative Computation",
6% AUTHOR = "E P Simoncelli and W T Freeman",
7% BOOKTITLE = "Second Int'l Conf on Image Processing",
8% ADDRESS = "Washington, DC", MONTH = "October", YEAR = 1995 }
9%
10% Filter kernel design described in:
11%
12%@INPROCEEDINGS{Karasaridis96,
13% TITLE = "A Filter Design Technique for
14% Steerable Pyramid Image Transforms",
15% AUTHOR = "A Karasaridis and E P Simoncelli",
16% BOOKTITLE = "ICASSP", ADDRESS = "Atlanta, GA",
17% MONTH = "May", YEAR = 1996 }
18
19% Eero Simoncelli, 6/96.
20
21function [lo0filt,hi0filt,lofilt,bfilts,mtx,harmonics] = sp0Filters();
22
23harmonics = [ 0 ];
24
25lo0filt = [ ...
26-4.514000e-04 -1.137100e-04 -3.725800e-04 -3.743860e-03 -3.725800e-04 -1.137100e-04 -4.514000e-04
27-1.137100e-04 -6.119520e-03 -1.344160e-02 -7.563200e-03 -1.344160e-02 -6.119520e-03 -1.137100e-04
28-3.725800e-04 -1.344160e-02 6.441488e-02 1.524935e-01 6.441488e-02 -1.344160e-02 -3.725800e-04
29-3.743860e-03 -7.563200e-03 1.524935e-01 3.153017e-01 1.524935e-01 -7.563200e-03 -3.743860e-03
30-3.725800e-04 -1.344160e-02 6.441488e-02 1.524935e-01 6.441488e-02 -1.344160e-02 -3.725800e-04
31-1.137100e-04 -6.119520e-03 -1.344160e-02 -7.563200e-03 -1.344160e-02 -6.119520e-03 -1.137100e-04
32-4.514000e-04 -1.137100e-04 -3.725800e-04 -3.743860e-03 -3.725800e-04 -1.137100e-04 -4.514000e-04];
33
34lofilt = [ ...
35-2.257000e-04 -8.064400e-04 -5.686000e-05 8.741400e-04 -1.862800e-04 -1.031640e-03 -1.871920e-03 -1.031640e-03 -1.862800e-04 8.741400e-04 -5.686000e-05 -8.064400e-04 -2.257000e-04
36-8.064400e-04 1.417620e-03 -1.903800e-04 -2.449060e-03 -4.596420e-03 -7.006740e-03 -6.948900e-03 -7.006740e-03 -4.596420e-03 -2.449060e-03 -1.903800e-04 1.417620e-03 -8.064400e-04
37-5.686000e-05 -1.903800e-04 -3.059760e-03 -6.401000e-03 -6.720800e-03 -5.236180e-03 -3.781600e-03 -5.236180e-03 -6.720800e-03 -6.401000e-03 -3.059760e-03 -1.903800e-04 -5.686000e-05
388.741400e-04 -2.449060e-03 -6.401000e-03 -5.260020e-03 3.938620e-03 1.722078e-02 2.449600e-02 1.722078e-02 3.938620e-03 -5.260020e-03 -6.401000e-03 -2.449060e-03 8.741400e-04
39-1.862800e-04 -4.596420e-03 -6.720800e-03 3.938620e-03 3.220744e-02 6.306262e-02 7.624674e-02 6.306262e-02 3.220744e-02 3.938620e-03 -6.720800e-03 -4.596420e-03 -1.862800e-04
40-1.031640e-03 -7.006740e-03 -5.236180e-03 1.722078e-02 6.306262e-02 1.116388e-01 1.348999e-01 1.116388e-01 6.306262e-02 1.722078e-02 -5.236180e-03 -7.006740e-03 -1.031640e-03
41-1.871920e-03 -6.948900e-03 -3.781600e-03 2.449600e-02 7.624674e-02 1.348999e-01 1.576508e-01 1.348999e-01 7.624674e-02 2.449600e-02 -3.781600e-03 -6.948900e-03 -1.871920e-03
42-1.031640e-03 -7.006740e-03 -5.236180e-03 1.722078e-02 6.306262e-02 1.116388e-01 1.348999e-01 1.116388e-01 6.306262e-02 1.722078e-02 -5.236180e-03 -7.006740e-03 -1.031640e-03
43-1.862800e-04 -4.596420e-03 -6.720800e-03 3.938620e-03 3.220744e-02 6.306262e-02 7.624674e-02 6.306262e-02 3.220744e-02 3.938620e-03 -6.720800e-03 -4.596420e-03 -1.862800e-04
448.741400e-04 -2.449060e-03 -6.401000e-03 -5.260020e-03 3.938620e-03 1.722078e-02 2.449600e-02 1.722078e-02 3.938620e-03 -5.260020e-03 -6.401000e-03 -2.449060e-03 8.741400e-04
45-5.686000e-05 -1.903800e-04 -3.059760e-03 -6.401000e-03 -6.720800e-03 -5.236180e-03 -3.781600e-03 -5.236180e-03 -6.720800e-03 -6.401000e-03 -3.059760e-03 -1.903800e-04 -5.686000e-05
46-8.064400e-04 1.417620e-03 -1.903800e-04 -2.449060e-03 -4.596420e-03 -7.006740e-03 -6.948900e-03 -7.006740e-03 -4.596420e-03 -2.449060e-03 -1.903800e-04 1.417620e-03 -8.064400e-04
47-2.257000e-04 -8.064400e-04 -5.686000e-05 8.741400e-04 -1.862800e-04 -1.031640e-03 -1.871920e-03 -1.031640e-03 -1.862800e-04 8.741400e-04 -5.686000e-05 -8.064400e-04 -2.257000e-04];
48
49mtx = [ 1.000000 ];
50
51hi0filt = [...
525.997200e-04 -6.068000e-05 -3.324900e-04 -3.325600e-04 -2.406600e-04 -3.325600e-04 -3.324900e-04 -6.068000e-05 5.997200e-04
53-6.068000e-05 1.263100e-04 4.927100e-04 1.459700e-04 -3.732100e-04 1.459700e-04 4.927100e-04 1.263100e-04 -6.068000e-05
54-3.324900e-04 4.927100e-04 -1.616650e-03 -1.437358e-02 -2.420138e-02 -1.437358e-02 -1.616650e-03 4.927100e-04 -3.324900e-04
55-3.325600e-04 1.459700e-04 -1.437358e-02 -6.300923e-02 -9.623594e-02 -6.300923e-02 -1.437358e-02 1.459700e-04 -3.325600e-04
56-2.406600e-04 -3.732100e-04 -2.420138e-02 -9.623594e-02 8.554893e-01 -9.623594e-02 -2.420138e-02 -3.732100e-04 -2.406600e-04
57-3.325600e-04 1.459700e-04 -1.437358e-02 -6.300923e-02 -9.623594e-02 -6.300923e-02 -1.437358e-02 1.459700e-04 -3.325600e-04
58-3.324900e-04 4.927100e-04 -1.616650e-03 -1.437358e-02 -2.420138e-02 -1.437358e-02 -1.616650e-03 4.927100e-04 -3.324900e-04
59-6.068000e-05 1.263100e-04 4.927100e-04 1.459700e-04 -3.732100e-04 1.459700e-04 4.927100e-04 1.263100e-04 -6.068000e-05
605.997200e-04 -6.068000e-05 -3.324900e-04 -3.325600e-04 -2.406600e-04 -3.325600e-04 -3.324900e-04 -6.068000e-05 5.997200e-04 ];
61
62bfilts = [ ...
63-9.066000e-05 -1.738640e-03 -4.942500e-03 -7.889390e-03 -1.009473e-02 -7.889390e-03 -4.942500e-03 -1.738640e-03 -9.066000e-05 ...
64-1.738640e-03 -4.625150e-03 -7.272540e-03 -7.623410e-03 -9.091950e-03 -7.623410e-03 -7.272540e-03 -4.625150e-03 -1.738640e-03 ...
65-4.942500e-03 -7.272540e-03 -2.129540e-02 -2.435662e-02 -3.487008e-02 -2.435662e-02 -2.129540e-02 -7.272540e-03 -4.942500e-03 ...
66-7.889390e-03 -7.623410e-03 -2.435662e-02 -1.730466e-02 -3.158605e-02 -1.730466e-02 -2.435662e-02 -7.623410e-03 -7.889390e-03 ...
67-1.009473e-02 -9.091950e-03 -3.487008e-02 -3.158605e-02 9.464195e-01 -3.158605e-02 -3.487008e-02 -9.091950e-03 -1.009473e-02 ...
68-7.889390e-03 -7.623410e-03 -2.435662e-02 -1.730466e-02 -3.158605e-02 -1.730466e-02 -2.435662e-02 -7.623410e-03 -7.889390e-03 ...
69-4.942500e-03 -7.272540e-03 -2.129540e-02 -2.435662e-02 -3.487008e-02 -2.435662e-02 -2.129540e-02 -7.272540e-03 -4.942500e-03 ...
70-1.738640e-03 -4.625150e-03 -7.272540e-03 -7.623410e-03 -9.091950e-03 -7.623410e-03 -7.272540e-03 -4.625150e-03 -1.738640e-03 ...
71-9.066000e-05 -1.738640e-03 -4.942500e-03 -7.889390e-03 -1.009473e-02 -7.889390e-03 -4.942500e-03 -1.738640e-03 -9.066000e-05 ]';
72
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/sp1Filters.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/sp1Filters.m
deleted file mode 100755
index 215e651..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/sp1Filters.m
+++ /dev/null
@@ -1,91 +0,0 @@
1% Steerable pyramid filters. Transform described in:
2%
3% @INPROCEEDINGS{Simoncelli95b,
4% TITLE = "The Steerable Pyramid: A Flexible Architecture for
5% Multi-Scale Derivative Computation",
6% AUTHOR = "E P Simoncelli and W T Freeman",
7% BOOKTITLE = "Second Int'l Conf on Image Processing",
8% ADDRESS = "Washington, DC", MONTH = "October", YEAR = 1995 }
9%
10% Filter kernel design described in:
11%
12%@INPROCEEDINGS{Karasaridis96,
13% TITLE = "A Filter Design Technique for
14% Steerable Pyramid Image Transforms",
15% AUTHOR = "A Karasaridis and E P Simoncelli",
16% BOOKTITLE = "ICASSP", ADDRESS = "Atlanta, GA",
17% MONTH = "May", YEAR = 1996 }
18
19% Eero Simoncelli, 6/96.
20
21function [lo0filt,hi0filt,lofilt,bfilts,mtx,harmonics] = sp1Filters();
22
23harmonics = [ 1 ];
24
25%% filters only contain first harmonic.
26mtx = eye(2);
27
28lo0filt = [ ...
29-8.701000e-05 -1.354280e-03 -1.601260e-03 -5.033700e-04 2.524010e-03 -5.033700e-04 -1.601260e-03 -1.354280e-03 -8.701000e-05
30-1.354280e-03 2.921580e-03 7.522720e-03 8.224420e-03 1.107620e-03 8.224420e-03 7.522720e-03 2.921580e-03 -1.354280e-03
31-1.601260e-03 7.522720e-03 -7.061290e-03 -3.769487e-02 -3.297137e-02 -3.769487e-02 -7.061290e-03 7.522720e-03 -1.601260e-03
32-5.033700e-04 8.224420e-03 -3.769487e-02 4.381320e-02 1.811603e-01 4.381320e-02 -3.769487e-02 8.224420e-03 -5.033700e-04
332.524010e-03 1.107620e-03 -3.297137e-02 1.811603e-01 4.376250e-01 1.811603e-01 -3.297137e-02 1.107620e-03 2.524010e-03
34-5.033700e-04 8.224420e-03 -3.769487e-02 4.381320e-02 1.811603e-01 4.381320e-02 -3.769487e-02 8.224420e-03 -5.033700e-04
35-1.601260e-03 7.522720e-03 -7.061290e-03 -3.769487e-02 -3.297137e-02 -3.769487e-02 -7.061290e-03 7.522720e-03 -1.601260e-03
36-1.354280e-03 2.921580e-03 7.522720e-03 8.224420e-03 1.107620e-03 8.224420e-03 7.522720e-03 2.921580e-03 -1.354280e-03
37-8.701000e-05 -1.354280e-03 -1.601260e-03 -5.033700e-04 2.524010e-03 -5.033700e-04 -1.601260e-03 -1.354280e-03 -8.701000e-05
38];
39
40lofilt = [ ...
41-4.350000e-05 1.207800e-04 -6.771400e-04 -1.243400e-04 -8.006400e-04 -1.597040e-03 -2.516800e-04 -4.202000e-04 1.262000e-03 -4.202000e-04 -2.516800e-04 -1.597040e-03 -8.006400e-04 -1.243400e-04 -6.771400e-04 1.207800e-04 -4.350000e-05 ; ...
421.207800e-04 4.460600e-04 -5.814600e-04 5.621600e-04 -1.368800e-04 2.325540e-03 2.889860e-03 4.287280e-03 5.589400e-03 4.287280e-03 2.889860e-03 2.325540e-03 -1.368800e-04 5.621600e-04 -5.814600e-04 4.460600e-04 1.207800e-04 ; ...
43-6.771400e-04 -5.814600e-04 1.460780e-03 2.160540e-03 3.761360e-03 3.080980e-03 4.112200e-03 2.221220e-03 5.538200e-04 2.221220e-03 4.112200e-03 3.080980e-03 3.761360e-03 2.160540e-03 1.460780e-03 -5.814600e-04 -6.771400e-04 ; ...
44-1.243400e-04 5.621600e-04 2.160540e-03 3.175780e-03 3.184680e-03 -1.777480e-03 -7.431700e-03 -9.056920e-03 -9.637220e-03 -9.056920e-03 -7.431700e-03 -1.777480e-03 3.184680e-03 3.175780e-03 2.160540e-03 5.621600e-04 -1.243400e-04 ; ...
45-8.006400e-04 -1.368800e-04 3.761360e-03 3.184680e-03 -3.530640e-03 -1.260420e-02 -1.884744e-02 -1.750818e-02 -1.648568e-02 -1.750818e-02 -1.884744e-02 -1.260420e-02 -3.530640e-03 3.184680e-03 3.761360e-03 -1.368800e-04 -8.006400e-04 ; ...
46-1.597040e-03 2.325540e-03 3.080980e-03 -1.777480e-03 -1.260420e-02 -2.022938e-02 -1.109170e-02 3.955660e-03 1.438512e-02 3.955660e-03 -1.109170e-02 -2.022938e-02 -1.260420e-02 -1.777480e-03 3.080980e-03 2.325540e-03 -1.597040e-03 ; ...
47-2.516800e-04 2.889860e-03 4.112200e-03 -7.431700e-03 -1.884744e-02 -1.109170e-02 2.190660e-02 6.806584e-02 9.058014e-02 6.806584e-02 2.190660e-02 -1.109170e-02 -1.884744e-02 -7.431700e-03 4.112200e-03 2.889860e-03 -2.516800e-04 ; ...
48-4.202000e-04 4.287280e-03 2.221220e-03 -9.056920e-03 -1.750818e-02 3.955660e-03 6.806584e-02 1.445500e-01 1.773651e-01 1.445500e-01 6.806584e-02 3.955660e-03 -1.750818e-02 -9.056920e-03 2.221220e-03 4.287280e-03 -4.202000e-04 ; ...
491.262000e-03 5.589400e-03 5.538200e-04 -9.637220e-03 -1.648568e-02 1.438512e-02 9.058014e-02 1.773651e-01 2.120374e-01 1.773651e-01 9.058014e-02 1.438512e-02 -1.648568e-02 -9.637220e-03 5.538200e-04 5.589400e-03 1.262000e-03 ; ...
50-4.202000e-04 4.287280e-03 2.221220e-03 -9.056920e-03 -1.750818e-02 3.955660e-03 6.806584e-02 1.445500e-01 1.773651e-01 1.445500e-01 6.806584e-02 3.955660e-03 -1.750818e-02 -9.056920e-03 2.221220e-03 4.287280e-03 -4.202000e-04 ; ...
51-2.516800e-04 2.889860e-03 4.112200e-03 -7.431700e-03 -1.884744e-02 -1.109170e-02 2.190660e-02 6.806584e-02 9.058014e-02 6.806584e-02 2.190660e-02 -1.109170e-02 -1.884744e-02 -7.431700e-03 4.112200e-03 2.889860e-03 -2.516800e-04 ; ...
52-1.597040e-03 2.325540e-03 3.080980e-03 -1.777480e-03 -1.260420e-02 -2.022938e-02 -1.109170e-02 3.955660e-03 1.438512e-02 3.955660e-03 -1.109170e-02 -2.022938e-02 -1.260420e-02 -1.777480e-03 3.080980e-03 2.325540e-03 -1.597040e-03 ; ...
53-8.006400e-04 -1.368800e-04 3.761360e-03 3.184680e-03 -3.530640e-03 -1.260420e-02 -1.884744e-02 -1.750818e-02 -1.648568e-02 -1.750818e-02 -1.884744e-02 -1.260420e-02 -3.530640e-03 3.184680e-03 3.761360e-03 -1.368800e-04 -8.006400e-04 ; ...
54-1.243400e-04 5.621600e-04 2.160540e-03 3.175780e-03 3.184680e-03 -1.777480e-03 -7.431700e-03 -9.056920e-03 -9.637220e-03 -9.056920e-03 -7.431700e-03 -1.777480e-03 3.184680e-03 3.175780e-03 2.160540e-03 5.621600e-04 -1.243400e-04 ; ...
55-6.771400e-04 -5.814600e-04 1.460780e-03 2.160540e-03 3.761360e-03 3.080980e-03 4.112200e-03 2.221220e-03 5.538200e-04 2.221220e-03 4.112200e-03 3.080980e-03 3.761360e-03 2.160540e-03 1.460780e-03 -5.814600e-04 -6.771400e-04 ; ...
561.207800e-04 4.460600e-04 -5.814600e-04 5.621600e-04 -1.368800e-04 2.325540e-03 2.889860e-03 4.287280e-03 5.589400e-03 4.287280e-03 2.889860e-03 2.325540e-03 -1.368800e-04 5.621600e-04 -5.814600e-04 4.460600e-04 1.207800e-04 ; ...
57-4.350000e-05 1.207800e-04 -6.771400e-04 -1.243400e-04 -8.006400e-04 -1.597040e-03 -2.516800e-04 -4.202000e-04 1.262000e-03 -4.202000e-04 -2.516800e-04 -1.597040e-03 -8.006400e-04 -1.243400e-04 -6.771400e-04 1.207800e-04 -4.350000e-05 ];
58
59hi0filt = [...
60-9.570000e-04 -2.424100e-04 -1.424720e-03 -8.742600e-04 -1.166810e-03 -8.742600e-04 -1.424720e-03 -2.424100e-04 -9.570000e-04 ; ...
61-2.424100e-04 -4.317530e-03 8.998600e-04 9.156420e-03 1.098012e-02 9.156420e-03 8.998600e-04 -4.317530e-03 -2.424100e-04 ; ...
62-1.424720e-03 8.998600e-04 1.706347e-02 1.094866e-02 -5.897780e-03 1.094866e-02 1.706347e-02 8.998600e-04 -1.424720e-03 ; ...
63-8.742600e-04 9.156420e-03 1.094866e-02 -7.841370e-02 -1.562827e-01 -7.841370e-02 1.094866e-02 9.156420e-03 -8.742600e-04 ; ...
64-1.166810e-03 1.098012e-02 -5.897780e-03 -1.562827e-01 7.282593e-01 -1.562827e-01 -5.897780e-03 1.098012e-02 -1.166810e-03 ; ...
65-8.742600e-04 9.156420e-03 1.094866e-02 -7.841370e-02 -1.562827e-01 -7.841370e-02 1.094866e-02 9.156420e-03 -8.742600e-04 ; ...
66-1.424720e-03 8.998600e-04 1.706347e-02 1.094866e-02 -5.897780e-03 1.094866e-02 1.706347e-02 8.998600e-04 -1.424720e-03 ; ...
67-2.424100e-04 -4.317530e-03 8.998600e-04 9.156420e-03 1.098012e-02 9.156420e-03 8.998600e-04 -4.317530e-03 -2.424100e-04 ; ...
68-9.570000e-04 -2.424100e-04 -1.424720e-03 -8.742600e-04 -1.166810e-03 -8.742600e-04 -1.424720e-03 -2.424100e-04 -9.570000e-04 ];
69
70bfilts = -[ ...
716.125880e-03 -8.052600e-03 -2.103714e-02 -1.536890e-02 -1.851466e-02 -1.536890e-02 -2.103714e-02 -8.052600e-03 6.125880e-03 ...
72-1.287416e-02 -9.611520e-03 1.023569e-02 6.009450e-03 1.872620e-03 6.009450e-03 1.023569e-02 -9.611520e-03 -1.287416e-02 ...
73-5.641530e-03 4.168400e-03 -2.382180e-02 -5.375324e-02 -2.076086e-02 -5.375324e-02 -2.382180e-02 4.168400e-03 -5.641530e-03 ...
74-8.957260e-03 -1.751170e-03 -1.836909e-02 1.265655e-01 2.996168e-01 1.265655e-01 -1.836909e-02 -1.751170e-03 -8.957260e-03 ...
750.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 ...
768.957260e-03 1.751170e-03 1.836909e-02 -1.265655e-01 -2.996168e-01 -1.265655e-01 1.836909e-02 1.751170e-03 8.957260e-03 ...
775.641530e-03 -4.168400e-03 2.382180e-02 5.375324e-02 2.076086e-02 5.375324e-02 2.382180e-02 -4.168400e-03 5.641530e-03 ...
781.287416e-02 9.611520e-03 -1.023569e-02 -6.009450e-03 -1.872620e-03 -6.009450e-03 -1.023569e-02 9.611520e-03 1.287416e-02 ...
79-6.125880e-03 8.052600e-03 2.103714e-02 1.536890e-02 1.851466e-02 1.536890e-02 2.103714e-02 8.052600e-03 -6.125880e-03; ...
80...
81-6.125880e-03 1.287416e-02 5.641530e-03 8.957260e-03 0.000000e+00 -8.957260e-03 -5.641530e-03 -1.287416e-02 6.125880e-03 ...
828.052600e-03 9.611520e-03 -4.168400e-03 1.751170e-03 0.000000e+00 -1.751170e-03 4.168400e-03 -9.611520e-03 -8.052600e-03 ...
832.103714e-02 -1.023569e-02 2.382180e-02 1.836909e-02 0.000000e+00 -1.836909e-02 -2.382180e-02 1.023569e-02 -2.103714e-02 ...
841.536890e-02 -6.009450e-03 5.375324e-02 -1.265655e-01 0.000000e+00 1.265655e-01 -5.375324e-02 6.009450e-03 -1.536890e-02 ...
851.851466e-02 -1.872620e-03 2.076086e-02 -2.996168e-01 0.000000e+00 2.996168e-01 -2.076086e-02 1.872620e-03 -1.851466e-02 ...
861.536890e-02 -6.009450e-03 5.375324e-02 -1.265655e-01 0.000000e+00 1.265655e-01 -5.375324e-02 6.009450e-03 -1.536890e-02 ...
872.103714e-02 -1.023569e-02 2.382180e-02 1.836909e-02 0.000000e+00 -1.836909e-02 -2.382180e-02 1.023569e-02 -2.103714e-02 ...
888.052600e-03 9.611520e-03 -4.168400e-03 1.751170e-03 0.000000e+00 -1.751170e-03 4.168400e-03 -9.611520e-03 -8.052600e-03 ...
89-6.125880e-03 1.287416e-02 5.641530e-03 8.957260e-03 0.000000e+00 -8.957260e-03 -5.641530e-03 -1.287416e-02 6.125880e-03 ...
90]';
91
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/sp3Filters.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/sp3Filters.m
deleted file mode 100755
index c9cfaaf..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/sp3Filters.m
+++ /dev/null
@@ -1,121 +0,0 @@
1% Steerable pyramid filters. Transform described in:
2%
3% @INPROCEEDINGS{Simoncelli95b,
4% TITLE = "The Steerable Pyramid: A Flexible Architecture for
5% Multi-Scale Derivative Computation",
6% AUTHOR = "E P Simoncelli and W T Freeman",
7% BOOKTITLE = "Second Int'l Conf on Image Processing",
8% ADDRESS = "Washington, DC", MONTH = "October", YEAR = 1995 }
9%
10% Filter kernel design described in:
11%
12%@INPROCEEDINGS{Karasaridis96,
13% TITLE = "A Filter Design Technique for
14% Steerable Pyramid Image Transforms",
15% AUTHOR = "A Karasaridis and E P Simoncelli",
16% BOOKTITLE = "ICASSP", ADDRESS = "Atlanta, GA",
17% MONTH = "May", YEAR = 1996 }
18
19% Eero Simoncelli, 6/96.
20
21function [lo0filt,hi0filt,lofilt,bfilts,mtx,harmonics] = sp3Filters();
22
23harmonics = [1 3];
24
25mtx = [ ...
26 0.5000 0.3536 0 -0.3536
27 -0.0000 0.3536 0.5000 0.3536
28 0.5000 -0.3536 0 0.3536
29 -0.0000 0.3536 -0.5000 0.3536];
30
31hi0filt = [
32-4.0483998600E-4 -6.2596000498E-4 -3.7829999201E-5 8.8387000142E-4 1.5450799838E-3 1.9235999789E-3 2.0687500946E-3 2.0898699295E-3 2.0687500946E-3 1.9235999789E-3 1.5450799838E-3 8.8387000142E-4 -3.7829999201E-5 -6.2596000498E-4 -4.0483998600E-4
33-6.2596000498E-4 -3.2734998967E-4 7.7435001731E-4 1.5874400269E-3 2.1750701126E-3 2.5626500137E-3 2.2892199922E-3 1.9755100366E-3 2.2892199922E-3 2.5626500137E-3 2.1750701126E-3 1.5874400269E-3 7.7435001731E-4 -3.2734998967E-4 -6.2596000498E-4
34-3.7829999201E-5 7.7435001731E-4 1.1793200392E-3 1.4050999889E-3 2.2253401112E-3 2.1145299543E-3 3.3578000148E-4 -8.3368999185E-4 3.3578000148E-4 2.1145299543E-3 2.2253401112E-3 1.4050999889E-3 1.1793200392E-3 7.7435001731E-4 -3.7829999201E-5
358.8387000142E-4 1.5874400269E-3 1.4050999889E-3 1.2960999738E-3 -4.9274001503E-4 -3.1295299996E-3 -4.5751798898E-3 -5.1014497876E-3 -4.5751798898E-3 -3.1295299996E-3 -4.9274001503E-4 1.2960999738E-3 1.4050999889E-3 1.5874400269E-3 8.8387000142E-4
361.5450799838E-3 2.1750701126E-3 2.2253401112E-3 -4.9274001503E-4 -6.3222697936E-3 -2.7556000277E-3 5.3632198833E-3 7.3032598011E-3 5.3632198833E-3 -2.7556000277E-3 -6.3222697936E-3 -4.9274001503E-4 2.2253401112E-3 2.1750701126E-3 1.5450799838E-3
371.9235999789E-3 2.5626500137E-3 2.1145299543E-3 -3.1295299996E-3 -2.7556000277E-3 1.3962360099E-2 7.8046298586E-3 -9.3812197447E-3 7.8046298586E-3 1.3962360099E-2 -2.7556000277E-3 -3.1295299996E-3 2.1145299543E-3 2.5626500137E-3 1.9235999789E-3
382.0687500946E-3 2.2892199922E-3 3.3578000148E-4 -4.5751798898E-3 5.3632198833E-3 7.8046298586E-3 -7.9501636326E-2 -0.1554141641 -7.9501636326E-2 7.8046298586E-3 5.3632198833E-3 -4.5751798898E-3 3.3578000148E-4 2.2892199922E-3 2.0687500946E-3
392.0898699295E-3 1.9755100366E-3 -8.3368999185E-4 -5.1014497876E-3 7.3032598011E-3 -9.3812197447E-3 -0.1554141641 0.7303866148 -0.1554141641 -9.3812197447E-3 7.3032598011E-3 -5.1014497876E-3 -8.3368999185E-4 1.9755100366E-3 2.0898699295E-3
402.0687500946E-3 2.2892199922E-3 3.3578000148E-4 -4.5751798898E-3 5.3632198833E-3 7.8046298586E-3 -7.9501636326E-2 -0.1554141641 -7.9501636326E-2 7.8046298586E-3 5.3632198833E-3 -4.5751798898E-3 3.3578000148E-4 2.2892199922E-3 2.0687500946E-3
411.9235999789E-3 2.5626500137E-3 2.1145299543E-3 -3.1295299996E-3 -2.7556000277E-3 1.3962360099E-2 7.8046298586E-3 -9.3812197447E-3 7.8046298586E-3 1.3962360099E-2 -2.7556000277E-3 -3.1295299996E-3 2.1145299543E-3 2.5626500137E-3 1.9235999789E-3
421.5450799838E-3 2.1750701126E-3 2.2253401112E-3 -4.9274001503E-4 -6.3222697936E-3 -2.7556000277E-3 5.3632198833E-3 7.3032598011E-3 5.3632198833E-3 -2.7556000277E-3 -6.3222697936E-3 -4.9274001503E-4 2.2253401112E-3 2.1750701126E-3 1.5450799838E-3
438.8387000142E-4 1.5874400269E-3 1.4050999889E-3 1.2960999738E-3 -4.9274001503E-4 -3.1295299996E-3 -4.5751798898E-3 -5.1014497876E-3 -4.5751798898E-3 -3.1295299996E-3 -4.9274001503E-4 1.2960999738E-3 1.4050999889E-3 1.5874400269E-3 8.8387000142E-4
44-3.7829999201E-5 7.7435001731E-4 1.1793200392E-3 1.4050999889E-3 2.2253401112E-3 2.1145299543E-3 3.3578000148E-4 -8.3368999185E-4 3.3578000148E-4 2.1145299543E-3 2.2253401112E-3 1.4050999889E-3 1.1793200392E-3 7.7435001731E-4 -3.7829999201E-5
45-6.2596000498E-4 -3.2734998967E-4 7.7435001731E-4 1.5874400269E-3 2.1750701126E-3 2.5626500137E-3 2.2892199922E-3 1.9755100366E-3 2.2892199922E-3 2.5626500137E-3 2.1750701126E-3 1.5874400269E-3 7.7435001731E-4 -3.2734998967E-4 -6.2596000498E-4
46-4.0483998600E-4 -6.2596000498E-4 -3.7829999201E-5 8.8387000142E-4 1.5450799838E-3 1.9235999789E-3 2.0687500946E-3 2.0898699295E-3 2.0687500946E-3 1.9235999789E-3 1.5450799838E-3 8.8387000142E-4 -3.7829999201E-5 -6.2596000498E-4 -4.0483998600E-4
47];
48
49lo0filt = [
50-8.7009997515E-5 -1.3542800443E-3 -1.6012600390E-3 -5.0337001448E-4 2.5240099058E-3 -5.0337001448E-4 -1.6012600390E-3 -1.3542800443E-3 -8.7009997515E-5
51-1.3542800443E-3 2.9215801042E-3 7.5227199122E-3 8.2244202495E-3 1.1076199589E-3 8.2244202495E-3 7.5227199122E-3 2.9215801042E-3 -1.3542800443E-3
52-1.6012600390E-3 7.5227199122E-3 -7.0612900890E-3 -3.7694871426E-2 -3.2971370965E-2 -3.7694871426E-2 -7.0612900890E-3 7.5227199122E-3 -1.6012600390E-3
53-5.0337001448E-4 8.2244202495E-3 -3.7694871426E-2 4.3813198805E-2 0.1811603010 4.3813198805E-2 -3.7694871426E-2 8.2244202495E-3 -5.0337001448E-4
542.5240099058E-3 1.1076199589E-3 -3.2971370965E-2 0.1811603010 0.4376249909 0.1811603010 -3.2971370965E-2 1.1076199589E-3 2.5240099058E-3
55-5.0337001448E-4 8.2244202495E-3 -3.7694871426E-2 4.3813198805E-2 0.1811603010 4.3813198805E-2 -3.7694871426E-2 8.2244202495E-3 -5.0337001448E-4
56-1.6012600390E-3 7.5227199122E-3 -7.0612900890E-3 -3.7694871426E-2 -3.2971370965E-2 -3.7694871426E-2 -7.0612900890E-3 7.5227199122E-3 -1.6012600390E-3
57-1.3542800443E-3 2.9215801042E-3 7.5227199122E-3 8.2244202495E-3 1.1076199589E-3 8.2244202495E-3 7.5227199122E-3 2.9215801042E-3 -1.3542800443E-3
58-8.7009997515E-5 -1.3542800443E-3 -1.6012600390E-3 -5.0337001448E-4 2.5240099058E-3 -5.0337001448E-4 -1.6012600390E-3 -1.3542800443E-3 -8.7009997515E-5
59];
60
61lofilt = [
62-4.3500000174E-5 1.2078000145E-4 -6.7714002216E-4 -1.2434000382E-4 -8.0063997302E-4 -1.5970399836E-3 -2.5168000138E-4 -4.2019999819E-4 1.2619999470E-3 -4.2019999819E-4 -2.5168000138E-4 -1.5970399836E-3 -8.0063997302E-4 -1.2434000382E-4 -6.7714002216E-4 1.2078000145E-4 -4.3500000174E-5
631.2078000145E-4 4.4606000301E-4 -5.8146001538E-4 5.6215998484E-4 -1.3688000035E-4 2.3255399428E-3 2.8898599558E-3 4.2872801423E-3 5.5893999524E-3 4.2872801423E-3 2.8898599558E-3 2.3255399428E-3 -1.3688000035E-4 5.6215998484E-4 -5.8146001538E-4 4.4606000301E-4 1.2078000145E-4
64-6.7714002216E-4 -5.8146001538E-4 1.4607800404E-3 2.1605400834E-3 3.7613599561E-3 3.0809799209E-3 4.1121998802E-3 2.2212199401E-3 5.5381999118E-4 2.2212199401E-3 4.1121998802E-3 3.0809799209E-3 3.7613599561E-3 2.1605400834E-3 1.4607800404E-3 -5.8146001538E-4 -6.7714002216E-4
65-1.2434000382E-4 5.6215998484E-4 2.1605400834E-3 3.1757799443E-3 3.1846798956E-3 -1.7774800071E-3 -7.4316998944E-3 -9.0569201857E-3 -9.6372198313E-3 -9.0569201857E-3 -7.4316998944E-3 -1.7774800071E-3 3.1846798956E-3 3.1757799443E-3 2.1605400834E-3 5.6215998484E-4 -1.2434000382E-4
66-8.0063997302E-4 -1.3688000035E-4 3.7613599561E-3 3.1846798956E-3 -3.5306399222E-3 -1.2604200281E-2 -1.8847439438E-2 -1.7508180812E-2 -1.6485679895E-2 -1.7508180812E-2 -1.8847439438E-2 -1.2604200281E-2 -3.5306399222E-3 3.1846798956E-3 3.7613599561E-3 -1.3688000035E-4 -8.0063997302E-4
67-1.5970399836E-3 2.3255399428E-3 3.0809799209E-3 -1.7774800071E-3 -1.2604200281E-2 -2.0229380578E-2 -1.1091699824E-2 3.9556599222E-3 1.4385120012E-2 3.9556599222E-3 -1.1091699824E-2 -2.0229380578E-2 -1.2604200281E-2 -1.7774800071E-3 3.0809799209E-3 2.3255399428E-3 -1.5970399836E-3
68-2.5168000138E-4 2.8898599558E-3 4.1121998802E-3 -7.4316998944E-3 -1.8847439438E-2 -1.1091699824E-2 2.1906599402E-2 6.8065837026E-2 9.0580143034E-2 6.8065837026E-2 2.1906599402E-2 -1.1091699824E-2 -1.8847439438E-2 -7.4316998944E-3 4.1121998802E-3 2.8898599558E-3 -2.5168000138E-4
69-4.2019999819E-4 4.2872801423E-3 2.2212199401E-3 -9.0569201857E-3 -1.7508180812E-2 3.9556599222E-3 6.8065837026E-2 0.1445499808 0.1773651242 0.1445499808 6.8065837026E-2 3.9556599222E-3 -1.7508180812E-2 -9.0569201857E-3 2.2212199401E-3 4.2872801423E-3 -4.2019999819E-4
701.2619999470E-3 5.5893999524E-3 5.5381999118E-4 -9.6372198313E-3 -1.6485679895E-2 1.4385120012E-2 9.0580143034E-2 0.1773651242 0.2120374441 0.1773651242 9.0580143034E-2 1.4385120012E-2 -1.6485679895E-2 -9.6372198313E-3 5.5381999118E-4 5.5893999524E-3 1.2619999470E-3
71-4.2019999819E-4 4.2872801423E-3 2.2212199401E-3 -9.0569201857E-3 -1.7508180812E-2 3.9556599222E-3 6.8065837026E-2 0.1445499808 0.1773651242 0.1445499808 6.8065837026E-2 3.9556599222E-3 -1.7508180812E-2 -9.0569201857E-3 2.2212199401E-3 4.2872801423E-3 -4.2019999819E-4
72-2.5168000138E-4 2.8898599558E-3 4.1121998802E-3 -7.4316998944E-3 -1.8847439438E-2 -1.1091699824E-2 2.1906599402E-2 6.8065837026E-2 9.0580143034E-2 6.8065837026E-2 2.1906599402E-2 -1.1091699824E-2 -1.8847439438E-2 -7.4316998944E-3 4.1121998802E-3 2.8898599558E-3 -2.5168000138E-4
73-1.5970399836E-3 2.3255399428E-3 3.0809799209E-3 -1.7774800071E-3 -1.2604200281E-2 -2.0229380578E-2 -1.1091699824E-2 3.9556599222E-3 1.4385120012E-2 3.9556599222E-3 -1.1091699824E-2 -2.0229380578E-2 -1.2604200281E-2 -1.7774800071E-3 3.0809799209E-3 2.3255399428E-3 -1.5970399836E-3
74-8.0063997302E-4 -1.3688000035E-4 3.7613599561E-3 3.1846798956E-3 -3.5306399222E-3 -1.2604200281E-2 -1.8847439438E-2 -1.7508180812E-2 -1.6485679895E-2 -1.7508180812E-2 -1.8847439438E-2 -1.2604200281E-2 -3.5306399222E-3 3.1846798956E-3 3.7613599561E-3 -1.3688000035E-4 -8.0063997302E-4
75-1.2434000382E-4 5.6215998484E-4 2.1605400834E-3 3.1757799443E-3 3.1846798956E-3 -1.7774800071E-3 -7.4316998944E-3 -9.0569201857E-3 -9.6372198313E-3 -9.0569201857E-3 -7.4316998944E-3 -1.7774800071E-3 3.1846798956E-3 3.1757799443E-3 2.1605400834E-3 5.6215998484E-4 -1.2434000382E-4
76-6.7714002216E-4 -5.8146001538E-4 1.4607800404E-3 2.1605400834E-3 3.7613599561E-3 3.0809799209E-3 4.1121998802E-3 2.2212199401E-3 5.5381999118E-4 2.2212199401E-3 4.1121998802E-3 3.0809799209E-3 3.7613599561E-3 2.1605400834E-3 1.4607800404E-3 -5.8146001538E-4 -6.7714002216E-4
771.2078000145E-4 4.4606000301E-4 -5.8146001538E-4 5.6215998484E-4 -1.3688000035E-4 2.3255399428E-3 2.8898599558E-3 4.2872801423E-3 5.5893999524E-3 4.2872801423E-3 2.8898599558E-3 2.3255399428E-3 -1.3688000035E-4 5.6215998484E-4 -5.8146001538E-4 4.4606000301E-4 1.2078000145E-4
78-4.3500000174E-5 1.2078000145E-4 -6.7714002216E-4 -1.2434000382E-4 -8.0063997302E-4 -1.5970399836E-3 -2.5168000138E-4 -4.2019999819E-4 1.2619999470E-3 -4.2019999819E-4 -2.5168000138E-4 -1.5970399836E-3 -8.0063997302E-4 -1.2434000382E-4 -6.7714002216E-4 1.2078000145E-4 -4.3500000174E-5
79];
80
81bfilts = [...
82-8.1125000725E-4 4.4451598078E-3 1.2316980399E-2 1.3955879956E-2 1.4179450460E-2 1.3955879956E-2 1.2316980399E-2 4.4451598078E-3 -8.1125000725E-4 ...
833.9103501476E-3 4.4565401040E-3 -5.8724298142E-3 -2.8760801069E-3 8.5267601535E-3 -2.8760801069E-3 -5.8724298142E-3 4.4565401040E-3 3.9103501476E-3 ...
841.3462699717E-3 -3.7740699481E-3 8.2581602037E-3 3.9442278445E-2 5.3605638444E-2 3.9442278445E-2 8.2581602037E-3 -3.7740699481E-3 1.3462699717E-3 ...
857.4700999539E-4 -3.6522001028E-4 -2.2522680461E-2 -0.1105690673 -0.1768419296 -0.1105690673 -2.2522680461E-2 -3.6522001028E-4 7.4700999539E-4 ...
860.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 ...
87-7.4700999539E-4 3.6522001028E-4 2.2522680461E-2 0.1105690673 0.1768419296 0.1105690673 2.2522680461E-2 3.6522001028E-4 -7.4700999539E-4 ...
88-1.3462699717E-3 3.7740699481E-3 -8.2581602037E-3 -3.9442278445E-2 -5.3605638444E-2 -3.9442278445E-2 -8.2581602037E-3 3.7740699481E-3 -1.3462699717E-3 ...
89-3.9103501476E-3 -4.4565401040E-3 5.8724298142E-3 2.8760801069E-3 -8.5267601535E-3 2.8760801069E-3 5.8724298142E-3 -4.4565401040E-3 -3.9103501476E-3 ...
908.1125000725E-4 -4.4451598078E-3 -1.2316980399E-2 -1.3955879956E-2 -1.4179450460E-2 -1.3955879956E-2 -1.2316980399E-2 -4.4451598078E-3 8.1125000725E-4; ...
91...
920.0000000000 -8.2846998703E-4 -5.7109999034E-5 4.0110000555E-5 4.6670897864E-3 8.0871898681E-3 1.4807609841E-2 8.6204400286E-3 -3.1221499667E-3 ...
938.2846998703E-4 0.0000000000 -9.7479997203E-4 -6.9718998857E-3 -2.0865600090E-3 2.3298799060E-3 -4.4814897701E-3 1.4917500317E-2 8.6204400286E-3 ...
945.7109999034E-5 9.7479997203E-4 0.0000000000 -1.2145539746E-2 -2.4427289143E-2 5.0797060132E-2 3.2785870135E-2 -4.4814897701E-3 1.4807609841E-2 ...
95-4.0110000555E-5 6.9718998857E-3 1.2145539746E-2 0.0000000000 -0.1510555595 -8.2495503128E-2 5.0797060132E-2 2.3298799060E-3 8.0871898681E-3 ...
96-4.6670897864E-3 2.0865600090E-3 2.4427289143E-2 0.1510555595 0.0000000000 -0.1510555595 -2.4427289143E-2 -2.0865600090E-3 4.6670897864E-3 ...
97-8.0871898681E-3 -2.3298799060E-3 -5.0797060132E-2 8.2495503128E-2 0.1510555595 0.0000000000 -1.2145539746E-2 -6.9718998857E-3 4.0110000555E-5 ...
98-1.4807609841E-2 4.4814897701E-3 -3.2785870135E-2 -5.0797060132E-2 2.4427289143E-2 1.2145539746E-2 0.0000000000 -9.7479997203E-4 -5.7109999034E-5 ...
99-8.6204400286E-3 -1.4917500317E-2 4.4814897701E-3 -2.3298799060E-3 2.0865600090E-3 6.9718998857E-3 9.7479997203E-4 0.0000000000 -8.2846998703E-4 ...
1003.1221499667E-3 -8.6204400286E-3 -1.4807609841E-2 -8.0871898681E-3 -4.6670897864E-3 -4.0110000555E-5 5.7109999034E-5 8.2846998703E-4 0.0000000000; ...
101...
1028.1125000725E-4 -3.9103501476E-3 -1.3462699717E-3 -7.4700999539E-4 0.0000000000 7.4700999539E-4 1.3462699717E-3 3.9103501476E-3 -8.1125000725E-4 ...
103-4.4451598078E-3 -4.4565401040E-3 3.7740699481E-3 3.6522001028E-4 0.0000000000 -3.6522001028E-4 -3.7740699481E-3 4.4565401040E-3 4.4451598078E-3 ...
104-1.2316980399E-2 5.8724298142E-3 -8.2581602037E-3 2.2522680461E-2 0.0000000000 -2.2522680461E-2 8.2581602037E-3 -5.8724298142E-3 1.2316980399E-2 ...
105-1.3955879956E-2 2.8760801069E-3 -3.9442278445E-2 0.1105690673 0.0000000000 -0.1105690673 3.9442278445E-2 -2.8760801069E-3 1.3955879956E-2 ...
106-1.4179450460E-2 -8.5267601535E-3 -5.3605638444E-2 0.1768419296 0.0000000000 -0.1768419296 5.3605638444E-2 8.5267601535E-3 1.4179450460E-2 ...
107-1.3955879956E-2 2.8760801069E-3 -3.9442278445E-2 0.1105690673 0.0000000000 -0.1105690673 3.9442278445E-2 -2.8760801069E-3 1.3955879956E-2 ...
108-1.2316980399E-2 5.8724298142E-3 -8.2581602037E-3 2.2522680461E-2 0.0000000000 -2.2522680461E-2 8.2581602037E-3 -5.8724298142E-3 1.2316980399E-2 ...
109-4.4451598078E-3 -4.4565401040E-3 3.7740699481E-3 3.6522001028E-4 0.0000000000 -3.6522001028E-4 -3.7740699481E-3 4.4565401040E-3 4.4451598078E-3 ...
1108.1125000725E-4 -3.9103501476E-3 -1.3462699717E-3 -7.4700999539E-4 0.0000000000 7.4700999539E-4 1.3462699717E-3 3.9103501476E-3 -8.1125000725E-4; ...
111...
1123.1221499667E-3 -8.6204400286E-3 -1.4807609841E-2 -8.0871898681E-3 -4.6670897864E-3 -4.0110000555E-5 5.7109999034E-5 8.2846998703E-4 0.0000000000 ...
113-8.6204400286E-3 -1.4917500317E-2 4.4814897701E-3 -2.3298799060E-3 2.0865600090E-3 6.9718998857E-3 9.7479997203E-4 -0.0000000000 -8.2846998703E-4 ...
114-1.4807609841E-2 4.4814897701E-3 -3.2785870135E-2 -5.0797060132E-2 2.4427289143E-2 1.2145539746E-2 0.0000000000 -9.7479997203E-4 -5.7109999034E-5 ...
115-8.0871898681E-3 -2.3298799060E-3 -5.0797060132E-2 8.2495503128E-2 0.1510555595 -0.0000000000 -1.2145539746E-2 -6.9718998857E-3 4.0110000555E-5 ...
116-4.6670897864E-3 2.0865600090E-3 2.4427289143E-2 0.1510555595 0.0000000000 -0.1510555595 -2.4427289143E-2 -2.0865600090E-3 4.6670897864E-3 ...
117-4.0110000555E-5 6.9718998857E-3 1.2145539746E-2 0.0000000000 -0.1510555595 -8.2495503128E-2 5.0797060132E-2 2.3298799060E-3 8.0871898681E-3 ...
1185.7109999034E-5 9.7479997203E-4 -0.0000000000 -1.2145539746E-2 -2.4427289143E-2 5.0797060132E-2 3.2785870135E-2 -4.4814897701E-3 1.4807609841E-2 ...
1198.2846998703E-4 -0.0000000000 -9.7479997203E-4 -6.9718998857E-3 -2.0865600090E-3 2.3298799060E-3 -4.4814897701E-3 1.4917500317E-2 8.6204400286E-3 ...
1200.0000000000 -8.2846998703E-4 -5.7109999034E-5 4.0110000555E-5 4.6670897864E-3 8.0871898681E-3 1.4807609841E-2 8.6204400286E-3 -3.1221499667E-3 ...
121]';
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/sp5Filters.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/sp5Filters.m
deleted file mode 100755
index 4cddcfd..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/sp5Filters.m
+++ /dev/null
@@ -1,110 +0,0 @@
1% Steerable pyramid filters. Transform described in:
2%
3% @INPROCEEDINGS{Simoncelli95b,
4% TITLE = "The Steerable Pyramid: A Flexible Architecture for
5% Multi-Scale Derivative Computation",
6% AUTHOR = "E P Simoncelli and W T Freeman",
7% BOOKTITLE = "Second Int'l Conf on Image Processing",
8% ADDRESS = "Washington, DC", MONTH = "October", YEAR = 1995 }
9%
10% Filter kernel design described in:
11%
12%@INPROCEEDINGS{Karasaridis96,
13% TITLE = "A Filter Design Technique for
14% Steerable Pyramid Image Transforms",
15% AUTHOR = "A Karasaridis and E P Simoncelli",
16% BOOKTITLE = "ICASSP", ADDRESS = "Atlanta, GA",
17% MONTH = "May", YEAR = 1996 }
18
19% Eero Simoncelli, 6/96.
20
21function [lo0filt,hi0filt,lofilt,bfilts,mtx,harmonics] = sp5Filters();
22
23harmonics = [1 3 5];
24
25mtx = [ ...
26 0.3333 0.2887 0.1667 0.0000 -0.1667 -0.2887
27 0.0000 0.1667 0.2887 0.3333 0.2887 0.1667
28 0.3333 -0.0000 -0.3333 -0.0000 0.3333 -0.0000
29 0.0000 0.3333 0.0000 -0.3333 0.0000 0.3333
30 0.3333 -0.2887 0.1667 -0.0000 -0.1667 0.2887
31 -0.0000 0.1667 -0.2887 0.3333 -0.2887 0.1667];
32
33hi0filt = [
34-0.00033429 -0.00113093 -0.00171484 -0.00133542 -0.00080639 -0.00133542 -0.00171484 -0.00113093 -0.00033429
35-0.00113093 -0.00350017 -0.00243812 0.00631653 0.01261227 0.00631653 -0.00243812 -0.00350017 -0.00113093
36-0.00171484 -0.00243812 -0.00290081 -0.00673482 -0.00981051 -0.00673482 -0.00290081 -0.00243812 -0.00171484
37-0.00133542 0.00631653 -0.00673482 -0.07027679 -0.11435863 -0.07027679 -0.00673482 0.00631653 -0.00133542
38-0.00080639 0.01261227 -0.00981051 -0.11435863 0.81380200 -0.11435863 -0.00981051 0.01261227 -0.00080639
39-0.00133542 0.00631653 -0.00673482 -0.07027679 -0.11435863 -0.07027679 -0.00673482 0.00631653 -0.00133542
40-0.00171484 -0.00243812 -0.00290081 -0.00673482 -0.00981051 -0.00673482 -0.00290081 -0.00243812 -0.00171484
41-0.00113093 -0.00350017 -0.00243812 0.00631653 0.01261227 0.00631653 -0.00243812 -0.00350017 -0.00113093
42-0.00033429 -0.00113093 -0.00171484 -0.00133542 -0.00080639 -0.00133542 -0.00171484 -0.00113093 -0.00033429];
43
44
45lo0filt = [
460.00341614 -0.01551246 -0.03848215 -0.01551246 0.00341614
47-0.01551246 0.05586982 0.15925570 0.05586982 -0.01551246
48-0.03848215 0.15925570 0.40304148 0.15925570 -0.03848215
49-0.01551246 0.05586982 0.15925570 0.05586982 -0.01551246
500.00341614 -0.01551246 -0.03848215 -0.01551246 0.00341614];
51
52lofilt = 2*[
530.00085404 -0.00244917 -0.00387812 -0.00944432 -0.00962054 -0.00944432 -0.00387812 -0.00244917 0.00085404
54-0.00244917 -0.00523281 -0.00661117 0.00410600 0.01002988 0.00410600 -0.00661117 -0.00523281 -0.00244917
55-0.00387812 -0.00661117 0.01396746 0.03277038 0.03981393 0.03277038 0.01396746 -0.00661117 -0.00387812
56-0.00944432 0.00410600 0.03277038 0.06426333 0.08169618 0.06426333 0.03277038 0.00410600 -0.00944432
57-0.00962054 0.01002988 0.03981393 0.08169618 0.10096540 0.08169618 0.03981393 0.01002988 -0.00962054
58-0.00944432 0.00410600 0.03277038 0.06426333 0.08169618 0.06426333 0.03277038 0.00410600 -0.00944432
59-0.00387812 -0.00661117 0.01396746 0.03277038 0.03981393 0.03277038 0.01396746 -0.00661117 -0.00387812
60-0.00244917 -0.00523281 -0.00661117 0.00410600 0.01002988 0.00410600 -0.00661117 -0.00523281 -0.00244917
610.00085404 -0.00244917 -0.00387812 -0.00944432 -0.00962054 -0.00944432 -0.00387812 -0.00244917 0.00085404];
62
63bfilts = [...
64 0.00277643 0.00496194 0.01026699 0.01455399 0.01026699 0.00496194 0.00277643 ...
65-0.00986904 -0.00893064 0.01189859 0.02755155 0.01189859 -0.00893064 -0.00986904 ...
66-0.01021852 -0.03075356 -0.08226445 -0.11732297 -0.08226445 -0.03075356 -0.01021852 ...
67 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 ...
68 0.01021852 0.03075356 0.08226445 0.11732297 0.08226445 0.03075356 0.01021852 ...
69 0.00986904 0.00893064 -0.01189859 -0.02755155 -0.01189859 0.00893064 0.00986904 ...
70-0.00277643 -0.00496194 -0.01026699 -0.01455399 -0.01026699 -0.00496194 -0.00277643;
71...
72-0.00343249 -0.00640815 -0.00073141 0.01124321 0.00182078 0.00285723 0.01166982 ...
73-0.00358461 -0.01977507 -0.04084211 -0.00228219 0.03930573 0.01161195 0.00128000 ...
74 0.01047717 0.01486305 -0.04819057 -0.12227230 -0.05394139 0.00853965 -0.00459034 ...
75 0.00790407 0.04435647 0.09454202 -0.00000000 -0.09454202 -0.04435647 -0.00790407 ...
76 0.00459034 -0.00853965 0.05394139 0.12227230 0.04819057 -0.01486305 -0.01047717 ...
77-0.00128000 -0.01161195 -0.03930573 0.00228219 0.04084211 0.01977507 0.00358461 ...
78-0.01166982 -0.00285723 -0.00182078 -0.01124321 0.00073141 0.00640815 0.00343249;
79...
80 0.00343249 0.00358461 -0.01047717 -0.00790407 -0.00459034 0.00128000 0.01166982 ...
81 0.00640815 0.01977507 -0.01486305 -0.04435647 0.00853965 0.01161195 0.00285723 ...
82 0.00073141 0.04084211 0.04819057 -0.09454202 -0.05394139 0.03930573 0.00182078 ...
83-0.01124321 0.00228219 0.12227230 -0.00000000 -0.12227230 -0.00228219 0.01124321 ...
84-0.00182078 -0.03930573 0.05394139 0.09454202 -0.04819057 -0.04084211 -0.00073141 ...
85-0.00285723 -0.01161195 -0.00853965 0.04435647 0.01486305 -0.01977507 -0.00640815 ...
86-0.01166982 -0.00128000 0.00459034 0.00790407 0.01047717 -0.00358461 -0.00343249;
87...
88-0.00277643 0.00986904 0.01021852 -0.00000000 -0.01021852 -0.00986904 0.00277643 ...
89-0.00496194 0.00893064 0.03075356 -0.00000000 -0.03075356 -0.00893064 0.00496194 ...
90-0.01026699 -0.01189859 0.08226445 -0.00000000 -0.08226445 0.01189859 0.01026699 ...
91-0.01455399 -0.02755155 0.11732297 -0.00000000 -0.11732297 0.02755155 0.01455399 ...
92-0.01026699 -0.01189859 0.08226445 -0.00000000 -0.08226445 0.01189859 0.01026699 ...
93-0.00496194 0.00893064 0.03075356 -0.00000000 -0.03075356 -0.00893064 0.00496194 ...
94-0.00277643 0.00986904 0.01021852 -0.00000000 -0.01021852 -0.00986904 0.00277643;
95...
96-0.01166982 -0.00128000 0.00459034 0.00790407 0.01047717 -0.00358461 -0.00343249 ...
97-0.00285723 -0.01161195 -0.00853965 0.04435647 0.01486305 -0.01977507 -0.00640815 ...
98-0.00182078 -0.03930573 0.05394139 0.09454202 -0.04819057 -0.04084211 -0.00073141 ...
99-0.01124321 0.00228219 0.12227230 -0.00000000 -0.12227230 -0.00228219 0.01124321 ...
100 0.00073141 0.04084211 0.04819057 -0.09454202 -0.05394139 0.03930573 0.00182078 ...
101 0.00640815 0.01977507 -0.01486305 -0.04435647 0.00853965 0.01161195 0.00285723 ...
102 0.00343249 0.00358461 -0.01047717 -0.00790407 -0.00459034 0.00128000 0.01166982;
103...
104-0.01166982 -0.00285723 -0.00182078 -0.01124321 0.00073141 0.00640815 0.00343249 ...
105-0.00128000 -0.01161195 -0.03930573 0.00228219 0.04084211 0.01977507 0.00358461 ...
106 0.00459034 -0.00853965 0.05394139 0.12227230 0.04819057 -0.01486305 -0.01047717 ...
107 0.00790407 0.04435647 0.09454202 -0.00000000 -0.09454202 -0.04435647 -0.00790407 ...
108 0.01047717 0.01486305 -0.04819057 -0.12227230 -0.05394139 0.00853965 -0.00459034 ...
109-0.00358461 -0.01977507 -0.04084211 -0.00228219 0.03930573 0.01161195 0.00128000 ...
110-0.00343249 -0.00640815 -0.00073141 0.01124321 0.00182078 0.00285723 0.01166982]';
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/spyrBand.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/spyrBand.m
deleted file mode 100755
index 474a8dc..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/spyrBand.m
+++ /dev/null
@@ -1,34 +0,0 @@
1% [LEV,IND] = spyrBand(PYR,INDICES,LEVEL,BAND)
2%
3% Access a band from a steerable pyramid.
4%
5% LEVEL indicates the scale (finest = 1, coarsest = spyrHt(INDICES)).
6%
7% BAND (optional, default=1) indicates which subband
8% (1 = vertical, rest proceeding anti-clockwise).
9
10% Eero Simoncelli, 6/96.
11
12function res = spyrBand(pyr,pind,level,band)
13
14if (exist('level') ~= 1)
15 level = 1;
16end
17
18if (exist('band') ~= 1)
19 band = 1;
20end
21
22nbands = spyrNumBands(pind);
23if ((band > nbands) | (band < 1))
24 error(sprintf('Bad band number (%d) should be in range [1,%d].', band, nbands));
25end
26
27maxLev = spyrHt(pind);
28if ((level > maxLev) | (level < 1))
29 error(sprintf('Bad level number (%d), should be in range [1,%d].', level, maxLev));
30end
31
32firstband = 1 + band + nbands*(level-1);
33res = pyrBand(pyr, pind, firstband);
34
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/spyrHigh.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/spyrHigh.m
deleted file mode 100755
index f91b466..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/spyrHigh.m
+++ /dev/null
@@ -1,10 +0,0 @@
1% RES = spyrHigh(PYR, INDICES)
2%
3% Access the highpass residual band from a steerable pyramid.
4
5% Eero Simoncelli, 6/96.
6
7function res = spyrHigh(pyr,pind)
8
9res = pyrBand(pyr, pind, 1);
10
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/spyrHt.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/spyrHt.m
deleted file mode 100755
index 8706b9e..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/spyrHt.m
+++ /dev/null
@@ -1,16 +0,0 @@
1% [HEIGHT] = spyrHt(INDICES)
2%
3% Compute height of steerable pyramid with given index matrix.
4
5% Eero Simoncelli, 6/96.
6
7function [ht] = spyrHt(pind)
8
9nbands = spyrNumBands(pind);
10
11% Don't count lowpass, or highpass residual bands
12if (size(pind,1) > 2)
13 ht = (size(pind,1)-2)/nbands;
14else
15 ht = 0;
16end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/spyrLev.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/spyrLev.m
deleted file mode 100755
index 5cb4a85..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/spyrLev.m
+++ /dev/null
@@ -1,24 +0,0 @@
1% [LEV,IND] = spyrLev(PYR,INDICES,LEVEL)
2%
3% Access a level from a steerable pyramid.
4% Return as an SxB matrix, B = number of bands, S = total size of a band.
5% Also returns an Bx2 matrix containing dimensions of the subbands.
6
7% Eero Simoncelli, 6/96.
8
9function [lev,ind] = spyrLev(pyr,pind,level)
10
11nbands = spyrNumBands(pind);
12
13if ((level > spyrHt(pind)) | (level < 1))
14 error(sprintf('Level number must be in the range [1, %d].', spyrHt(pind)));
15end
16
17firstband = 2 + nbands*(level-1);
18firstind = 1;
19for l=1:firstband-1
20 firstind = firstind + prod(pind(l,:));
21end
22
23ind = pind(firstband:firstband+nbands-1,:);
24lev = pyr(firstind:firstind+sum(prod(ind'))-1);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/spyrNumBands.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/spyrNumBands.m
deleted file mode 100755
index 68aec3f..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/spyrNumBands.m
+++ /dev/null
@@ -1,20 +0,0 @@
1% [NBANDS] = spyrNumBands(INDICES)
2%
3% Compute number of orientation bands in a steerable pyramid with
4% given index matrix. If the pyramid contains only the highpass and
5% lowpass bands (i.e., zero levels), returns 0.
6
7% Eero Simoncelli, 2/97.
8
9function [nbands] = spyrNumBands(pind)
10
11if (size(pind,1) == 2)
12 nbands = 0;
13else
14 % Count number of orientation bands:
15 b = 3;
16 while ((b <= size(pind,1)) & all( pind(b,:) == pind(2,:)) )
17 b = b+1;
18 end
19 nbands = b-2;
20end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/steer.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/steer.m
deleted file mode 100755
index 8f9c2ac..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/steer.m
+++ /dev/null
@@ -1,68 +0,0 @@
1% RES = STEER(BASIS, ANGLE, HARMONICS, STEERMTX)
2%
3% Steer BASIS to the specfied ANGLE.
4%
5% BASIS should be a matrix whose columns are vectorized rotated copies of a
6% steerable function, or the responses of a set of steerable filters.
7%
8% ANGLE can be a scalar, or a column vector the size of the basis.
9%
10% HARMONICS (optional, default is N even or odd low frequencies, as for
11% derivative filters) should be a list of harmonic numbers indicating
12% the angular harmonic content of the basis.
13%
14% STEERMTX (optional, default assumes cosine phase harmonic components,
15% and filter positions at 2pi*n/N) should be a matrix which maps
16% the filters onto Fourier series components (ordered [cos0 cos1 sin1
17% cos2 sin2 ... sinN]). See steer2HarmMtx.m
18
19% Eero Simoncelli, 7/96.
20
21function res = steer(basis,angle,harmonics,steermtx)
22
23num = size(basis,2);
24
25if ( any(size(angle) ~= [size(basis,1) 1]) & any(size(angle) ~= [1 1]) )
26 error('ANGLE must be a scalar, or a column vector the size of the basis elements');
27end
28
29%% If HARMONICS are not passed, assume derivatives.
30if (exist('harmonics') ~= 1)
31 if (mod(num,2) == 0)
32 harmonics = [0:(num/2)-1]'*2 + 1;
33 else
34 harmonics = [0:(num-1)/2]'*2;
35 end
36else
37 harmonics = harmonics(:);
38 if ((2*size(harmonics,1)-any(harmonics == 0)) ~= num)
39 error('harmonics list is incompatible with basis size');
40 end
41end
42
43%% If STEERMTX not passed, assume evenly distributed cosine-phase filters:
44if (exist('steermtx') ~= 1)
45 steermtx = steer2HarmMtx(harmonics, pi*[0:num-1]/num, 'even');
46end
47
48steervect = zeros(size(angle,1),num);
49arg = angle * harmonics(find(harmonics~=0))';
50if (all(harmonics))
51 steervect(:, 1:2:num) = cos(arg);
52 steervect(:, 2:2:num) = sin(arg);
53else
54 steervect(:, 1) = ones(size(arg,1),1);
55 steervect(:, 2:2:num) = cos(arg);
56 steervect(:, 3:2:num) = sin(arg);
57end
58
59steervect = steervect * steermtx;
60
61if (size(steervect,1) > 1)
62 tmp = basis' .* steervect';
63 res = sum(tmp)';
64else
65 res = basis * steervect';
66end
67
68
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/steer2HarmMtx.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/steer2HarmMtx.m
deleted file mode 100755
index 1f3e80e..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/steer2HarmMtx.m
+++ /dev/null
@@ -1,71 +0,0 @@
1% MTX = steer2HarmMtx(HARMONICS, ANGLES, REL_PHASES)
2%
3% Compute a steering matrix (maps a directional basis set onto the
4% angular Fourier harmonics). HARMONICS is a vector specifying the
5% angular harmonics contained in the steerable basis/filters. ANGLES
6% (optional) is a vector specifying the angular position of each filter.
7% REL_PHASES (optional, default = 'even') specifies whether the harmonics
8% are cosine or sine phase aligned about those positions.
9% The result matrix is suitable for passing to the function STEER.
10
11% Eero Simoncelli, 7/96.
12
13function mtx = steer2HarmMtx(harmonics, angles, evenorodd)
14
15%%=================================================================
16%%% Optional Parameters:
17
18if (exist('evenorodd') ~= 1)
19 evenorodd = 'even';
20end
21
22% Make HARMONICS a row vector
23harmonics = harmonics(:)';
24
25numh = 2*size(harmonics,2) - any(harmonics == 0);
26
27if (exist('angles') ~= 1)
28 angles = pi * [0:numh-1]'/numh;
29else
30 angles = angles(:);
31end
32
33%%=================================================================
34
35if isstr(evenorodd)
36 if strcmp(evenorodd,'even')
37 evenorodd = 0;
38 elseif strcmp(evenorodd,'odd')
39 evenorodd = 1;
40 else
41 error('EVEN_OR_ODD should be the string EVEN or ODD');
42 end
43end
44
45%% Compute inverse matrix, which maps Fourier components onto
46%% steerable basis.
47imtx = zeros(size(angles,1),numh);
48col = 1;
49for h=harmonics
50 args = h*angles;
51 if (h == 0)
52 imtx(:,col) = ones(size(angles));
53 col = col+1;
54 elseif evenorodd
55 imtx(:,col) = sin(args);
56 imtx(:,col+1) = -cos(args);
57 col = col+2;
58 else
59 imtx(:,col) = cos(args);
60 imtx(:,col+1) = sin(args);
61 col = col+2;
62 end
63end
64
65r = rank(imtx);
66if (( r ~= numh ) & ( r ~= size(angles,1) ))
67 fprintf(2,'WARNING: matrix is not full rank');
68end
69
70mtx = pinv(imtx);
71
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/subMtx.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/subMtx.m
deleted file mode 100755
index ea3c2ea..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/subMtx.m
+++ /dev/null
@@ -1,21 +0,0 @@
1% MTX = subMtx(VEC, DIMENSIONS, START_INDEX)
2%
3% Reshape a portion of VEC starting from START_INDEX (optional,
4% default=1) to the given dimensions.
5
6% Eero Simoncelli, 6/96.
7
8function mtx = subMtx(vec, sz, offset)
9
10if (exist('offset') ~= 1)
11 offset = 1;
12end
13
14vec = vec(:);
15sz = sz(:);
16
17if (size(sz,1) ~= 2)
18 error('DIMENSIONS must be a 2-vector.');
19end
20
21mtx = reshape( vec(offset:offset+prod(sz)-1), sz(1), sz(2) );
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/upBlur.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/upBlur.m
deleted file mode 100755
index 948c2e1..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/upBlur.m
+++ /dev/null
@@ -1,52 +0,0 @@
1% RES = upBlur(IM, LEVELS, FILT)
2%
3% Upsample and blur an image. The blurring is done with filter
4% kernel specified by FILT (default = 'binom5'), which can be a string
5% (to be passed to namedFilter), a vector (applied separably as a 1D
6% convolution kernel in X and Y), or a matrix (applied as a 2D
7% convolution kernel). The downsampling is always by 2 in each
8% direction.
9%
10% The procedure is applied recursively LEVELS times (default=1).
11
12% Eero Simoncelli, 4/97.
13
14function res = upBlur(im, nlevs, filt)
15
16%------------------------------------------------------------
17%% OPTIONAL ARGS:
18
19if (exist('nlevs') ~= 1)
20 nlevs = 1;
21end
22
23if (exist('filt') ~= 1)
24 filt = 'binom5';
25end
26
27%------------------------------------------------------------
28
29if isstr(filt)
30 filt = namedFilter(filt);
31end
32
33if nlevs > 1
34 im = upBlur(im,nlevs-1,filt);
35end
36
37if (nlevs >= 1)
38 if (any(size(im)==1))
39 if (size(im,1)==1)
40 filt = filt';
41 end
42 res = upConv(im,filt,'reflect1',(size(im)~=1)+1);
43 elseif (any(size(filt)==1))
44 filt = filt(:);
45 res = upConv(im,filt,'reflect1',[2 1]);
46 res = upConv(res,filt','reflect1',[1 2]);
47 else
48 res = upConv(im,filt,'reflect1',[2 2]);
49 end
50else
51 res = im;
52end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/upConv.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/upConv.m
deleted file mode 100755
index 4d1ffd9..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/upConv.m
+++ /dev/null
@@ -1,80 +0,0 @@
1% RES = upConv(IM, FILT, EDGES, STEP, START, STOP, RES)
2%
3% Upsample matrix IM, followed by convolution with matrix FILT. These
4% arguments should be 1D or 2D matrices, and IM must be larger (in
5% both dimensions) than FILT. The origin of filt
6% is assumed to be floor(size(filt)/2)+1.
7%
8% EDGES is a string determining boundary handling:
9% 'circular' - Circular convolution
10% 'reflect1' - Reflect about the edge pixels
11% 'reflect2' - Reflect, doubling the edge pixels
12% 'repeat' - Repeat the edge pixels
13% 'zero' - Assume values of zero outside image boundary
14% 'extend' - Reflect and invert
15% 'dont-compute' - Zero output when filter overhangs OUTPUT boundaries
16%
17% Upsampling factors are determined by STEP (optional, default=[1 1]),
18% a 2-vector [y,x].
19%
20% The window over which the convolution occurs is specfied by START
21% (optional, default=[1,1], and STOP (optional, default =
22% step .* (size(IM) + floor((start-1)./step))).
23%
24% RES is an optional result matrix. The convolution result will be
25% destructively added into this matrix. If this argument is passed, the
26% result matrix will not be returned. DO NOT USE THIS ARGUMENT IF
27% YOU DO NOT UNDERSTAND WHAT THIS MEANS!!
28%
29% NOTE: this operation corresponds to multiplication of a signal
30% vector by a matrix whose columns contain copies of the time-reversed
31% (or space-reversed) FILT shifted by multiples of STEP. See corrDn.m
32% for the operation corresponding to the transpose of this matrix.
33
34% Eero Simoncelli, 6/96. revised 2/97.
35
36function result = upConv(im,filt,edges,step,start,stop,res)
37
38%% THIS CODE IS NOT ACTUALLY USED! (MEX FILE IS CALLED INSTEAD)
39
40fprintf(1,'WARNING: You should compile the MEX version of "upConv.c",\n found in the MEX subdirectory of matlabPyrTools, and put it in your matlab path. It is MUCH faster, and provides more boundary-handling options.\n');
41
42%------------------------------------------------------------
43%% OPTIONAL ARGS:
44
45if (exist('edges') == 1)
46 if (strcmp(edges,'reflect1') ~= 1)
47 warning('Using REFLECT1 edge-handling (use MEX code for other options).');
48 end
49end
50
51if (exist('step') ~= 1)
52 step = [1,1];
53end
54
55if (exist('start') ~= 1)
56 start = [1,1];
57end
58
59% A multiple of step
60if (exist('stop') ~= 1)
61 stop = step .* (floor((start-ones(size(start)))./step)+size(im))
62end
63
64if ( ceil((stop(1)+1-start(1)) / step(1)) ~= size(im,1) )
65 error('Bad Y result dimension');
66end
67if ( ceil((stop(2)+1-start(2)) / step(2)) ~= size(im,2) )
68 error('Bad X result dimension');
69end
70
71if (exist('res') ~= 1)
72 res = zeros(stop-start+1);
73end
74
75%------------------------------------------------------------
76
77tmp = zeros(size(res));
78tmp(start(1):step(1):stop(1),start(2):step(2):stop(2)) = im;
79
80result = rconv2(tmp,filt) + res;
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/var2.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/var2.m
deleted file mode 100755
index 6957eff..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/var2.m
+++ /dev/null
@@ -1,17 +0,0 @@
1% V = VAR2(MTX,MEAN)
2%
3% Sample variance of a matrix.
4% Passing MEAN (optional) makes the calculation faster.
5
6function res = var2(mtx, mn)
7
8if (exist('mn') ~= 1)
9 mn = mean2(mtx);
10end
11
12if (isreal(mtx))
13 res = sum(sum(abs(mtx-mn).^2)) / max((prod(size(mtx)) - 1),1);
14else
15 res = sum(sum(real(mtx-mn).^2)) + i*sum(sum(imag(mtx-mn).^2));
16 res = res / max((prod(size(mtx)) - 1),1);
17end
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/vectify.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/vectify.m
deleted file mode 100755
index 3664223..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/vectify.m
+++ /dev/null
@@ -1,8 +0,0 @@
1% [VEC] = columnize(MTX)
2%
3% Pack elements of MTX into a column vector. Just provides a
4% function-call notatoin for the operation MTX(:)
5
6function vec = columnize(mtx)
7
8vec = mtx(:);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/wpyrBand.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/wpyrBand.m
deleted file mode 100755
index c027cca..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/wpyrBand.m
+++ /dev/null
@@ -1,39 +0,0 @@
1% RES = wpyrBand(PYR, INDICES, LEVEL, BAND)
2%
3% Access a subband from a separable QMF/wavelet pyramid.
4%
5% LEVEL (optional, default=1) indicates the scale (finest = 1,
6% coarsest = wpyrHt(INDICES)).
7%
8% BAND (optional, default=1) indicates which subband (1=horizontal,
9% 2=vertical, 3=diagonal).
10
11% Eero Simoncelli, 6/96.
12
13function im = wpyrBand(pyr,pind,level,band)
14
15if (exist('level') ~= 1)
16 level = 1;
17end
18
19if (exist('band') ~= 1)
20 band = 1;
21end
22
23if ((pind(1,1) == 1) | (pind(1,2) ==1))
24 nbands = 1;
25else
26 nbands = 3;
27end
28
29if ((band > nbands) | (band < 1))
30 error(sprintf('Bad band number (%d) should be in range [1,%d].', band, nbands));
31end
32
33maxLev = wpyrHt(pind);
34if ((level > maxLev) | (level < 1))
35 error(sprintf('Bad level number (%d), should be in range [1,%d].', level, maxLev));
36end
37
38band = band + nbands*(level-1);
39im = pyrBand(pyr,pind,band);
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/wpyrHt.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/wpyrHt.m
deleted file mode 100755
index 476be83..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/wpyrHt.m
+++ /dev/null
@@ -1,15 +0,0 @@
1% [HEIGHT] = wpyrHt(INDICES)
2%
3% Compute height of separable QMF/wavelet pyramid with given index matrix.
4
5% Eero Simoncelli, 6/96.
6
7function [ht] = wpyrHt(pind)
8
9if ((pind(1,1) == 1) | (pind(1,2) ==1))
10 nbands = 1;
11else
12 nbands = 3;
13end
14
15ht = (size(pind,1)-1)/nbands;
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/wpyrLev.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/wpyrLev.m
deleted file mode 100755
index 18f30ae..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/wpyrLev.m
+++ /dev/null
@@ -1,30 +0,0 @@
1% [LEV,IND] = wpyrLev(PYR,INDICES,LEVEL)
2%
3% Access a level from a separable QMF/wavelet pyramid.
4% Return as an SxB matrix, B = number of bands, S = total size of a band.
5% Also returns an Bx2 matrix containing dimensions of the subbands.
6
7% Eero Simoncelli, 6/96.
8
9function [lev,ind] = wpyrLev(pyr,pind,level)
10
11if ((pind(1,1) == 1) | (pind(1,2) ==1))
12 nbands = 1;
13else
14 nbands = 3;
15end
16
17if ((level > wpyrHt(pind)) | (level < 1))
18 error(sprintf('Level number must be in the range [1, %d].', wpyrHt(pind)));
19end
20
21firstband = 1 + nbands*(level-1)
22firstind = 1;
23for l=1:firstband-1
24 firstind = firstind + prod(pind(l,:));
25end
26
27
28ind = pind(firstband:firstband+nbands-1,:);
29lev = pyr(firstind:firstind+sum(prod(ind'))-1);
30
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/zconv2.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/zconv2.m
deleted file mode 100755
index f678d89..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/zconv2.m
+++ /dev/null
@@ -1,41 +0,0 @@
1% RES = ZCONV2(MTX1, MTX2, CTR)
2%
3% Convolution of two matrices, with boundaries handled as if the larger mtx
4% lies in a sea of zeros. Result will be of size of LARGER vector.
5%
6% The origin of the smaller matrix is assumed to be its center.
7% For even dimensions, the origin is determined by the CTR (optional)
8% argument:
9% CTR origin
10% 0 DIM/2 (default)
11% 1 (DIM/2)+1 (behaves like conv2(mtx1,mtx2,'same'))
12
13% Eero Simoncelli, 2/97.
14
15function c = zconv2(a,b,ctr)
16
17if (exist('ctr') ~= 1)
18 ctr = 0;
19end
20
21if (( size(a,1) >= size(b,1) ) & ( size(a,2) >= size(b,2) ))
22 large = a; small = b;
23elseif (( size(a,1) <= size(b,1) ) & ( size(a,2) <= size(b,2) ))
24 large = b; small = a;
25else
26 error('one arg must be larger than the other in both dimensions!');
27end
28
29ly = size(large,1);
30lx = size(large,2);
31sy = size(small,1);
32sx = size(small,2);
33
34%% These values are the index of the small mtx that falls on the
35%% border pixel of the large matrix when computing the first
36%% convolution response sample:
37sy2 = floor((sy+ctr+1)/2);
38sx2 = floor((sx+ctr+1)/2);
39
40clarge = conv2(large,small);
41c = clarge(sy2:ly+sy2-1, sx2:lx+sx2-1);