数字图像处理代码文档格式.docx
- 文档编号:4446801
- 上传时间:2023-05-03
- 格式:DOCX
- 页数:32
- 大小:20.28KB
数字图像处理代码文档格式.docx
《数字图像处理代码文档格式.docx》由会员分享,可在线阅读,更多相关《数字图像处理代码文档格式.docx(32页珍藏版)》请在冰点文库上搜索。
CBaseColorInfoinfo=_colorData[index];
//计算
intgray=0.299*info.GetRed()+0.587*info.GetGreen()+0.114*info.GetBlue();
//赋值
newColor[index].SetRed(gray);
newColor[index].SetGreen(gray);
newColor[index].SetBlue(gray);
}}//显示
CDlgShowArraydlg;
//颜色
dlg.SetColorData(newColor);
//图象大小
dlg.SetWidth(width);
//宽度
dlg.SetHeight(height);
//高度
dlg.DoModal();
//释放
delete[]newColor;
}
黑白图
OnMenuitem32823()
intshow=100;
intvalue=_colorData[index].GetGreen();
intgray=255;
if(value>
=show){gray=255;
elsegray=0;
//计算//赋值
newColor[index].SetRed(gray);
newColor[index].SetGreen(gray);
newColor[index].SetBlue(gray);
dlg.DoModal();
行删除
OnZoom1()
intnewwidth=_infoHeader.biWidth/2;
intnewheight=_infoHeader.biHeight/2;
CBaseColorInfo*newColor=newCBaseColorInfo[newwidth*newheight];
for(intx=0;
x<
newwidth;
++x)
{for(inty=0;
y<
newheight;
++y)
{intnewindex=y*newwidth+x;
//新图象的INDEX
intx1=x*2;
inty1=y*2;
intindex=y1*_infoHeader.biWidth+x1;
//原图象的INDEX
CBaseColorInfoinfo=_colorData[index];
intgary=0.299*info.GetRed()+0.587*info.GetGreen()+0.114*info.GetBlue();
//赋值
newColor[newindex].SetRed(gary);
newColor[newindex].SetGreen(gary);
newColor[newindex].SetBlue(gary);
}}
CDlgShowArraydlg;
//
//数据
dlg.SetWidth(newwidth);
dlg.SetHeight(newheight);
//高度
delete[]newColor;
}
行复制
OnCopy()
intnewwidth=_infoHeader.biWidth*2;
intnewheight=_infoHeader.biHeight*2;
{for(inty=0;
intx1=x/2;
inty1=y/2;
intred=info.GetRed();
intblue=info.GetBlue();
intgreen=info.GetGreen();
newColor[newindex].SetRed(red);
newColor[newindex].SetGreen(green);
newColor[newindex].SetBlue(blue);
}}
delete[]newColor;
灰度分辨率
Onhuidufenbianlv()
intwidth=_infoHeader.biWidth;
intheight=_infoHeader.biHeight;
CBaseColorInfo*newColor=newCBaseColorInfo[width*height];
intlen=width*height;
for(intindex=0;
index<
len;
++index)
{CBaseColorInfoinfo=_colorData[index];
intnewred=red/32*32;
newColor[index].SetRed(newred);
intnewblue=blue/32*32;
newColor[index].SetBlue(newblue);
intnewgreen=green/32*32;
newColor[index].SetGreen(newgreen);
最新领插值
OnChazhi()
{intnewindex=y*newwidth+x;
intx1=int(x/2+0.5);
inty1=int(y/2+0.5);
intblue=info.GetBlue();
双线性插值
OnShuangchazhi()
Addyourcommandhandlercodeheredoubles=2.0;
intnewwidth=_infoHeader.biWidth*s;
intnewheight=_infoHeader.biHeight*s;
intoldLen=_infoHeader.biWidth*_infoHeader.biHeight;
for(intx=1;
newwidth-1;
{for(inty=1;
newheight-1;
{intnewindex=y*newwidth+x;
//新图象的INDEX
doubley1=y/s;
doublex1=x/s;
intleft=int(x1);
inttop=int(y1);
intgaIndex=top*_infoHeader.biWidth+left;
intgbIndex=gaIndex+1;
intgcIndex=gaIndex+_infoHeader.biWidth;
intgdIndex=gcIndex+1;
intga=_grayData[gaIndex];
intgb=_grayData[gbIndex];
intgc=_grayData[gcIndex];
intgd=_grayData[gdIndex];
intge=(x1-left)*(gb-ga)+ga;
intgf=(x1-left)*(gd-gc)+gc;
intnewgray=(y1-top)*(gf-ge)+ge;
newColor[newindex].SetRed(newgray);
newColor[newindex].SetGreen(newgray);
newColor[newindex].SetBlue(newgray);
灰度取反
OnQufan()
intnewwidth=_infoHeader.biWidth;
intnewheight=_infoHeader.biHeight;
{intnewindex=y*newwidth+x;
intnewgray=255-_grayData[newindex];
newColor[newindex].SetRed(newgray);
newColor[newindex].SetGreen(newgray);
对数
OnDuishu()
{intnewindex=y*newwidth+x;
intnewgray=255-log10((1+double(_grayData[newindex]))/40.0);
}}
冥次变换
Onmingcibianhuan()
CBaseColorInfo*newColor
=newCBaseColorInfo[newwidth*newheight];
//新图象的INDEX
intnewgray=240*pow(_grayData[newindex]/255.0,2.0);
分段线性拉伸
Onfenduan()
Addyourcommandhandlercodehere
//建新图
intwidth1=80,height1=25;
intwidth2=130,height2=230;
intgray=0;
intvalue=_grayData[index];
if(value<
=width1)gray=(height1/width1)*value;
elseif(width1<
=value&
&
value<
=width2)
gray=((height2-height1)/(width2-width1))*(value-width1)+height1;
elsegray=((255-height2)/(255-width2))*(value-width2)+height2;
dlg.SetColorData(newColor);
//颜色数据
dlg.SetWidth(width);
//宽
dlg.SetHeight(height);
//高dlg.DoModal();
位平面
Onweipinmian()
CBaseColorInfo*newColor=newCBaseColorInfo[width*height];
intm=7;
intnewgray;
inta=_grayData[index];
a>
>
=m;
if(1==(a%2))newgray=255;
elsenewgray=0;
newColor[index].SetRed(newgray);
newColor[index].SetGreen(newgray);
newColor[index].SetBlue(newgray);
CDlgShowArraydlg;
直方图均衡化
Onzhufangtujunhenghua()
intyuanshi[256];
intindex;
intwidth=_info
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 数字图像 处理 代码