artoon
artoon

Reputation: 739

Interpolation warp

I use opencv with cpp.

I have std::vector<std::pair<cv::Point2d, cv::Point2d> > wich represent a warp. For each point of an image A, i associate a point of an image B. I don't know all association between points of image A and points of image B. The points of image A are on a sparse matrix. These data have also probably epsilon error. So I would like interpolate. In opencv I don't found a function which do simply an interpolation. How do this ?

I found the function cv::warpPoint but I don't know the cv::Mat Camera intrinsic parameters nor cv::Mat Camera rotation matrix. How compute these matrix from my data ?

Upvotes: 0

Views: 2724

Answers (2)

Andrey  Smorodov
Andrey Smorodov

Reputation: 10850

I think the best way is piecewise affine warper:

https://code.google.com/p/imgwarp-opencv/

I have my own fast implementation, but comments are in russian, you can find it here.

Upvotes: 1

Micka
Micka

Reputation: 20160

So there are 2 questions:

  1. how to warp the points from one image to the other. Try cv::remap to do that, once you have dense (interpolated) description. See http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/remap/remap.html for example.

  2. How to compute non-given point pairs by interpolation. I don't have a solution for this, but some ideas:

    • don't use point pairs but displacement vectors. displacement might be easier to interpolate.
    • use inverse formulation to get a dense description of the second image (otherwise there might be pixel that aren't touched at all

But I guess the "real" method to do this would be some kind of spline interpolation.

Upvotes: 0

Related Questions