SsimQa implements Qa<Float, StaticColor> { @Override public TransientOperation<Float, StaticColor> evaluate(final BufferedImage left, final BufferedImage right) { BufferedImage leftImg = new SRGBColorConverter( new ConvenientBufferedImageWrapper(left)).getImage().getBufferedImage(); BufferedImage rightImg = new SRGBColorConverter( new ConvenientBufferedImageWrapper(right)).getImage().getBufferedImage(); ShrinkResizePreprocessor shrink = new ShrinkResizePreprocessor(leftImg, rightImg); shrink.process(); leftImg = shrink.getResult1(); rightImg = shrink.getResult2(); shrink = null; ScaleToNearestFactorPreprocessor scale = new ScaleToNearestFactorPreprocessor(leftImg, rightImg, targetSize); scale.process(); leftImg = scale.getResult1(); rightImg = scale.getResult2(); scale = null; HSBColorConverter c1 = new HSBColorConverter( new SRGBColorConverter(new ConvenientBufferedImageWrapper(leftImg))); HSBColorConverter c2 = new HSBColorConverter( new SRGBColorConverter(new ConvenientBufferedImageWrapper(rightImg))); SimpleSSIMMetric metric = new SimpleSSIMMetric(c1, c2, new Point(0, 0), new Point(leftImg.getWidth(), leftImg.getHeight()), numThreads); return metric.execute(); } SsimQa(); SsimQa targetSize(int targetSize); SsimQa numThreads(int numThreads); @Override TransientOperation<Float, StaticColor> evaluate(final BufferedImage left, final BufferedImage right);  }
@Test public void evaluateTest_differentSize() { BufferedImage left = BufferedImageHelper.createSolidImage(new Color(0, 0, 0), 500, 400); BufferedImage right = BufferedImageHelper.createSolidImage(new Color(0, 0, 0), 400, 500); SsimQa ssimQa = new SsimQa(); TransientOperation<Float, StaticColor> op = ssimQa.evaluate(left, right); }
@Test public void evaluateTest_equal_solid000000() { BufferedImage left = BufferedImageHelper.createSolidImage(new Color(0, 0, 0)); BufferedImage right = BufferedImageHelper.createSolidImage(new Color(0, 0, 0)); SsimQa ssimQa = new SsimQa(); TransientOperation<Float, StaticColor> op = ssimQa.evaluate(left, right); checkOperationEqual(op, 1.0f); }
@Test public void evaluateTest_equal_solid646464() { BufferedImage left = BufferedImageHelper.createSolidImage(new Color(100, 100, 100)); BufferedImage right = BufferedImageHelper.createSolidImage(new Color(100, 100, 100)); SsimQa ssimQa = new SsimQa(); TransientOperation<Float, StaticColor> op = ssimQa.evaluate(left, right); checkOperationEqual(op, 1.0f); }
@Test public void evaluateTest_equal_solid9924cd() { BufferedImage left = BufferedImageHelper.createSolidImage(new Color(153, 36, 205)); BufferedImage right = BufferedImageHelper.createSolidImage(new Color(153, 36, 205)); SsimQa ssimQa = new SsimQa(); TransientOperation<Float, StaticColor> op = ssimQa.evaluate(left, right); checkOperationEqual(op, 1.0f); }
@Test public void evaluateTest_half000000_111111_half000000_111111() { BufferedImage left = BufferedImageHelper.createSolidHalfImage(new Color(0, 0, 0), new Color(255, 255, 255)); BufferedImage right = BufferedImageHelper.createSolidHalfImage(new Color(0, 0, 0), new Color(255, 255, 255)); SsimQa ssimQa = new SsimQa(); TransientOperation<Float, StaticColor> op = ssimQa.evaluate(left, right); checkOperationEqual(op, 1.0f); }
@Test public void evaluateTest_size_equal() { BufferedImage left = BufferedImageHelper.createSolidImage(new Color(0, 0, 0), 100, 100); BufferedImage right = BufferedImageHelper.createSolidImage(new Color(0, 0, 0), 50, 50); SsimQa ssimQa = new SsimQa(); TransientOperation<Float, StaticColor> op = ssimQa.evaluate(left, right); checkOperationEqual(op, 1.0f); }
@Test public void evaluateTest_size_half000000_111111_half000000_111111() { BufferedImage left = BufferedImageHelper.createSolidHalfImage(new Color(0, 0, 0), new Color(255, 255, 255), 100, 100); BufferedImage right = BufferedImageHelper.createSolidHalfImage(new Color(0, 0, 0), new Color(255, 255, 255), 50, 50); SsimQa ssimQa = new SsimQa(); TransientOperation<Float, StaticColor> op = ssimQa.evaluate(left, right); checkOperationEqual(op, 1.0f); }