MCPcopy Create free account
hub / github.com/CVCUDA/CV-CUDA / ExportOpLabel

Function ExportOpLabel

python/mod_cvcuda/operators/OpLabel.cpp:142–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140} // namespace
141
142void ExportOpLabel(py::module &m)
143{
144 using namespace pybind11::literals;
145
146 py::enum_<NVCVLabelMaskType>(m, "LabelMaskType", py::arithmetic())
147 .value("REMOVE_ISLANDS_OUTSIDE_MASK_ONLY", NVCV_REMOVE_ISLANDS_OUTSIDE_MASK_ONLY)
148 .export_values();
149
150 m.def("label", &Label, "src"_a, "connectivity"_a = NVCV_CONNECTIVITY_4_2D, "assign_labels"_a = NVCV_LABEL_FAST,
151 "mask_type"_a = NVCV_REMOVE_ISLANDS_OUTSIDE_MASK_ONLY, py::kw_only(), "count"_a = false, "stats"_a = false,
152 "max_labels"_a = 10000, "bg_label"_a = nullptr, "min_thresh"_a = nullptr, "max_thresh"_a = nullptr,
153 "min_size"_a = nullptr, "mask"_a = nullptr, "stream"_a = nullptr, R"pbdoc(
154
155 Executes the Label operation on the given cuda stream.
156
157 See also:
158 Refer to the CV-CUDA C API reference for the Label operator for more details and usage examples.
159
160 Args:
161 src (cvcuda.Tensor): Input tensor to label connected-component regions.
162 connectivity (cvcuda.ConnectivityType, optional): Choice to control connectivity of input elements,
163 default is cvcuda.CONNECTIVITY_4_2D.
164 assign_labels (cvcuda.LABEL, optional): Choice on how labels are assigned,
165 default is cvcuda.LABEL.FAST.
166 mask_type (cvcuda.LabelMaskType, optional): Choice on how the mask is used,
167 default is cvcuda.REMOVE_ISLANDS_OUTSIDE_MASK_ONLY.
168 count (bool, optional): Use True to return the count of valid labeled regions.
169 stats (bool, optional): Use True to return the statistics of valid labeled regions.
170 max_labels (Number, optional): Maximum number of labels to compute statistics for, default is 10000.
171 bg_label (cvcuda.Tensor, optional): Background tensor to define input values to be considered background
172 labels and thus ignored.
173 min_thresh (cvcuda.Tensor, optional): Minimum threshold tensor to mask input values below it to be 0, and others 1.
174 max_thresh (cvcuda.Tensor, optional): Maximum threshold tensor to mask input values above it to be 0, and others 1.
175 min_size (cvcuda.Tensor, optional): Minimum size tensor to remove islands, i.e. labeled regions with number of
176 elements less than the minimum size.
177 mask (cvcuda.Tensor, optional): Mask tensor, its behavior is controlled by \ref mask_type. One choice is to
178 control island removal in addition to \ref min_size, i.e. regions with at
179 least one element inside the mask (non-zero values) are not removed in case
180 mask_type is cvcuda.REMOVE_ISLANDS_OUTSIDE_MASK_ONLY.
181 stream (cvcuda.Stream, optional): CUDA Stream on which to perform the operation.
182
183 Returns:
184 Tuple[cvcuda.Tensor, cvcuda.Tensor, cvcuda.Tensor]: A tuple with output labels, count of regions and their statistics.
185 The count or stats tensors may be None if theirs arguments are False.
186
187 Caution:
188 Restrictions to several arguments may apply. Check the C API references of the CV-CUDA operator.
189 )pbdoc");
190
191 m.def("label_into", &LabelInto, "dst"_a, "count"_a = nullptr, "stats"_a = nullptr, "src"_a,
192 "connectivity"_a = NVCV_CONNECTIVITY_4_2D, "assign_labels"_a = NVCV_LABEL_FAST,
193 "mask_type"_a = NVCV_REMOVE_ISLANDS_OUTSIDE_MASK_ONLY, py::kw_only(), "bg_label"_a = nullptr,
194 "min_thresh"_a = nullptr, "max_thresh"_a = nullptr, "min_size"_a = nullptr, "mask"_a = nullptr,
195 "stream"_a = nullptr, R"pbdoc(
196
197 Executes the Label operation on the given cuda stream.
198
199 See also:

Callers 1

PYBIND11_MODULEFunction · 0.85

Calls 1

valueMethod · 0.45

Tested by

no test coverage detected