- Add numpy120.patch to support numpy 1.20 gh#jterrace/pyssim#44
- Update to 0.5 * No release notes found OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-pyssim?expand=0&rev=9
This commit is contained in:
parent
33f34c85b0
commit
f6921517ab
69
numpy120.patch
Normal file
69
numpy120.patch
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
From fa854ac6b4c2a691a418cfac0eb5a2305731576c Mon Sep 17 00:00:00 2001
|
||||||
|
From: "adria.labay" <adria.labay@gmail.com>
|
||||||
|
Date: Wed, 8 Feb 2023 15:40:36 +0100
|
||||||
|
Subject: [PATCH] support numpy 1.20
|
||||||
|
|
||||||
|
---
|
||||||
|
ssim/utils.py | 26 ++++++++++++--------------
|
||||||
|
1 file changed, 12 insertions(+), 14 deletions(-)
|
||||||
|
|
||||||
|
Index: pyssim-0.5/ssim/utils.py
|
||||||
|
===================================================================
|
||||||
|
--- pyssim-0.5.orig/ssim/utils.py
|
||||||
|
+++ pyssim-0.5/ssim/utils.py
|
||||||
|
@@ -2,31 +2,29 @@
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
|
|
||||||
|
-import numpy
|
||||||
|
-from numpy.ma.core import exp
|
||||||
|
+import numpy as np
|
||||||
|
import scipy.ndimage
|
||||||
|
|
||||||
|
from ssim.compat import ImageOps
|
||||||
|
|
||||||
|
+
|
||||||
|
def convolve_gaussian_2d(image, gaussian_kernel_1d):
|
||||||
|
"""Convolve 2d gaussian."""
|
||||||
|
- result = scipy.ndimage.filters.correlate1d(
|
||||||
|
+ result = scipy.ndimage.correlate1d(
|
||||||
|
image, gaussian_kernel_1d, axis=0)
|
||||||
|
- result = scipy.ndimage.filters.correlate1d(
|
||||||
|
+ return scipy.ndimage.correlate1d(
|
||||||
|
result, gaussian_kernel_1d, axis=1)
|
||||||
|
- return result
|
||||||
|
+
|
||||||
|
|
||||||
|
def get_gaussian_kernel(gaussian_kernel_width=11, gaussian_kernel_sigma=1.5):
|
||||||
|
"""Generate a gaussian kernel."""
|
||||||
|
# 1D Gaussian kernel definition
|
||||||
|
- gaussian_kernel_1d = numpy.ndarray((gaussian_kernel_width))
|
||||||
|
- norm_mu = int(gaussian_kernel_width / 2)
|
||||||
|
+ gaussian_kernel_1d = np.arange(0, gaussian_kernel_width, 1.)
|
||||||
|
+ gaussian_kernel_1d -= gaussian_kernel_width / 2
|
||||||
|
+ gaussian_kernel_1d = np.exp(-0.5 * gaussian_kernel_1d**2 /
|
||||||
|
+ gaussian_kernel_sigma**2)
|
||||||
|
+ return gaussian_kernel_1d / np.sum(gaussian_kernel_1d)
|
||||||
|
|
||||||
|
- # Fill Gaussian kernel
|
||||||
|
- for i in range(gaussian_kernel_width):
|
||||||
|
- gaussian_kernel_1d[i] = (exp(-(((i - norm_mu) ** 2)) /
|
||||||
|
- (2 * (gaussian_kernel_sigma ** 2))))
|
||||||
|
- return gaussian_kernel_1d / numpy.sum(gaussian_kernel_1d)
|
||||||
|
|
||||||
|
def to_grayscale(img):
|
||||||
|
"""Convert PIL image to numpy grayscale array and numpy alpha array.
|
||||||
|
@@ -37,11 +35,11 @@ def to_grayscale(img):
|
||||||
|
Returns:
|
||||||
|
(gray, alpha): both numpy arrays.
|
||||||
|
"""
|
||||||
|
- gray = numpy.asarray(ImageOps.grayscale(img)).astype(numpy.float)
|
||||||
|
+ gray = np.asarray(ImageOps.grayscale(img)).astype(float)
|
||||||
|
|
||||||
|
imbands = img.getbands()
|
||||||
|
alpha = None
|
||||||
|
if 'A' in imbands:
|
||||||
|
- alpha = numpy.asarray(img.split()[-1]).astype(numpy.float)
|
||||||
|
+ alpha = np.asarray(img.split()[-1]).astype(float)
|
||||||
|
|
||||||
|
return gray, alpha
|
3
pyssim-0.5.tar.gz
Normal file
3
pyssim-0.5.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:438ff84a371f05e443f136ed6cba0afad4dd486038da39b6d0d9d189a80973a4
|
||||||
|
size 2263693
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Mar 6 11:17:51 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
|
||||||
|
|
||||||
|
- Add numpy120.patch to support numpy 1.20 gh#jterrace/pyssim#44
|
||||||
|
- Update to 0.5
|
||||||
|
* No release notes found
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sat Feb 13 07:49:33 UTC 2021 - Dirk Müller <dmueller@suse.com>
|
Sat Feb 13 07:49:33 UTC 2021 - Dirk Müller <dmueller@suse.com>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-pyssim
|
# spec file for package python-pyssim
|
||||||
#
|
#
|
||||||
# Copyright (c) 2021 SUSE LLC
|
# Copyright (c) 2023 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -16,17 +16,18 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
|
||||||
%global skip_python36 1
|
%global skip_python36 1
|
||||||
Name: python-pyssim
|
Name: python-pyssim
|
||||||
Version: 0.4
|
Version: 0.5
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Structured Similarity Image Metric (SSIM)
|
Summary: Structured Similarity Image Metric (SSIM)
|
||||||
License: MIT
|
License: MIT
|
||||||
Group: Development/Languages/Python
|
Group: Development/Languages/Python
|
||||||
URL: https://github.com/jterrace/pyssim
|
URL: https://github.com/jterrace/pyssim
|
||||||
Source: https://github.com/jterrace/pyssim/archive/v%{version}.tar.gz
|
Source: https://files.pythonhosted.org/packages/source/p/pyssim/pyssim-%{version}.tar.gz
|
||||||
Patch0: Pillow-imports.patch
|
Patch0: Pillow-imports.patch
|
||||||
|
# PATCH-FIX-UPSTREAM numpy120.patch gh#jterrace/pyssim#44
|
||||||
|
Patch1: numpy120.patch
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
@ -34,7 +35,7 @@ Requires: python-Pillow
|
|||||||
Requires: python-numpy
|
Requires: python-numpy
|
||||||
Requires: python-scipy
|
Requires: python-scipy
|
||||||
Requires(post): update-alternatives
|
Requires(post): update-alternatives
|
||||||
Requires(postun): update-alternatives
|
Requires(postun):update-alternatives
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
# SECTION test requirements
|
# SECTION test requirements
|
||||||
BuildRequires: %{python_module Pillow}
|
BuildRequires: %{python_module Pillow}
|
||||||
@ -47,8 +48,7 @@ BuildRequires: %{python_module scipy}
|
|||||||
Module for computing Structured Similarity Image Metric (SSIM) in Python.
|
Module for computing Structured Similarity Image Metric (SSIM) in Python.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n pyssim-%{version}
|
%autosetup -p1 -n pyssim-%{version}
|
||||||
%patch0 -p1
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%python_build
|
||||||
@ -77,6 +77,7 @@ $python -m ssim --cw --width 128 --height 128 test-images/test3-orig.jpg test-im
|
|||||||
%license LICENSE.md
|
%license LICENSE.md
|
||||||
%doc README.md
|
%doc README.md
|
||||||
%python_alternative %{_bindir}/pyssim
|
%python_alternative %{_bindir}/pyssim
|
||||||
%{python_sitelib}/*
|
%{python_sitelib}/ssim
|
||||||
|
%{python_sitelib}/pyssim-%{version}*-info
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:c7b0842f46dd002b27d76e4ccfb30d29bb853f415990ef95710f725debbfc532
|
|
||||||
size 2661739
|
|
Loading…
x
Reference in New Issue
Block a user