meshlabpymeshlab

Determing accurate direction and distance of models in meshlab


I am working on a project where I need to evaluate models in various viewing directions and distances (zoom in/out) using MeshLab. I would greatly appreciate any assistance on how to determine the distance and direction of the model accurately.

If there are any transformation matrices for direction and distance of the model, please let me know how to find them in meshlab.


Solution

  • There is two transformation matrix that affect each model

    I will assume that you are interested in the view matrix because you are refering to distances and zoom values, which is data related to the camera.

    The view matrix is changed every time we import a new mesh into our project, because meshlab move the camera to ensure every model in the project is visible in the screen. Of course, it is changed again when you click and drag the mouse in the render area.

    You can get the view matrix and every other configuration of the camera using the Menu Windows->Copy Camera Setting to Clipboard

    enter image description here

    The information of the camera will be written as a XML string to the clipboard. You can paste this screen into notepad or other text editor. The XML string has always this format

    <!DOCTYPE ViewState>
    <project>
     <VCGCamera PixelSizeMm="0.0369161 0.0369161" 
                BinaryData="0" 
                RotationMatrix="0.956861 -0.289892 -0.0194649 0 
                                0.0539982 0.111607  0.992284 0 
                               -0.285483 -0.950529  0.122446 0 
                                0 0 0 1 " 
                CameraType="1"
                CenterPx="408 345"
                TranslationVector="105.628 356.217 -59.6948 1"
                FocalMm="292.12616"
                ViewportPx="816 691"
                LensDistortion="0 0"/>
     <ViewSettings NearPlane="0.80000001" FarPlane="11.905772" TrackScale="0.10642788"/>
    </project>
    

    The information you are interested at can be extracted from this string. For example: