ICMP: Image Comparer => Baby Cam + JPEG-6B Toolset (i.e. djpeg)

  • Leute,


    anbei ein kleines GNU-Hilfstool:


    1.
    ICMP: Vergleicht 2 Bilder(RAW, PGM, BMP) und gibt die Ähnlichkeit aus. Kann man z.B. verwenden, um Bewegungen mittels einer IPCAM zu erkennen.


    Zwei große 2.3 Mbyte BMPs benoetigen ca. 2 sec um berechnet zu werden. Kleinere (z.B. 640x480) dauern ca. 0,5 Sekunden.


    Nach dem Download nicht "gunzip icmp" und "chmod 755 icmp" vergessen.


    2. Gleich mit kommt die "free library for JPEG image compression" von h**p://www.ijg.org. Kann man u.U. gut gebrauchen.


    Viel Spass damit.


    ___________ENGLISH___________________
    Folks,


    1) for a hobby project (baby-ipcam on the Drean TV Screen), I managed to compile the following little helper:


    ICMP reads two image files and prints statistics of the error between the images. Can be used to detect motion using an IP CAM.


    On the DB7020 two 2.3 Mbyte images need approx. 2 secs to compute. Smaler images are done quicker than that.


    Don't forget to gunzip and chmod the icmp file.


    2) Also attached, the free library for JPEG image compression from h**p://www.ijg.org. One might need djpeg occassionally.


    Have fun.


    Gruß/Regards,


    Mamba


    _________________________
    Command line options:


    All command line options have an equivalent short and long form.


    -h, -help
    Print this usage information.


    -i1 IMAGE1, -image1 IMAGE1 [ default: standard input ]
    Specify the file name of image 1. Use '-' for standard input.


    -i2 IMAGE2, -image2 IMAGE2 [ default: standard input ]
    Specify the file name of image 2. Use '-' for standard input.


    -s ROWS COLUMNS, -size ROWS COLUMNS [ default: 512 512 ]
    Specify the size of the images.


    -p NUMPLANES, -planes NUMPLANES [ default: 1 ]
    Specify the number of color planes in the images. This will
    most likely be 1 or 3, but any positive value can be used.


    -d DEPTH, -depth DEPTH [ default: 8 ]
    Specify the bit depth of the images. If the depth is between 1
    and 8 one byte is read per pixel. If the depth is between 9 and
    16, two bytes are read per pixel, most signifigant byte first.
    ICMP does not check to see whether the pixel value read actually
    fits in DEPTH bits.


    -s1 NUM, -skip1 NUM [ default: 0 ]
    Specify the number of header bytes to skip in image file 1.


    -s2 NUM, -skip2 NUM [ default: 0 ]
    Specify the number of header bytes to skip in image file 2.


    -cee, -check-end-eof [ default: yes ]
    Tell ICMP to make sure that after all data is read in both images
    the end of the file has ben reached.


    -ncee, -no-check-end-eof [ default: yes ]
    Tell ICMP to skip the end of file check.


    -e FILE, -encode FILE [ default: none ]
    Specify the encoded data file. If given, ICMP will print
    its size in bytes and bits-per-pixel.


    -f FORMAT, -format FORMAT [ default: see below ]
    Specify the format for printing results of the comparison.


    The -f FORMAT option allows you to specify how the image statistics are
    printed in a flexible way similar to the format string for the printf
    command. Each character from the format string is printed unless it is
    part of an escape sequence. Escape sequences ate two-character sequences
    beginning with '\' to print special characters or '%' to print computed
    statistics. The escape sequences recognized are:
    '\b': backspace
    '\f': formfeed
    '\n': newline
    '\r': carriage return
    '\t': tab
    '\v': vertcal tab
    '\\': \
    '%p': peak signal to noise ratio
    '%r': root mean square error
    '%x': maximum absolute error
    '%y': maximum positive error
    '%z': maximum negative error (as a positive number)
    '%m': mean absolute error
    '%b': compressed file bits per pixel
    '%s': compressed file size in bytes
    '%k': peak signal (2^depth-1)
    '%%': %
    The default format displays all statistics except %k.


    Note that you cannot specify printf style field widths or other
    modifiers for the % escape sequences, as in '%7.2r'.


    For the purposes of computing maximum positive and negative error, the
    second image is subtracted from the first.


    ICMP will print an error message and exit if either input image has
    extra bytes at its end, unless you use the '-ncee' option.


    By default both images are read from standard input. This default
    must be overidden by giving a file for at least one of the images
    otherwise, an error message is printed and the program exits.


    Please contact me (e-mail below) with bug reports, bug fixes, suggestions
    for improving this program, or if you would like to be notified after
    signifigant enhancements are made.


    Copyright (C) 1998-2000 Fred Wheeler
    Licensed under the terms of the GNU General Public License
    h**p://www.gnu.org/copyleft/gpl.html


    The latest version of ICMP can be found at
    h**p://www.cipr.rpi.edu/wheeler/icmp


    Fred Wheeler
    wheeler@cipr.rpi.edu