资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

java天天生鲜项目代码 天天生鲜项目源码

参加java培训,需要有什么基础?

入门学习java唯一需要的基础就是英语词汇量,入门阶段不需要太多的词汇量,3000足够了(这里面java程序类关键字是最重要的),注意仅仅是词汇量而已,不需要掌握英语口语沟通中的语法。但是入门以后,想要完全精通java(当然这不是一件容易的事),8000以上词汇量还是要有的。

创新互联公司-专业网站定制、快速模板网站建设、高性价比黄陂网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式黄陂网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖黄陂地区。费用合理售后完善,10余年实体公司更值得信赖。

除此之外就是书本上最基础的一些java理论知识,这些理论知识不一定必须都要一字不差的背下来,但是这些都是基础需要很好的了解和理解,而且并不难理解。

这些基础的东西并没有什么技术性的难度,可以说就是一些需要死记硬背的东西而已,真正有难度的是你之后自己动手写代码的这个阶段。刚开始可能很难自己动手写出来100行以上逻辑性强且没有Bug的代码,基本都是需要看着别人的代码然后自己照葫芦画瓢的抄写,不然就不会写,所有初学者开始都是这样,所以是很正常的,这个就需要平时多写多练,一点一点累积。知识点积累的多了,逻辑通顺了,之后自然而然的就会动手写出自己的代码了。就是一个多写多练的问题。

如果你已经决定了要去学java,并且以找工作为目的的话,不建议自学,因为java想要零基础自学到最后顺利找到开发的工作,可以说基本是不可能的。一种情况除外,就是你对电脑编程有着异于常人的天赋可以无师自通,否则的话还是要去系统的培训一下。只要你能跟着有经验的人学,能有人带你练习做项目,外加平时自己多写代码,多去接触并理解新的知识点,最后找到开发的工作问题还是不大的。

新手学习使用Java,尝试着做一个项目使用Java做一个视频图像的处理。

Java图像处理技巧四则

下面代码中用到的sourceImage是一个已经存在的Image对象

图像剪切

对于一个已经存在的Image对象,要得到它的一个局部图像,可以使用下面的步骤:

//import java.awt.*;

//import java.awt.image.*;

Image croppedImage;

ImageFilter cropFilter;

CropFilter =new CropImageFilter(25,30,75,75); //四个参数分别为图像起点坐标和宽高,即CropImageFilter(int x,int y,int width,int height),详细情况请参考API

CroppedImage= Toolkit.getDefaultToolkit().createImage(new FilteredImageSource(sourceImage.getSource(),cropFilter));

如果是在Component的子类中使用,可以将上面的Toolkit.getDefaultToolkit().去掉。FilteredImageSource是一个ImageProducer对象。

图像缩放

对于一个已经存在的Image对象,得到它的一个缩放的Image对象可以使用Image的getScaledInstance方法:

Image scaledImage=sourceImage. getScaledInstance(100,100, Image.SCALE_DEFAULT); //得到一个100X100的图像

Image doubledImage=sourceImage. getScaledInstance(sourceImage.getWidth(this)*2,sourceImage.getHeight(this)*2, Image.SCALE_DEFAULT); //得到一个放大两倍的图像,这个程序一般在一个swing的组件中使用,而类Jcomponent实现了图像观察者接口ImageObserver,所有可以使用this。

//其它情况请参考API

灰度变换

下面的程序使用三种方法对一个彩色图像进行灰度变换,变换的效果都不一样。一般而言,灰度变换的算法是将象素的三个颜色分量使用R*0.3+G*0.59+ B*0.11得到灰度值,然后将之赋值给红绿蓝,这样颜色取得的效果就是灰度的。另一种就是取红绿蓝三色中的最大值作为灰度值。java核心包也有一种算法,但是没有看源代码,不知道具体算法是什么样的,效果和上述不同。

/* GrayFilter.java*/

/*@author:cherami */

/*email:cherami@163.net*/

import java.awt.image.*;

public class GrayFilter extends RGBImageFilter {

int modelStyle;

public GrayFilter() {

modelStyle=GrayModel.CS_MAX;

canFilterIndexColorModel=true;

}

public GrayFilter(int style) {

modelStyle=style;

canFilterIndexColorModel=true;

}

public void setColorModel(ColorModel cm) {

if (modelStyle==GrayModel

else if (modelStyle==GrayModel

}

public int filterRGB(int x,int y,int pixel) {

return pixel;

}

}

/* GrayModel.java*/

/*@author:cherami */

/*email:cherami@163.net*/

import java.awt.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(sourceModel.getPixelSize());

this.sourceModel=sourceModel;

modelStyle=0;

}

public GrayModel(ColorModel sourceModel,int style) {

super(sourceModel.getPixelSize());

this.sourceModel=sourceModel;

modelStyle=style;

}

public void setGrayStyle(int style) {

modelStyle=style;

}

protected int getGrayLevel(int pixel) {

if (modelStyle==CS_MAX) {

return Math.max(sourceModel.getRed(pixel),Math.max(sourceModel.getGreen(pixel),sourceModel.getBlue(pixel)));

}

else if (modelStyle==CS_FLOAT){

return (int)(sourceModel.getRed(pixel)*0.3+sourceModel.getGreen(pixel)*0.59+sourceModel.getBlue(pixel)*0.11);

}

else {

return 0;

}

}

public int getAlpha(int pixel) {

return sourceModel.getAlpha(pixel);

}

public int getRed(int pixel) {

return getGrayLevel(pixel);

}

public int getGreen(int pixel) {

return getGrayLevel(pixel);

}

public int getBlue(int pixel) {

return getGrayLevel(pixel);

}

public int getRGB(int pixel) {

int gray=getGrayLevel(pixel);

return (getAlpha(pixel)24)+(gray16)+(gray8)+gray;

}

}

