0

我正在尝试使用 im4java 比较两个 jpg 图像并显示它们之间的差异。我已经成功地做到了,但是差异图像对比度的输出减少了。但我需要用原始对比度显示输出图像的差异。我需要在不改变对比度的情况下获得结果作为差异

public static void compareImageswithdifferenceimage (String expected, String actual, String difference) throws Exception {
        try {
            String Ipath="jars\\ImageMagick-7.0.10-Q16-HDRI";
            ProcessStarter.setGlobalSearchPath(Ipath);
            CompareCmd compare = new CompareCmd();
            //compare.setErrorConsumer(StandardStream.STDERR);
            IMOperation compareoperation = new IMOperation();
            //compareoperation.addRawArgs("compare");
            compareoperation.addImage(expected);
            compareoperation.addImage(actual);
            
            compareoperation.fuzz(1.0);
            //compareoperation.channel("red");
            compareoperation.metric("AE");
            compareoperation.transparentColor("Black");
           // compareoperation.fill("rgba(255, 215, 0, 0.1");
            //compareoperation.opaque("red");
           compareoperation.addImage(difference);
            try {
                System.out.println ("*******Comparison has Started********");
                compare.run(compareoperation);
                System.out.println ("*******Comparison has Finished*******");
                }
                catch (Exception e) {
                     System.out.println ("##### Comparison has Failed #######");
                     e.printStackTrace();
                }
            }
            catch(Exception exc) {
                System.out.println("Exception while executing compareImageswithdifferenceimage function");
                exc.printStackTrace();
    
        }
    }

注意:我无法在此处发布图片

4

0 回答 0