200分奖励, 寻找快速的线性插值图像缩放程序 如果你有比以下程序更快速的http://d.ahjoe.com/z/ZoomTest.zip请提供演示程序地址或发到[email protected]注意: 网上找到的某些代码在做图像缩小时,结果是不正确的(与PhotoShop对比)。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用strechblt觉得比你这个快,你这个太慢了。我用VB写的算法也比你这个快很多。下午给你看个例子。 演示程序中也有提供 StretchBlt的测试。如果做图像压缩,或者放大非整数倍的时候,它的效果很差的。 我上传的,你可以比较下http://files.cnblogs.com/laviewpbt/zyl910_Scale.rar 谢谢你!你这个我昨晚已经试过了.你的代码有点儿问题, 压缩时图像不正确(压缩到50%后与PhotoShop比较就知道了)。速度也比较慢,以长宽各放大到200%为例你的代码用时 0.321, 我的代码用时 0.104 先把24bit格式的源Bitmap和目标Bitmap准备好,然后只计转换所用的时间 procedure TForm1.Button3Click(Sender: TObject);label repzoom;var i: integer; tmp: integer;begin if Bmp1.Width = 0 then Exit; StatusBar1.Panels[0].Text := 'Processing...'; StatusBar1.Panels[1].Text := ''; StatusBar1.Panels[2].Text := ''; StatusBar1.Panels[3].Text := ''; Bmp2.Width := Bmp1.Width * Round(Rx.Value) div 100; Bmp2.Height := Bmp1.Height * Round(Rx.Value) div 100; ZoomTime := GetTickCount(); i := 0;repzoom: ZoomBitmap24Int(Bmp2, Bmp1); // 源图 Bmp1, 目标图 Bmp2都是24bit格式 Inc(i); tmp := GetTickCount(); if tmp - ZoomTime < 1200 then goto repzoom; Count := i; // 转换次数 ZoomTime := (tmp - ZoomTime) div i; // 平均时间 PaintBox1.Width := Bmp2.Width; PaintBox1.Height := Bmp2.Height; PaintBox1.Invalidate();end; hehe佩服,缩小的时候楼主的字体还是能看清除的,然我们的都不行了,GDI+的我试了也不行。楼主高人。 过奖了。对图像处理其实我是外行的,这是我的第一个图像处理代码。之前我用的缩放代码都是用这个版本的http://foe.bokee.com/6640682.html在做图像压缩的时候它的结果不正确,所以只好硬着头皮自己写了。 没什么特别要求的话,能用就行了。所谓线性插值,中心思想是考虑ab两点之间色彩值是线性变化,这种方法处理下来,图像效果要比StretchBlt(最近邻域法)稍好,但在图像细节部分会变得模糊。 都是高手啊,呵呵。小弟这两天也在做这个呢,不过不是图象处理,就是一般的图形缩放,却不知如何下手,学习ing 這個錯誤什麽原因啊? delphi5/6开发的程序,在delphi7下无法编辑打印报表部分 請問下CPU FSB 533 MHZ 该配哪款DDR内存? 这里的人气好像不够旺啊。。 有关程序中“流程图”的设计,恳请高手请进来帮帮小弟! 找mp3控件的源码难吗???? 【提问! 求助!】SOS!要命啦!大家快来帮帮忙吧!谢谢了! 分不是问题! 打开一个窗体时,跳出一个对话框说cla 急?绝对加分!! ! 哎,~~又要问问题啦。。。。 请高手帮忙FTP上载的问题!!!!急呀!!!
http://files.cnblogs.com/laviewpbt/zyl910_Scale.rar
你的代码有点儿问题, 压缩时图像不正确(压缩到50%后与PhotoShop比较就知道了)。
速度也比较慢,以长宽各放大到200%为例
你的代码用时 0.321, 我的代码用时 0.104
label repzoom;
var
i: integer;
tmp: integer;
begin
if Bmp1.Width = 0 then
Exit;
StatusBar1.Panels[0].Text := 'Processing...';
StatusBar1.Panels[1].Text := '';
StatusBar1.Panels[2].Text := '';
StatusBar1.Panels[3].Text := '';
Bmp2.Width := Bmp1.Width * Round(Rx.Value) div 100;
Bmp2.Height := Bmp1.Height * Round(Rx.Value) div 100;
ZoomTime := GetTickCount();
i := 0;
repzoom:
ZoomBitmap24Int(Bmp2, Bmp1); // 源图 Bmp1, 目标图 Bmp2都是24bit格式
Inc(i);
tmp := GetTickCount();
if tmp - ZoomTime < 1200 then
goto repzoom;
Count := i; // 转换次数
ZoomTime := (tmp - ZoomTime) div i; // 平均时间
PaintBox1.Width := Bmp2.Width;
PaintBox1.Height := Bmp2.Height;
PaintBox1.Invalidate();
end;
佩服,缩小的时候楼主的字体还是能看清除的,然我们的都不行了,GDI+的我试了也不行。楼主高人。
http://foe.bokee.com/6640682.html
在做图像压缩的时候它的结果不正确,所以只好硬着头皮自己写了。
所谓线性插值,中心思想是考虑ab两点之间色彩值是线性变化,这种方法处理下来,图像效果要比StretchBlt(最近邻域法)稍好,但在图像细节部分会变得模糊。