Mesh Mask

The algorithm create a set of mask images. Firstly, by generating depth maps by projecting a Mesh using poses loaded from disk, then it runs Edge detection on these depth maps.

Input

  • Single Mesh.

  • Path to a folder that contains poses as .txt files. Each pose file must have “pose” in its name, and it should contain info about the camera extrinsic and intrinsic parameters.

Output

  • a SharedImageSet that contains depth maps equal to the number of poses provided. Pixels in these images have the value of 0 for all pixels, except the ones with high depth variation compared to its neighbors(edges).

Description

Firstly, The algorithm simulates a depth sensor, by projecting the provided mesh which create depth maps. To achieve this, It searches in the provided folder for all files that contains “pose” in its name. These “pose” file must contain 25 lines, each with a single float number: the first 16 lines store the values of the extrinsic matrix of the pose (row-major order), the next 9 lines store the values of the intrinsic parameters of the camera (also row-major order).

Once the depth maps are generated, it builds the mask: initially all pixels are set to 0, then pixel with high depth variation compared to it neighbors are set to 255.

The algorithm parameters are as follows:

  • m_poseFilesPath: the path to the folder which contains the “pose” files.

  • m_width: the width of the output depth images.

  • m_height: the height of the output depth images.

  • m_erosionFilterSize: the mask building algorithm sometimes generates edges of a width greater than 1, an erosion algorithm is used to shrink all edges, this parameter controls the size of the erosion filter size.

  • m_depthThreshold: the threshold used when comparing the depth value of a pixel to its neighboring 8 pixels. If the difference is greater than this threshold, then it is considered as an edge pixel.

  • m_saveMasks: if set to true, the mask images are also saved in the same folder m_poseFilesPath.