# Forum

### Author Topic: Ruler tool on 2D photo  (Read 435 times)

#### kaaiinn

• Newbie
• Posts: 11
##### Ruler tool on 2D photo
« on: April 21, 2021, 06:12:14 PM »
Hello!

We have aligned 360 degree panoramas together (many panoramas taken very close to each other) and the results are really good. We have given the model real world coordinates from known locations around the scene (accurate XYZ points known from pre-existing model).

Recently found that you can use the 'ruler' function to check measurements whilst viewing the panoramic photograph, rather than the point cloud - this is sometimes easier to see what you are clicking on.

My question is - how does Metashape know the XYZ location of the points you are clicking? (I see the XYZ is shown when clicking the first ruler point) Is it just using the tie points behind the image - if so, would the ruler function work better (more accurate) once a dense point cloud has been created, rather than the initial alignment?

Thanks.

#### Paulo

• Hero Member
• Posts: 638
##### Re: Ruler tool on 2D photo
« Reply #1 on: April 21, 2021, 10:55:21 PM »
ni kaiin,

I guess the ruler function on photo works thi way:

- for each ruler click or point (2D) on photo, the program  projects this point onto the model (using pickPoint function in API) and gets its 3d coordinates in real world or local coordinates;
- the distance is calculated   from these 2 3d point coordinates.

Now, if there is no model, then it uses dense cloud. If no dense cloud then it uses the sparse cloud. Obviously Model or dense cloud would give more precise results than sparse cloud.
« Last Edit: April 21, 2021, 11:56:07 PM by Paulo »
Best Regards,

Paul Pelletier

#### kaaiinn

• Newbie
• Posts: 11
##### Re: Ruler tool on 2D photo
« Reply #2 on: April 22, 2021, 12:07:55 AM »
Thank you very much for replying!

Just so I understand what you are saying -

When viewing the image and using the ruler function the program projects this point onto the sparse point cloud? (I have not yet made the dense point cloud) I am pretty amazed at the apparent accuracy of this as I have the ability to measure small objects - when I am pretty sure there would not be many tie points around it.

Apologies, I am not familiar with the pickPoint function API

#### Paulo

• Hero Member
• Posts: 638
##### Re: Ruler tool on 2D photo
« Reply #3 on: April 22, 2021, 02:01:10 AM »
Yes Kaaiinn,

that is correct though difference between the 2 measurements (using sparse cloud or dense cloud) seems to be small....

In example, i have 2 markers (1 and 2) on a photo (Drohne01634) and I print out their image coordinates, world coordinates and distance between the 2 using first point_cloud (sparse cloud) as surface and then dense_cloud. Difference is at cm or mm level....

For 2 markers set further apart on same photo, the difference in distance between using sparse or dense cloud is still small (2cm). See 2nd attachment...

Another example where distance calculated using 3dModel as surface vs point cloud shows much more discrepancy around 55 cm...3rd attachmant

Last example shows 2 measured distances  using projection of points on 2 surfaces :

- point-cloud represented by red line;
- 3D model represented by brown line.

It is clear that 3D Model distance is much more precicse as projection on a  closed model  really represents the position of 2 points on surface while projecting onto the sparse cloud will only pick the closest tie point to actual projection as seen in right window where red line vertex near point 5 (roof corner) can only pick a tpt a liile inside the roof, thus leading to less accuracy using point_cloud as surface....
« Last Edit: April 25, 2021, 12:35:01 AM by Paulo »
Best Regards,

Paul Pelletier