Skip to content

Commit

Permalink
Merge pull request #49 from s-t-e-v-e-n-k/use-pywavelets
Browse files Browse the repository at this point in the history
Use PyWavelets for continuous wavelet transform
  • Loading branch information
jterrace authored Feb 6, 2025
2 parents e4f864c + 64a5868 commit cde7466
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ pillow
numpy
scipy
argparse
PyWavelets
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
author_email='[email protected]',
platforms=['any'],
license='MIT License',
install_requires=['numpy', 'pillow', 'scipy'],
install_requires=['numpy', 'pillow', 'scipy', 'PyWavelets'],
url='https://github.com/jterrace/pyssim',
entry_points={
'console_scripts': [
Expand Down
6 changes: 3 additions & 3 deletions ssim/ssimlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import sys

import numpy as np
from scipy import signal
import pywt

from ssim import compat
from ssim.compat import Image, ImageOps
Expand Down Expand Up @@ -168,8 +168,8 @@ def cw_ssim_value(self, target, width=30):
sig2 = np.asarray(target.img_gray.getdata())

# Convolution
cwtmatr1 = signal.cwt(sig1, signal.ricker, widths)
cwtmatr2 = signal.cwt(sig2, signal.ricker, widths)
cwtmatr1, freqs1 = pywt.cwt(sig1, widths, 'mexh')
cwtmatr2, freqs2 = pywt.cwt(sig2, widths, 'mexh')

# Compute the first term
c1c2 = np.multiply(abs(cwtmatr1), abs(cwtmatr2))
Expand Down

0 comments on commit cde7466

Please sign in to comment.