################################## ########### Ready to go ################################## use Time::HiRes 'time'; my $t = time; my ( undef, $w, $h ) = $image-> dims; my $fat_rgb = $image-> clump( 1, 2 ); my $perm_2_sort = $fat_rgb-> qsortveci; my $sorted = $fat_rgb-> dice_axis( 1, $perm_2_sort ); my $enumerated = $sorted-> enumvecg; my $selector = $enumerated-> uniqind; my $slim_rgb = $sorted-> dice_axis( 1, $selector ); $slim_rgb = t_lab-> apply(( !t_srgb )-> apply( $slim_rgb )); $palette = t_lab-> apply(( !t_srgb )-> apply( $palette )); my $slim_indexed = delta_e_2000( $palette, $slim_rgb-> dummy( 1, $plt_size ) )-> minimum_ind; my $indexed = $slim_indexed -> index( $enumerated ) # fatten -> index( $perm_2_sort-> qsorti ) # permute to original -> reshape( $w, $h ); # reshape :) print time - $t, "\n"; print @pixels[ @$_ ], "\n" for @{ $indexed-> unpdl };