如果你有自己的算法或者想取得特殊的效果,你可以修改类GrayModel的方法getGrayLevel()。

色彩变换

根据上面的原理,我们也可以实现色彩变换,这样的效果就很多了。下面是一个反转变换的例子:

/* ReverseColorModel.java*/

/*@author:cherami */

/*email:cherami@163.net*/

import java.awt.image.*;

public class ReverseColorModel extends ColorModel {

ColorModel sourceModel;

public ReverseColorModel(ColorModel sourceModel) {

super(sourceModel.getPixelSize());

this.sourceModel=sourceModel;

}

public int getAlpha(int pixel) {

return sourceModel.getAlpha(pixel);

}

public int getRed(int pixel) {

return ~sourceModel.getRed(pixel);

}

public int getGreen(int pixel) {

return ~sourceModel.getGreen(pixel);

}

public int getBlue(int pixel) {

return ~sourceModel.getBlue(pixel);

}

public int getRGB(int pixel) {

return (getAlpha(pixel)24)+(getRed(pixel)16)+(getGreen(pixel)8)+getBlue(pixel);

}

}

/* ReverseColorModel.java*/

/*@author:cherami */

/*email:cherami@163.net*/

import java.awt.image.*;

public class ReverseFilter extends RGBImageFilter {

public ReverseFilter() {

canFilterIndexColorModel=true;

}

public void setColorModel(ColorModel cm) {

substituteColorModel(cm,new ReverseColorModel(cm));

}

public int filterRGB(int x,int y,int pixel) {

return pixel;

}

}

要想取得自己的效果,需要修改ReverseColorModel.java中的三个方法,getRed、getGreen、getBlue。

下面是上面的效果的一个总的演示程序。

/*GrayImage.java*/

/*@author:cherami */

/*email:cherami@163.net*/

import java.awt.*;

import java.awt.image.*;

import javax.swing.*;

import java.awt.color.*;

public class GrayImage extends JFrame{

Image source,gray,gray3,clip,bigimg;

BufferedImage bimg,gray2;

GrayFilter filter,filter2;

ImageIcon ii;

ImageFilter cropFilter;

int iw,ih;

public GrayImage() {

ii=new ImageIcon(\"images/11.gif\");

source=ii.getImage();

iw=source.getWidth(this);

ih=source.getHeight(this);

filter=new GrayFilter();

filter2=new GrayFilter(GrayModel.CS_FLOAT);

gray=createImage(new FilteredImageSource(source.getSource(),filter));

gray3=createImage(new FilteredImageSource(source.getSource(),filter2));

cropFilter=new CropImageFilter(5,5,iw-5,ih-5);

clip=createImage(new FilteredImageSource(source.getSource(),cropFilter));

bigimg=source.getScaledInstance(iw*2,ih*2,Image.SCALE_DEFAULT);

MediaTracker mt=new MediaTracker(this);

mt.addImage(gray,0);

try {

mt.waitForAll();

} catch (Exception e) {

}

自学java开发很难吗?

Java语言是一种面向对象的编程语言,刚接触Java的人可能会感觉比较抽象,学起来会有点吃力,不过没关系不用着急,你只要上课的时候认真听老师讲解,一些概念知识慢慢去理解,课后多做练习就熟能生巧,只有多练,当你在做项目时你才能很熟练的写出你想要代码。

不过想自学java还是有点难度的,对于之前完全没了解过Java的同学,建议最好还是报个培训班,跟着老师系统的学,不容易掉队,否则从最基础的开始学起,那些数组、基础语法、面向对象、操作系统什么的,枯燥乏味,很容易中途掉队放弃,因为自学时间比较长,学习过程中又得不到反馈,很多人都坚持不到最后,就直接放弃了,身边很多这样活生生的例子。

初学者在培训java的过程中还会遇到这样一个有趣的问题,上课老师讲的内容,自己感觉Java并不难学,也理解,可是敲代码的时候就有点费事,就在一个点上卡住了,就是过不去,直到老师和同学一提才恍然大悟,其实究其原因就是自己练的太少了,要多练才能熟练运用老师讲到的各种方法。

想学好Java一定要记住,关键一点就是坚持练习,唯有自己平时多练习,多参考别人的项目,学会总结,只有每天反复练习我们在遇到问题时才有一定的思路。

然后你会发现学好java简直是小菜一碟,比老婆婆用铁杵磨针要简单多了。

想学好java欲速则不达,学习java编程需要一个漫长的阶段,不能一步登天,这需要一个过程,在这个过程中慢慢积累经验扎实基础。

总之,不管你是否有基础,只要你对Java语言感兴趣,愿意投入时间和精力去学习,那么你一定会有所收获,至于你问Java难不难,我告诉你,答案还是有一定难度的,但是并不代表你学不会呀,并不代表你不行呀。

其实很多时候是你自己的态度决定一切,有句话是这么说的"成功的道路并不拥挤,因为坚持下来的人并不多",想要拿下Java你需要付出比别人更多的努力。


当前标题:java天天生鲜项目代码 天天生鲜项目源码
分享URL:http://cdkjz.cn/article/dogeehj.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220