Apr-19-2024, 02:50 AM
hi, sorry for my bad english,
i tried to create phash compare using "VideoHash"
i tried to using format( '#064b') but it for string data,
i need it because the binary needs to compare using a bitwise technique
i tried to create phash compare using "VideoHash"
#pip install videohash
from videohash import VideoHash
import time
start_time = time.time()
path = "input.mp4"
a = VideoHash(path=path)
print(a)
print(type(a))
b = str(a)
print(b)
print("len :",len(b))
print(type(b))
c = int(b,2)
print(c)
print(type(c))
d = bin(c)
print(d)
print("len :",len(d))
print(time.time() - start_time,"Seconds")and the result:Output:0b0000100100001110111000100111111101100001011000010100000000000000
<class 'videohash.videohash.VideoHash'>
0b0000100100001110111000100111111101100001011000010100000000000000
len : 66
<class 'str'>
652708032737787904
<class 'int'>
0b100100001110111000100111111101100001011000010100000000000000
len : 62
9.695210933685303 Secondsbut the number of digits after conversion is different, the original is 66, and the converted is 62,i tried to using format( '#064b') but it for string data,
i need it because the binary needs to compare using a bitwise technique
def hamming_distance(a, b):
return bin(a ^ b).count('1')
print(hamming_distance(a, b))please help me
