• 大小: 3.11MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-11-21
  • 语言: Java
  • 标签:

资源简介

这个是数字图像处理java编程实践的源代码,适合初级人员..

资源截图

代码片段和文件信息

/**
 * @Ch10ImageMorph.java
 * @Version 1.0 2010.02.21
 * @Author Xie-Hua Sun 
 */

package process.algorithms;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import process.algorithms.ImageMorph;
import process.common.Common;

public class Ch10ImageMorph extends Jframe implements ActionListenerMouseListener
{
    Image iImage oImage;
     
    boolean loadflag = false       //输入图像标志
            runflag  = false       //执行处理标志   
            fillflag = false;
    int   iw ih;
    int[] pixels;          
             
    ImageMorph morph;
    Common common;
    
    public Ch10ImageMorph()
    {    
        settitle(“数字图像处理-Java编程与实验 第10章 图像形态学“);
        this.setBackground(Color.lightGray);        
              
        //菜单界面
        setMenu();
        
        morph = new ImageMorph();
        common  = new Common();
        
        //关闭窗口
        closeWin();
        
        setSize(530 330);
        setVisible(true);
    }

    public void actionPerformed(ActionEvent evt)
    {
     Graphics graph = getGraphics();
              
        if (evt.getSource() == openItem) 
        {
         //文件选择对话框
            JFileChooser chooser = new JFileChooser();
            common.chooseFile(chooser “./images/ch10“ 0);//设置默认目录过滤文件
            int r = chooser.showOpenDialog(null);
                        
            MediaTracker tracker = new MediaTracker(this);
            
            if(r == JFileChooser.APPROVE_OPTION) 
            {  
                String name = chooser.getSelectedFile().getAbsolutePath();
                 
                if(runflag)
                { 
                    loadflag  = false;
                    runflag   = false;
                }                 
    if(!loadflag)
    {
                //装载图像
    iImage = common.openImage(name tracker);    
    //取载入图像的宽和高
    iw = iImage.getWidth(null);
    ih = iImage.getHeight(null);     
    repaint();
    loadflag = true;
    }                          
            }                        
        }        
        else if (evt.getSource() == erode1Item)//腐蚀
        {
            if(loadflag)        
         {             
         settitle(“第10章 图像形态学 正方形结构腐蚀 作者 孙燮华“);
            removeMouseListener(this);
            show(graph 11 “正方形腐蚀“);              
         }
         else
  JOptionPane.showMessageDialog(null “请先打开图像!“);
        } 
        else if (evt.getSource() == erode2Item)
        {
         if(loadflag)        
         {             
         settitle(“第10章 图像形态学 菱形结构腐蚀 作者 孙燮华“);
            removeMouseListener(this);
            show(graph 12 “菱形腐蚀“);              
         }
         else
  JOptionPane.showMessageDialog(null “请先打开图像!“);
        }
        else if (evt.getSource() == erode3Item)
        {
         if

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      20829  2010-06-04 22:36  imProcess\Ch10ImageMorph.java

     文件      21695  2010-06-04 17:19  imProcess\Ch11DigitRecog.java

     文件      12436  2010-06-04 22:07  imProcess\Ch12ImageCompress.java

     文件       8338  2010-06-04 22:16  imProcess\Ch13FracImageCompress.java

     文件      17567  2010-06-04 22:23  imProcess\Ch14ImageCipher.java

     文件      16194  2010-06-04 22:26  imProcess\Ch15ImageWatermark.java

     文件      10803  2010-06-04 22:32  imProcess\Ch1Introduction.java

     文件       6266  2010-06-04 22:32  imProcess\Ch2Digitization.java

     文件      12986  2010-06-04 22:28  imProcess\Ch3Elements.java

     文件      13929  2010-06-04 22:30  imProcess\Ch4GeomTrans.java

     文件      13065  2010-06-04 22:30  imProcess\Ch5ImageTrans.java

     文件      17616  2010-06-02 22:09  imProcess\Ch6ImageEnhance.java

     文件       4897  2010-03-07 15:26  imProcess\Ch7ImageRestore.java

     文件      15009  2010-06-04 22:34  imProcess\Ch8ImageSegment.java

     文件       9722  2010-06-04 22:35  imProcess\Ch9ImageAnalyse.java

     文件       2000  2009-10-11 09:19  imProcess\digits.txt

     文件       4000  2010-02-22 11:57  imProcess\digits23.txt

     文件      19712  2004-05-21 14:02  imProcess\images\Baboo.jpg

     文件      12170  2008-10-27 11:36  imProcess\images\boats.JPG

     文件      66614  1996-10-24 16:44  imProcess\images\ch1\bmp\Lena.BMP

     文件      68509  2008-11-28 16:37  imProcess\images\ch1\gif\Lena.gif

    ..A..H.      7168  2010-03-06 20:24  imProcess\images\ch1\gif\Thumbs.db

     文件      10318  1994-04-18 14:17  imProcess\images\ch1\pgm\1.pgm

     文件      65554  2009-10-02 16:40  imProcess\images\ch1\pgm\Baboo.pgm

     文件      65554  2009-10-02 11:18  imProcess\images\ch1\pgm\cat.pgm

     文件      58800  2010-02-11 23:57  imProcess\images\ch1\png\Lena.PNG

    ..A..H.      7168  2010-03-06 20:54  imProcess\images\ch1\png\Thumbs.db

     文件     196623  2006-05-16 15:36  imProcess\images\ch1\ppm\teapot.ppm

     文件      65536  2006-05-19 15:35  imProcess\images\ch1\raw\cat.raw

     文件      65536  1999-07-08 21:32  imProcess\images\ch1\raw\Lena256.raw

............此处省略283个文件信息

评论

共有 条评论

相关资源