gpt4 book ai didi

java - im4java 读取图像

转载 作者:搜寻专家 更新时间:2023-11-01 03:53:26 25 4
gpt4 key购买 nike

我尝试使用库 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)

我试图在 route 放置完整的路线,但它不起作用。然后我尝试用命令和操作来做,但不工作:

    // 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)

最佳答案

你可以设置ImageMagick安装的搜索路径试试:ProcessStarter.setGlobalSearchPath("$PATH:<>");

关于java - im4java 读取图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17136771/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com