I need to do image comparison using Normalized Cross Correlation(NCC). The command line try with IMagick works fine for the following command
compare -metric NCC expected.jpg actual.jpg null:2>1&
Code snippet
Code: Select all
public void compare(File actual, File expected) throws Exception {
arguments.add("-metric");
arguments.add(Metric.NCC.name());
operation = new IMOperation();
operation.addRawArgs(arguments);
operation.addImage(actual.getAbsolutePath());
operation.addImage(expected.getAbsolutePath());
operation.addImage("output.jpg");
ImageCommand compare = new ImageCommand();
compare.setOutputConsumer(output);
compare.setCommand("compare");
try {
compare.run(operation);
} catch (IOException | InterruptedException e) {
throw e;
} catch (IM4JavaException e) {
e.printStackTrace();
}
}
Code: Select all
Caused by: org.im4java.core.CommandException: [b]0.866473[/b]
at org.im4java.core.ImageCommand.finished(ImageCommand.java:253)
at org.im4java.process.ProcessStarter.run(ProcessStarter.java:314)
at org.im4java.core.ImageCommand.run(ImageCommand.java:215)
Please help me to resolve these issues. Thanks in Advance.
-Appu