Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG REPORT #88

Closed
akamhy opened this issue May 10, 2022 · 3 comments · Fixed by #89
Closed

BUG REPORT #88

akamhy opened this issue May 10, 2022 · 3 comments · Fixed by #89
Labels
bug Something isn't working

Comments

@akamhy
Copy link
Owner

akamhy commented May 10, 2022

Describe the bug
Hash collision for some videos of same length

To Reproduce

v1 = VideoHash(url="https://canvaz.scdn.co/upload/artist/3PhoLpVuITZKcymswpck5b/video/5e966e9c01f147cdae93a02c61a4bf7c.cnvs.mp4")
v2 = VideoHash(url="https://canvaz.scdn.co/upload/licensor/7JGwF0zhX9oItt9901OvB5/video/dc047df48f774d1590b61fd38bc082e4.cnvs.mp4")
print(v1 == v2)

Expected behavior
The hash should be different but is same.

Screenshots
NA

Please complete the following information:

  • Operating system: NA
  • Python Version: NA
  • VideoHash version: NA

Additional context
The issue can probably be resolved by extracting more features such as brightness levels or maybe the most dominant colors of frames extracted at a specific FPS. Increase the number of hash bits to accommodate more data.

OR

why not use colorhash + whash and change the bit site to 128( twice of 64, the current size)? They generate hash is very different ways and collisions should be highly unlikely.

@akamhy akamhy added the bug Something isn't working label May 10, 2022
@akamhy
Copy link
Owner Author

akamhy commented May 13, 2022

Use Resampling.LANCZOS

akamhy added a commit that referenced this issue May 17, 2022
There were some issues with only using whash for videos of samelength and kind of similar brighness levels.

Exmaples in #88

To fix this issue we are making a image that is horizontally concatenation
of all the frames used for the collage in whash

Then we divide the horizontally concatenated into 64 equal tiles and
find the dominant color of the tile.

We have a deafult list of how we expect the dominant color to be, if they are
same as our default list we set the bit to one else set it to zero.

Finally take the bitwise XOR of the whash bit list and dominant color bitlist.
akamhy added a commit that referenced this issue May 17, 2022
* update tests and isort imports

* version 2.1.9 -> 3.0.0 as servere changes made and update copyright info

* 2021-2022 year

* year 2021-2022

* isort sort the file

* add new reqs imagedominantcolor and image_slicer, for finding dominant color and slicing images of the tiles respectively.

* sort imports with isort

* sort imports with isort

* sort imports with isort

* sort imports with isort

* sort imports with isort

* make mypy ignore imagedominantcolor and image_slicer

* create videohash/tilemaker.py and updated videohash/videohash.py

There were some issues with only using whash for videos of samelength and kind of similar brighness levels.

Exmaples in #88

To fix this issue we are making a image that is horizontally concatenation
of all the frames used for the collage in whash

Then we divide the horizontally concatenated into 64 equal tiles and
find the dominant color of the tile.

We have a deafult list of how we expect the dominant color to be, if they are
same as our default list we set the bit to one else set it to zero.

Finally take the bitwise XOR of the whash bit list and dominant color bitlist.

* use Pillow>=9.0.0 and drop python 3.6

* remove sys, unused import in tilemaker.py

* trying to fix pillow install in MacOS/Windows In GitHub action

* use Pillow>=9.0.0

* incorporate code from image_slicer, issues with Pillow

* remove unused parts of image_slicer and aslo lint
@akamhy
Copy link
Owner Author

akamhy commented May 17, 2022

jj.mp4

@akamhy
Copy link
Owner Author

akamhy commented May 17, 2022

vid.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant