1、原旋转中的
double phase[33]={ 0};//16相位,包含端点存在33个距离 for (int i=0;i<33;i++) { double i2=1.0*i; phase[i]=fs(i2/16); } int size; if(dbZoom>1) { size=iWidth*iHeight; } else { size=ceil(iWidth*dbZoom)*ceil(iHeight*dbZoom); } int newWidth=ceil(dbZoom*iWidth); //旋转中心为图像中心 double rx0=ceil(dbZoom*iWidth)*0.5; double ry0=ceil(dbZoom*iHeight)*0.5; double srcx,srcy,u,v; int xOr,yOr; dbRotate=dbRotate*3.1415926/180.0; for (int y=0;y=0 && xOr+2<=iWidth && yOr-1>=0 && yOr+2<=iHeight)) { pbTag[y*newWidth+x]=0; } else { double middle= pbSrc[(yOr-1)*iWidth+(xOr-1)]*A1*A2+ pbSrc[(yOr)*iWidth+(xOr-1)]*A1*B2+ pbSrc[(yOr+1)*iWidth+(xOr-1)]*A1*C2+ pbSrc[(yOr+2)*iWidth+(xOr-1)]*A1*D2+ pbSrc[(yOr-1)*iWidth+(xOr)]*B1*A2+ pbSrc[(yOr)*iWidth+(xOr)]*B1*B2+ pbSrc[(yOr+1)*iWidth+(xOr)]*B1*C2+ pbSrc[(yOr+2)*iWidth+(xOr)]*B1*D2+ pbSrc[(yOr-1)*iWidth+(xOr+1)]*C1*A2+ pbSrc[(yOr)*iWidth+(xOr+1)]*C1*B2+ pbSrc[(yOr+1)*iWidth+(xOr+1)]*C1*C2+ pbSrc[(yOr+2)*iWidth+(xOr+1)]*C1*D2+ pbSrc[(yOr-1)*iWidth+(xOr+2)]*D1*A2+ pbSrc[(yOr)*iWidth+(xOr+2)]*D1*B2+ pbSrc[(yOr+1)*iWidth+(xOr+2)]*D1*C2+ pbSrc[(yOr+2)*iWidth+(xOr+2)]*D1*D2; if(middle<=255&&middle>=0) pbTag[y*newWidth+x]=middle; else if(middle>255) pbTag[y*newWidth+x]=255; else pbTag[y*newWidth+x]=0; } } } //memcpy(pbTag,pbSrc,size); return ERROR_SUCCESS;
2、插值后只显示中间1280*1024。
double phase[33]={ 0};//16相位,包含端点存在33个距离 for (int i=0;i<33;i++) { double i2=1.0*i; phase[i]=fs(i2/16); } //旋转中心为图像中心 double rx0=iWidth; double ry0=iHeight; double srcx,srcy,u,v; int xOr,yOr; int newWidth=ceil(dbZoom*iWidth); int newHeight=ceil(dbZoom*iHeight); for (int y=0;y=0 && srcx<=iWidth && srcy>=0 && srcy<=iHeight)) { pbTag[y*2*iWidth+x]=0;//255 } else { double middle= pbSrc[(yOr-1)*iWidth+(xOr-1)]*A1*A2+ pbSrc[(yOr)*iWidth+(xOr-1)]*A1*B2+ pbSrc[(yOr+1)*iWidth+(xOr-1)]*A1*C2+ pbSrc[(yOr+2)*iWidth+(xOr-1)]*A1*D2+ pbSrc[(yOr-1)*iWidth+(xOr)]*B1*A2+ pbSrc[(yOr)*iWidth+(xOr)]*B1*B2+ pbSrc[(yOr+1)*iWidth+(xOr)]*B1*C2+ pbSrc[(yOr+2)*iWidth+(xOr)]*B1*D2+ pbSrc[(yOr-1)*iWidth+(xOr+1)]*C1*A2+ pbSrc[(yOr)*iWidth+(xOr+1)]*C1*B2+ pbSrc[(yOr+1)*iWidth+(xOr+1)]*C1*C2+ pbSrc[(yOr+2)*iWidth+(xOr+1)]*C1*D2+ pbSrc[(yOr-1)*iWidth+(xOr+2)]*D1*A2+ pbSrc[(yOr)*iWidth+(xOr+2)]*D1*B2+ pbSrc[(yOr+1)*iWidth+(xOr+2)]*D1*C2+ pbSrc[(yOr+2)*iWidth+(xOr+2)]*D1*D2; if(middle<=255&&middle>=0) pbTag[y*newWidth+x]=middle; else if(middle>255) pbTag[y*newWidth+x]=255; else pbTag[y*newWidth+x]=0; } } } for (int y=0;y<1024;y++) { for (int x=0;x<1280;x++) { int y2=newHeight/2-512; int x2=newWidth/2-640; pbFinal[y*1280+x]=pbTag[(y2+y)*newWidth+(x2+x)]; } } return ERROR_SUCCESS;
双三。