数字图像处理的代码

上传人:新** 文档编号:499068450 上传时间:2024-03-11 格式:DOCX 页数:8 大小:9.39KB
返回 下载 相关 举报
数字图像处理的代码_第1页
第1页 / 共8页
数字图像处理的代码_第2页
第2页 / 共8页
数字图像处理的代码_第3页
第3页 / 共8页
数字图像处理的代码_第4页
第4页 / 共8页
数字图像处理的代码_第5页
第5页 / 共8页
点击查看更多>>
资源描述

《数字图像处理的代码》由会员分享,可在线阅读,更多相关《数字图像处理的代码(8页珍藏版)》请在金锄头文库上搜索。

1、using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace final public partial class Form1 : Form public Form1() InitializeComponent(); Bitmap recBitmap; private void openT

2、oolStripMenuItem_Click(object sender, EventArgs e) OpenFileDialog openFileDlg = new OpenFileDialog(); openFileDlg.ShowDialog(); String fileName = openFileDlg.FileName; recBitmap = new Bitmap(fileName); recPicBox.Image = recBitmap; private void rToolStripMenuItem_Click(object sender, EventArgs e) int

3、 width = recBitmap.Width; int height = recBitmap.Height; Bitmap decBitmap = new Bitmap(width, height); for (int i = 0; i width; i+) for (int j = 0; j height; j+) Color c = recBitmap.GetPixel(i, j); int r = c.R; Color cc = Color.FromArgb(r, 0, 0); decBitmap.SetPixel(i, j, cc); decPicBox.Image = decBi

4、tmap; private void gToolStripMenuItem_Click(object sender, EventArgs e) int width = recBitmap.Width; int height = recBitmap.Height; Bitmap decBitmap = new Bitmap(width, height); for (int i = 0; i width; i+) for (int j = 0; j height; j+) Color c = recBitmap.GetPixel(i, j); int g = c.G; Color cc = Col

5、or.FromArgb(0, g, 0); decBitmap.SetPixel(i, j, cc); decPicBox.Image = decBitmap; private void bToolStripMenuItem_Click(object sender, EventArgs e) int width = recBitmap.Width; int height = recBitmap.Height; Bitmap decBitmap = new Bitmap(width, height); for (int i = 0; i width; i+) for (int j = 0; j

6、height; j+) Color c = recBitmap.GetPixel(i, j); int b = c.B; Color cc = Color.FromArgb(0, 0, b); decBitmap.SetPixel(i, j, cc); decPicBox.Image = decBitmap; private void grayToolStripMenuItem_Click(object sender, EventArgs e) int width = recBitmap.Width; int height = recBitmap.Height; Bitmap decBitma

7、p = new Bitmap(width, height); for (int i = 0; i width; i+) for (int j = 0; j height; j+) Color c = recBitmap.GetPixel(i, j); int r = c.R; int g = c.G; int b = c.B; int gray = (r + g + b) / 3; Color cc = Color.FromArgb(gray, gray, gray); decBitmap.SetPixel(i, j, cc); decPicBox.Image = decBitmap; pri

8、vate void vToolStripMenuItem_Click(object sender, EventArgs e) int width = recBitmap.Width; int height = recBitmap.Height; Bitmap decBitmap = new Bitmap(width, height); for (int i = 0; i width; i+) for (int j = 0; j height; j+) Color c = recBitmap.GetPixel(i, j); decBitmap.SetPixel(width - i - 1, j,

9、 c); decPicBox.Image = decBitmap; private void gToolStripMenuItem1_Click(object sender, EventArgs e) int width = recBitmap.Width; int height = recBitmap.Height; Bitmap decBitmap = new Bitmap(width, height); for (int i = 0; i width; i+) for (int j = 0; j height; j+) Color c = recBitmap.GetPixel(i, j)

10、; decBitmap.SetPixel(i, height - j - 1, c); decPicBox.Image = decBitmap; private void vtToolStripMenuItem_Click(object sender, EventArgs e) int width = recBitmap.Width; int height = recBitmap.Height; Bitmap decBitmap = new Bitmap(width, height); for (int i = 0; i width; i+) for (int j = 0; j height; j+) Color c = recBitmap.GetPixel(i, j); int vtran = i - width / 3; if (vtran 0) vtran = 0; decBitmap.SetPixel(vtran, j, c);

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 机械/制造/汽车 > 汽车技术

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号