# Extracting trans,rot and scale from homography matrix

 Classic List Threaded
6 messages
Reply | Threaded
Open this post in threaded view
|
Report Content as Inappropriate

## 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?
Reply | Threaded
Open this post in threaded view
|
Report Content as Inappropriate

## RE: Extracting trans,rot and scale from homography matrix

 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?
Reply | Threaded
Open this post in threaded view
|
Report Content as Inappropriate

## Re: Extracting trans,rot and scale from homography matrix

 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_matrixOn 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?**** > > **** > >   >
Reply | Threaded
Open this post in threaded view
|
Report Content as Inappropriate

## RE: Extracting trans,rot and scale from homography matrix

 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} gives   \mathbf{E} = \mathbf{U} \, \mathbf{\Sigma} \, \mathbf{V}^{T}   [\mathbf{t}]_{\times} = \mathbf{V} \, \mathbf{W} \, \mathbf{\Sigma} \, \mathbf{V}^{T}   \mathbf{R} = \mathbf{U} \, \mathbf{W}^{-1} \, \mathbf{V}^{T}     [\mathbf{t}]_{\times} = \mathbf{V} \, \mathbf{Z} \, \mathbf{V}^{T}   with     \mathbf{Z} = \begin{pmatrix} 0 & -1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix} http://en.wikipedia.org/wiki/Essential_matrixOn 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?
Reply | Threaded
Open this post in threaded view
|
Report Content as Inappropriate

## Re: Extracting trans,rot and scale from homography matrix

 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" 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} > dabb7e0b8.png> gives > >   \mathbf{E} = \mathbf{U} \, \mathbf{\Sigma} \, \mathbf{V}^{T} > 25cbf4245.png> > >   [\mathbf{t}]_{\times} = \mathbf{V} \, \mathbf{W} \, \mathbf{\Sigma} \, > \mathbf{V}^{T} > a31505ad5.png> > >   \mathbf{R} = \mathbf{U} \, \mathbf{W}^{-1} \, \mathbf{V}^{T} > ae377d279.png> > >   > >   [\mathbf{t}]_{\times} = \mathbf{V} \, \mathbf{Z} \, \mathbf{V}^{T} > d734fa2bc.png>   with     \mathbf{Z} = \begin{pmatrix} 0 & -1 & 0 \\ 1 & 0 & > 0 \\ 0 & 0 & 0 \end{pmatrix} > 02daf1104.png> > > http://en.wikipedia.org/wiki/Essential_matrix> > On Fri, Nov 18, 2011 at 9:14 PM, 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? >
Reply | Threaded
Open this post in threaded view
|
Report Content as Inappropriate

## Re: Extracting trans,rot and scale from homography matrix

 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" 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? >
Loading...