Label
- cvcuda.label(src: nvcv.Tensor, connectivity: cvcuda.ConnectivityType = <ConnectivityType.CONNECTIVITY_4_2D: 0>, assign_labels: cvcuda.LABEL = <LABEL.FAST: 0>, mask_type: cvcuda.LabelMaskType = <LabelMaskType.REMOVE_ISLANDS_OUTSIDE_MASK_ONLY: 0>, *, count: bool = False, stats: bool = False, max_labels: int = 10000, bg_label: Optional[nvcv.Tensor] = None, min_thresh: Optional[nvcv.Tensor] = None, max_thresh: Optional[nvcv.Tensor] = None, min_size: Optional[nvcv.Tensor] = None, mask: Optional[nvcv.Tensor] = None, stream: Optional[nvcv.cuda.Stream] = None) tuple[nvcv.Tensor, nvcv.Tensor | None, nvcv.Tensor | None]
Executes the Label operation on the given cuda stream.
See also
Refer to the CV-CUDA C API reference for the Label operator for more details and usage examples.
- Parameters:
src (nvcv.Tensor) – Input tensor to label connected-component regions.
connectivity (cvcuda.ConnectivityType, optional) – Choice to control connectivity of input elements, default is cvcuda.CONNECTIVITY_4_2D.
assign_labels (cvcuda.LABEL, optional) – Choice on how labels are assigned, default is cvcuda.LABEL.FAST.
mask_type (cvcuda.LabelMaskType, optional) – Choice on how the mask is used, default is cvcuda.REMOVE_ISLANDS_OUTSIDE_MASK_ONLY.
count (bool, optional) – Use True to return the count of valid labeled regions.
stats (bool, optional) – Use True to return the statistics of valid labeled regions.
max_labels (Number, optional) – Maximum number of labels to compute statistics for, default is 10000.
bg_label (nvcv.Tensor, optional) – Background tensor to define input values to be considered background labels and thus ignored.
min_thresh (nvcv.Tensor, optional) – Minimum threshold tensor to mask input values below it to be 0, and others 1.
max_thresh (nvcv.Tensor, optional) – Maximum threshold tensor to mask input values above it to be 0, and others 1.
min_size (nvcv.Tensor, optional) – Minimum size tensor to remove islands, i.e. labeled regions with number of elements less than the minimum size.
mask (nvcv.Tensor, optional) – Mask tensor, its behavior is controlled by ref mask_type. One choice is to control island removal in addition to ref min_size, i.e. regions with at least one element inside the mask (non-zero values) are not removed in case mask_type is cvcuda.REMOVE_ISLANDS_OUTSIDE_MASK_ONLY.
stream (nvcv.cuda.Stream, optional) – CUDA Stream on which to perform the operation.
- Returns:
- A tuple with output labels, count of regions and their statistics.
The count or stats tensors may be None if theirs arguments are False.
- Return type:
Tuple[nvcv.Tensor, nvcv.Tensor, nvcv.Tensor]
Caution
Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.
- cvcuda.label_into(dst: nvcv.Tensor, count: Optional[nvcv.Tensor] = None, stats: Optional[nvcv.Tensor] = None, src: nvcv.Tensor, connectivity: cvcuda.ConnectivityType = <ConnectivityType.CONNECTIVITY_4_2D: 0>, assign_labels: cvcuda.LABEL = <LABEL.FAST: 0>, mask_type: cvcuda.LabelMaskType = <LabelMaskType.REMOVE_ISLANDS_OUTSIDE_MASK_ONLY: 0>, *, bg_label: Optional[nvcv.Tensor] = None, min_thresh: Optional[nvcv.Tensor] = None, max_thresh: Optional[nvcv.Tensor] = None, min_size: Optional[nvcv.Tensor] = None, mask: Optional[nvcv.Tensor] = None, stream: Optional[nvcv.cuda.Stream] = None) tuple[nvcv.Tensor, nvcv.Tensor | None, nvcv.Tensor | None]
Executes the Label operation on the given cuda stream.
See also
Refer to the CV-CUDA C API reference for the Label operator for more details and usage examples.
- Parameters:
dst (nvcv.Tensor) – Output tensor with labels.
count (nvcv.Tensor, optional) – Output tensor with count number of labeled regions.
stats (nvcv.Tensor, optional) – Output tensor with statistics for each labeled region.
src (nvcv.Tensor) – Input tensor to label connected-component regions.
connectivity (cvcuda.ConnectivityType, optional) – Choice to control connectivity of input elements, default is cvcuda.CONNECTIVITY_4_2D.
assign_labels (cvcuda.LABEL, optional) – Choice on how labels are assigned, default is cvcuda.LABEL.FAST.
mask_type (cvcuda.LabelMaskType, optional) – Choice on how the mask is used, default is cvcuda.REMOVE_ISLANDS_OUTSIDE_MASK_ONLY.
bg_label (nvcv.Tensor, optional) – Background tensor to define input values to be considered background labels and thus ignored.
min_thresh (nvcv.Tensor, optional) – Minimum threshold tensor to mask input values below it to be 0, and others 1.
max_thresh (nvcv.Tensor, optional) – Maximum threshold tensor to mask input values above it to be 0, and others 1.
min_size (nvcv.Tensor, optional) – Minimum size tensor to remove islands, i.e. labeled regions with number of elements less than the minimum size.
mask (nvcv.Tensor, optional) – Mask tensor, its behavior is controlled by ref mask_type. One choice is to control island removal in addition to ref min_size, i.e. regions with at least one element inside the mask (non-zero values) are not removed in case mask_type is cvcuda.REMOVE_ISLANDS_OUTSIDE_MASK_ONLY.
stream (nvcv.cuda.Stream, optional) – CUDA Stream on which to perform the operation.
- Returns:
- A tuple with output labels, count of regions and their statistics.
The count or stats tensors may be None if theirs arguments are None.
- Return type:
Tuple[nvcv.Tensor, nvcv.Tensor, nvcv.Tensor]
Caution
Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.