Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/360.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在java中的图像中查找图像_Java_Image_Search_Video - Fatal编程技术网

在java中的图像中查找图像

在java中的图像中查找图像,java,image,search,video,Java,Image,Search,Video,我一直在寻找,但我找不到任何有效的方法,所以我想问一下, 基本上,我试图让java浏览一个视频,找到一个特定的图像,比如一个徽标或其他东西,但现在我只是在视频之前的其他图像部分中查找图像。我正在使用eclipse和来自此的代码, 但是我不能让它工作,而且总是会出错: SLF4J:未能加载类“org.SLF4J.impl.StaticLoggerBinder”。 SLF4J:默认为无操作(NOP)记录器实现SLF4J: 有关更多信息,请参见 细节。线程“main”java.lang.NullPoi

我一直在寻找,但我找不到任何有效的方法,所以我想问一下, 基本上,我试图让java浏览一个视频,找到一个特定的图像,比如一个徽标或其他东西,但现在我只是在视频之前的其他图像部分中查找图像。我正在使用eclipse和来自此的代码, 但是我不能让它工作,而且总是会出错:

SLF4J:未能加载类“org.SLF4J.impl.StaticLoggerBinder”。
SLF4J:默认为无操作(NOP)记录器实现SLF4J:
有关更多信息,请参见
细节。线程“main”java.lang.NullPointerException中的异常位于 org.sikuli.api.visual.Canvas.addLabel(Canvas.java:230)位于 main(Search.java:39)

这是我的密码:

import java.net.MalformedURLException;
import java.net.URL;

import org.sikuli.api.*;
import org.sikuli.api.robot.Mouse;
import org.sikuli.api.robot.desktop.DesktopMouse;
import org.sikuli.api.visual.Canvas;
import org.sikuli.api.visual.DesktopCanvas;

import static org.sikuli.api.API.*;

public class Search {

    public static void main(String[] args) throws MalformedURLException {

            // Open the main page of Google Code in the default web browser
            browse(newURL("http://zelda.wikia.com/wiki/File:Wii_U_(logo).png"));
            // Create a screen region object that corresponds to the default monitor in full screen 
            ScreenRegion s = new DesktopScreenRegion();

            // Specify an image as the target to find on the screen
            URL imageURL = new URL("http://vignette1.wikia.nocookie.net/zelda/images/1/17/Wii_U_%28logo%29.png/revision/latest?cb=20110609012932");                
            Target imageTarget = new ImageTarget(imageURL);

            // Wait for the target to become visible on the screen for at most 5 seconds
            // Once the target is visible, it returns a screen region object corresponding
            // to the region occupied by this target
            ScreenRegion r = s.wait(imageTarget,5000);

            // Display "Hello World" next to the found target for 3 seconds
            Canvas canvas = new DesktopCanvas();
            canvas.addLabel(r, "Hello World").display(3);

            // Click the center of the found target
            Mouse mouse = new DesktopMouse();
            mouse.click(r.getCenter());
    }
}