MashiMaroLjc / Learn-to-identify-similar-images

Record my python script about Iearning to identify similar images
397 stars 174 forks source link

DCT变换中系数矩阵有误 #2

Closed hongweipeng closed 8 years ago

hongweipeng commented 8 years ago

pHash.py的计算系数矩阵函数get_coefficient中

sqr = math.sqrt(1/n)
    value = []
    for i in range(0,n):
        value.append(sqr)

应为

sqr = math.sqrt(2.0 / n) * math.sqrt(1/n)
MashiMaroLjc commented 8 years ago

DCT算法是参考这篇文章完成的

其中,其指出了系数矩阵为:

系数矩阵

第一行把系数乘进去后,为sqrt(2/N)*sqrt(1/2) = sqrt(1/N)

hongweipeng commented 8 years ago

那没错,是我看错了,可耻的匿了