pub trait ConnectedComponents<B: Backend> {
// Required methods
fn connected_components(
self,
connectivity: Connectivity,
) -> Tensor<B, 2, Int>;
fn connected_components_with_stats(
self,
connectivity: Connectivity,
options: ConnectedStatsOptions,
) -> (Tensor<B, 2, Int>, ConnectedStats<B>);
}Expand description
Connected components tensor extensions
Required Methods§
Sourcefn connected_components(self, connectivity: Connectivity) -> Tensor<B, 2, Int>
fn connected_components(self, connectivity: Connectivity) -> Tensor<B, 2, Int>
Computes the connected components labeled image of boolean image with 4 or 8 way connectivity - returns a tensor of the component label of each pixel.
img- The boolean image tensor in the format [batches, height, width]
Sourcefn connected_components_with_stats(
self,
connectivity: Connectivity,
options: ConnectedStatsOptions,
) -> (Tensor<B, 2, Int>, ConnectedStats<B>)
fn connected_components_with_stats( self, connectivity: Connectivity, options: ConnectedStatsOptions, ) -> (Tensor<B, 2, Int>, ConnectedStats<B>)
Computes the connected components labeled image of boolean image with 4 or 8 way connectivity and collects statistics on each component - returns a tensor of the component label of each pixel, along with stats collected for each component.
img- The boolean image tensor in the format [batches, height, width]