-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-implement
pHash
comparison using cv2
. Drop imagehash
+Pillow
(
#266) - Re-implement `pHash` comparison using `cv2`. - Drop `imagehash` and `Pillow` as dependencies - Reduce bundle size by 1.93MB (139.004 --> 137.074) - ~1.6x speed improvement for pHash comparison - Reduce install/build time considerably by not installing D3DShot from GitHub - Testing suggests some images might differ in comparison from old implementation by at most 2/64 (3.125%)
- Loading branch information
Showing
10 changed files
with
274 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
from numpy.fft import ifft as ifft | ||
from numpy.random import rand as rand, randn as randn | ||
from scipy import ( | ||
cluster, | ||
constants, | ||
datasets, | ||
fft, | ||
fftpack, | ||
integrate, | ||
interpolate, | ||
io, | ||
linalg, | ||
misc, | ||
ndimage, | ||
odr, | ||
optimize, | ||
signal, | ||
sparse, | ||
spatial, | ||
special, | ||
stats, | ||
) | ||
from scipy.__config__ import show as show_config | ||
from scipy._lib._ccallback import LowLevelCallable | ||
from scipy._lib._testutils import PytestTester | ||
from scipy.version import version as __version__ | ||
|
||
__all__ = [ | ||
"cluster", | ||
"constants", | ||
"datasets", | ||
"fft", | ||
"fftpack", | ||
"integrate", | ||
"interpolate", | ||
"io", | ||
"linalg", | ||
"misc", | ||
"ndimage", | ||
"odr", | ||
"optimize", | ||
"signal", | ||
"sparse", | ||
"spatial", | ||
"special", | ||
"stats", | ||
"LowLevelCallable", | ||
"test", | ||
"show_config", | ||
"__version__", | ||
] | ||
|
||
test: PytestTester | ||
def __dir__() -> list[str]: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
from numpy.fft import fftfreq, fftshift, ifftshift, rfftfreq | ||
from scipy._lib._testutils import PytestTester | ||
from scipy.fft._backend import register_backend, set_backend, set_global_backend, skip_backend | ||
from scipy.fft._basic import ( | ||
fft, | ||
fft2, | ||
fftn, | ||
hfft, | ||
hfft2, | ||
hfftn, | ||
ifft, | ||
ifft2, | ||
ifftn, | ||
ihfft, | ||
ihfft2, | ||
ihfftn, | ||
irfft, | ||
irfft2, | ||
irfftn, | ||
rfft, | ||
rfft2, | ||
rfftn, | ||
) | ||
from scipy.fft._fftlog import fhtoffset | ||
from scipy.fft._fftlog_multimethods import fht, ifht | ||
from scipy.fft._helper import next_fast_len | ||
from scipy.fft._pocketfft.helper import get_workers, set_workers | ||
from scipy.fft._realtransforms import dct, dctn, dst, dstn, idct, idctn, idst, idstn | ||
|
||
__all__ = [ | ||
"fft", | ||
"ifft", | ||
"fft2", | ||
"ifft2", | ||
"fftn", | ||
"ifftn", | ||
"rfft", | ||
"irfft", | ||
"rfft2", | ||
"irfft2", | ||
"rfftn", | ||
"irfftn", | ||
"hfft", | ||
"ihfft", | ||
"hfft2", | ||
"ihfft2", | ||
"hfftn", | ||
"ihfftn", | ||
"fftfreq", | ||
"rfftfreq", | ||
"fftshift", | ||
"ifftshift", | ||
"next_fast_len", | ||
"dct", | ||
"idct", | ||
"dst", | ||
"idst", | ||
"dctn", | ||
"idctn", | ||
"dstn", | ||
"idstn", | ||
"fht", | ||
"ifht", | ||
"fhtoffset", | ||
"set_backend", | ||
"skip_backend", | ||
"set_global_backend", | ||
"register_backend", | ||
"get_workers", | ||
"set_workers", | ||
] | ||
test: PytestTester |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
from _typeshed import Incomplete | ||
from numpy import float64, generic | ||
from numpy.typing import NDArray | ||
|
||
__all__ = ["dct", "idct", "dst", "idst", "dctn", "idctn", "dstn", "idstn"] | ||
|
||
|
||
def dctn( | ||
x, | ||
type=2, | ||
s=None, | ||
axes=None, | ||
norm=None, | ||
overwrite_x=False, | ||
workers=None, | ||
*, | ||
orthogonalize=None, | ||
): ... | ||
|
||
|
||
def idctn( | ||
x, | ||
type=2, | ||
s=None, | ||
axes=None, | ||
norm=None, | ||
overwrite_x=False, | ||
workers=None, | ||
orthogonalize=None, | ||
): ... | ||
|
||
|
||
def dstn( | ||
x, | ||
type=2, | ||
s=None, | ||
axes=None, | ||
norm=None, | ||
overwrite_x=False, | ||
workers=None, | ||
orthogonalize=None, | ||
): ... | ||
|
||
|
||
def idstn( | ||
x, | ||
type=2, | ||
s=None, | ||
axes=None, | ||
norm=None, | ||
overwrite_x=False, | ||
workers=None, | ||
orthogonalize=None, | ||
): ... | ||
|
||
|
||
def dct( | ||
x: NDArray[generic], | ||
type: int = 2, | ||
n: Incomplete | None = None, | ||
axis: int = -1, | ||
norm: Incomplete | None = None, | ||
overwrite_x: bool = False, | ||
workers: Incomplete | None = None, | ||
orthogonalize: Incomplete | None = None, | ||
) -> NDArray[float64]: ... | ||
|
||
|
||
def idct( | ||
x, | ||
type=2, | ||
n=None, | ||
axis=-1, | ||
norm=None, | ||
overwrite_x=False, | ||
workers=None, | ||
orthogonalize=None, | ||
): ... | ||
|
||
|
||
def dst( | ||
x, | ||
type=2, | ||
n=None, | ||
axis=-1, | ||
norm=None, | ||
overwrite_x=False, | ||
workers=None, | ||
orthogonalize=None, | ||
): ... | ||
|
||
|
||
def idst( | ||
x, | ||
type=2, | ||
n=None, | ||
axis=-1, | ||
norm=None, | ||
overwrite_x=False, | ||
workers=None, | ||
orthogonalize=None, | ||
): ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
partial |