OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Wed, 25 Dec 2019 08:27:58 -0600Issue with cv2.PerspectiveTransform and Direct Point Specific Homography Translation [Python]http://answers.opencv.org/question/223927/issue-with-cv2perspectivetransform-and-direct-point-specific-homography-translation-python/I am attempting to use the [perspectiveTransform()](https://docs.opencv.org/2.4/modules/core/doc/operations_on_arrays.html?highlight=perspectivetransform#perspectivetransform) function for tranlation of cordinates using homography matrix.
I used the [following](https://answers.opencv.org/question/252/cv2perspectivetransform-with-python/) method to input homography matrix along with the coordinates. This function returns a list of a list of the number of points, each of size 512. A list consisting of 4 lists of size 512 in the current scenario. I was expecting to get four updated coordinates.
points=np.array([[xmin,ymin],[xmin,ymax],[xmax,ymin],[xmax,ymax]], dtype='float32')
h=np.array([homographyMatrix],dtype='float32')
print(cv2.perspectiveTransform(cords,h))
Moreover, I found [another](https://answers.opencv.org/question/213466/single-point-perspective-transform/?answer=213473#post-id-213473) solution earlier regarding the translating of a single coordinate using the homography matrix directly and extending the dimensional (x,y,1) and using the third dimension to normalize the new coordinates will give me the translated coordinates. But this gives me one negative and a positive incorrect coordinate
p1=(x1, y1, 1)
p2=p1.dot(H) #numpy matrix multiplication function
p2 /= p2[2]; //normalize the output to get the right (x2, y2, 1)
**I want the updated coordinates of the player after transformation for a single point (x,y) I want to know at what position (x',y') will it be translated to**muaz65Wed, 25 Dec 2019 08:27:58 -0600http://answers.opencv.org/question/223927/Interpolation of transformation matrixhttp://answers.opencv.org/question/218636/interpolation-of-transformation-matrix/Is it possible to interpolate transformation matrix? I want to have rough homography for every frame between two frames for which homography was calculated manualy.
For example there's frame 0 with calculated transformation matrix H and frame 101 with calculated matrix H'. Granted that camera movement is even I want to find 100 transformation matrices to every frame between 0 and 101.
![image description](/upfiles/15689924226327921.jpg)
Or is there any simplier solution for this problem?karlososFri, 20 Sep 2019 10:14:45 -0500http://answers.opencv.org/question/218636/How to decompose homography transformation matrix in opencvhttp://answers.opencv.org/question/105179/how-to-decompose-homography-transformation-matrix-in-opencv/Hello,
I have found feature points detection and matching using SURF and based on homography transformation matrix. Now, I want to decompose homography transformation matrix to retrieve rotation and translation parameters.
I have tried in opencv2.4.9 and all higher version. there is function for decomposePerspectiveMat but not for homography transformation matrix.
This function is available for opencv3.0 and higher version. But before to use this function, I have to find feature points using SURF and xfeature2d as per documentation is required. But when we installed opencv3.1.0, then no file available like xfeature2d.hpp.
Can you please help to decompose homgraphy transformation matrix?
Thank you,darshana.mistryWed, 19 Oct 2016 02:00:37 -0500http://answers.opencv.org/question/105179/homography matrixhttp://answers.opencv.org/question/42267/homography-matrix/After calibration, I can know each checkboard rotation and translation matrix, how can I calculate the homography matrix between the one checkboard to the camera please? cheers!shutingjiaThu, 18 Sep 2014 03:13:00 -0500http://answers.opencv.org/question/42267/Apply infinite homography to imagehttp://answers.opencv.org/question/37630/apply-infinite-homography-to-image/
Hi, <br>
I want to apply a infinite homography to an image, but I dont know how to do it. <br>
I'm working with the openCV api for java. <br>
I have the below code, but I dont get good results. <br>
From image A, I get image B <br>
Do someone know how to apply this homography ?
![image description](/upfiles/14059135876919384.png)
----------
Calib3d.stereoCalibrate(objectPoints_1, imagePoints_1, imagePoints_2,
cameraMatrix_1, distCoeffs_1, cameraMatrix_2, distCoeffs_2, imageSize_1, R, T, E, F,
new TermCriteria( TermCriteria.MAX_ITER + TermCriteria.EPS , 30, 0.1),
Calib3d.CALIB_FIX_INTRINSIC );
Imgproc.initUndistortRectifyMap(cameraMatrix_1, distCoeffs_1, new Mat(), new Mat(), newImageSize_1, CvType.CV_32FC1, mapx_1, mapy_1);
Imgproc.initUndistortRectifyMap(cameraMatrix_2, distCoeffs_2, new Mat(), new Mat(), newImageSize_2, CvType.CV_32FC1, mapx_2, mapy_2);
Imgproc.remap(image_1, undistorted_1, mapx_1, mapy_1, Imgproc.INTER_LINEAR);
Imgproc.remap(image_2, undistorted_2, mapx_2, mapy_2, Imgproc.INTER_LINEAR);
Mat cameraMatrix_2_inv = new Mat(cameraMatrix_2.size(),cameraMatrix_2.type());
Core.invert(cameraMatrix_2, cameraMatrix_2_inv);
Core.invert(R, R_inv);
// inverse Homography: H_inf = k1*R*k2_inv
Mat H_inf = new Mat(3,3,CvType.CV_64FC1);
Core.gemm(cameraMatrix_1, R, 1, cameraMatrix_2_inv, 1, H_inf);
Mat outputImage_3 = new Mat();
Imgproc.warpPerspective(undistorted_2, outputImage_3, H_inf, undistorted_2.size());
----------rafaocSun, 20 Jul 2014 22:35:11 -0500http://answers.opencv.org/question/37630/Inverse Perspective Mapping with Known Rotation and Translationhttp://answers.opencv.org/question/33267/inverse-perspective-mapping-with-known-rotation-and-translation/Hi,
I need to obtain a new view of an image from a desired point of view (a general case of bird's eye view).
Imagine we change the camera's position with a **known rotation and transformation**. what would be the new image of the same scene?
We may put it in another way: how can we compute **homography matrix** by having the rotation and translation matrices?
I really appreciate any help!gozariTue, 13 May 2014 11:25:31 -0500http://answers.opencv.org/question/33267/accessing element in a homography matrixhttp://answers.opencv.org/question/30553/accessing-element-in-a-homography-matrix/Hi all,
I have a 3x3 homography matrix , which I computed using findHomography() function.
I store it in a cv::Mat matrix.
I am trying to do element access using the following code
float cvHomography::accessElements(const cv::Mat& aCvMat)
{
//cout << aCvMat << endl;
const float* Mi;
for( int i = 0; i < aCvMat.rows; i++){
Mi = aCvMat.ptr<float>(i);
for( int j = 0; j < aCvMat.cols; j++){
cout << Mi[j] << endl;
}
}
}
The above does not return the correct value from the homography matrix.
I have searched through documentation , tutorials and google and I honestly cannot see what I am doing wrong.synthnassizerTue, 25 Mar 2014 08:58:35 -0500http://answers.opencv.org/question/30553/Paper image correctionhttp://answers.opencv.org/question/20717/paper-image-correction/Suppose I have this image:
![image description](/upfiles/13791871086487651.png)
How to automatically detect the outher box And Correct the corners of the destination image based on that outher box, so that the image looks like this?
![image description](/upfiles/13791871286837554.png)Tony HenriqueSat, 14 Sep 2013 14:35:21 -0500http://answers.opencv.org/question/20717/