|
Algorithm 1 Object Measurement |
| : The lowest position of the picker from the lens in z-axis |
| : The maximum depth of objects |
| , : The rows and columns in the 2D pixel coordinate system |
| : The depth value at
|
| : The minimum area of object cross section |
| C: The contour of the object |
| : The width, height, depth and orientation of the object |
| : The width and height of the depth frame |
| : The picked position in -axes on the object |
| |
| (1) Acquire sensor data. |
| Capture a depth frame from D435 |
| if the depth frame is not successfully captured then
|
| return the error code of ’’ |
| end if
|
| Calculate point clouds from the depth frame |
| |
| (2) Extract object area. |
| Separate the pixels where
|
| Find the contours of the separated pixels whose area is larger than
|
| if no contour is found then
|
| return the error code of ’’ |
| end if
|
| Select the largest contour as C
|
| if
C is out of the depth frame bound then
|
| return the error code of ’’ |
| end if
|
| |
| (3) Calculate d, w, h and . |
| Accumulate the point clouds in C
|
| = average of the z-axis values of the point clouds |
| d =
|
| Find a rotated rectangle of the minimum area enclosing C
|
| Calculate the scaling factor S from the point clouds |
| w = width pixels of the rectangle
|
| h = height pixels of the rectangle
|
| = rotation of the rectangle |
| |
| (4) Calculate and . |
| = average of the four corner positions of the rectangle in pixels |
| = ( − , − ) |
|
|
| |
| (5) Return w, h, d, , and
|