问题描述
我在java中使用sikuli-api 1.0.1。目前的问题是我想对给定的图像使用匹配的算法而不是屏幕。有效的代码是:
im using sikuli-api 1.0.1 in java. The current problem is that I want to use the matching algo for a given image instead of a screen. The code which works is:
ScreenRegion s = new DesktopScreenRegion();
Target imageTarget = new ImageTarget(new File("someImage"));
ScreenRegion r = s.find(imageTarget);
我想使用给定的图像(File / BufferedImage),而不是使用ScreenRegion。
任何想法怎么做?我不想点击图像等。我只想用sikulis algo检查目标是否在图像内。
Instead of using the ScreenRegion I would like to use a given image (File/BufferedImage). Any ideas how to do it? I dont want to click on the image etc. I just want to use sikulis algo to check if the target is inside the image.
提前致谢
推荐答案
您最好的办法是创建自己的 ScreenRegion
实施。用 ImageScreenRegion
替换 DesktopScreenRegion
,它实现 ScreenRegion
。
Your best bet is to create your own ScreenRegion
implementation. Replace DesktopScreenRegion
by an ImageScreenRegion
which implements ScreenRegion
.
ScreenRegion
接口在外部类实现方面非常有限。看来你只需要实现一个 ImageScreen
和一个 ImageScreenLocation
(简单就是馅饼)
ScreenRegion
interface is pretty limited in terms of external classes implementations. It seems you'll just have to implement an ImageScreen
and an ImageScreenLocation
(easy as pie)
请查看
这篇关于在java中使用sikuli比较图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!