日期:2014-05-20  浏览次数:20805 次

C#图像处理问题


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 WindowsFormsApplication14
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void 打开图像_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "BMP FILE|*.jpg";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                Bitmap curMap = new Bitmap(openFileDialog1.FileName);
                pictureBox1.Image = curMap;
                
            }
        }

        private void 提取图像_Click(object sender, EventArgs e)
        {
            if (pictureBox1.Image != null)
            {

                this.label1.Text = "";
                int width1, width2, height1, height2;
                int r1, r2;
                int g1, g2;
                int b1, b2;
                Color c1 =new Color() ;