void CWvltDoc::OnFilterSmoothmean()//均值滤波
{
LPBITMAPFILEHEADER lpBitmapFileHeader = (LPBITMAPFILEHEADER)m_pBitmap;
LPBITMAPINFOHEADER lpBitmapInfoHeader = (LPBITMAPINFOHEADER)(m_pBitmap + 14);
unsigned char *lpData = m_pBitmap + lpBitmapFileHeader->bfOffBits;
unsigned long biHeight = lpBitmapInfoHeader->biHeight;
unsigned long biWidth = lpBitmapInfoHeader->biWidth;
unsigned long biAlign = (biWidth * 3 + 3) / 4 * 4;
unsigned long bmSize = biHeight * biAlign;
if (m_pTransfered == NULL)
m_pTransfered = (unsigned char*)malloc(bmSize);
if (m_pTransfered == NULL)
return;
//Add the processing code here, which reverses the color of each pixel.
int x, y, cur;
for (y = 1; y < (int)biHeight-1; y++)
{
for (x = 1; x < (int)biWidth-1; x++)
{
cur = y*biAlign + 3 * x;
int i,j,sum;
int data[9];
for (i = 0; i < 3; i++
数字图像处理——图像平滑(均值滤波)
最新推荐文章于 2024-10-08 11:23:45 发布
该博客介绍了一种数字图像处理方法——均值滤波,通过提供一段C++代码展示了如何反转图像中每个像素的颜色,并使用3x3模板进行平滑处理。文章附带了处理前后的图片效果对比。
摘要由CSDN通过智能技术生成