Package at.tuwien.minimee.migration.evaluators

Examples of at.tuwien.minimee.migration.evaluators.ImageCompareEvaluator


            saveTempFile(sample);
            saveTempFile(result);
           
            // NOTE: imageEvaluator is still called once per leaf !
            // -> could be optimized, but the used minimee evaluator will do separate calls anyway
            ImageCompareEvaluator imageEvaluator = new ImageCompareEvaluator();
           
            for(MeasurementInfoUri measurementInfoUri: measurementInfoUris) {
                String propertyURI = measurementInfoUri.getAsURI();
                String fragment = measurementInfoUri.getFragment();
                Scale scale = descriptor.getMeasurementScale(measurementInfoUri);
                if (scale == null)  {
                    // This means that I am not entitled to evaluate this measurementInfo and therefore supposed to skip it:
                    continue;
                }
                if ((propertyURI != null) && propertyURI.startsWith(OBJECT_IMAGE_SIMILARITY +"#")) {
                    Value v = null;
                    if (fragment.equals("equal")) {
                        Double d= imageEvaluator.evaluate(tempDir.getAbsolutePath(),
                                tempFiles.get(sample),
                                tempFiles.get(result),
                                "AE");
                       
                        if (d.compareTo(Scale.MAX_VALUE) == 0) {
                            // No: only evaluation results are returned, no error messages
                            // v.setComment("ImageMagick compare failed or could not be called");
                        } else {
                            v = scale.createValue();
                            ((BooleanValue)v).bool(d.compareTo(0.0) == 0);
                            v.setComment("ImageMagick compare returned "+Double.toString(d)+" different pixels");
                        }
        //                log.debug("difference" + Double.toString(Scale.MAX_VALUE-d));
                    } else {
                        Double d= imageEvaluator.evaluate(tempDir.getAbsolutePath(),
                                         tempFiles.get(sample),
                                         tempFiles.get(result),
                                         fragment);
                        if (d == null) {
                            // No: only evaluation results are returned, no error messages
View Full Code Here


            saveTempFile(sample);
            saveTempFile(result);

            // NOTE: imageEvaluator is called once per criterion as the used
            // minimee evaluator will do separate calls anyway
            ImageCompareEvaluator imageEvaluator = new ImageCompareEvaluator();

            for (String measureUri : measureUris) {
                Scale scale = null;
                String mode = null;
                if (MeasureConstants.IMAGE_CONTENT_IS_EQUAL.equals(measureUri)) {
                    mode = "equal";
                    scale = new BooleanScale();
                } else if (MeasureConstants.ABSOLUTE_ERROR_AE.equals(measureUri)) {
                    mode = "ae";
                    scale = new PositiveFloatScale();
                } else if (MeasureConstants.PEAK_ABSOLUTE_ERROR_PAE.equals(measureUri)) {
                    mode = "pae";
                    scale = new PositiveFloatScale();
                } else if (MeasureConstants.PEAK_SIGNAL_TO_NOISE_RATIO.equals(measureUri)) {
                    mode = "psnr";
                    scale = new PositiveFloatScale();
                } else if (MeasureConstants.MEAN_ABSOLUTE_ERROR.equals(measureUri)) {
                    mode = "mae";
                    scale = new PositiveFloatScale();
                } else if (MeasureConstants.MEAN_SQUARED_ERROR.equals(measureUri)) {
                    mode = "mse";
                    scale = new PositiveFloatScale();
                } else if (MeasureConstants.IMAGE_DISTANCE_RMSE.equals(measureUri)) {
                    mode = "rmse";
                    scale = new PositiveFloatScale();
                }

                if (mode != null) {
                    if (mode.equals("equal")) {
                        Double d = imageEvaluator.evaluate(tempDir.getAbsolutePath(), tempFiles.get(sample),
                            tempFiles.get(result), "AE");
                        if (d != null && d.compareTo(Scale.MAX_VALUE) != 0) {
                            Value v = scale.createValue();
                            ((BooleanValue) v).bool(d.compareTo(0.0) == 0);
                            v.setComment("ImageMagick compare returned " + Double.toString(d) + " different pixels");
                            results.put(measureUri, v);
                        }
                    } else {
                        Double d = imageEvaluator.evaluate(tempDir.getAbsolutePath(), tempFiles.get(sample),
                            tempFiles.get(result), mode);
                        if (d != null && d.compareTo(Scale.MAX_VALUE) != 0) {
                            Value v = scale.createValue();
                            if (v instanceof FloatValue) {
                                ((FloatValue) v).setValue(d);
View Full Code Here

TOP

Related Classes of at.tuwien.minimee.migration.evaluators.ImageCompareEvaluator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.