Hello, I think there is an errore in the frame selection inside PIL_decode_parts(). for frame in ImageSequence.Iterator(image): # Assume the pixel with the largest value is the # background. bg = max(frame.histogram()) if bg < bgpix: image = frame bgpix = bg outside this loop image (in my opinion) will be always the last frame of original image. A part from this the algorithm could be better. From my test using stddev and sum2 yield better result.
From a (very) raw test you may use the attached code snippet. Of course all of these are very simple test and can be wrong bug you test failed for a pattern common few days ago (see the attached image)
-- Luigi Pugnetti Symbolic S.p.A. V.le Mentana, 29 I-43100 Parma Italy Tel: +39 0521 708811 Fax: +39 0521 776190
Luigi> I think there is an errore in the frame selection inside Luigi> PIL_decode_parts(). Luigi> for frame in ImageSequence.Iterator(image): Luigi> # Assume the pixel with the largest value is the Luigi> # background. Luigi> bg = max(frame.histogram()) Luigi> if bg < bgpix: Luigi> image = frame Luigi> bgpix = bg Luigi, I can't tell what you're doing in this change. Can you describe it? Also, in the future, please submit patches and bug reports to the SourceForge tracker (as context or unified diffs, not as complete replacements). Luigi> A part from this the algorithm could be better. From my test Luigi> using stddev and sum2 yield better result. No doubt my algorithm could be better. I'm afraid I just don't know what yours does and the ImageStat.Stat documentation isn't much help. ;-) Skip
participants (2)
-
Luigi Pugnetti -
skip@pobox.com