User's Guide

IMGCMP

Compare two images

Function:

Compares two images, pixel by pixel, to determine if they are identical. If the images are identical, the function will complete successfully. If the images are different, the line and sample location of the first difference is reported and the function issues a fatal error message.

Parameters:

IN
Input images. The images to be compared. Window and band options are allowed. The images must be the same size and have the same number of bands.

TOLVAL(0.0)
Tolerance value. The absolute difference of two pixels must be greater than TOLVAL to be considered different. The default is value is 0.0, indicating that the pixels must be equal.

Examples:

  1. LAS> imgcmp in=(answer test)

    The images ANSWER and TEST are compared pixel by pixel. If there are any differences, the function will issue a fatal error message indicating where the first difference occurs. If the images are identical, the function will complete successfully.

  2. LAS> imgcmp in=(answer test) tolval=1.0

    The images ANSWER and TEST are compared pixel by pixel. If any of the pixel values are different by more than 1.0, the function will issue a fatal error message indicating where the first difference occurs. If all pixel values in the input images differ by 1.0 or less, the function will complete successfully.

  3. LAS> imgcmp in=(answer "test1+test2")

    The image ANSWER is compared to the images TEST1 and TEST2. ANSWER must contain the same number of bands as TEST1 and TEST2 combined. If there are any differences, the function will issue a fatal error message indicating where the first difference occurs. If the images are identical, the function will complete successfully.

Description/Algorithm:

The corresponding pixel values in the input images are compared. The function will issue a fatal error message if it encounters a difference that is greater than TOLVAL.

If all of the pixel values are within TOLVAL of each other, the function will complete successfully.

Nonfatal Error Messages:

    None.

Fatal Error Messages:

  1. [imgcmp-alloc] Error allocating dynamic memory

    IMGCMP was unable to allocate dynamic memory. If the error persists, contact the system administrator.

  2. [imgcmp-bands] Different number of bands specified

    Both elements of IN must contain the same number of bands. Check the images specified for IN and re-run.

  3. [imgcmp-diff] Pixels differ in band <x> at line <y>, sample <z>

    The first pixel found to be different in the two images was found in band <x>, on line <y>, at sample <z>.

  4. [imgcmp-fatal] Fatal error encountered

    A fatal error was encountered during processing. The error message that is displayed immediately preceding this message is the specific error encountered. Processing is terminated.

  5. [imgcmp-size] Not all images are the same size

    The specified images have different sizes or different size windows applied to them. Re-specify the input images so they are the same size.

User Note:

  1. A related function is DIFF.