# Color image or mask image distance measurement

In VISION version 1.7.1, how can the length of an object in a color image or mask image be measured? For example, if there is a mask image as shown below, how to measure its length and width?

First, you need to find the pixel coordinates of these two vertices, and then obtain the physical distance through Step “Convert Lengths Pixel-Wise to Physical”.

The specific steps are as follows:

• Data collection: First, you need to capture an image of the dot calibration board. Then, at the same position, capture an image of the object. It’s important to keep the object and the calibration board on the same plane.
• Detect line segments: Detect the line segments on the edge of the object image (the endpoints are those two corners). You can use Step “Detect Line Segments” to get the pixel-wise coordinates of the line segment endpoints.
• Convert pixel-wise distance to actual distance: Input the line segment endpoint coordinates and the captured calibration board image into Step “Convert Lengths Pixel-Wise to Physical”, and set relevant parameters to get the physical distance.

This process should allow you to measure the length of an object in a color image or mask image in Mech-Vision version 1.7.1.

By converting the scale, we can only get the actual distance of the object at a certain height. The conversion scale for the actual distance at different heights is actually variable. How can we get the actual distance between points at different heights by only inputting a color image or depth map?

Step “Convert Lengths Pixel-Wise to Physical” needs to be used under the condition that the relative position of the target and the camera is fixed and the target is perpendicular. If it is at different heights, you need to re-determine the pixel size each time or capture images of the calibration board to get the actual distance.

So how do you measure distance through a depth map?

In Mech-Vision, you can use depth maps to:

1. Measure the height difference between two points;
2. Measure the height difference from a point to a baseline;
3. Measure the height difference from a point to a plane; These three functions have corresponding steps and can meet most measurement needs by selecting the corresponding reference points and measurement points on the depth map in ‘Measurement Mode’.

As for measuring the three-dimensional distance between points, due to the fluctuation of point clouds, which causes unstable point selection and unstable measurement results, there is currently no demand in this regard.