point pixel coordinates in opencv

I have a matrix with floating-point pixel coordinates and corresponding matrix of greyscale values in this floating-point pixel coordinates. I need to remap an image from floating-point pixel coordinates to the regular grid. The cv::remap function from opencv transforms a source image like this: dst(x,y) = src(mapx(x,y), mapy(x,y)) In my case I have something like this: dst(mapx(x,y), mapy(x,y)) = src(x,y) From the equation above I need to determine destination image (dst(x,y)). Is there an easy way in OpenCv to perform such remapping or can you suggest any other open source image processing library to solve the problem?


  • Take the four corners of your picture.
  • Extract their correspondent in the dst image. Store them in two point vectors: std::vector<cv::Point> dstPts, srcPts .
  • extract the geometric relation between them with cv::findHomography(dstPts, srcPtrs,...)
  • apply cv::warpPerspective(). Internally, it calculates and applies the correct remapping
  • It works if the transform defined in your maps is a homographic transform. It doesn't work if it's some swirling, fisheye effect, lens correction map, etc.

    链接地址: http://www.djcxy.com/p/89784.html

    上一篇: MATLAB和C ++中OpenCV的不同像素值

    下一篇: opencv中的点像素坐标