在日常學(xué)習(xí)、工作或生活中,大家總少不了接觸作文或者范文吧,通過文章可以把我們那些零零散散的思想,聚集在一塊。相信許多人會(huì)覺得范文很難寫?接下來小編就給大家介紹一下優(yōu)秀的范文該怎么寫,我們一起來看一看吧。
java圖像處理的方法有哪幾種篇一
項(xiàng)目需要調(diào)整圖片服務(wù)器的解決方案,這次調(diào)整使用fastdfs存儲(chǔ)小文件,也就是圖片,版的客服端,所以理所當(dāng)然把處理圖片放到了java這塊,使用java來處理圖片并且上傳到fastdfs上以下是小編為大家搜索整理的java圖像處理的方法,歡迎閱讀!更多精彩內(nèi)容請(qǐng)及時(shí)關(guān)注我們應(yīng)屆畢業(yè)生考試網(wǎng)!
對(duì)于一個(gè)已經(jīng)存在的image對(duì)象,要得到它的`一個(gè)局部圖像,可以使用下面的步驟:
//import .*;
//import .image.*;
image croppedimage;
imagefilter cropfilter;
cropfilter =new cropimagefilter(25,30,75,75);//四個(gè)參數(shù)分別為圖像起點(diǎn)坐標(biāo)和寬高,即cropimagefilter(int x,int y,int width,int height),詳細(xì)情況請(qǐng)參考api
croppedimage= aulttoolkit().createimage(new filteredimagesource(rce(),cropfilter));
//如果是在component的子類中使用,可以將上面的aulttoolkit().去掉。
//filteredimagesource是一個(gè)imageproducer對(duì)象。
對(duì)于一個(gè)已經(jīng)存在的image對(duì)象,得到它的一個(gè)縮放的image對(duì)象可以使用image的getscaledinstance方法:
image scaledimage=sourceimage. getscaledinstance(100,100, _default);//得到一個(gè)100x100的圖像
image doubledimage=sourceimage. getscaledinstance(th(this)*2,ght(this)*2, _default);//得到一個(gè)放大兩倍的圖像,這個(gè)程序一般在一個(gè)swing的組件中使用,而類jcomponent實(shí)現(xiàn)了圖像觀察者接口imageobserver,所有可以使用this。
//其它情況請(qǐng)參考api。
下面的程序使用三種方法對(duì)一個(gè)彩色圖像進(jìn)行灰度變換,變換的效果都不一樣。一般而言,灰度變換的算法是將象素的三個(gè)顏色分量使用 r*0.3+g*0.59+b*0.11得到灰度值,然后將之賦值給紅綠藍(lán),這樣顏色取得的效果就是灰度的。另一種就是取紅綠藍(lán)三色中的最大值作為灰度值。java核心包也有一種算法,但是沒有看源代碼,不知道具體算法是什么樣的,效果和上述不同。
/* */
/*@author:cherami */
/*email:cherami@*/
import .image.*;
public class grayfilter extends rgbimagefilter {
int modelstyle;
public grayfilter() {
modelstyle=_max;
canfilterindexcolormodel=true;
}
public grayfilter(int style) {
modelstyle=style;
canfilterindexcolormodel=true;
}
public void setcolormodel(colormodel cm) {
if (modelstyle==_max) {
substitutecolormodel(cm,new graymodel(cm));
}
else if (modelstyle==_float) {
substitutecolormodel(cm,new graymodel(cm,modelstyle));
}
public int filterrgb(int x,int y,int pixel) {
return pixel;
}
}
/* */
/*@author:cherami */
/*email:cherami@*/
import .image.*;
public class graymodel extends colormodel {
public static final int cs_max=0;
public static final int cs_float=1;
colormodel sourcemodel;
int modelstyle;
public graymodel(colormodel sourcemodel) {
super(elsize());
model=sourcemodel;
modelstyle=0;
}
s("content_relate");【java圖像處理的方法】相關(guān)文章:
1.
java圖像處理的方法大全
2.java處理bom文本的方法
3.java 異常處理
4.利用c語言實(shí)現(xiàn)計(jì)算機(jī)圖像處理的方法
5.java方法重寫的方法分析
6.java“類的分包處理”詳細(xì)教程
7.移動(dòng)場景下的圖像處理應(yīng)用設(shè)計(jì)
8.關(guān)于photoshop技巧之圖像處理的技巧大全
9.java異常處理語句及解析
【本文地址:http://mlvmservice.com/zuowen/2799544.html】