当前位置:文档之家› (图像识别与处理代码)

(图像识别与处理代码)

(图像识别与处理代码)
(图像识别与处理代码)

1.FileChooserT est.java类:

package OperationOfPictures;

import java.awt.Image;

import java.awt.Toolkit;

import javax.swing.JFrame;

public class FileChooserTest {

public static void main(String[] args){

ImageV iewerFrame frame=new ImageV iewerFrame();

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.setV isible(true);

Toolkit kit=Toolkit.getDefaultToolkit();

Image image = kit.getImage("Mark.jpg");

frame.setIconImage(image);

}

}

2.Canvas.java类:

package OperationOfPictures;

import java.awt.geom.AffineTransform;

import java.awt.image.BufferedImage;

import java.awt.*;

import javax.swing.JPanel;

public class Canvas extends JPanel {

private BufferedImage bufferedImage;//Buffered

private AffineTransform trans = new AffineTransform();

public void setImage(BufferedImage bufferedImage) {

if (bufferedImage != null) {

this.bufferedImage = bufferedImage;

}

if (isV isible()) {

paintImmediately(0, 0, getWidth(), getHeight());

}

}

public BufferedImage getImage() {

return bufferedImage;

}

public void setRota(double rota) {

trans.setToRotation(rota, (bufferedImage.getWidth()) >> 1, (bufferedImage.getHeight()) >> 1);

}

protected void paintComponent(Graphics g) {

super.paintComponent(g);

g.setColor(Color.WHITE);

g.fillRect(0, 0, getWidth(), getHeight());

if (bufferedImage == null) {

return;

}

Graphics2D gg = (Graphics2D) g.create();

int iw = bufferedImage.getWidth(), ih = bufferedImage.getHeight();

int anchorX = (getWidth() - iw) >> 1, anchorY = (getHeight() - ih) >> 1;

AffineTransform af = gg.getTransform();

af.translate(anchorX, anchorY);

af.concatenate(trans);

gg.drawImage(bufferedImage, af, this);

gg.dispose();

}

}

3.Cellapplet.java类:

package OperationOfPictures;

import java.applet.Applet;

import java.awt.*;

import javax.swing.*;

public class Cellapplet extends Applet{

private int default_r = 1;

private long default_nr = 18;

private int r;

private long nr;

private boolean layout= false;

private Thread drawThread = null;

private Cellcanvas canvas;

private Choice radiusChoice;

private JTextField ruleField;

private JLabel ruleSequence;

private Button stopButton,restartButton;

public Cellapplet() {

}

public void init() {

if (drawThread != null) {

drawThread = null;

}

r=1;

nr=18;

if (r < 1) {

r = default_r;

}

if (nr < 0) {

nr = default_nr; }

if (layout == false) {

GridBagLayout gridLayout = new GridBagLayout();//布局管理器

GridBagConstraints constr;//使用GridBagLayout布局管理器的约束setLayout(gridLayout);//设定添加布局管理器

Panel cellPanel = new Panel();

cellPanel.setLayout(new GridLayout(1, 0));//设定添加布局管理器canvas = new Cellcanvas(r, nr);

cellPanel.add("Center", canvas);

constr = new GridBagConstraints();

constr.fill = GridBagConstraints.BOTH;

constr.insets = new Insets(0, 0, 0, 0);

constr.weightx = 1.0;

constr.weighty = 1.0;

constr.gridwidth = GridBagConstraints.REMAINDER;

gridLayout.setConstraints(cellPanel, constr);

add(cellPanel);

JLabel radius_label = new JLabel("半径:");

constr = new GridBagConstraints();

constr.fill = GridBagConstraints.BOTH;

constr.insets = new Insets(2, 4, 2, 4);

constr.weightx = 0.1;

constr.weighty = 0.0;

constr.gridx = 3;

constr.gridy = 2;

gridLayout.setConstraints(radius_label, constr);

add(radius_label);

radiusChoice = new Choice();

radiusChoice.addItem("1");

radiusChoice.addItem("2");

radiusChoice.addItem("3");

radiusChoice.select(r - 1);

radiusChoice.setEnabled(false);

constr = new GridBagConstraints();

constr.fill = GridBagConstraints.BOTH;

constr.insets = new Insets(2, 4, 2, 4);

constr.weightx = 0.3;

constr.weighty = 0.0;

constr.gridx = 4;

constr.gridy = 2;

gridLayout.setConstraints(radiusChoice, constr);

add(radiusChoice);

JLabel rule_label = new JLabel("编码:");

constr = new GridBagConstraints();

constr.fill = GridBagConstraints.BOTH;

constr.weightx = 0.1;

constr.weighty = 0.0;

constr.gridx = 5;

constr.gridy = 2;

gridLayout.setConstraints(rule_label, constr);

add(rule_label);

ruleField = new JTextField("" + nr, 6);

ruleField.setEnabled(false);

constr = new GridBagConstraints();

constr.fill = GridBagConstraints.BOTH;

constr.insets = new Insets(2, 4, 2, 4);

constr.weightx = 0.3;

constr.weighty = 0.0;

constr.gridx = 6;

constr.gridy = 2;

constr.gridwidth = GridBagConstraints.REMAINDER; gridLayout.setConstraints(ruleField, constr);

add(ruleField);

stopButton = new Button("Stop");

constr = new GridBagConstraints();

constr.fill = GridBagConstraints.BOTH;

constr.insets = new Insets(2, 4, 2, 4);

constr.weightx = 0.3;

constr.weighty = 0.0;

constr.gridx = 3;

constr.gridy = 3;

constr.gridwidth = 2;

gridLayout.setConstraints(stopButton, constr);

add(stopButton);

restartButton = new Button("Restart"); restartButton.setEnabled(false);

constr = new GridBagConstraints();

constr.fill = GridBagConstraints.BOTH;

constr.insets = new Insets(2, 4, 2, 4);

constr.weightx = 0.3;

constr.weighty = 0.0;

constr.gridx = 5;

constr.gridy = 3;

constr.gridwidth = GridBagConstraints.REMAINDER; gridLayout.setConstraints(restartButton, constr);

add(restartButton);

ruleSequence = new JLabel("");

ruleSequence.setText("基元序列:"+canvas.getRule());

constr.fill = GridBagConstraints.BOTH;

constr.insets = new Insets(2, 4, 2, 4);

constr.weightx = 0.3;

constr.weighty = 0.0;

constr.gridx = 1;

constr.gridy = 4;

constr.gridwidth = GridBagConstraints.REMAINDER;

gridLayout.setConstraints(ruleSequence, constr);

add(ruleSequence);

ruleSequence.setVisible(true);

validate();

layout = true;

}

}

public void start(){

drawThread = new Thread(canvas);

drawThread.setPriority(Thread.MIN_PRIORITY);

drawThread.start();

}

public boolean action(Event evt, Object arg) {

if (evt.target instanceof Button) {

if (arg.equals("Restart")) {

int new_r;

new_r = Integer.parseInt(radiusChoice.getSelectedItem());

long new_nr;

new_nr = Long.parseLong(ruleField.getText());

if (drawThread != null)

drawThread = null;

r = new_r;

nr = new_nr;

canvas.reinit(r, nr);

drawThread = new Thread(canvas);

drawThread.setPriority(Thread.MIN_PRIORITY);

drawThread.start();

ruleSequence.setText("基元序列:" + canvas.getRule());

restartButton.setEnabled(false);

radiusChoice.setEnabled(false);

ruleField.setEnabled(false);

stopButton.setEnabled(true);

} else if (arg.equals("Stop")) {

if (drawThread != null) {

drawThread.interrupt();

drawThread = null;

restartButton.setEnabled(true);

radiusChoice.setEnabled(true);

ruleField.setEnabled(true);

stopButton.setEnabled(false);

} } }

return true;

}}

4.Cellauto.java类:

package OperationOfPictures;

import java.util.Random;

