100分求教,怎样得到两张图片的相似度? 比如 a图片、b图片。。并不是完全一样的,有可能是百分之30 ,怎么得到这个30的相似度了只要能得到相似度就可以了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //说明,bmp1,bmp2必须大小一致,位深度假设为24位的function GetSimilar(bmp1,bmp2 : TBitmap) : single; var ps,pd : pbytearray; ncount,i ,j: integer; color1,color2 : tcolor;begin ncount := 0; for i := 0 to bmp1.height - 1 do begin ps := bmp1.Scanline[i]; pd := bmp2.Scanline[i]; for j := 0 to bmp1.width - 1 do begin color1 := RGB(ps[j * 3 + 2],ps[j * 3 + 1],ps[j * 3]); color2 := RGB(pd[j * 3 + 2],pd[j * 3 + 1],pd[j * 3]); if color1 = color2 then inc(ncount); end; end; result := ncount / bmp1.width * bmp1.Height;end;木有测试.... dbgrideh 滚动条 的问题。。。。。。 求api发E-mail的代码? 程序中向comboBox赋给Text属性时,如何使其响应Onchange事件?? 怎样把bitbtn按钮放在edit内???? 有关类的多态性问题 急!急!急! 100分相送.先来先送! fastReport RichView行距 DBGridEh的EditButton无法设置,奇怪了 ACCESS中怎么判断空值?用(SQL语句) 请问怎么知道RICHEDIT的当前光标的坐标 怎么把form1里面的edit1.text或其它的。text,不保存在数据库里直接用fastreport打印出来 同时激活窗口标题栏
//说明,bmp1,bmp2必须大小一致,位深度假设为24位的
function GetSimilar(bmp1,bmp2 : TBitmap) : single;
var ps,pd : pbytearray;
ncount,i ,j: integer;
color1,color2 : tcolor;
begin
ncount := 0;
for i := 0 to bmp1.height - 1 do
begin
ps := bmp1.Scanline[i];
pd := bmp2.Scanline[i];
for j := 0 to bmp1.width - 1 do
begin
color1 := RGB(ps[j * 3 + 2],ps[j * 3 + 1],ps[j * 3]);
color2 := RGB(pd[j * 3 + 2],pd[j * 3 + 1],pd[j * 3]);
if color1 = color2 then inc(ncount);
end;
end;
result := ncount / bmp1.width * bmp1.Height;
end;
木有测试....