[opensuse-programming] comparing two jpegs
For running motion detect on a network camera that is delivering individual JPEGs, I'm thinking of comparing/subtracting two jpegs - with imagemagick, "composite img1 img2 -compose difference difference.jpeg" works quite well. To do it programmatically however, I seem to have a number of options - libgd imagemagickcore libjpeg libgd has a nice an easy interface, but is a little primitive for this. The imagecompare function isn't sufficiently flexible, and occasionally even abends. imagemagickcore seems to be a big gun, but looks okay. I can't find a way to read in an image already in memory though, only from file. I don't now libjpeg at all, but that's where I'm going next. Any other I might want to consider? -- Per Jessen, Zürich (18.8°C) http://www.hostsuisse.com/ - virtual servers, made in Switzerland. -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-programming+owner@opensuse.org
On Wed, 2014-07-02 at 16:58 +0200, Per Jessen wrote:
For running motion detect on a network camera that is delivering individual JPEGs, I'm thinking of comparing/subtracting two jpegs - with imagemagick, "composite img1 img2 -compose difference difference.jpeg" works quite well. To do it programmatically however, I seem to have a number of options - libgd imagemagickcore libjpeg libgd has a nice an easy interface, but is a little primitive for this. The imagecompare function isn't sufficiently flexible, and occasionally even abends. imagemagickcore seems to be a big gun, but looks okay. I can't find a way to read in an image already in memory though, only from file. I don't now libjpeg at all, but that's where I'm going next. Any other I might want to consider?
I'd look into OpenCV for this task. <http://derek.simkowiak.net/motion-tracking-with-python/> -- Adam Tauno Williams <mailto:awilliam@whitemice.org> GPG D95ED383 Systems Administrator, Python Developer, LPI / NCLA -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-programming+owner@opensuse.org
Adam Tauno Williams wrote:
On Wed, 2014-07-02 at 16:58 +0200, Per Jessen wrote:
For running motion detect on a network camera that is delivering individual JPEGs, I'm thinking of comparing/subtracting two jpegs - with imagemagick, "composite img1 img2 -compose difference difference.jpeg" works quite well. To do it programmatically however, I seem to have a number of options - libgd imagemagickcore libjpeg libgd has a nice an easy interface, but is a little primitive for this. The imagecompare function isn't sufficiently flexible, and occasionally even abends. imagemagickcore seems to be a big gun, but looks okay. I can't find a way to read in an image already in memory though, only from file. I don't now libjpeg at all, but that's where I'm going next. Any other I might want to consider?
I'd look into OpenCV for this task. <http://derek.simkowiak.net/motion-tracking-with-python/>
Thanks Adam, that looks promising. -- Per Jessen, Zürich (18.8°C) http://www.hostsuisse.com/ - dedicated server rental in Switzerland. -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-programming+owner@opensuse.org
Per Jessen wrote:
Adam Tauno Williams wrote:
On Wed, 2014-07-02 at 16:58 +0200, Per Jessen wrote:
For running motion detect on a network camera that is delivering individual JPEGs, I'm thinking of comparing/subtracting two jpegs - with imagemagick, "composite img1 img2 -compose difference difference.jpeg" works quite well. To do it programmatically however, I seem to have a number of options - libgd imagemagickcore libjpeg libgd has a nice an easy interface, but is a little primitive for this. The imagecompare function isn't sufficiently flexible, and occasionally even abends. imagemagickcore seems to be a big gun, but looks okay. I can't find a way to read in an image already in memory though, only from file. I don't now libjpeg at all, but that's where I'm going next. Any other I might want to consider?
I'd look into OpenCV for this task. <http://derek.simkowiak.net/motion-tracking-with-python/>
Thanks Adam, that looks promising.
Just a quick follow-up - for the time being, I'm using libjpeg. The interface is fairly easy and I do the comparison myself. -- Per Jessen, Zürich (14.4°C) http://www.dns24.ch/ - your free DNS host, made in Switzerland. -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-programming+owner@opensuse.org
On Tuesday, July 08, 2014 01:50:56 PM Per Jessen wrote:
Per Jessen wrote:
Just a quick follow-up - for the time being, I'm using libjpeg. The interface is fairly easy and I do the comparison myself.
A note: compare images can mean different things. One interpretation is a new image represented with simple diff: abs(X - Y), or a binarization of this image. Other interpretation is a scalar between some range that measure how different or similar are the images, but do not show where is this difference . Another interesting interpretation is the one that ImageMagick do with compare: http://www.imagemagick.org/script/compare.php With this tool you can have a new image with red points in places where there are some difference bigger that some threshold. -- SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-programming+owner@opensuse.org
Alberto Planas Dominguez wrote:
On Tuesday, July 08, 2014 01:50:56 PM Per Jessen wrote:
Per Jessen wrote:
Just a quick follow-up - for the time being, I'm using libjpeg. The interface is fairly easy and I do the comparison myself.
A note: compare images can mean different things. One interpretation is a new image represented with simple diff: abs(X - Y), or a binarization of this image. Other interpretation is a scalar between some range that measure how different or similar are the images, but do not show where is this difference . Another interesting interpretation is the one that ImageMagick do with compare:
http://www.imagemagick.org/script/compare.php
With this tool you can have a new image with red points in places where there are some difference bigger that some threshold.
Interesting discussion, I have been wondering about how best to approach it too. What I will be comparing are individual JPEGs from a camera that does MPJEG, with the intention of detection motion. I've been doing a simple diff with a threshold, saying 1% changed pixels -> motion. I have not yet tested how well this works :-) With imagemagick, this gave me good results in the past: composite img1 img2 -compose difference difference_frames.jpeg -- Per Jessen, Zürich (13.1°C) http://www.dns24.ch/ - your free DNS host, made in Switzerland. -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-programming+owner@opensuse.org
participants (3)
-
Adam Tauno Williams
-
Alberto Planas Dominguez
-
Per Jessen