我尝试使用库 im4java 读取 Java 中的图像:
File file = new File("img\\test.jpg");
Info imageInfo = new Info(file.getPath(),true);
问题是 Info() 无法识别图像。一个例外被称为:
Exception in thread "main" org.im4java.core.InfoException: org.im4java.core.CommandException: java.io.IOException: Cannot run program "identify": CreateProcess error=2, The sistem can not find the specific file.
at org.im4java.core.Info.getBaseInfo(Info.java:360)
at org.im4java.core.Info.<init>(Info.java:151)
at FeatureExtractor.main(FeatureExtractor.java:51)
在路线中,我试图放置完整的路线,但它不起作用。然后我尝试用命令和操作来做,但不工作:
// create command
ConvertCmd cmd = new ConvertCmd();
//cmd.setSearchPath("img");
// create the operation, add images and operators/options
IMOperation op = new IMOperation();
op.addImage("img\\test.jpg");
错误是:
org.im4java.core.CommandException: org.im4java.core.CommandException: Specification not valid.
at org.im4java.core.ImageCommand.run(ImageCommand.java:219)
at FeatureExtractor.main(FeatureExtractor.java:28)