deleting duplicates in an image list

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
gubach
Posts: 45
Joined: 2013-12-13T11:13:29-07:00
Authentication code: 6789

deleting duplicates in an image list

Post by gubach »

I have a list with downscaled black-and-white images ($mask_segment_list_dual) generated by an image processing pipeline and I want to delete duplicates in the list. In the command line tools I found

Code: Select all

compare -metric AE (or MAE) image1.png image2.png null: 2>&1
that delivers 0 if the two images are the same http://www.imagemagick.org/Usage/compare/#statistics. This is working fine when the images are on Harddisk. I have experimented in PerlMagick with lines like

Code: Select all

$mask_segment_list_dual->[0]->Compare(image=>$mask_segment_list_dual->[1],  metric=>'AE')
but I could not get it right. How can I compare for example the first two images in the list and got a comparison value in a Perl variable?
Or even better has someone an efficient general solution for deleting duplicates in an image list (preserving of positions in the list is not necessary)? Thanks!!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: deleting duplicates in an image list

Post by snibgo »

Perhaps perl has the equivalent of the command-line option "-layers remove-dups". See http://www.imagemagick.org/script/comma ... php#layers
snibgo's IM pages: im.snibgo.com
Post Reply