net.sourceforge.jiu.color.analysis
Class MeanDifference
public class MeanDifference
This operation determines the mean difference between two images.
It requires two images of the same resolution and adds the absolute difference
of all samples.
Then it divides by the number of samples in the image (width times height times
number of channels).
Supported combinations of image types
Usage example
Double meanDifference = MeanDifference.compute(image1, image2);
compute
public static Double compute(PixelImage image1,
PixelImage image2)
Compute the mean difference between two images.
image1
- first image to be examinedimage2
- second image to be examined
- sum of all differences divided by number of pixels
as Double or
null
on failure (image types
are incompatible)
computeDiff
private static int computeDiff(int a,
int b)
Returns abs(a - b).
a
- first numberb
- second number
getDifference
public double getDifference()
After a call to process, returns the determined mean difference value.
- difference value, 0.0 or larger
setDifference
private void setDifference(double newValue)
setImages
public void setImages(PixelImage firstImage,
PixelImage secondImage)
Sets the two images for which the mean difference is to be
determined.
firstImage
- first imagesecondImage
- second image