实验4 图像几何变换—哈哈镜制作(7)

时间:2025-04-20

vc++实现图像放大、缩小、平移、旋转、各种哈哈镜变形

g=(gUpLeft*(1-float_srcX)*(1-float_srcY)+gUpRight*float_srcX*(1-float_srcY)+ gDownLeft*(1-float_srcX)*float_srcY+gDownRight*float_srcX*float_srcY);

r=(rUpLeft*(1-float_srcX)*(1-float_srcY)+rUpRight*float_srcX*(1-float_srcY)+

rDownLeft*(1-float_srcX)*float_srcY+rDownRight*float_srcX*float_srcY);

}

if(int_srcY>=0 && int_srcY<=pImg->height*2 && int_srcX>=0 && { }

pImg1->imageData[i*pImg1->widthStep+j*3+0]=b; pImg1->imageData[i*pImg1->widthStep+j*3+1]=g; pImg1->imageData[i*pImg1->widthStep+j*3+2]=r;

int_srcX<=pImg->width*2)

break;

// 水平外凹 case HORAO:

pImg1 = cvCreateImage(cvGetSize(pImg),pImg->depth,pImg->nChannels); for(i=0;i<pImg1->height;i++) {

tmp = RANGE*sin(i*PI/pImg1->height); for(j=tmp;j<pImg1->width-tmp;j++) {

int s=(int)((j-tmp)*(pImg->width)/(pImg->width-2*tmp)); for(int k=0;k<pImg->nChannels;k++) {

pImg1->imageData[i*pImg1->widthStep+j*pImg->nChannels+k]=pImg->imageData[i*pImg->widthStep+s*pImg->nChannels+k];

} break;

}

}

// 水平外凸 case HORTU:

pImg1 = cvCreateImage(cvGetSize(pImg),pImg->depth,pImg->nChannels); for(i=0;i<pImg1->height;i++) {

tmp = RANGE*sin(i*PI/pImg1->height+PI)+RANGE; for(j=tmp;j<pImg1->width-tmp;j++) {

实验4 图像几何变换—哈哈镜制作(7).doc 将本文的Word文档下载到电脑

精彩图片

热门精选

大家正在看

× 游客快捷下载通道(下载后可以自由复制和排版)

限时特价:7 元/份 原价:20元

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219