Partial sampling#
The Dead Leaves Model allows controlling how many leaves are sampled and where they appear.
Sparse sampling#
Specifying the argument n_sample in the LeafGeometryGenerator limits the number of leaves to sample.
If the sampling stops before the entire image is filled, the resulting segmentation will contain empty pixels.
Example
Masking#
Passing a position_mask to the LeafGeometryGenerator will exclude masked positions from the sampling process.
Any pixel where sampling is prohibited may remain empty in the segmentation.
The position mask may be passed as a boolean numpy array or torch tensor.
Alternatively, a dictionary can be passed which contains a shape key to select a leaf mask shape and a params key specifying the parameters for the respective shape of leaf mask.
Example
Background color#
Empty pixels resulting from sparse sampling or masked positions are filled with a RGB background color.
The background color can be specified explicitly via the ImageRenderer argument background_color, if not specified the background will be black.
Example