whichimg
blazing fast template matching when possible images are all known. Handy tool for GUI scripting.
How to Use
It supports python 3.6 +
pip install whichimg
from whichimg import ImageTeller
teller = ImageTeller([img1, img2, img3, img4]) # numpy arrays
teller.tell(secret_img) # returns 0 or 1 or 2 or 3 or -1 for not found
if you're sure secret_img is one of the images, you can set keyword argument surprises to False. This will give you a minor performance gain.
teller = ImageTeller([img1, img2, img3, img4], surprises=False)
This is equivalent to the following naive approach
def naive_tell(images, sample_img):
for i, img in enumerate(images):
if np.array_equal(img, sample_img):
return i
return -1
naive_tell([img1, img2, img3, img4], secret_img)
Note
It's not generally faster than the naive approach. I thought my approach was faster and spent a week writing this shit though. lmfao.
They're about equally fast on the tests/fixtures testing data I came up with (10x10 images). Through my rough testing, there could be a magnitude of performance gain when there are many possible images (>10) and when the images are larger (200x200 for example).
Metadata
Release files for whichimg 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| whichimg-1.0.5.tar.gz | 7.4 kB | Without provenance | Details for whichimg-1.0.5.tar.gz |
Release files / whichimg-1.0.5.tar.gz
| Download URL | whichimg-1.0.5.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
05453cb5207b953b434c0db51852e7fba7dfaf5e4b79f2ffe1f43d54f477f8bc
|
|
BLAKE2b-256 checksum How to use checksums |
1f8df66e437b8c59fc5a2a96148363380069f75938a873c7221d4725fa0ed75f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.7
|
Security for whichimg 1.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.