椒盐噪声代码
//椒盐噪声代码
void CZaoShengView::OnOperatorJiaoyan()
{
// TODO: Add your command handler code here
CZaoShengDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
DWORD size = pDoc->dib.GetSize();
BYTE *p_data; //原图数据区指针
int wide,height;
BYTE* p_temp=new BYTE [size];
p_data=pDoc->dib.GetData(); //取得原图的数据区指针
memcpy(p_temp,p_data,size);
if(pDoc->dib.m_pBitmapInfoHeader->biBitCount<9) //灰度图像
{
wide=pDoc->dib.GetWidth(); //取得原图的数据区宽
height=pDoc->dib.GetHeight(); //取得原图的数据区高
for(int j=0;j<height;j++)
{
for(int i=0;i<wide;i++)
{
if(rand()>31500)
p_temp[j*wide+i]=0;
}
}
memcpy(p_data,p_temp,size);
delete p_temp;
}
else //24位彩色
{
wide=pDoc->dib.GetWidth()*3; //取得原图的数据区宽
height=pDoc->dib.GetHeight(); //取得原图的数据区高
for(int j=0;j<height;j++)
{
for(int i=0;i<wide;i++)
{
if(rand()>31500)
p_temp[j*wide+i]=0;
}
}
memcpy(p_data,p_temp,size);
delete p_temp;
}
Invalidate();
}
jiaoyan.rar_加噪声
版权申诉
201 浏览量
2022-09-23
23:45:41
上传
评论
收藏 879B RAR 举报
JaniceLu
- 粉丝: 79
- 资源: 1万+
最新资源
- 基于matlab实现字符识别的参考程序,用所用的字体识别率挺高,部分手写的也能识别,但是还不能识别扭曲和倾斜的字符 .rar
- 基于matlab实现指纹识别系统 包括数据库导入、图像选择识别、帮助功能、识别图像可视、gabor滤波可视,实现界面操作.rar
- 基于matlab实现指纹识别,利用gabor滤波器,提取指纹特征,只能呢读取bmp图像.rar
- 基于matlab实现于数字图像相关方法中散斑质量评价
- 基于matlab实现遗传算法和佳点集遗传算法的基本思想和不同点,用遗传算法测试一标准函数 佳点集算法测试一标准函数
- tensorflow-gpu-2.5.1-cp38-cp38-manylinux2010-x86-64.whl
- tensorflow-gpu-2.5.0-cp39-cp39-manylinux2010-x86-64.whl
- tensorflow-gpu-2.5.2-cp39-cp39-manylinux2010-x86-64.whl
- 内含方正小标宋简体、仿宋-Gb2312、黑体、楷体、宋体,五个公文常用字体
- 记忆卡牌游戏源码及可运行文件
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