use strict; use warnings; use feature 'say'; use PDL; use PDL::Image2D; use PDL::IO::Image; # sample: http://image.ibb.co/i6Qj76/test171217.png my $fn = 'test171217.png'; my $pdl = PDL::IO::Image-> new_from_file( $fn )-> pixels_to_pdl-> short; say $pdl-> info; my $segmented = cc8compt( $pdl ); say $segmented-> info; say $segmented-> max; #### D:\>perl 171217.pl PDL: Short D [1200,3950] PDL: Short D [1200,3950] 32756 D:\>perl 171217.pl PDL: Short D [1200,3950] PDL: Short D [1200,3950] 32764 D:\>perl 171217.pl PDL: Short D [1200,3950] PDL: Short D [1200,3950] 32736 D:\>perl 171217.pl PDL: Short D [1200,3950] PDL: Short D [1200,3950] 32756 D:\>perl 171217.pl PDL: Short D [1200,3950] PDL: Short D [1200,3950] 32760