public class Cellauto {//细胞序列类

private final int cellState = 2;//状态数

private int radius = 1;//半径

private long ruleMaster = 18;//编码

private int[] ruleSequence = makeRule();//制定细胞状态演化规则

public Cellauto( int r, long Master) {

if (radius != r || ruleMaster != Master ) {

if (r >= 0) {

radius = r;//细胞的邻域半径

}

if (Master >= 0) {

ruleMaster = Master;//细胞规则的控制者

}

ruleSequence = makeRule();//重新制定规则

}

}

private int[] makeRule() {

int n= (int) (Math.pow(cellState, 2 * radius + 1));//确定规则序列的长度

int[] Sequence = new int[n];

for (int k = 1; k <= n; k++) {

Sequence[k - 1] = computeV alue(k, ruleMaster);//确定规则序列每个元素的值}

return Sequence;

}

private int computeV alue(int count, long n) {

if (count == 1) {

return (int) (n % cellState);

} else {

return computeV alue(count - 1, n / cellState);//递归求值

}

}

public int[] initSequence(int n) {//随机生成细胞初始状态序列

Random random = new Random();

int[] Sequence = new int[n];

for (int i = 0; i < n; i++) {

Sequence[i] = (int) (cellState * random.nextDouble());

if (Sequence[i] > cellState - 1) {

Sequence[i] = cellState - 1;

} }

return Sequence;

}

public int[] nextSequence(int[] Sequence) {//求当前细胞序列的下一个状态序列

int len = Sequence.length;

int[] newSequence = new int[len];

for (int i = 0; i < len; i++) {

newSequence[i] = 0;

for (int j = -radius; j <= radius; j++)

newSequence[i] = newSequence[i] * cellState + Sequence[(i + j + len)%len];

newSequence[i] = ruleSequence[newSequence[i]];

}

return newSequence;

}

public int[] getRuleSequence(){

return ruleSequence;

}

}

5.Cellcanvas.java类:

package OperationOfPictures;

import java.awt.*;

public class Cellcanvas extends Canvas implements Runnable{//细胞状态板

private int width = -1;//宽度

private int height = -1;//高度

private int gridwidth = 16;//细胞的大小

private int number1, number2;//分别控制细胞的横向变化和纵向变化

private Cellauto cell = null;//细胞序列类型

private int[] startSequence = null;//细胞序列的开始状态

private Color[] colors = new Color[2];//细胞的状态数组

private Image cellPicture =null;//细胞图像

private int[] ruleSequence = null;

public Cellcanvas(int r, long Master) {

cell = new Cellauto(r, Master);//细胞序列初始化实例

colors[0]= Color.white;//黑白色表示细胞的两种状态

colors[1]= Color.black;

ruleSequence=cell.getRuleSequence();

}

public void reinit(int r, long Master) {//改变条件后的细胞序列实例

cell = new Cellauto(r, Master);

ruleSequence=cell.getRuleSequence();

}

public void run() {

Graphics2D g;

Dimension d = getSize();

int[] nextSequence;

width = d.width;

number1 = (int) (width / gridwidth);//确定面板内一行容纳的细胞数,即细胞序列长度height = d.height;

number2 = (int) (height / gridwidth);

startSequence = cell.initSequence(number1);

cellPicture = this.createImage(width, height);

g = (Graphics2D) cellPicture.getGraphics();

// Draw the background

g.setColor(Color.white);//设置背景色

g.fillRect(0, 0, width, height);//填充背景色

// Draw the initial configuration

for (int i = 0; i < number1; i++) {

g.setColor(colors[startSequence[i]]);//确定初始细胞序列各个细胞的状态颜色

g.fillRect(i * gridwidth, 0, gridwidth, gridwidth);//画出初始细胞序列的状态

}

show_picture();//显示初始细胞序列的状态

// Compute and draw rest of the picture

nextSequence = startSequence;

for (int j = 1; j < number2; j++) {

nextSequence = cell.nextSequence(nextSequence);//求演化后的细胞序列

for (int i = 0; i < number1; i++) {

g.setColor(colors[nextSequence[i]]);//求演化后的细胞序列各个细胞的状态颜色g.fillRect(i * gridwidth, j * gridwidth, gridwidth, gridwidth);//画出演化后的细胞序列的状态

}

show_picture();//显示演化后的细胞序列的状态

}

try {

while (true) {

g.copyArea(0, 0, width, height, 0, -gridwidth);

nextSequence = cell.nextSequence(nextSequence);

for (int i = 0; i < number1; i++) {

g.setColor(colors[nextSequence[i]]);

g.fillRect(i * gridwidth, height - gridwidth, gridwidth, gridwidth);

}

show_picture();

Thread.sleep(100);//视觉停留时间的设定

}

} catch (InterruptedException e) {

}

}

synchronized void show_picture() {

Graphics gp = this.getGraphics();

if (gp != null && cellPicture != null) {

Image picture = cellPicture;

gp.drawImage(picture, 0, 0, this);//画出细胞序列的状态颜色表示

gp.dispose();

}

}

public void paint(Graphics g) {//重载绘画函数,自行调用

show_picture();

}

public String getRule(){

String rule = "";

for (int k = 0; k < ruleSequence.length; k++) {

rule+= ruleSequence[k];

}

return rule;

}}

https://www.doczj.com/doc/ec8122377.html,plex.java类:

package OperationOfPictures;

public class Complex {

private double re;

private double im;

public Complex() {

this.re = 0;

this.im = 0;

}

public Complex(double re, double im) {

this.re = re;

this.im = im;

}

public void setRE(double re) {

this.re = re;

}

public void setIM(double im) {

this.im = im;

}

public double getRE() {

return this.re;

}

public double getIM() {

return this.im;

}

public double abs(){

return Math.sqrt(re*re+im*im);

}

public double angle(){

return Math.atan(im/re);

}

public void equal(Complex that){

this.re=that.getRE();

this.im=that.getIM();

}

public void addEqual(Complex that){

this.re+=that.getRE();

this.im+=that.getIM();

}

public void subEqual(Complex that){

this.re-=that.getRE();

this.im-=that.getIM();

}

public void mulEqual(Complex that){

double Re=this.getRE()*that.getRE()-this.getIM()*that.getIM();

double Im=this.getRE()*that.getIM()+this.getIM()*that.getRE();

this.re=Re;

this.im=Im;

}

public void mulEqual(double temp){

this.re*=temp;

this.im*=temp;

}

public void divEqual(double temp){

this.re/=temp;

this.im/=temp;

}

public Complex add(Complex that){

return new Complex(this.getRE()+that.getRE(),

this.getIM()+that.getIM());

}

public Complex sub(Complex that){

return new Complex(this.getRE()-that.getRE(),

this.getIM()-that.getIM());

}

public Complex mul(Complex that){

return new Complex(this.getRE()*that.getRE()-this.getIM()*that.getIM(),

this.getRE()*that.getIM()+this.getIM()*that.getRE());

}

public Complex div(double temp){

return new Complex(this.getRE()/temp,

this.getIM()/temp);

}

public void inverse(){

im=-im;

}}

7.Coordinate.java类:

package OperationOfPictures;

import java.awt.*;

import javax.swing.*;

public class Coordinate extends JFrame {

private int Max;

private static int height = 500;

private static int width = 400;

private int[] grayHistogram;

private int[] rHistogram;

private int[] gHistogram;

private int[] bHistogram;

private boolean colorFlag = false;

private boolean grayFlag = false;

public Coordinate(int max) {

Max = max;

setTitle("图像直方图");

JPanel pdown;

setSize(width, height);

pdown = new JPanel();

add(pdown, BorderLayout.SOUTH);

}

public void paint(Graphics g) {

int k=1,max=400;

if (max < Max) {

while (max < Max) {

k++;

max = max + 400;

}

g.setColor(Color.BLACK);

g.drawLine(52, 460, 337, 460);

g.drawLine(52, 45, 52, 460);

g.drawLine(337, 460, 332, 455);

g.drawLine(337, 460, 332, 465);

g.drawLine(52, 45, 47, 50);

g.drawLine(52, 45, 57, 50);

g.drawString("频度", 43, 45);

int j = 32;

for (int i = 0; i < 9; i++) {

g.drawLine(52 + 32 * i, 455, 52 + 32 * i, 460);

g.drawString(Integer.toString(j * i), 49 + 32 * i, 475);

}

j = 40;

for (int i = 1; i < 11; i++) {

g.drawLine(52, 460 - i * 40, 57, 460 - i * 40);

g.drawString(Integer.toString(j * i * k), 20, 466 - i * 40);

}

if (grayFlag) {

g.drawString("灰度直方图", 200, 45);

g.drawString("灰度值", 340, 465);

g.setColor(Color.gray);

for (int i = 0; i < 256; i++)

g.drawLine(52 + i, 459 - (int) (grayHistogram[i] / k), 52 + i, 460);

}

if (colorFlag) {

g.drawString("彩色直方图", 200, 45);

g.drawString("RGB值", 343, 465);

g.drawString("R值", 430, 50);

g.drawString("G值", 430, 55);

g.drawString("B值", 430, 60);

g.setColor(Color.red);

g.drawLine(425, 50, 430, 50);

for (int i = 0; i < 256; i++)

g.drawLine(52 + i, 459 - (int) (rHistogram[i] / k), 52 + i, 460);

g.setColor(Color.green);

g.drawLine(425, 55, 430, 55);

for (int i = 0; i < 256; i++)

g.drawLine(52 + i, 459 - (int)(gHistogram[i] / k), 52 + i,460);

g.setColor(Color.blue);

g.drawLine(425, 60, 430, 60);

for (int i = 0; i < 256; i++)

g.drawLine(52 + i, 459 - (int) (bHistogram[i] / k), 52 + i, 460);

}

}

else{

int[] yinZi={1,2,4,5,8,10,20,40};

for(k=0;k

if(max/yinZi[k+1]

break;

g.setColor(Color.BLACK);

g.drawLine(52, 460, 337, 460);

g.drawLine(52, 45, 52, 460);

g.drawLine(337, 460, 332, 455);

g.drawLine(337, 460, 332, 465);

g.drawLine(52, 45, 47, 50);

g.drawLine(52, 45, 57, 50);

g.drawString("频度", 43, 45);

int j = 32;

for (int i = 0; i < 9; i++) {

g.drawLine(52 + 32 * i, 455, 52 + 32 * i, 460);

g.drawString(Integer.toString(j * i), 49 + 32 * i, 475);

}

j = 40;

for (int i = 1; i < 11; i++) {

g.drawLine(52, 460 - i * 40, 57, 460 - i * 40);

g.drawString(Integer.toString(j * i /yinZi[k]), 28, 466 - i * 40);

}

if (grayFlag) {

g.drawString("灰度直方图", 200, 45);

g.drawString("灰度值", 340, 465);

g.setColor(Color.gray);

for (int i = 0; i < 256; i++)

g.drawLine(52 + i, 459 - (int) (grayHistogram[i] * yinZi[k]), 52 + i, 460); }

if (colorFlag) {

g.drawString("彩色直方图", 200, 45);

g.drawString("RGB值", 343, 465);

g.drawString("R值", 430, 50);

g.drawString("G值", 430, 55);

g.drawString("B值", 430, 60);

g.setColor(Color.red);

g.drawLine(425, 50, 430, 50);

for (int i = 0; i < 256; i++)

g.drawLine(52 + i, 459 - (int) (rHistogram[i] * yinZi[k]), 52 + i, 460);

g.setColor(Color.green);

g.drawLine(425, 55, 430, 55);

for (int i = 0; i < 256; i++)

g.drawLine(52 + i, 459 - (int)(gHistogram[i] * yinZi[k]), 52 + i,460);

g.setColor(Color.blue);

g.drawLine(425, 60, 430, 60);

for (int i = 0; i < 256; i++)

g.drawLine(52 + i, 459 - (int) (bHistogram[i] * yinZi[k]), 52 + i, 460);

} } }

public void drawGray(int[] gray) {

grayHistogram = gray;

grayFlag = true;

}

public void drawColor(int[] red, int[] green, int[] blue) {

rHistogram = red;

gHistogram = blue;

bHistogram = green;

colorFlag = true;

}

}

8.ExpDialog.java类:

package OperationOfPictures;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

public class ExpDialog extends JPanel{

private JTextField A,B,C;

private boolean flag;

private JDialog dialog;

public ExpDialog() {

setLayout(new BorderLayout());

JPanel panel = new JPanel();

panel.setLayout(new GridLayout(4,4));

panel.add(new JLabel(" 参数"));

panel.add(new JLabel("范围"));

panel.add(new JLabel(" 适宜"));

panel.add(new JLabel("范围"));

panel.add(new JLabel(" A:"));

A = new JTextField("");

panel.add(A);

panel.add(new JLabel(" -160

panel.add(new JLabel("<100"));

panel.add(new JLabel(" B:"));

B = new JTextField("");

panel.add(B);

panel.add(new JLabel(" 1.2

panel.add(new JLabel("<1.6"));

panel.add(new JLabel(" C:"));

C = new JTextField("");

panel.add(C);

panel.add(new JLabel(" 0.05

panel.add(new JLabel("<80"));

add(panel, BorderLayout.NORTH);

JButton okButton = new JButton("确认");

okButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent event) {

flag = true;

dialog.setVisible(false);

}

});

JButton cancelButton = new JButton("取消");

cancelButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent event) {

A.setText("");

B.setText("");

C.setText("");

}

});

JPanel buttonPanel = new JPanel();

buttonPanel.setLayout(new GridLayout(1,2));

buttonPanel.add(okButton);

buttonPanel.add(cancelButton);

add(buttonPanel, BorderLayout.CENTER);

}

public boolean showDialog(Component parent, String title) {

Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();

int Width=screenSize.width;

int Height=screenSize.height;

flag = true;

Frame owner = null;

if (parent instanceof Frame)

owner = (Frame) parent;

else

owner = (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parent);

if (dialog == null || dialog.getOwner() != owner) {

owner = null;

dialog = new JDialog(owner, true);

dialog.getContentPane().add(this);

dialog.pack();

dialog.setResizable(false);

}

dialog.setTitle(title);

dialog.setLocation((Width-dialog.getWidth())/2,(Height-dialog.getHeight())/2);

dialog.setVisible(true);

return flag;

}

public void setA(String a) {

A.setText(a);

}

public void setB(String b) {

B.setText(b);

}

public void setC(String c) {

C.setText(c);

}

public double getA() {

return Double.parseDouble(A.getText());

}

public double getB() {

return Double.parseDouble(B.getText());

}

public double getC() {

return Double.parseDouble(C.getText());

}

}

9.ExtensionFileFilter.java类:

package OperationOfPictures;

import java.io.File;

import java.util.ArrayList;

import javax.swing.filechooser.FileFilter;

class ExtensionFileFilter extends FileFilter{

private String description="";

private ArrayList extensions=new ArrayList();//文件类型后缀名public void addExtension(String extension){//处理文件类型后缀名成标准形式if(!extension.startsWith("."))

extension="."+extension;

extensions.add(extension.toLowerCase());

}

public void setDescription(String aDescription){

description=aDescription;

}

public String getDescription(){

return description;

}

public boolean accept(File f) {

if (f.isDirectory()) {//测试此抽象路径名表示的文件是否是一个标准文件

return true;

}

String name = f.getName().toLowerCase();

for (String extension : extensions) {//匹配文件类型是否符合给定的文件类型if (name.endsWith(extension))

return true;

}

return false;

}}

10. FileIconView.java类:

package OperationOfPictures;

import java.io.*;

import javax.swing.ImageIcon;

import javax.swing.filechooser.FileView;

class FileIconView extends FileView{

private ExtensionFileFilter filter;//文件显示过滤器

private ImageIcon icon;//图像

public FileIconView(ExtensionFileFilter aFilter,ImageIcon anIcon){

filter=aFilter;

icon=anIcon;

}

@Override

public ImageIcon getIcon(File f){

if(!f.isDirectory()&&filter.accept(f))//测试此抽象路径名表示的文件是否是一个标准文件

return icon;

else

return null;

}

}

11.ImagePreviewer.java类:

package OperationOfPictures;

import java.awt.*;

import java.beans.*;

import java.io.File;

import javax.swing.*;

class ImagePreviewer extends JLabel{

public ImagePreviewer(JFileChooser chooser){

setPreferredSize(new Dimension(100,100));

setBorder(BorderFactory.createEtchedBorder());

chooser.addPropertyChangeListener(new PropertyChangeListener()

{

public void propertyChange(PropertyChangeEvent event){

if(event.getPropertyName().equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)){

File f=(File)event.getNew V alue();

if(f==null){

setIcon(null);

return;

}

ImageIcon icon=new ImageIcon(f.getPath());

if(icon.getIconWidth()>getWidth())

icon=new

ImageIcon(icon.getImage().getScaledInstance(getWidth(),-1,Image.SCALE_DEFAULT));

setIcon(icon);

}

}});

}}

12. ImageUtil.java类:

package OperationOfPictures;

class ImageUtil {

public static int[] decodeColor(int color, int rgb[]) {

if (rgb == null) {

rgb = new int[3];

}

rgb[0] = (color & 0x00ff0000) >> 16;

rgb[1] = (color & 0x0000ff00) >> 8;

rgb[2] = (color & 0x000000ff);

return rgb;

}

public static int encodeColor(int rgb[]) {

int color = (255 << 24) | (rgb[0] << 16) | (rgb[1] << 8) | rgb[2];

return color;

}

public static int getBrightness(int color) {

int r = (color & 0x00ff0000) >> 16;

int g = (color & 0x0000ff00) >> 8;

int b = (color & 0x000000ff);

int y = Math.round(0.3f * r + 0.59f * g + 0.11f * b);

y = y < 0 ? 0 : y;

y = y > 255 ? 255 : y;

return y;

}

public static float[] convertRGBToYHS(int color, float yhs[]) {

if (yhs == null) {

yhs = new float[3];

}

int r = (color & 0x00ff0000) >> 16;

int g = (color & 0x0000ff00) >> 8;

int b = (color & 0x000000ff);

yhs[0] = (float) (0.3 * r + 0.59 * g + 0.11 * b);

double c1 = 0.7 * r - 0.59 * g - 0.11 * b;

double c2 = -0.3 * r - 0.59 * g + 0.89 * b;

yhs[2] = (float) Math.sqrt(c1 * c1 + c2 * c2);

if (yhs[2] < 0.005) {

yhs[1] = 0;

} else {

yhs[1] = (float) Math.atan2(c1, c2);

if (yhs[1] < 0) {

yhs[1] += (float) Math.PI * 2;

} }

return yhs;

}

public static int convertYHSToRGB(float yhs[]) {

double c1 = yhs[2] * Math.sin(yhs[1]);

double c2 = yhs[2] * Math.cos(yhs[1]);

int r = (int) Math.round(yhs[0] + c1);

r = r < 0 ? 0 : r;

r = r > 255 ? 255 : r;

int g = (int) Math.round(yhs[0] - 0.3 * c1 / 0.9 - 0.11 * c2 / 0.59);

g = g < 0 ? 0 : g;

g = g > 255 ? 255 : g;

int b = (int) Math.round(yhs[0] + c2);

b = b < 0 ? 0 : b;

b = b > 255 ? 255 : b;

int color = (255 << 24) | (r << 16) | (g << 8) | b;

return color;

}

}

13. ImageViewerFrame.java类:

package OperationOfPictures;

import java.awt.*;

import java.awt.event.*;

import java.awt.image.*;

import java.io.*;

import java.util.logging.*;

import javax.imageio.ImageIO;

import javax.swing.*;

class ImageViewerFrame extends JFrame{

public int DEFAULT_WIDTH=500;//窗口宽度

public int DEFAULT_HEIGHT=400;//窗口高度

private int Width;

private int Height;

private JLabel label=null;//用于图像、文本或同时显示二者的区域

private Image readImage=null;

private Image writeImage=null;

private String path=null;

private Canvas canvas=new Canvas();

private JMenuBar menuBar;

private JMenu menuFile;

private JMenuItem openItem;

private JMenuItem saveItem;

private JMenuItem exitItem;

private JMenu menuPoint;

private JMenuItem grayItem;

private JMenuItem colorItem;

private JMenu menuRevise;

private JMenu menuGeometry;

private JMenuItem zoomItem;

private JMenuItem circumItem;

private JMenu menuGray;

private JMenuItem expItem;

private JMenuItem logItem;

private JMenu menuFilter;

private JMenu menuNeighbor;

private JMenuItem averageItem;

private JMenuItem middleItem;

private JMenuItem laplacianItem;

private JMenuItem sobelItem;

private JMenuItem robertItem;

private JMenu menuBlock;

private JMenuItem FFTItem;

private JMenuItem waveletItem;

private JMenu menuCell;

private JMenuItem cellItem;

private JFileChooser chooser;//一种为用户选择文件的简单机制

public ImageViewerFrame(){

Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();

Width=screenSize.width;

图像分割算法研究与实现

中北大学 课程设计说明书 学生姓名:梁一才学号:10050644X30 学院:信息商务学院 专业:电子信息工程 题目:信息处理综合实践: 图像分割算法研究与实现 指导教师:陈平职称: 副教授 2013 年 12 月 15 日

中北大学 课程设计任务书 13/14 学年第一学期 学院:信息商务学院 专业:电子信息工程 学生姓名:焦晶晶学号:10050644X07 学生姓名:郑晓峰学号:10050644X22 学生姓名:梁一才学号:10050644X30 课程设计题目:信息处理综合实践: 图像分割算法研究与实现 起迄日期:2013年12月16日~2013年12月27日课程设计地点:电子信息科学与技术专业实验室指导教师:陈平 系主任:王浩全 下达任务书日期: 2013 年12月15 日

课程设计任务书 1.设计目的: 1、通过本课程设计的学习,学生将复习所学的专业知识,使课堂学习的理论知识应用于实践,通过本课程设计的实践使学生具有一定的实践操作能力; 2、掌握Matlab使用方法,能熟练运用该软件设计并完成相应的信息处理; 3、通过图像处理实践的课程设计,掌握设计图像处理软件系统的思维方法和基本开发过程。 2.设计内容和要求(包括原始数据、技术参数、条件、设计要求等): (1)编程实现分水岭算法的图像分割; (2)编程实现区域分裂合并法; (3)对比分析两种分割算法的分割效果; (4)要求每位学生进行查阅相关资料,并写出自己的报告。注意每个学生的报告要有所侧重,写出自己所做的内容。 3.设计工作任务及工作量的要求〔包括课程设计计算说明书(论文)、图纸、实物样品等〕: 每个同学独立完成自己的任务,每人写一份设计报告,在课程设计论文中写明自己设计的部分,给出设计结果。

车辆牌照图像识别算法研究与实现本科毕设论文

Q260046902 专业做论文 西南科技大学 毕业设计(论文)题目名称:车辆牌照图像识别算法研究与实现

车辆牌照图像识别算法研究与实现 摘要:近年来随着国民经济的蓬勃发展,国内高速公路、城市道路、停车场建设越来越多,对交通控制、安全管理的要求也日益提高。因此,汽车牌照识别技术在公共安全及交通管理中具有特别重要的实际应用意义。本文对车牌识别系统中的车牌定位、字符分割和字符识别进行了初步研究。对车牌定位,本文采用投影法对车牌进行定位;在字符分割方面,本文使用阈值规则进行字符分割;针对车牌图像中数字字符识别的问题,本文采用了基于BP神经网络的识别方法。在学习并掌握了数字图像处理和模式识别的一些基本原理后,使用VC++6.0软件利用以上原理针对车牌识别任务进行编程。实现了对车牌的定位和车牌中数字字符的识别。 关键词:车牌定位;字符分割;BP神经网络;车牌识别;VC++

Research and Realization of License Plate Recognition Algorithm Abstract:In recent years, with the vigorous development of the national economy,there are more and more construct in the domestic expressway, urban road, and parking area. The requisition on the traffic control, safety management improves day by day. Therefore, license plate recognition technology has the particularly important practical application value in the public security and the traffic control. In the paper, a preliminary research was made on the license location, characters segment and characters recognition of the license plate recognition. On the license location,the projection was used to locate the license plate; On the characters segmentation, the liminal rule was used to divide the characters; In order to solve the problem of the digital characters recognition in the plate, BP nerve network was used to recognize the digital characters. After studying and mastering some basic principles of the digital image processing and pattern recognition, the task of license plate recognition was programmed with VC++ 6.0 using above principles. The license location and the digital characters recognition in the license plate were implemented. Keywords: license location, characters segmentation, BP nerve network, license plate recognition, VC++

血液细胞图像自动识别系统开发探讨

血液细胞图像自动识别系统的开发 汤学民1)林学訚2)何林1) 1) (深圳市人民医院 518020) 2) (清华大学计算机科学与技术系) 摘要运用计算机模式识别技术自动识别血细胞图像是模式识别在医学图像领域应用的一个重要研究课题。由于血细胞的种类多、图像复杂而使这项工作不易实现,目前,临床医学中对血细胞形态的识别都是人工操作。本系统运用模式识别技术可对外周血中的血细胞图像实现自动识别。本文所用的图像分割方法是在对图像距离变换的基础上,综合区域和边界方法,充分利用图像中包含的信息,实现血细胞图像的分割。根据细胞的形状、纹理、颜色等的特点选取并测定22个特征值,用统计分类的方法设计分类器。通过对50幅图像共88个细胞的测试表明,此系统的识别正确率为96%,经临床专家评估,此系统具有较好的实用价值。 关键词模式识别血液细胞自动识别 Abstract It is an important topic in the field of medicine image to make research on Blood Cell image recognition with Computer Pattern Recognition technique. However, there are so many types of blood cells and the image is complex. Therefore, it is not easy to fulfill image recognition with this technique. Up to now, the recognition of blood cells in clinic is by manual work. The system in this paper can recognize the blood cells by pattern recognition technique automatically. In order to fulfill the segmentation, the image segmentation method is based on distance transformation image, combining the region approach and edge approach, and taking full advantage of image information. There are 22 features selected and measured in accordance to the shape of cell, the texture of cell, and color appearance of cell. The classifier is designed with the statistical classification. The experimental results show that the classification accuracy is 96% from the 88 blood cells found in a set of 50 images. The system also confirms the validity and the clinical value.  Keywords Pattern recognition, Blood Cell, Automatic recognition 1 引言  随着计算机技术的不断发展,计算机技术在医学中的应用也越来越多,其中一个重要方面是对显微镜下细胞形态的自动图像识别。细胞形态的检测是医学检测中的一个重要部分,很多疾病的诊治主要依靠医学专家观察标本中细胞在显

