confusion over averaging rotation matrices as described












0














I am currently reading the paper on automatic calibration of traffic cameras (https://www.microsoft.com/en-us/research/wp-content/uploads/2017/09/AutoCalib.pdf). At some point, the authors compute multiple calibrations and compute an average of the rotation part of these matrices.



So, the text describes the process as follows:




Finally, we compute the “average” of the remaining calibrations. We
average the Z axis unit vector across all filtered calibrations and
compute two mutually orthogonal X and Y axis unit vectors.




So, let us assume I have two rotation matrices that I want to average. So something like:



r1 = [[-0.64375223,  0.63471324,  0.42746014],
[-0.52107859, -0.77267423, 0.3625626 ],
[ 0.56041072, 0.01066016, 0.82814624]]

r2 = [[-0.31267459, -0.0464914 , 0.94872185],
[-0.88839581, -0.33914166, -0.30941205],
[ 0.3361361 , -0.93958581, 0.06473821]]


So, first I compute the z-axes vector average as:



import numpy as np

c = [r1, r2]
z_avg = np.mean(c, axis=0)[:, 2]


This creates the average z-axes as:



array([0.688091  , 0.02657528, 0.44644223])


Then I wrote the function to compute the basis vectors as:



def basis(v):
v = v / np.linalg.norm(v)
if v[0] > 0.9:
b1 = np.asarray([0.0, 1.0, 0.0])
else:
b1 = np.asarray([1.0, 0.0, 0.0])

b1 -= v * np.dot(b1, v)
b1 /= np.linalg.norm(b1)
b2 = np.cross(v, b1)
return b1, b2, v


I can compute the orthogonal basis vectors as:



x, y, z = basis(z_avg)


Now, the next steps are what has me confused. The text goes on to say:




We then compute the Rotation Matrix for these three unit vectors,
which forms our (averaged) final Rotation Matrix for the calibration
estimate




I am really not sure what is meant by "computing the rotation matrix for these three unit vectors". I am also failing to see how this process is somehow "averaging" these rotation matrices. Any insight you can give me would be really appreciated!










share|improve this question



























    0














    I am currently reading the paper on automatic calibration of traffic cameras (https://www.microsoft.com/en-us/research/wp-content/uploads/2017/09/AutoCalib.pdf). At some point, the authors compute multiple calibrations and compute an average of the rotation part of these matrices.



    So, the text describes the process as follows:




    Finally, we compute the “average” of the remaining calibrations. We
    average the Z axis unit vector across all filtered calibrations and
    compute two mutually orthogonal X and Y axis unit vectors.




    So, let us assume I have two rotation matrices that I want to average. So something like:



    r1 = [[-0.64375223,  0.63471324,  0.42746014],
    [-0.52107859, -0.77267423, 0.3625626 ],
    [ 0.56041072, 0.01066016, 0.82814624]]

    r2 = [[-0.31267459, -0.0464914 , 0.94872185],
    [-0.88839581, -0.33914166, -0.30941205],
    [ 0.3361361 , -0.93958581, 0.06473821]]


    So, first I compute the z-axes vector average as:



    import numpy as np

    c = [r1, r2]
    z_avg = np.mean(c, axis=0)[:, 2]


    This creates the average z-axes as:



    array([0.688091  , 0.02657528, 0.44644223])


    Then I wrote the function to compute the basis vectors as:



    def basis(v):
    v = v / np.linalg.norm(v)
    if v[0] > 0.9:
    b1 = np.asarray([0.0, 1.0, 0.0])
    else:
    b1 = np.asarray([1.0, 0.0, 0.0])

    b1 -= v * np.dot(b1, v)
    b1 /= np.linalg.norm(b1)
    b2 = np.cross(v, b1)
    return b1, b2, v


    I can compute the orthogonal basis vectors as:



    x, y, z = basis(z_avg)


    Now, the next steps are what has me confused. The text goes on to say:




    We then compute the Rotation Matrix for these three unit vectors,
    which forms our (averaged) final Rotation Matrix for the calibration
    estimate




    I am really not sure what is meant by "computing the rotation matrix for these three unit vectors". I am also failing to see how this process is somehow "averaging" these rotation matrices. Any insight you can give me would be really appreciated!










    share|improve this question

























      0












      0








      0







      I am currently reading the paper on automatic calibration of traffic cameras (https://www.microsoft.com/en-us/research/wp-content/uploads/2017/09/AutoCalib.pdf). At some point, the authors compute multiple calibrations and compute an average of the rotation part of these matrices.



      So, the text describes the process as follows:




      Finally, we compute the “average” of the remaining calibrations. We
      average the Z axis unit vector across all filtered calibrations and
      compute two mutually orthogonal X and Y axis unit vectors.




      So, let us assume I have two rotation matrices that I want to average. So something like:



      r1 = [[-0.64375223,  0.63471324,  0.42746014],
      [-0.52107859, -0.77267423, 0.3625626 ],
      [ 0.56041072, 0.01066016, 0.82814624]]

      r2 = [[-0.31267459, -0.0464914 , 0.94872185],
      [-0.88839581, -0.33914166, -0.30941205],
      [ 0.3361361 , -0.93958581, 0.06473821]]


      So, first I compute the z-axes vector average as:



      import numpy as np

      c = [r1, r2]
      z_avg = np.mean(c, axis=0)[:, 2]


      This creates the average z-axes as:



      array([0.688091  , 0.02657528, 0.44644223])


      Then I wrote the function to compute the basis vectors as:



      def basis(v):
      v = v / np.linalg.norm(v)
      if v[0] > 0.9:
      b1 = np.asarray([0.0, 1.0, 0.0])
      else:
      b1 = np.asarray([1.0, 0.0, 0.0])

      b1 -= v * np.dot(b1, v)
      b1 /= np.linalg.norm(b1)
      b2 = np.cross(v, b1)
      return b1, b2, v


      I can compute the orthogonal basis vectors as:



      x, y, z = basis(z_avg)


      Now, the next steps are what has me confused. The text goes on to say:




      We then compute the Rotation Matrix for these three unit vectors,
      which forms our (averaged) final Rotation Matrix for the calibration
      estimate




      I am really not sure what is meant by "computing the rotation matrix for these three unit vectors". I am also failing to see how this process is somehow "averaging" these rotation matrices. Any insight you can give me would be really appreciated!










      share|improve this question













      I am currently reading the paper on automatic calibration of traffic cameras (https://www.microsoft.com/en-us/research/wp-content/uploads/2017/09/AutoCalib.pdf). At some point, the authors compute multiple calibrations and compute an average of the rotation part of these matrices.



      So, the text describes the process as follows:




      Finally, we compute the “average” of the remaining calibrations. We
      average the Z axis unit vector across all filtered calibrations and
      compute two mutually orthogonal X and Y axis unit vectors.




      So, let us assume I have two rotation matrices that I want to average. So something like:



      r1 = [[-0.64375223,  0.63471324,  0.42746014],
      [-0.52107859, -0.77267423, 0.3625626 ],
      [ 0.56041072, 0.01066016, 0.82814624]]

      r2 = [[-0.31267459, -0.0464914 , 0.94872185],
      [-0.88839581, -0.33914166, -0.30941205],
      [ 0.3361361 , -0.93958581, 0.06473821]]


      So, first I compute the z-axes vector average as:



      import numpy as np

      c = [r1, r2]
      z_avg = np.mean(c, axis=0)[:, 2]


      This creates the average z-axes as:



      array([0.688091  , 0.02657528, 0.44644223])


      Then I wrote the function to compute the basis vectors as:



      def basis(v):
      v = v / np.linalg.norm(v)
      if v[0] > 0.9:
      b1 = np.asarray([0.0, 1.0, 0.0])
      else:
      b1 = np.asarray([1.0, 0.0, 0.0])

      b1 -= v * np.dot(b1, v)
      b1 /= np.linalg.norm(b1)
      b2 = np.cross(v, b1)
      return b1, b2, v


      I can compute the orthogonal basis vectors as:



      x, y, z = basis(z_avg)


      Now, the next steps are what has me confused. The text goes on to say:




      We then compute the Rotation Matrix for these three unit vectors,
      which forms our (averaged) final Rotation Matrix for the calibration
      estimate




      I am really not sure what is meant by "computing the rotation matrix for these three unit vectors". I am also failing to see how this process is somehow "averaging" these rotation matrices. Any insight you can give me would be really appreciated!







      image-processing computer-vision coordinates transform coordinate-transformation






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 23 '18 at 22:46









      LucaLuca

      3,22352779




      3,22352779
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53453623%2fconfusion-over-averaging-rotation-matrices-as-described%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53453623%2fconfusion-over-averaging-rotation-matrices-as-described%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

          Calculate evaluation metrics using cross_val_predict sklearn

          Insert data from modal to MySQL (multiple modal on website)