NAME
snr - computes the rms error between two images
SYNOPSIS
#include <CVIPimage.h>
#include "CVIPcompress.h"
float *snr(Image *im1, Image *im2)
<im1> - Pointer to Image
<im2> - Pointer to Image
RETURNS: Pointer to rms values (float)
PATH
$CVIPHOME/COMPRESSION/rms_error.c
DESCRIPTION
snr() calculates the Peak Signal-to-Noise ratio between two
images, assuming a maximum value of 255 (BYTE).
The number of values contained in the return value of snr()
is equal to bands+1. Thus, for a color image (RGB), snr()
will return float *fptr; where fptr[0]=snr in Red Band;
fptr[1]=snr in Green band; fptr[2]=snr in Blue band; and
fptr[3] is overall SNR.
If case if there is no error between two images for a band,
the return value for that band is set to -1.0 as an indica-
tion.
The input images may be any data type, but for the result to
be meaningful the maximum value should be around 255.
EXAMPLE
#include <CVIPimage.h>
#include <CVIPhisto.h>
void main()
{
Image *cvipImage, *heqimage;
IMAGE_FORMAT format;
char *inputfile;
float *error;
int i;
print_CVIP("\n\t\tEnter the Input File Name: ");
inputfile =(char *) getString_CVIP();
format = getFormat_CVIP(inputfile);
cvipImage = read_Image(inputfile, 1);
heqimage=histeq(cvipImage);
error = snr(cvipImage, heqimage);
for(i=0; i<getNoOfBands_Image(cvipImage); i++) {
fprintf(stdout, "SNR in band #%d: %f0, i, error[i]);
}
fprintf(stdout, "Overall SNR: %f0,
error[getNoOfBands_Image(cvipImage)];
BUGS
None at this time
SEE ALSO
snr()
AUTHOR
Copyright (C) 1993-1996 SIUE - by Scott Umbaugh and Arve
Kjoelen