import dia.jai.widget.DisplayJAI;
import java.awt.GridLayout;
dia.jai.JAI;
dia.jai.PlanarImage;
dia.jai.operator.MedianFilterDescriptor;
import javax.swing.BorderFactory;
import javax.swing.JScrollPane;
import javax.swing.border.TitledBorder;
/*
* Median.java
* 版权所有 - 贺向前
* 地址:重庆市渝中区医学院路1号
* 重庆医科大学基础医学院计算机教研室
* 邮编:400016
* 邮件:hexiangqian@gmail
* 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 ateTitledBorder(""+str);
jp.setBorder(titled);
add(jp);
}
private PlanarImage loadFile(String fileName){
PlanarImage ate("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")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
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(
ateParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
ateParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
);
pack();
}// </editor-fold>
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=(ate("medianfilter",im0,MedianFilterDescriptor.MEDIAN_MASK_SQUARE,new Integer(5));
showImage(im1,"5*5SqureShapeMedian");
PlanarImage im2=(ate("medianfilter",im0,MedianFilterDescriptor.
MEDIAN_MASK_X,new Integer(3));
showImage(im2,"3*3XShapeMedian");
PlanarImage im3=(ate("medianfilter",im0,MedianFilterDescriptor.MEDIAN_MASK_PLUS,new Integer(5));
showImage(im3,"5*5PlusShapeMedian");
ate("filestore", im1, "MedianFilter.jpg", "jpeg", null);
springboot实现aop pack();
show();
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see acle/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.InstalledLookAndFeels()) {
if ("Nimbus".Name())) {
javax.swing.UIManager.ClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.Logger(Name()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论