图像非整数倍放大缩小问题,,高手指点下,谢谢~!
时间:2011-12-19
来源:互联网
void CCywView::Onfd2b()
{
// TODO: Add your command handler code here
CCywDoc * pDoc = GetDocument();
int i,j,nBmpHeight,nnWidth,nBmpWidth,a,b;
nBmpHeight=pDoc->BmpHeight*2;
nBmpWidth=pDoc->nWidth*2;
BYTE *npImage;
npImage=(BYTE*)malloc(sizeof(BYTE)*(nBmpHeight*nBmpWidth));
if (nBmpWidth%4==0)
{
nnWidth=nBmpWidth;
}
else
{
nnWidth=(nBmpWidth+3)/4*4;
}
for (i = 0; i < nBmpHeight; i++)
for(j = 0; j < nBmpWidth; j++)
{
a=(int)i/2;
b=(int)j/2;
npImage[i*nnWidth+j]=pDoc->pImage[a*pDoc->nWidth+b];
}
fangda dlg;
dlg.pImage=npImage;
dlg.BmpWidth=nBmpWidth;
dlg.BmpHeight=nBmpHeight;
dlg.pBitMapInfo=pDoc->pBitMapInfo;
dlg.BitMapFileHeader=pDoc->BitMapFileHeader;
dlg.ColorUsed=pDoc->ColorUsed;
dlg.BitCount=pDoc->BitCount;
dlg.nWidth=nnWidth;
dlg.DoModal();
free(npImage);
}
{
// TODO: Add your command handler code here
CCywDoc * pDoc = GetDocument();
int i,j,nBmpHeight,nnWidth,nBmpWidth,a,b;
nBmpHeight=pDoc->BmpHeight*2;
nBmpWidth=pDoc->nWidth*2;
BYTE *npImage;
npImage=(BYTE*)malloc(sizeof(BYTE)*(nBmpHeight*nBmpWidth));
if (nBmpWidth%4==0)
{
nnWidth=nBmpWidth;
}
else
{
nnWidth=(nBmpWidth+3)/4*4;
}
for (i = 0; i < nBmpHeight; i++)
for(j = 0; j < nBmpWidth; j++)
{
a=(int)i/2;
b=(int)j/2;
npImage[i*nnWidth+j]=pDoc->pImage[a*pDoc->nWidth+b];
}
fangda dlg;
dlg.pImage=npImage;
dlg.BmpWidth=nBmpWidth;
dlg.BmpHeight=nBmpHeight;
dlg.pBitMapInfo=pDoc->pBitMapInfo;
dlg.BitMapFileHeader=pDoc->BitMapFileHeader;
dlg.ColorUsed=pDoc->ColorUsed;
dlg.BitCount=pDoc->BitCount;
dlg.nWidth=nnWidth;
dlg.DoModal();
free(npImage);
}
作者: ye461166855 发布时间: 2011-12-19
试试opencv的cvResize函数
作者: fengbingchun 发布时间: 2011-12-19
归根结底是坐标变换加上插值的问题,至于代码还是自己多看几遍吧
作者: renshengrumenglibing 发布时间: 2011-12-19
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28