sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Importing Camera CAHV format - up and direction vectors?

    Scheduled Pinned Locked Moved Developers' Forum
    2 Posts 2 Posters 429 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Chris FullmerC Offline
      Chris Fullmer
      last edited by

      I've written a quick importer for a fun little project that imports camera location data for a bunch of image frames. But I can't determine what in this data is what I would use for the up and direction vector for making a new camera. It supplies quite a few vectors, and I'm not sure which are the ones I want. To make matters worse, there is other 3d data that comes in with th file, and it is all mirrored what it should be, and the y and z for 3d points had to be swapped.

      So between not entirely trusting the directions of the provided vectors, I can't even determine which ones would be for the sketchup z-vector and the vector for the direction the camera is facing.

      I've got some better ideas for how to test it later, but I was hopinh maybe someone here was familiar with these camera terms.

      This is the instructions that come with the camera data:

      # Description of the CAHV camera model;
      # -------------
      # (Cx, Cy, Cz)    ; CameraPosition [mm]
      # (Ax, Ay, Az)    ; RotationAxis2  [unit vector]
      # (Hx, Hy, Hz)    ; RotationAxis0 [pel] (including FocalLength, PixelSizeX, and Principal Point offset) 
      # (Vx, Vy, Vz)    ; RotationAxis1 [pel] (including FocalLength, PixelSizeY, and Principal Point offset) 
      # (K3, K5)        ; Radialdistortion;	K3 [1/(mm)^2]	K5 [1/(mm)^4]
      # (sx, sy)        ; PixelSize	[mm/pel]
      # (Width, Height) ; ImageSize	[pel]
      # -------------
      # (ppx, ppy)      ; Principal Point offset [pel]
      # f               ; Focal Length [mm]
      # fov             ; Horizontal Field of View [degree] = (2*atan(0.5*Width*sx/f)*180/PI;
      # (H0x, H0y, H0z) ; RotationAxis0 [unit vector]
      # (V0x, V0y, V0z) ; RotationAxis1 [unit vector]
      # -------------
      # (x, y)          ; image coordinates [pel]
      # (X, Y, Z)       ; 3D coordinates [mm]
      # -------------
      # Projection of 3D coordinates in the camera image;
      #  [ x' ] =  [ Hx Hy Hz ] [ 1 0 0 -Cx] [ X ]
      #  [ y' ] =  [ Vx Vy Vz ] [ 0 1 0 -Cy] [ Y ]
      #  [ z' ] =  [ Ax Ay Az ] [ 0 0 1 -Cz] [ Z ]
      #                                      [ 1 ]
      # or 
      #  [ x' ] =  [f/sx 0    ppx] [ H0x H0y H0z ] [ 1 0 0 -Cx] [ X ]
      #  [ y' ] =  [0    f/sy ppy] [ V0x V0y V0z ] [ 0 1 0 -Cy] [ Y ]
      #  [ z' ] =  [0    0    1  ] [ Ax  Ay  Az  ] [ 0 0 1 -Cz] [ Z ]
      #                                                         [ 1 ]
      # then x = x'/z' and y = y'/z' , if the origin of the image coordinates is in the center of the image
      # or x = x'/z' + 0.5*(Width-1) and y = y'/z' + 0.5*(Height-1) , if the origin of the image coordinates is in the upper left corner
      

      A big thanks to anyone who takes a stab at this or thinks they have an answer for which od the provided vectors correlate to what I need. Thanks!

      Chris

      Lately you've been tan, suspicious for the winter.
      All my Plugins I've written

      1 Reply Last reply Reply Quote 0
      • J Offline
        Jim
        last edited by

        Chris,

        Have a look at the film and stage plugin - if I remember, there is some code in it which might be useful.

        Hi

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Buy SketchPlus
        Buy SUbD
        Buy WrapR
        Buy eBook
        Buy Modelur
        Buy Vertex Tools
        Buy SketchCuisine
        Buy FormFonts

        Advertisement