Comments (10)
@rhsimplex Nice, love you guys.
from image-match.
@rhsimplex vrde's fork fixed my problem, issue solved 😃
from image-match.
Nope, it should return 0.0
. I'll try to replicate this Monday and see what's going on.
Thanks for reporting the issue.
from image-match.
Ok, I only get a distance of 0.09, which should be under the threshold for matching. However these images should be identical.
In [1]: from image_match.goldberg import ImageSignature
In [2]: gis = ImageSignature()
In [3]: path1 = 'https://cloud.githubusercontent.com/assets/1967804/18188884/53e77c7a-70e8-11e6-8e27-98c196f1e242.jpg'
In [4]: path2 = 'https://cloud.githubusercontent.com/assets/1967804/18188887/5bbba7aa-70e8-11e6-93b9-3e881bc03e66.jpg'
In [5]: sig1 = gis.generate_signature(path1)
In [6]: sig2 = gis.generate_signature(path2)
In [7]: gis.normalized_distance(sig1, sig2)
Out[7]: 0.094653959692538772
What's going on? I think one of these images is greyscale, and one is color.
In [8]: from skimage.io import imread
In [9]: imread(path1).shape
Out[9]: (1334, 750, 3)
In [10]: imread(path2).shape
Out[10]: (1334, 750)
So skimage
(which image-match
uses for loading the images) converts to greyscale from color with range (0,1)
but if the image is already greyscale over 8 bits, it leaves it!
In [12]: imread(path1, as_grey=True)
Out[12]:
array([[ 1., 1., 1., ..., 1., 1., 1.],
[ 1., 1., 1., ..., 1., 1., 1.],
[ 1., 1., 1., ..., 1., 1., 1.],
...,
[ 1., 1., 1., ..., 1., 1., 1.],
[ 1., 1., 1., ..., 1., 1., 1.],
[ 1., 1., 1., ..., 1., 1., 1.]])
In [13]: imread(path2, as_grey=True)
Out[13]:
array([[255, 255, 255, ..., 255, 255, 255],
[255, 255, 255, ..., 255, 255, 255],
[255, 255, 255, ..., 255, 255, 255],
...,
[255, 255, 255, ..., 255, 255, 255],
[255, 255, 255, ..., 255, 255, 255],
[255, 255, 255, ..., 255, 255, 255]], dtype=uint8)
Hence the slightly different signatures. The correct fix would be get rid of the skimage
dependency and use PIL
directly. A quick fix might be to detect if an image is uint8
and divide by 255
.
from image-match.
Interestingly, when I try dividing by 255
, I get the same distance value as you: 0.70823708184882128
. Maybe something has changed with skimage
. Can you tell me the output of:
import skimage
print(skimage.__version__)
?
I'm using version 0.12.3
from image-match.
@rhsimplex , Thank you for your reply.
I use pavlov/match docker image pavlov/match@9b7df7ecc867
.
and the skimage
version is exactly 0.12.3
Would use PIL
directly fix the problem? Any plan to replace it ?
from image-match.
If you're using pavlov's match, then the real problem is that it's using an out-of-date image-match build. Their docker file has the line:
pip install git+https://github.com/ascribe/[email protected]
And we're at version 1+ now. My colleague @vrde has actually ported match to use the latest version of image-match (which now uses python3), you can find that fork here: https://github.com/vrde/match. I'll ask him to make a PR against the original repository.
Sorry about the confusion, but see if using this version helps. If so, I probably won't make any changes because 0.09
is well below the threshold of what should be considered a match.
from image-match.
@rhsimplex Good news, I will use @vrde's fork and see if it woks out. Thank you very much. 👍
from image-match.
You're welcome. Please let me know if it fixes your problem.
from image-match.
there is now a PR dsys/match#8 on Pavlov's match. When the merge it you can pull from there directly =)
from image-match.
Related Issues (20)
- skimage `imread` as_grey vs as_gray HOT 4
- Using Image-Match with Real-Time/Live/Video Stream? HOT 2
- Issue installing on python 3.7 conda env HOT 2
- cut_distance
- fails to pass a sanity check due to a bug in the windows runtime
- Failure when running this function through pytest
- Will the face search function be added?
- Mongo search is slow
- Is this still maintained? HOT 1
- New release compatible with Python 3.7
- Broken link to Pavlov in the readme
- Bulk insert of images on ElasticSearch
- Elasticsearch version conflict HOT 1
- Link to get 80M images is FORBIDDEN
- Fast Insert HOT 2
- setup.py fails when installing scikit-image everytime HOT 2
- Error on search_image HOT 3
- ValueError: the input array must have size 3 along `channel_axis`, got (923, 600) HOT 15
- Doesn't support Webp image format. HOT 1
- Whether to consider adding face search ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from image-match.