基于matlab数字图像处理与识别系统含程序

目录 第一章绪论 (2) 1.1 研究背景 (2) 1.2 人脸图像识别的应用前景 (3) 1.3 本文研究的问题 (4) 1.4 识别系统构成 (4) 1.5 论文的内容及组织 (5) 第二章图像处理的Matlab实现 (6) 2.1 Matlab简介 (6) 2.2 数字图像处理及过程 (6) 2.2.1图像处理的基本操作 (6) 2.2.2图像类型的转换 (7) 2.2.3图像增强 (7) 2.2.4边缘检测 (8) 2.3图像处理功能的Matlab实现实例 (8) 2.4 本章小结 (11) 第三章人脸图像识别计算机系统 (11) 3.1 引言 (11) 3.2系统基本机构 (12) 3.3 人脸检测定位算法 (13) 3.4 人脸图像的预处理 (18) 3.4.1 仿真系统中实现的人脸图像预处理方法 (19) 第四章基于直方图的人脸识别实现 (21) 4.1识别理论 (21) 4.2 人脸识别的matlab实现 (21) 4.3 本章小结 (22) 第五章总结 (22) 致谢 (23) 参考文献 (24) 附录 (25)

第一章绪论 本章提出了本文的研究背景及应用前景。首先阐述了人脸图像识别意义;然后介绍了人脸图像识别研究中存在的问题;接着介绍了自动人脸识别系统的一般框架构成;最后简要地介绍了本文的主要工作和章节结构。 1.1 研究背景 自70年代以来.随着人工智能技术的兴起.以及人类视觉研究的进展.人们逐渐对人脸图像的机器识别投入很大的热情,并形成了一个人脸图像识别研究领域,.这一领域除了它的重大理论价值外,也极具实用价值。 在进行人工智能的研究中,人们一直想做的事情就是让机器具有像人类一样的思考能力,以及识别事物、处理事物的能力,因此从解剖学、心理学、行为感知学等各个角度来探求人类的思维机制、以及感知事物、处理事物的机制,并努力将这些机制用于实践,如各种智能机器人的研制。人脸图像的机器识别研究就是在这种背景下兴起的,因为人们发现许多对于人类而言可以轻易做到的事情,而让机器来实现却很难,如人脸图像的识别,语音识别,自然语言理解等。如果能够开发出具有像人类一样的机器识别机制,就能够逐步地了解人类是如何存储信息,并进行处理的,从而最终了解人类的思维机制。 同时,进行人脸图像识别研究也具有很大的使用价依。如同人的指纹一样,人脸也具有唯一性,也可用来鉴别一个人的身份。现在己有实用的计算机自动指纹识别系统面世,并在安检等部门得到应用,但还没有通用成熟的人脸自动识别系统出现。人脸图像的自动识别系统较之指纹识别系统、DNA鉴定等更具方便性,因为它取样方便,可以不接触目标就进行识别,从而开发研究的实际意义更大。并且与指纹图像不同的是,人脸图像受很多因素的干扰:人脸表情的多样性;以及外在的成像过程中的光照,图像尺寸,旋转,姿势变化等。使得同一个人,

