Move pixel coordinate
Hi guys, i want to implement this formula :
can anyone suggest function in opencv to do this ?
Hi guys, i want to implement this formula :
can anyone suggest function in opencv to do this ?
you can use remap for your shearing transformation:
const float a = 0.27; // it's a constant ?
Mat img = imread("../img/grid.jpg");
Mat_<Vec2f> prjMap(img.size());
for (int x=0; x<img.cols; x++) {
for (int y=0; y<img.rows; y++) {
float u = x - y * tan(a);
float v = y;
prjMap(y, x) = Vec2f(u,v);
}
}
Mat projected;
remap(img, projected, prjMap, cv::Mat(), INTER_LINEAR);
why, you iterate with the column first ? Should it be the row first ?
Asked: 2017-05-25 04:32:35 -0600
Seen: 704 times
Last updated: May 25 '17
remapping
sorry, the link can't be acessed.
^^ thanks for notice, fixed now !
can i do shear transformation on x axis using remapping ? because i have used warpaffine, and it gives me wrong result.
you can do any transformation with it (that's the beauty), you're not restricted to an affine or perspective conserving formula.