JAVA图像处理中值滤波.doc_第1页
JAVA图像处理中值滤波.doc_第2页
JAVA图像处理中值滤波.doc_第3页
JAVA图像处理中值滤波.doc_第4页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

import com.sun.media.jai.widget.DisplayJAI;import java.awt.GridLayout;import javax.media.jai.JAI;import javax.media.jai.PlanarImage;import javax.media.jai.operator.MedianFilterDescriptor;import javax.swing.BorderFactory;import javax.swing.JScrollPane;import javax.swing.border.TitledBorder;/* * Median.java * 版权所有 - 贺向前 * 地址:重庆市渝中区医学院路1号 * 重庆医科大学基础医学院计算机教研室 * 邮编:400016 * 邮件: * QQ: 910019784 * 于重庆,石桥铺枫丹苑 2011-11-1, 18:09:13 * 未经授权,不得复制、传播。 */* * * author Administrator */public class Median extends javax.swing.JFrame /* Creates new form Median */ public Median() initComponents(); setTitle(中值滤波); setLayout(new GridLayout(2,2); private void showImage(PlanarImage im,String str) DisplayJAI dj=new DisplayJAI(im); JScrollPane jp=new JScrollPane(dj); TitledBorder titled=BorderFactory.createTitledBorder(+str); jp.setBorder(titled); add(jp); private PlanarImage loadFile(String fileName) PlanarImage dst=JAI.create(fileload,fileName); return dst; /* This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ SuppressWarnings(unchecked) / private void initComponents() setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); addMouseListener(new java.awt.event.MouseAdapter() public void mouseClicked(java.awt.event.MouseEvent evt) formMouseClicked(evt); ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane(); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 300, Short.MAX_VALUE) ); pack(); / private void formMouseClicked(java.awt.event.MouseEvent evt) / TODO add your handling code here: String fileName=srcx.jpg; PlanarImage im0=loadFile(fileName); showImage(im0,Source); PlanarImage im1=(PlanarImage)JAI.create(medianfilter,im0,MedianFilterDescriptor.MEDIAN_MASK_SQUARE,new Integer(5); showImage(im1,5*5SqureShapeMedian); PlanarImage im2=(PlanarImage)JAI.create(medianfilter,im0,MedianFilterDescriptor.MEDIAN_MASK_X,new Integer(3); showImage(im2,3*3XShapeMedian); PlanarImage im3=(PlanarImage)JAI.create(medianfilter,im0,MedianFilterDescriptor.MEDIAN_MASK_PLUS,new Integer(5); showImage(im3,5*5PlusShapeMedian); JAI.create(filestore, im1, MedianFilter.jpg, jpeg, null); pack(); show(); /* * param args the command line arguments */ public static void main(String args) /* Set the Nimbus look and feel */ / /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see /javase/tutorial/uiswing/lookandfeel/plaf.html */ try for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels() if (Nimbus.equals(info.getName() javax.swing.UIManager.setLookAndFeel(info.getClassName(); break; catch (ClassNotFoundException ex) java.util.logging.Logger.getLogger(Median.class.getName().log(java.util.logging.Level.SEVERE, null, ex); catch (InstantiationException ex) java.util.logging.Logger.getLogger(Median.class.getName().log(java.util.logging.Level.SEVERE, null, ex); catch (IllegalAccessException ex) java.util.logging.Logger.getLogger(Median.class.getName().log(java.util.logging.Level.SEVERE, null, ex); catch (javax.swing.UnsupportedLookAndFeelException ex) java.util.logging.Logger.getLogger(Median.class.getName().log(java.util.logging.Level.SEVERE, null, ex); / /* Create and d

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论