求颜色直方图的相似度算法!

yu11men 2014-01-20 01:41:56
我已经求出两张图片的基于HSV的颜色直方图了,但是接下来 该用什么方式比较他们的相似度呢,求算法解析?
...全文
671 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
yu11men 2014-01-21
  • 打赏
  • 举报
回复
引用 6 楼 xuzuning 的回复:
你不是已经算出直方图了吗? 所以应用 式10 进行计算
$t = 0;
for($i=0; $i<count($q); $i++) {
  t += 1 - abs($q[$i]-$s[$i])/max($q[$i], $s[$i]);
}
r = $t / count($q);
[quote=引用 4 楼 yu11men 的回复:] for ($i = 0; $i < $L; $i++) { $max = $color_array[$i] > $color_array1[$i]?$color_array[$i]:$color_array1[$i] ; if( 0 == $max ) $max = 1; $sum = $sum + sqrt(($color_array[$i] - $color_array1[$i])*($color_array[$i] - $color_array1[$i])) / $max; } $sum = (1 - $sum)/$L; 是这样吗?那个L我还是不确定是什么
[/quote]老帅了你!谢谢啊!
xuzuning 2014-01-20
  • 打赏
  • 举报
回复
你不是已经算出直方图了吗? 所以应用 式10 进行计算
$t = 0;
for($i=0; $i<count($q); $i++) {
  t += 1 - abs($q[$i]-$s[$i])/max($q[$i], $s[$i]);
}
r = $t / count($q);
引用 4 楼 yu11men 的回复:
for ($i = 0; $i < $L; $i++) { $max = $color_array[$i] > $color_array1[$i]?$color_array[$i]:$color_array1[$i] ; if( 0 == $max ) $max = 1; $sum = $sum + sqrt(($color_array[$i] - $color_array1[$i])*($color_array[$i] - $color_array1[$i])) / $max; } $sum = (1 - $sum)/$L; 是这样吗?那个L我还是不确定是什么
青鬆下的坚躯 2014-01-20
  • 打赏
  • 举报
回复
引用 1 楼 xuzuning 的回复:
1、你贴出你的代码 2、一般可用欧氏距离算法
yu11men 2014-01-20
  • 打赏
  • 举报
回复
引用 3 楼 xuzuning 的回复:
你描述的是平面坐标系中的两点间的欧氏距离算法 实际就是使用勾股定律求斜边 而 HSV 表示的是颜色的矢量 实际是极坐标系中的极角*半径
for ($i = 0; $i < $L; $i++) { $max = $color_array[$i] > $color_array1[$i]?$color_array[$i]:$color_array1[$i] ; if( 0 == $max ) $max = 1; $sum = $sum + sqrt(($color_array[$i] - $color_array1[$i])*($color_array[$i] - $color_array1[$i])) / $max; } $sum = (1 - $sum)/$L; 是这样吗?那个L我还是不确定是什么
xuzuning 2014-01-20
  • 打赏
  • 举报
回复
你描述的是平面坐标系中的两点间的欧氏距离算法 实际就是使用勾股定律求斜边 而 HSV 表示的是颜色的矢量 实际是极坐标系中的极角*半径
yu11men 2014-01-20
  • 打赏
  • 举报
回复
引用 1 楼 xuzuning 的回复:
1、你贴出你的代码 2、一般可用欧氏距离算法
我看到还有这种欧式距离算法: ρ = sqrt( (x1-x2)^2+(y1-y2)^2 ) 这两个一样不,说实话我的数学是渣中之渣!
xuzuning 2014-01-20
  • 打赏
  • 举报
回复
1、你贴出你的代码
2、一般可用欧氏距离算法

21,887

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