0

我正在使用以下代码比较 2 个图像文件,但即使在下载所需的依赖项/jar 文件之后,CompareCmd 类也没有被识别并给出编译错误。

import org.im4java.core.*
import org.im4java.process.*
import org.im4java.utils.*

boolean compareImages(String file1, String file2) {
        // This instance wraps the compare command
        CompareCmd compare = new CompareCmd() //throws compilation error here
        // For metric-output
        compare.setErrorConsumer(StandardStream.STDERR)
        IMOperation cmpOp = new IMOperation()
        // Set the compare metric
        cmpOp.metric("mae")

        // Add the expected image
        cmpOp.addImage(file1)

        // Add the current image
        cmpOp.addImage(file2)

        // This stores the difference
//                        cmpOp.addImage(diff)

        try {
            // Do the compare
            compare.run(cmpOp);
            return true
        }
        catch (Exception ex) {
            return false
        }
    }

错误:无法解析类 CompareCmd @ 第 150 行,第 20 列。CompareCmd compare = new CompareCmd() ^

有人可以告诉我这个类是否仍然存在于最新版本的 im4Java 中?还是我错过了什么。

提前致谢。

4

0 回答 0