基于Matlab的图像边缘检测算法的实现及应用汇总

目录 摘要 (1) 引言 (2) 第一章绪论 (3) 1.1 课程设计选题的背景及意义 (3) 1.2 图像边缘检测的发展现状 (4) 第二章边缘检测的基本原理 (5) 2.1 基于一阶导数的边缘检测 (8) 2.2 基于二阶导的边缘检测 (9) 第三章边缘检测算子 (10) 3.1 Canny算子 (10) 3.2 Roberts梯度算子 (11) 3.3 Prewitt算子 (12) 3.4 Sobel算子 (13) 3.5 Log算子 (14) 第四章MATLAB简介 (15) 4.1 基本功能 (15) 4.2 应用领域 (16) 第五章编程和调试 (17) 5.1 edge函数 (17) 5.2 边缘检测的编程实现 (17) 第六章总结与体会 (20) 参考文献 (21)

摘要 边缘是图像最基本的特征,包含图像中用于识别的有用信息,边缘检测是数字图像处理中基础而又重要的内容。该课程设计具体考察了5种经典常用的边缘检测算子,并运用Matlab进行图像处理结果比较。梯度算子简单有效,LOG 算法和Canny 边缘检测器能产生较细的边缘。 边缘检测的目的是标识数字图像中灰度变化明显的点,而导函数正好能反映图像灰度变化的显著程度,因而许多方法利用导数来检测边缘。在分析其算法思想和流程的基础上,利用MATLAB对这5种算法进行了仿真实验,分析了各自的性能和算法特点,比较边缘检测效果并给出了各自的适用范围。 关键词:边缘检测;图像处理;MATLAB仿真

