1
소스 이미지의 모든 픽셀을 대상 이미지 (R2 ~ R2)의 픽셀에 매핑하는 두 개의 cv :: Mat 매트릭스가 주어지면 소스 이미지를 대상 이미지로 변환하고 싶습니다 .변환 맵을 사용한 OpenCV2 변환 이미지
cv::Mat srcImg(100,100,CV_8U);
//fill...
cv::Mat dstImg(100,100,CV_8U);
//dst2src ->backprojection
//these matrices indicates for each pixel in the destination image, where to map it from the source image
cv::Mat x_dst2src(100,100,CV_64F);
cv::Mat y_dst2src(100,100,CV_64F);
//fill...
for(int ydst=0; ydst!=100;++ydst)
{
for(int xdst=0; xdst!=100;++xdst)
{
double xsrc = x_dst2src.at<double>(ydst,xdst);
double ysrc = y_dst2src.at<double>(ydst,xdst);
double val = getBicubic(srcImg,xsrc,ysrc);
dstImg.at<double>(ydst,xdst) = val;
}
}
이 기본 코드가 작동하지만, 아주 천천히 (내 이미지는 100 × 100보다 큰, 나는 바이 큐빅을 사용해야합니다) : 나는 sucessfuly 루프를 사용하여 그렇게 한 적이 있지만 너무 느립니다. 감사합니다,
-O-