我正在尝试比较位于我的操作系统机器下的两个图像。我在我的操作系统机器上运行了 ImageMagick。我正在使用这种方法:
public boolean compareImages (String expectedScreenShot, String capturedScreenShot, String pdiffCompare) {
ProcessStarter.setGlobalSearchPath("/usr/local/bin/");
CompareCmd compare = new CompareCmd();
// For metric-output
IMOperation cmpOp = new IMOperation();
// Set the compare metric
cmpOp.metric("AE");
// Add the expected image
cmpOp.addImage(expectedScreenShot);
// Add the current image
cmpOp.addImage(capturedScreenShot);
// This stores the difference
cmpOp.addImage(pdiffCompare);
try {
// Do the compare
compare.run(cmpOp);
compare.getErrorText();
return true;
}
catch (Exception ex) {
return false;
}
}
我正在使用 im4java:1.4.0,但是当我运行compare.run(cmpOp);
时收到此异常:
org.im4java.core.CommandException:org.im4java.core.CommandException:magick:在 CLI arg 1 @error/operation.c/CLIOption/5225 处找不到操作“-metric”的图像。
任何帮助,将不胜感激。