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++) {