求一段C#的直方图均衡化的代码

来源:百度知道 编辑:UC知道 时间:2024/06/28 08:58:48
如上,最好有注释
灰度图像的直方图均衡化就可以

using System;
using System.Collections.Generic;
using
System.Text;
using System.Drawing;
using
System.Drawing.Imaging;

namespace 图像直方图及均衡化
{
///
<summary>
/// 图像直方图处理类
/// </summary>
class
Histogram
{
Bitmap sourceImg = null;

int width
= 0; //源图宽度
int height = 0; //源图高度
int bytes =
0;
int grayLevels = 0;// 图像灰度级数
int[] histogram =
null;// 直方图
float[] cumulativeHistogram = null;//
归一化的累积直方图
byte[] mapPixel = null;// 像素-灰度 映射表

int[] newHistogram = null; // 新直方图
int maxValue = 0;
//灰度最大值

/// <summary>
/// 初始化待处理图像

/// </summary>
/// <param
name="img">待处理图像</param&