Calc Color Image for Highest Layer
Function
This Procedure detects the area of the highest layer in the scene based on the depth map and then outputs the 2D image and the mask of the highest-layer area. The Steps in the Procedure are shown below.
Usage Scenario
This Procedure can extract the color image segment of the highest layer for deep learning recognition.
Processing Workflow and Parameter Tuning
The workflow of this Procedure is shown below:
Get Mask for Highest Layer
-
To filter out unwanted point clouds, an ROI should be selected in the original depth map, thus the processing efficiency in the subsequent Steps can be improved.
Double-click to enter this Procedure. Click the Set 3D ROI button in the Step Parameters panel of Invalidate Depth Pixels Outside 3D ROI and select 3D ROI in the pop-up Set ROI window.
The following show the point clouds before and after 3D ROI selection. The image on the left is the original depth map, containing many irrelevant point clouds; the image on the right is the depth map after 3D ROI selection, which no longer contains point clouds of regions outside the selected ROI.
-
Segment Depth Map segments the depth map within the ROI based on each pixel’s depth and generates the corresponding mask(s).
In the Step Parameters Panel of Segment Depth Map, click the Set 2D ROI button and select 2D ROI in the pop-up Set ROI window.
Then, set Max Height Diff between Neighbouring Pixels to determine whether the neighboring pixels belong to the same segment; set Min Segment Area to determine the valid segment.
As shown below, the image on the left is the depth map before segmentation, and that on the right is the depth image after segmentation.
-
Get Highest Layer Regions in Depth Map obtains the highest area(s) in a depth map based on the masks and masks’ depth information output from Segment Depth Map and generates the mask areas of the valid region closest to the camera under proper Layer Height. There could be one or multiple areas that satisfy this condition.
Morphological Transformations
-
Merge Mask Images merges the masks input from Get Highest Layer Regions in Depth Map if the input contains more than one mask to facilitate the further morphological transformation. The following image shows the mask of the highest layer after merging.
-
Morphological Transformations dilates the mask(s) to facilitate recognition or picking later (DilateOperator is selected).
Get Color image Segment under the Mask
-
Apply Masks to Image obtains the color image segment(s) under the transformed mask(s), as shown below.
-
Unpack Data obtains the color image of the first index in the list of image segments under masks.