@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); }
@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 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 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 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); }
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);  }