当前位置: 技术问答>java相关
求对图象放大缩小的算法
来源: 互联网 发布时间:2015-05-31
本文导语: 请问各位大拿,对图象放大缩小的常用算法有那些,小弟谢过了 | 以下网址有许多处理图像的源码: http://dmoz.org/Computers/Programming/Languages/Java/Class_Libraries/Graphics/ http://dmoz.org/Computers/Programming/Lang...
请问各位大拿,对图象放大缩小的常用算法有那些,小弟谢过了
|
以下网址有许多处理图像的源码:
http://dmoz.org/Computers/Programming/Languages/Java/Class_Libraries/Graphics/
http://dmoz.org/Computers/Programming/Languages/Java/Class_Libraries/Graphics/Data_Formats/
http://dmoz.org/Computers/Programming/Languages/Java/Class_Libraries/Graphics/
http://dmoz.org/Computers/Programming/Languages/Java/Class_Libraries/Graphics/Data_Formats/
|
Scale an Image
import java.awt.image.*;
import java.awt.*;
import java.net.*;
public class app extends java.applet.Applet {
Image source;
Image resizedImage;
public void init() {
MediaTracker media = new MediaTracker(this);
// java how-to image for example
source = getImage(getDocumentBase(),"jht.gif");
media.addImage(source,0);
try {
media.waitForID(0);
// scale down, half the original size
ImageFilter replicate =
new ReplicateScaleFilter
(source.getWidth(this)/2, source.getHeight(this)/2);
ImageProducer prod =
new FilteredImageSource(source.getSource(),replicate);
resizedImage = createImage(prod);
media.addImage(resizedImage,1);
media.waitForID(1);
}
catch(InterruptedException e) {}
}
public void paint(Graphics g) {
g.drawImage(source, 10,10,this);
g.drawImage(resizedImage,10, 80,this);
}
}
---------------
shmilu@sina.com
import java.awt.image.*;
import java.awt.*;
import java.net.*;
public class app extends java.applet.Applet {
Image source;
Image resizedImage;
public void init() {
MediaTracker media = new MediaTracker(this);
// java how-to image for example
source = getImage(getDocumentBase(),"jht.gif");
media.addImage(source,0);
try {
media.waitForID(0);
// scale down, half the original size
ImageFilter replicate =
new ReplicateScaleFilter
(source.getWidth(this)/2, source.getHeight(this)/2);
ImageProducer prod =
new FilteredImageSource(source.getSource(),replicate);
resizedImage = createImage(prod);
media.addImage(resizedImage,1);
media.waitForID(1);
}
catch(InterruptedException e) {}
}
public void paint(Graphics g) {
g.drawImage(source, 10,10,this);
g.drawImage(resizedImage,10, 80,this);
}
}
---------------
shmilu@sina.com
|
算法方面,你可以用边缘像素扩大法(我自己给取得名字)、我想你不是搞专业图像处理算法研究的,一般不必要自己写的、也用不着考虑。像我学过图像处理,现在还不忘了,只有用时还有可能再去查资料。
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。