c++ - How can I apply a transformation matrix to a point in OpenCV? -
suppose have transformation matrix mat
tr
got getaffinetransform()
, point2d
p
. want point result of warping p
tr
. opencv provide way of doing this?
cv::transform
used transforming points transformation matrix.
every element of n -channel array src interpreted n -element vector transformed using m x n or m x (n+1) matrix m m-element vector - corresponding element of output array dst . function may used geometrical transformation of n -dimensional points, arbitrary linear color space transformation (such various kinds of rgb yuv transforms), shuffling image channels, , forth.
there's concise illustration in inputarray
documentation (otherwise not relevant):
std::vector<point2f> vec; // points or circle for( int = 0; < 30; i++ ) vec.push_back(point2f((float)(100 + 30*cos(i*cv_pi*2/5)), (float)(100 - 30*sin(i*cv_pi*2/5)))); cv::transform(vec, vec, cv::matx23f(0.707, -0.707, 10, 0.707, 0.707, 20));
or can convert point2f
mat
, multiply matrix.
c++ opencv
No comments:
Post a Comment