我试图通过计算颜色直方图来检测图像中的主色。这是图像:
这是我为直方图计算编写的代码:
print(colors)
问题在于,当我说[(588, (255, 255, 255)), (878, (254, 255, 255)), (581, (255, 254, 255)), (209, (254, 254, 255)), (238, (253, 254, 255)), (164, (254, 253, 255)), (380, (253, 253, 255)), (232, (252, 253, 255)), (255, (253, 252, 255)), (16, (252, 252, 255)), (253, (251, 252, 255)), (422, (252, 251, 255)), (14, (251, 251, 255)), (296, (250, 251, 255)), (1515, (251, 250, 255)), (22, (250, 250, 255)), (91, (249, 250, 255)), (2, (247, 250, 255)), (88, (250, 249, 255)), (21, (249, 249, 255)), (1, (246, 249, 255)), (52, (249, 248, 255)), (90, (248, 248, 255)), (5, (245, 248, 255)), (1, (249, 247, 255)), (73, (248, 247, 255)), (245, (247, 247, 255)), (1, (248, 246, 255)), (106, (246, 246, 255)), (3, (242, 246, 255)), (3, (247, 245, 255)), (95, (245, 245, 247)), (39, (244, 245, 247)), (2, (246, 244, 255)),...
时,它会输出大量的RGB值及其相应的数量。
SELECT coalesce(SUM( PortFixedIncApp.PrincipalBalance + (PortFixedIncApp.PrincipalBalance * PortFixedIncApp.DailyInterestrate * DATEDIFF(day, PortFixedIncApp.LastDateOfInterestAccruals,'2016-02-05')) + PortFixedIncApp.InterestBalance),0 ) AS MarketValue
FROM PortFixedIncApp
WHERE (PortFixedIncApp.TransStatus = 'Active')
AND PortFixedIncApp.AccountNo='3051010000401'
AND (PortFixedIncApp.EndDate <='2016-02-05')
在我看来,JPEG压缩是原因,但我不知道确切的原因。在这种情况下,有人可以帮我计算直方图吗?