灰度图像均值平滑
2010-12-09 14:39
218 查看
灰度图像均值平滑
图像平滑用于去除图像中的噪声。均值平滑,就是将每个像素的灰度值用其领域的平均值代替。该算法简单,速度快,但不能完全消除椒盐噪声。平滑模板:
1 | 1 | 1 |
1 | 1 | 1 |
1 | 1 | 1 |
![]() | ![]() |
// 均值平滑 // 1. pImageData 图像数据 // 2. nWidth 图像宽度 // 3. nHeight 图像高度 // 4. nWidthStep 图像行大小 bool SmoothBlur(unsigned char *pImageData, int nWidth, int nHeight, int nWidthStep) { int i = 0; int j = 0; int nValue = 0; unsigned char *pLine[3] = { NULL, NULL, NULL }; for (j = 1; j < nHeight - 1; j++) { pLine[0] = pImageData + nWidthStep * (j - 1); pLine[1] = pImageData + nWidthStep * j; pLine[2] = pImageData + nWidthStep * (j + 1); for (i = 1; i < nWidth - 1; i++) { nValue = (pLine[0][i-1] + pLine[0][i] + pLine[0][i+1] + pLine[1][i-1] + pLine[1][i] + pLine[1][i+1] + pLine[2][i-1] + pLine[2][i] + pLine[2][i+1]) / 9; pLine[0][i-1] = (unsigned char) nValue; } } return true; }
相关文章推荐
- 灰度图像--图像增强 平滑之均值滤波、高斯滤波
- 灰度图像--图像增强 平滑之均值滤波、高斯滤波
- 图像读取、转为灰度图像、均值平滑、显示保存操作
- 灰度图像均值平滑
- 图像平滑技术之核算子、均值滤波、中值滤波、高斯滤波、双边滤滤、导向滤波的原理概要及OpenCV代码实现
- 灰度图像--图像分割 阈值处理之迭代均值阈值
- cvKMeans2均值聚类分析+代码解析+灰度彩色图像聚类
- 灰度图像--图像分割 Sobel算子,Prewitt算子和Scharr算子平滑能力比较
- cvKMeans2均值聚类分析+代码解析+灰度彩色图像聚类
- 灰度图像的加权平均平滑算法
- RGB图像中值平滑和均值平滑
- opencv实现图像的灰度转换,均值滤波,实现图像的显示和存储
- 数字图像处理——图像平滑(均值滤波)
- 10. 对一幅灰度图像进行均值滤波、中值滤波。(自己可适当对原图像增加高频噪声)
- 【转】图像均值平滑
- 灰度图像高斯平滑
- LeetCode-661:Image Smoother (灰度图像平滑)
- 灰度图像高斯平滑
- 图像处理(锐化、平滑、反色,霓虹灯,浮雕、灰度处理)
- MATLAB - 练习程序,求灰度图像均值、最大、最小数值