Measure
The Measure module is capable of measuring dimensions of objects based on the distance between two points, when the measuring lines that were drawn by the end-user, crosses the outline of an object, as described on video below.
For adding a line, simply place each point beyond the borders of an object you are going to measure and the line automatically detects the outline of the object.
Multiple lines can be added and the object has to be between the points of each line.
For optimal outline detection, set ‘Threshold’ value so the object borders are clearly visible.
Turn off the ‘Original image’ so you can see how the image looks after applying ‘Canny’
Canny Settings
Canny settings can be modified by using the slider or typing a desired value, this configuration is related to the canny edge detector. It should be adjusted when the the line is measuring other edges around the object, or the object edge isn’t whole, causing measuring inconsistencies.
You can find more about it in Preprocess article - Canny Edge Detector.
Original Image
When Original image is enabled, the original image is then displayed. When is disabled, the image is displayed with canny edge filter enabled (edges/outline of the image highlighted).
Evaluation
When the end-user clicks on ‘Evaluation’ button, a threshold can be set for line length, alongside with comparison rules, then click ‘Enable'. Lastly, click on 'Save and Close’.
Measurement is done in pixels, but if you e.g. put ruler into an image where the object would be, you can compute the pixel to mm ratio and then use it in Code module to evaluate the length of the lines. The lines are saved in Context in this format:
"lines": [
{
"id": 1651502661344,
"label": "Line1",
"start": {
"x": 165,
"y": 479
},
"end": {
"x": 158,
"y": 4
},
"angle": 1.5560605513728232,
"length": 475
},
{
"id": 1651502665897,
"label": "Line2",
"start": {
"x": 436,
"y": 479
},
"end": {
"x": 436,
"y": 4
},
"angle": 1.5707963267948966,
"length": 475
}
]