引言 边缘检测在图像处理系统中占有重要的作用,其效果直接影响着后续图像处理效果的好坏。许多数字图像处理直接或间接地依靠边缘检测算法的性能,并且在模式识别、机器人视觉、图像分割、特征提取、图像压缩等方面都把边缘检测作为最基本的工具。但实际图像中的边缘往往是各种类型的边缘以及它们模糊化后结果的组合,并且在实际图像中存在着不同程度的噪声,各种类型的图像边缘检测算法不断涌现。早在1965 年就有人提出边缘检测算子,边缘检测的传统方法包括Kirsch,Prewitt,Sobel,Roberts,Robins,Mar-Hildreth 边缘检测方法以及Laplacian-Gaussian(LOG)算子方法和Canny 最优算子方法等。 本设计主要讨论其中5种边缘检测算法。在图像处理的过程需要大量的计算工作,我们利用MATLAB各种丰富的工具箱以及其强大的计算功能可以更加方便有效的完成图像边缘的检测。并对这些方法进行比较

图像识别中仍然存在的问题及解决思路

图像识别中仍然存在的问题及解决思路 一、摄像系统晃动问题,在对焦侧及中部炉盖进行拍摄时,小的晃动问题并不显示很严重,但对机焦炉盖及上升管拍摄时,由于距离比较远,小的晃动就会造成画面的不稳定,影响识别精度。 晃动的原因:有几种情况,一是由于滑行车在风的作用下东西方向的摆动;二是摄像系统安装于滑行车外部支架上,有一定高低方向的颤动;三是由于云台的旋转俯仰均是齿轮驱动,齿轮配合间隙的晃动会造成一定的晃动。 解决方案:虽然现在的识别程序中已经对晃动进行了配准,但有时仍会由于晃动造成误判,因此考虑从硬件及软件两方面着手进行改善,硬件上解决滑行车摆动最理想的方案是采用双轨,但考虑到成本会增加较多,在王工新的设计中将摄像系统由滑行车外部移到中部应该对上下的颤动会有改善。云台齿轮间隙的问题,如要解决只能选用新的更精密的云台,考虑到这部分晃动的幅度较小,而且由于这种间隙没有弹性的回力,故在一定风向下一般不会发生来回的晃动,可不考虑。 软件的方面,现在所用的晃动图像配准方法有两个问题,一是由于运算量较大,现在只对晃动严重的上下方向进行了配准,对横向的晃动未进行配准。二是配准的算法上应该还有一定的提高空间(主要是降低运算量及提高配准精度),新来的小张由于研究生专业就是图像识别,考虑让他在这方面做一些工作(除了配准这部分,从整个识别算法上也可以做一个重新的考虑)。 另一个张总曾提出的软件解决方案是,在拍摄瞬时风速超过一定范围后,识别结果均定为不泄漏。 二、逆光问题,在下午的拍摄中,逆光是影响识别效果最严重的一个因素(对焦侧炉盖的拍摄基本没影响,对中间炉盖有一定影响同,对机侧炉盖及上升管拍摄影响很大),在逆光时拍摄回的画面,即使人工来识别,也已经无法判断泄漏与不泄漏,这种情况下计算机识别已经无能为力。 逆光原因:由于焦炉是南北走向,我们的摄像系统安装于焦炉东侧的焦侧方向,在下午对机侧炉盖及上升管拍摄时,阳光正好照射在摄像机护罩玻璃上,导致摄回的图像均变成灰色。除不能识别外,有时还会由于中部光线强度的变化导致一些误判。

