With FeatureDetector I get features on two images with the same element and match this features with BruteForceMatcher. Then I'm using OpenCv function findHomography to get homography matrix
H = findHomography( src2Dfeatures, dst2Dfeatures, outlierMask, RANSAC,3); and getting H matrix, then align image with: warpPerspective(img1,alignedSrcImage,H,img2.size(),INTER_LINEAR,BORDER_C ONSTANT); I need to know rotation angle, scale, displacement of detected element. Is there any simple way to get this than some big equations? Some evaluated formulas just to put data in? |
It is a complicate problem. But this may inspire you.
http://hal.inria.fr/docs/00/17/47/39/PDF/RR-6303.pdf From: [hidden email] [mailto:[hidden email]] On Behalf Of krzych07 Sent: Friday, November 18, 2011 6:45 AM To: [hidden email] Subject: [OpenCV] Extracting trans,rot and scale from homography matrix With FeatureDetector I get features on two images with the same element and match this features with BruteForceMatcher. Then I'm using OpenCv function findHomography to get homography matrix H = findHomography( src2Dfeatures, dst2Dfeatures, outlierMask, RANSAC,3); and getting H matrix, then align image with: warpPerspective(img1,alignedSrcImage,H,img2.size(),INTER_LINEAR,BORDER_C ONSTANT); I need to know rotation angle, scale, displacement of detected element. Is there any simple way to get this than some big equations? Some evaluated formulas just to put data in? |
from essential matrix we can calculate rotation and translation between
images. An SVD of [image: \mathbf{E}] gives [image: \mathbf{E} = \mathbf{U} \, \mathbf{\Sigma} \, \mathbf{V}^{T}][image: [\mathbf{t}]_{\times} = \mathbf{V} \, \mathbf{W} \, \mathbf{\Sigma} \, \mathbf{V}^{T}] [image: \mathbf{R} = \mathbf{U} \, \mathbf{W}^{-1} \, \mathbf{V}^{T}] [image: [\mathbf{t}]_{\times} = \mathbf{V} \, \mathbf{Z} \, \mathbf{V}^{T}] with [image: \mathbf{Z} = \begin{pmatrix} 0 & -1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix}]http://en.wikipedia.org/wiki/Essential_matrix On Fri, Nov 18, 2011 at 9:14 PM, lood339 <[hidden email]> wrote: > ** > > > It is a complicate problem. But this may inspire you. > http://hal.inria.fr/docs/00/17/47/39/PDF/RR-6303.pdf**** > > ** ** > > ** ** > > *From:* [hidden email] [mailto:[hidden email]] *On Behalf > Of *krzych07 > *Sent:* Friday, November 18, 2011 6:45 AM > *To:* [hidden email] > *Subject:* [OpenCV] Extracting trans,rot and scale from homography matrix* > *** > > ** ** > > **** > > With FeatureDetector I get features on two images with the same element > and match this features with BruteForceMatcher. Then I'm using OpenCv > function findHomography to get homography matrix > > H = findHomography( src2Dfeatures, dst2Dfeatures, outlierMask, > RANSAC,3); > and getting H matrix, then align image with: > > warpPerspective(img1,alignedSrcImage,H,img2.size(),INTER_LINEAR,BORDER_C > ONSTANT); > > I need to know rotation angle, scale, displacement of detected element. Is > there any simple way to get this than some big equations? Some evaluated > formulas just to put data in?**** > > **** > > > |
We can get R, T from essential matrix, but the pre-requirement of essential
matrix is the calibration of camera. From: [hidden email] [mailto:[hidden email]] On Behalf Of Yaswanth Gavini Sent: Friday, November 18, 2011 9:35 PM To: [hidden email] Subject: Re: [OpenCV] Extracting trans,rot and scale from homography matrix from essential matrix we can calculate rotation and translation between images. An SVD of \mathbf{E} <http://upload.wikimedia.org/wikipedia/en/math/4/9/0/490dd56a88cb93519bc965f dabb7e0b8.png> gives \mathbf{E} = \mathbf{U} \, \mathbf{\Sigma} \, \mathbf{V}^{T} <http://upload.wikimedia.org/wikipedia/en/math/a/4/c/a4c1466ee06708b86de6f4f 25cbf4245.png> [\mathbf{t}]_{\times} = \mathbf{V} \, \mathbf{W} \, \mathbf{\Sigma} \, \mathbf{V}^{T} <http://upload.wikimedia.org/wikipedia/en/math/6/c/0/6c0313ce3b30607a3b6771e a31505ad5.png> \mathbf{R} = \mathbf{U} \, \mathbf{W}^{-1} \, \mathbf{V}^{T} <http://upload.wikimedia.org/wikipedia/en/math/5/e/9/5e9de101b3b898871f23312 ae377d279.png> [\mathbf{t}]_{\times} = \mathbf{V} \, \mathbf{Z} \, \mathbf{V}^{T} <http://upload.wikimedia.org/wikipedia/en/math/c/3/e/c3e0bcab6e7217f63da1a2b d734fa2bc.png> with \mathbf{Z} = \begin{pmatrix} 0 & -1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix} <http://upload.wikimedia.org/wikipedia/en/math/7/4/9/749003c33d0498b21827563 02daf1104.png> http://en.wikipedia.org/wiki/Essential_matrix On Fri, Nov 18, 2011 at 9:14 PM, lood339 <[hidden email]> wrote: It is a complicate problem. But this may inspire you. http://hal.inria.fr/docs/00/17/47/39/PDF/RR-6303.pdf From: [hidden email] [mailto:[hidden email]] On Behalf Of krzych07 Sent: Friday, November 18, 2011 6:45 AM To: [hidden email] Subject: [OpenCV] Extracting trans,rot and scale from homography matrix With FeatureDetector I get features on two images with the same element and match this features with BruteForceMatcher. Then I'm using OpenCv function findHomography to get homography matrix H = findHomography( src2Dfeatures, dst2Dfeatures, outlierMask, RANSAC,3); and getting H matrix, then align image with: warpPerspective(img1,alignedSrcImage,H,img2.size(),INTER_LINEAR,BORDER_C ONSTANT); I need to know rotation angle, scale, displacement of detected element. Is there any simple way to get this than some big equations? Some evaluated formulas just to put data in? |
I'm not trying to calibrate camera etc. I have one object on image1, and the same object on image2. With keypoints matchers and warp perspective I want to get rotation of this element, disp and scale.
Warp perspective makes that element is transformed so it's the same as on second image, so i thought that it's some way to evaluate this trans, rot and scale from this. --- In [hidden email], "lood339" <lood339@...> wrote: > > We can get R, T from essential matrix, but the pre-requirement of essential > matrix is the calibration of camera. > > > > From: [hidden email] [mailto:[hidden email]] On Behalf Of > Yaswanth Gavini > Sent: Friday, November 18, 2011 9:35 PM > To: [hidden email] > Subject: Re: [OpenCV] Extracting trans,rot and scale from homography matrix > > > > > > from essential matrix we can calculate rotation and translation between > images. > > > > An SVD of \mathbf{E} > <http://upload.wikimedia.org/wikipedia/en/math/4/9/0/490dd56a88cb93519bc965f > dabb7e0b8.png> gives > > \mathbf{E} = \mathbf{U} \, \mathbf{\Sigma} \, \mathbf{V}^{T} > <http://upload.wikimedia.org/wikipedia/en/math/a/4/c/a4c1466ee06708b86de6f4f > 25cbf4245.png> > > [\mathbf{t}]_{\times} = \mathbf{V} \, \mathbf{W} \, \mathbf{\Sigma} \, > \mathbf{V}^{T} > <http://upload.wikimedia.org/wikipedia/en/math/6/c/0/6c0313ce3b30607a3b6771e > a31505ad5.png> > > \mathbf{R} = \mathbf{U} \, \mathbf{W}^{-1} \, \mathbf{V}^{T} > <http://upload.wikimedia.org/wikipedia/en/math/5/e/9/5e9de101b3b898871f23312 > ae377d279.png> > > > > [\mathbf{t}]_{\times} = \mathbf{V} \, \mathbf{Z} \, \mathbf{V}^{T} > <http://upload.wikimedia.org/wikipedia/en/math/c/3/e/c3e0bcab6e7217f63da1a2b > d734fa2bc.png> with \mathbf{Z} = \begin{pmatrix} 0 & -1 & 0 \\ 1 & 0 & > 0 \\ 0 & 0 & 0 \end{pmatrix} > <http://upload.wikimedia.org/wikipedia/en/math/7/4/9/749003c33d0498b21827563 > 02daf1104.png> > > http://en.wikipedia.org/wiki/Essential_matrix > > On Fri, Nov 18, 2011 at 9:14 PM, lood339 <lood339@...> wrote: > > > > It is a complicate problem. But this may inspire you. > http://hal.inria.fr/docs/00/17/47/39/PDF/RR-6303.pdf > > > > > > From: [hidden email] [mailto:[hidden email]] On Behalf Of > krzych07 > Sent: Friday, November 18, 2011 6:45 AM > To: [hidden email] > Subject: [OpenCV] Extracting trans,rot and scale from homography matrix > > > > > > With FeatureDetector I get features on two images with the same element and > match this features with BruteForceMatcher. Then I'm using OpenCv function > findHomography to get homography matrix > > H = findHomography( src2Dfeatures, dst2Dfeatures, outlierMask, > RANSAC,3); > and getting H matrix, then align image with: > > warpPerspective(img1,alignedSrcImage,H,img2.size(),INTER_LINEAR,BORDER_C > ONSTANT); > > I need to know rotation angle, scale, displacement of detected element. Is > there any simple way to get this than some big equations? Some evaluated > formulas just to put data in? > |
In reply to this post by krzych07
If elements (row,col) (3,1) = 0, (3,2) = 0, and (3,3) = 1 in H then you can view the homography as a similar transformation : H = [scos(\theta) -ssin(\theta) t_x; ssin(\theta) scos(\theta) t_y; 0 0 1] where s is the scale factor, \theta is the angle of rotation, and t_x and t_y are the translations. Might be better to solve for this form directly, but I don't know if a single command to do this exists in OpenCV. --- In [hidden email], "krzych07" <sas.krzysztof@...> wrote: > > With FeatureDetector I get features on two images with the same element and match this features with BruteForceMatcher. Then I'm using OpenCv function findHomography to get homography matrix > > H = findHomography( src2Dfeatures, dst2Dfeatures, outlierMask, > RANSAC,3); > and getting H matrix, then align image with: > > warpPerspective(img1,alignedSrcImage,H,img2.size(),INTER_LINEAR,BORDER_C ONSTANT); > > I need to know rotation angle, scale, displacement of detected element. Is there any simple way to get this than some big equations? Some evaluated formulas just to put data in? > |
Free forum by Nabble | Edit this page |