if (image == null || !sameResolution(orig,image))
if (orig == null) System.out.println("orig == null"); if (orig == null || image == null || !sameResolution(orig,image))
	public double similarity(ScalableGrayscaleImage image) {		GrayscaleImage orig = getImage();		if (image == null || !sameResolution(orig,image))			return 0.0;		int pc = orig.getWidth() * orig.getHeight();		long sum1 = 0, sum2 = 0;		for (int i = 0; i < pc; i++) {			sum1 += orig.getGrayscaleValue(i) * orig.getGrayscaleValue(i);			sum2 += image.getGrayscaleValue(i) * image.getGrayscaleValue(i);		}		return 1 - Math.abs(1 - (sum1 * 1.0 / sum2));	}