数据隐藏课程设计论文——图像的信息隐藏检测算法和实现

中国科学技术大学继续教育学院课程设计 论文报告 论文题目:图像的信息隐藏检测算法和实现学员姓名:黄琳 学号:TB04202130 专业:计算机科学与技术 指导教师: 日期:2007年1月20日

图像的信息隐藏检测算法和实现 [摘要] Information hiding analysis is the art of detecting the message's existence or destroying the stega nographic cover in order to blockade the secret communication. And information Information hiding includes steganography and digital watermark. The application of steganography can be traced to ancient time, and it is also an n hiding detection is the very first step in information hiding analysis. Firstlly, architectonic analysis about information hiding detection is proposed, including the analysis of digital image characteristics, image based detecting algorithms and some problems in its realization. Secondly, many detecting algorithms are introduced with theoretical analyses and experimental results in details. Thirdly, two applications of detecting technology are put forward. Finally, a detecting model used in Internet is discussed [关键词]安全信息隐藏检测 1. 引言 数字图像的信息隐藏技术是数字图像处理领域中最具挑战性、最为活跃的研究课题之一。本文概述了数字图像的信息隐藏技术,并给出了一个新的基于彩色静止数字图像的信息隐藏算法。 数字图像可分为静止图像和动态图像两种,后者一般称为视频图像。视频图像的每一帧均可看作是一幅静止图像,但是这些静止图像之间并不是相互孤立的,而是存在时间轴上的相关性。静止图像是像素(Pixel)的集合,相邻像素点所对应的实际距离称为图像的空间分辨率。根据像素颜色信息的不同,数字图像可分为二值图像、灰度图像以及彩色图像。数字图像的最终感受者是人的眼睛,人眼感受到的两幅质量非常相同的数字图像的像素值可能存在很大的差别。这样,依赖于人的视觉系统(Human Visual System,HVS)的不完善性,就为数字图像的失真压缩和信息隐藏提供了非常巨大的施展空间。 信息隐藏与信息加密是不尽相同的,信息加密是隐藏信息的内容,而信息隐藏是隐藏信息的存在性,信息隐藏比信息加密更为安全,因为它不容易引起攻击者的注意。 2. 信息隐藏技术综述 2.1信息隐藏简介 信息隐藏(Information Hiding),也称作数据隐藏(Data Hiding),或称作数字水印(Digital Watermarking)。简单来讲,信息隐藏是指将某一信号(一般称之为签字信号,Signature Signal)嵌入(embedding)另一信号(一般称之为主信号,Host Signal,或称之为掩护媒体,cover-media)的过程,掩护媒体经嵌入信息后变成一个伪装媒体(stegano-media)。这一嵌入过程需要满足下列条件:

图像识别技术的现状和未来

图像识别技术的背景 深圳知了图像识别科技有限公司,是一家以图像识别算法为核心的高科技企业,目前已经开发出了,知了点拍,钢管,钢筋智能点数app。识别率高,点数速度快,极大的方便了需要对钢管,钢筋点数人员的工作,提高了效率,知了点拍,是施工和建材经销商的好帮手。 移动互联网、智能手机以及社交网络的发展带来了海量图片信息,根据BI五月份的文章,Instagram每天图片上传量约为6000万张;今年2月份WhatsApp 每天的图片发送量为5亿张;国内的微信朋友圈也是以图片分享为驱动。不受地域和语言限制的图片逐渐取代了繁琐而微妙的文字,成为了传词达意的主要媒介。图片成为互联网信息交流主要媒介的原因主要在于两点:第一,从用户读取信息的习惯来看,相比于文字,图片能够为用户提供更加生动、容易理解、有趣及更具艺术感的信息;第二,从图片来源来看,智能手机为我们带来方便的拍摄和截屏手段,帮助我们更快的用图片来采集和记录信息。 但伴随着图片成为互联网中的主要信息载体,难题随之出现。当信息由文字记载时,我们可以通过关键词搜索轻易找到所需内容并进行任意编辑,而当信息是由图片记载时,我们却无法对图片中的内容进行检索,从而影响了我们从图片中找到关键内容的效率。图片给我们带来了快捷的信息记录和分享方式,却降低了我们的信息检索效率。在这个环境下,计算机的图像识别技术就显得尤为重要。 图像识别是计算机对图像进行处理、分析和理解,以识别各种不同模式的目标

和对像的技术。识别过程包括图像预处理、图像分割、特征提取和判断匹配。简单来说,图像识别就是计算机如何像人一样读懂图片的内容。借助图像识别技术,我们不仅可以通过图片搜索更快的获取信息,还可以产生一种新的与外部世界交互的方式,甚至会让外部世界更加智能的运行。百度李彦宏在2011年提到“全新的读图时代已经来临”,现在随着图形识别技术的不断进步,越来越多的科技公司开始涉及图形识别领域,这标志着读图时代正式到来,并且将引领我们进入更加智能的未来。 图像识别的初级阶段——娱乐化、工具化 在这个阶段,用户主要是借助图像识别技术来满足某些娱乐化需求。例如,百度魔图的“大咖配”功能可以帮助用户找到与其长相最匹配的明星,百度的图片搜索可以找到相似的图片;Facebook研发了根据相片进行人脸匹配的DeepFace;雅虎收购的图像识别公司IQ Engine开发的Glow可以通过图像识别自动生成照片的标签以帮助用户管理手机上的照片;国内专注于图像识别的创业公司旷视科技成立了VisionHacker游戏工作室,借助图形识别技术研发移动端的体感游戏。 这个阶段还有一个非常重要的细分领域——OCR(Optical Character Recognition,光学字符识别),是指光学设备检查纸上打印的字符,通过检测暗、亮的模式确定其形状,然后用字符识别方法将形状翻译成计算机文字的过程,就是计算机对文字的阅读。语言和文字是我们获取信息最基本、最重要的途径。在比特世界,我们可以借助互联网和计算机轻松的获取和处理文字。但一旦文字以图片的形式表现出来,就对我们获取和处理文字平添了很多麻烦。这一方面表现为数字世界中由于特定原因被存储称图片格式的文字;另一方面是我们在现实生活中看到的所有物理形态的文字。所以我们需要借助OCR技术将这些文字和信息提取出来。在这方面,国内产品包括百度的涂书笔记和百度翻译等;而谷歌借助经过DistBelief 训练的大型分布式神经网络,对于Google 街景图库的上千万门牌号的识别率超过90%,每天可识别百万门牌号。 在这个阶段,图像识别技术仅作为我们的辅助工具存在,为我们自身的人类视觉提供了强有力的辅助和增强,带给了我们一种全新的与外部世界进行交互的方

图像处理与识别论文.doc

辽宁工业大学 关于图像识别技术的论述 --图像处理与识别结课论文 学院:电子与信息工程学院 班级:电子102班 学号:100404054 姓名:包媛

关于图像识别技术的论述 随着科学技术的不断发展,计算机应用领域的不断开拓,一种全新的图像处理方法应运而生,这就是数字图像处理技术,即利用计算机设备将图像转变成数字信息来进行保存、处理、传输和重现。数字图像识别技术则是从数字图像处理技术中延伸出来的一个重要的研究方向。目前,数字图像处理与识别的应用范围越来越广。但就目前的水平而言,计算机对外部的感知能力还比较薄弱,还需要投入大量人力、物力从事数字图像处理与识别的理论和应用的研究。图像处理与识别的应用有很多种,如指纹识别,条码识别,人脸识别,车牌识别,残损纸币识别等等在生活,生产中,和警方侦破案件中都有很多很重要的应用。数字图像处理方法的分类以及数字图像处理系统的基本部件,“数字图像处理的基本方法”、“人脸识别”及“残损纸币识别”进行详细叙述。一些数字图像处理的基本方法,包括图像增强与图像检测两部分。人脸识别”当中,可采用SN-tuple神经网络的方法进行识别,同时网络参数的变化对识别率也会有所影响影响。对于“残损纸币识别”,可以选择边缘检测、Fisher判别和神经网络三种方法进行识别。其中,边缘检测需要区分纸币的面值和正反,之后方可识别,但性能较为稳定,识别效果较好;Fisher判别无需区分纸币的面值和正反,但识别率受样本选择的影响,不同样本,识别率有可能相差较大;神经网络方法也可不区分纸币的面值与正反,但识别率较低,若区分面值与正反,则可获得较高的识别率。下面分别对车牌识别,纸币、票据识别和手势识别做陈述。 随着我国国民经济的迅速增长,机动车的规模与流量大幅增加,随之而来的管理问题也日益严重。因此迫切需要采用高科技手段,对这些违法违章车辆牌照进行登记,汽车牌照识别系统的出现成为了交通管制必不可少的有力武器。汽车牌照的识别系统在公共安全,交通管理,及相关军事部门有着重要的应用价值。它是一个基于数字图像处理和字符识别的智能化交通管理系统,该系统先通过图像采集,再对图像进行处理以克服图像干扰,改善识别效果,而后进行二值化,归一化等处理,最后进行识别。车牌识别系统使得车辆管理更趋于数字化,网络化,大大提高了交通管理的有效性与方便性。车牌识别系统作为整个智能交通系统的一部分,其重要性不言而喻。 车牌识别是一项涉及到数字图像处理、计算机视觉、模式识别、人工智能等多门学科的技术,它在交通监视和控制中占有很重要的地位,已成为现代交通工程领域中研究的重点和热点之一。该项技术应用前景广泛,例如用在自动收费系统、不停车缴费、失窃车辆的查寻、停车场车辆管理、特殊部门车辆的出入控制

数字图像处理课程设计——人脸检测与识别

: 数字图像处理 课 程 设 计 ] $

: 人脸检测与识别课程设计 一、简介 人脸检测与识别是当前模式识别领域的一个前沿课题,人脸识别技术就是利用计算机技术,根据数据库的人脸图像,分析提取出有效的识别信息,用来“辨认”身份的技术。人脸识别是模式识别研究的一个热点, 它在身份鉴别、信用卡识别, 护照的核对及监控系统等方面有着广泛的应用。人脸图像由于受光照、表情以及姿态等因素的影响, 使得同一个人的脸像矩阵差异也比较大。因此, 进行人脸识别时, 所选取的特征必须对上述因素具备一定的稳定性和不变 性. 主元分析(PCA)方法是一种有效的特征提取方法,将人脸图像表示成一个列向量, 经过PCA 变换后, 不仅可以有效地降低其维数, 同时又能保留所需要的识别信息, 这些信息对光照、表情以及姿态具有一定的不敏感性. 在获得有效的特征向量后, 关键问题是设计具有良好分类能力和鲁棒性的分类器. 支持向量机 (SVM ) 模式识别方法,兼顾训练误差和泛化能力, 在解决小样本、非线性及高维模式识别问题中表现出许多特有的优势。 本此课程设计基于MATLAB,将检测与识别分开进行。其中检测部分使用实验指导书上的肤色模型算法进行,不进行赘述。识别部分采用PCA算法对检测出的人脸图像进行特征提取, 再利用最邻近距离分类法对特征向量进行分类识别,将在后文具体表述。仿真结果验

证了本算法是有效的。 二、人脸检测 1.》 2.源码 img=imread('D:\std_test_images\'); figure; imshow(img); R=img(:,:,1); G=img(:,:,2); B=img(:,:,3); faceRgn1=(R>95)&(G>40)&(B>20)&max(img,[],3)-min(img,[],3)>15&abs(R-G)>15&R>B; ~ figure; imshow(faceRgn1); r=double(R)./double(sum(img,3)); g=double(G)./double(sum(img,3)); Y=*R+*G+*B; faceRgn2=(r>&(r<&(g>&(g<&(r>g)&g>='Boundingbox'); BB1=struct2cell(BB); BB2=cell2mat(BB1); ) figure; imshow(img); [s1 s2]=size(BB2); mx=0; for k=3:4:s2-1 p=BB2(1,k)*BB2(1,k+1); if p>mx&(BB2(1,k)/BB2(1,k+1))< mx=p; ! j=k; hold on; rectangle('position',[BB2(1,j-2),BB2(1,j-1),BB2(1,j),BB2(1,j+1)],'linewidth',3,'edg ecolor','r'); hold off; end end

最新数字图像处理算法实现精编版

2020年数字图像处理算法实现精编版

数字图像处理算法实现 ------------编程心得(1) 2001414班朱伟 20014123 摘要: 关于空间域图像处理算法框架,直方图处理,空间域滤波器算法框架的编程心得,使用GDI+(C++) 一,图像文件的读取 初学数字图像处理时,图像文件的读取往往是一件麻烦的事情,我们要面对各种各样的图像文件格式,如果仅用C++的fstream库那就必须了解各种图像编码格式,这对于初学图像处理是不太现实的,需要一个能帮助轻松读取各类图像文件的库。在Win32平台上GDI+(C++)是不错的选择,不光使用上相对于Win32 GDI要容易得多,而且也容易移植到.Net平台上的GDI+。 Gdiplus::Bitmap类为我们提供了读取各类图像文件的接口, Bitmap::LockBits方法产生的BitmapData类也为我们提供了高速访问图像文件流的途径。这样我们就可以将精力集中于图像处理算法的实现,而不用关心各种图像编码。具体使用方式请参考MSDN中GDI+文档中关于Bitmap类和BitmapData类的说明。另外GDI+仅在Windows XP/2003上获得直接支持,对于Windows 2000必须安装相关DLL,或者安装有Office 2003,Visual Studio 2003 .Net等软件。 二,空间域图像处理算法框架 (1) 在空间域图像处理中,对于一个图像我们往往需要对其逐个像素的进行处理,对每个像素的处理使用相同的算法(或者是图像中的某个矩形部分)。即,对于图像f(x,y),其中0≤x≤M,0≤y≤N,图像为M*N大小,使用算法

图像识别技术和图像处理技术

摘要 本文对图形图像处理系统的发展现状和所采用的主要技术进行了详细分析,确定了相应的结构和主要功能,以及实际开发中所采取的技术。系统在Windows XP平台下实现,本课题是采用Visual C++作为编程工具,采用面向对象的程序设计技术实现一个图形绘制和图像处理的应用软件。主要工作分为三类,包括基本图形绘制与编辑、简单的图像处理、图像格式的转换。图形方面主要是设计图形基类,以及继承图形基类的具体图形类。通过对独立功能的封装,可以为今后需要的图形图像的应用奠定基础。系统的优点有:充分体现了面向对象的设计思想,充分运用了C++的特性,比如封装、多态、继承。程序结构清晰,可读性好,程序中做了充分的注释。图形绘制部分避免了传统的switch case的繁琐结构。容易扩充和移植。 最后,对系统进行测试表明,系统功能达到了预期的要求,界面友好,操作简便,运行也较稳定,是一个完成基本功能的图形图像系统。 总体上,本文介绍了系统开发设计的全过程和设计过程中部分代码,也对系统测试的过程进行简单描述,同时对系统中采用的关键技术也作了一些必要的说明,对图像变换的基本原理,图像处理的基本原理和各种图像格式做了详细的阐述。 关键词:图形;图像;多态;继承

Abstract This article has carried on the detailed analysis about graph image processing system development and using of the key technology,identify the corresponding structure and central function, as well as the system adopts technology in the actual development. The system realizes under the Windows XP platform, the topic use Visual C++ as a programming tool, use object-oriented programming techniques to achieve a graphic and image processing software. Major work is divided into three categories, basic drawing and editing graphics, simple image processing, and image format conversion. The graph aspect is designs the graph base class , as well as inherits the graph bas e class’s specific graph class. Through independent function's encapsulation, for the future’s needs of the graphic images lays the foundation. The system merit has: the object-oriented design’s thought application of the c++ properties, for example encapsulation, pol ymorphism, and inheritance. Program’s structure is clear, good readability, codes has the full annotation in the program. The graph plan’s part has avoided complicated structure of the traditional switch case. Easy expansion and transplantation. Finally, system’s testing shows, s ystem’s functions achieve the expected demand, friendly interface, and the operation is simple, also a much stable operation, it has basic functions of the graphic image system. As a whole, this paper describes the system design process and part of the process of designing code, also carries on the simple description to the system test process, meanwhile it made some necessary explanations about key technology in the system, it made the detailed description to image transform of the basic

图像识别系统介绍

图像识别及访客管理系统系统 介绍 1 图像识别系统组成 图像识别系统由数据库服务器、管理中心和图像识别终端三部分组成。数据库服务器,放置于中心机房,主要提供数据服务和图片显示服务;管理中心,放置于访客登记室和保卫处,用于访客登记、临时卡管理、员工管理、区域管理、操作员管理和历史查询等功能;图像识别终端,放置于各大楼门口,用于保安或武警对来往人员进行图像比对。 2 图像识别系统连接图 图像识别终端 图像识别终端

3 图像识别系统主要功能 来访登记:对使用二代身份证的外来人员,扫描仪读取身份证信息,包括姓名、身份证号码等,对外来人进行拍照,并与读取的信息一起存档。 被访人管理:把门禁系统的人员作为被访人员进行管理,可在数据库中选择被访人并带记忆功能,可查看或选择历史被访人。 来访卡发放:结合被访人所处的位置给来访卡授予相应权限,发放临时来访卡交外来人员,并实时在所限区域内生效,临时来访卡要设置合理的有效时间,超出时间自动失效。 来访卡回收:外来人员访问结束后,回收临时来访卡并设置访客离签。 访客延期:来访人由于某种原因需要延长访问时间,可在系统中登记延期。支持无卡延期。 来访卡丢失:来访卡丢失可在系统中挂失,挂失的卡无权限进出相应区域。 临时卡管理:针对短期的外来协助人员,如一个星期、一个月等,管理部门可以给这部分人员发放临时卡,在临时卡到期前,持卡人可以正常进出被授权区域,避免了重复的登记工作。 人员出入监控:对通道出入人员进行实时监控,核对信息,对比照片,防止不法人员进出。 数据查询和统计:授权管理人员随时查询来访人员信息和详细的出入记录。 打印归档:历史记录可以直接打印或者导出电子表格,方便用户归档保存。 操作员管理:对访客管理操作人员进行授权和密码管理。 区域管理:管理员非常方便地对系统中的区域进行管理,包括区域新增、修改、删除等。 4 主要硬件设备介绍 4.1 图像识别终端 图像识别终端外层为全金属外壳,内部采用一款无风扇低功耗高效能工业级计算机作为运行平台,整机体积小,功能齐全,环境适应性强,可以满足污染大,灰尘多,电磁干扰严重等

模式识别及其在图像处理中的应用

模式识别及其在图像处理中的应用 摘要:随着计算机和人工智能技术的发展,模式识别在图像处理中的应用日益广泛。综述了模式识别在图像处理中特征提取、主要的识别方法(统计决策法、句法识别、模糊识别、神经网络)及其存在的问题,并且对近年来模式识别的新进展——支持向量机与仿生模式识别做了分析和总结,最后讨论了模式识别亟待解决的问题并对其发展进行了展望。 关键词:模式识别;图像处理;特征提取;识别方法

模式识别诞生于20世纪20年代,随着计算机的出现和人工智能的发展,模式识别在60年代初迅速发展成一门学科。它所研究的理论和方法在很多学科和领域中得到广泛的重视,推动了人工智能系统的发展,扩大了计算机应用的可能性。图像处理就是模式识别方法的一个重要领域,目前广泛应用的文字识别( MNO)就是模式识别在图像处理中的一个典型应用。 1.模式识别的基本框架 模式识别在不同的文献中给出的定义不同。一般认为,模式是通过对具体的事物进行观测所得到的具有时间与空间分布的信息,模式所属的类别或同一类中模式的总体称为模式类,其中个别具体的模式往往称为样本。模式识别就是研究通过计算机自动地(或者人为进行少量干预)将待识别的模式分配到各个模式类中的技术。模式识别的基本框架如图1所示。 根据有无标准样本,模式识别可分为监督识别方法和非监督识别方法。监督识别方法是在已知训练样本所属类别的条件下设计分类器,通过该分类器对待识样本进行识别的方法。如图1,标准样本集中的样本经过预处理、选择与提取特征后设计分类器,分类器的性能与样本集的大小、分布等有关。待检样本经过预处理、选择与提取特征后进入分类器,得到分类结果或识别结果。非监督模式识别方法是在没有样本所属类别信息的情况下直接根据某种规则进行分类决策。应用于图像处理中的模式识别方法大多为有监督模式识别法,例如人脸检测、车牌识别等。无监督的模式识别方法主要用于图像分割、图像压缩、遥感图像的识别等。

车辆牌照图像识别算法的实现

本科毕业设计(论文) 车辆牌照图像识别算法的实现(题目二号宋体)学院名称:电气信息工程学院(四号宋体) 专业:通信工程 班级:通信 学号: 姓名:张 指导教师姓名:孙 指导教师职称:副教授 二〇一年六月 [空一行、字号小] (中文题目为号黑体居中) [空一行、字号小] 摘要:××××××××××××××××××(字左右,小四号宋体)×××××××××××××××××…… 关键词:×××;××××;×××××;×××(个,小四号宋体) 摘要应回答好个方面问题: ①(直接写出研究目的); ②(简述过程和方法); ③(罗列主要结果或结论); ④(通过②和③两方面内容具体展示文中创新之处)。

(号,居中对齐) [空一行、字号小] :××××××(小号)××××××××××××××××××××××……:×××;××××;×××××;×××(小号) 要求和中文摘要对应。 中实词首字母要大写。 一般采用第三人称、单数、现在时。

目录(号黑体居中) [空一行、字号小] 前言(号黑体)........................................ 错误!未指定书签。第章章标题(号黑体)................................................. 节标题(小宋体,倍行距,内侧缩进字符)............................ 小节标题(小宋体,倍行距, 内侧缩进字符)....................... 小节标题....................................................... 节标题 小节标题....................................................... 小节标题....................................................... 小节标题....................................................... 第章章标题............................................................. 节标题 小节标题....................................................... 小节标题....................................................... 节标题 小节标题....................................................... 小节标题....................................................... ................................(略) 参考文献(号黑体)...................................................... 致谢(号黑体) .......................................................... 附录标题(可选)....................................................... 附录标题(可选)....................................................... 注:目录中的内容一般列出“章”、“节”、“小节”三级标题即可。

相关主题
文本预览
相关文档 最新文档