sarxos webcam-capture-live-streaming示例错误:包us.sosia.video.stream.agent.ui不存在

时间:2018-01-08 20:36:41

标签: java webcam-capture

我想使用sarxos的网络摄像头库制作网络摄像头捕获软件和流媒体软件。首先要了解这些示例,我不知道要更改或添加的内容,以便在导入us.sosia时通过此错误。 包us.sosia.video.stream.agent.ui不存在 包us.sosia.video.stream.handler 也许我必须制作一个Marvin项目并更改pow.xml文件,但我不知道如何执行此操作,仍然使用NetBeans将我的sarxos库添加到Marvin项目中。

第一堂课是StreamServer:

package us.sosia.video.stream.agent;

import java.awt.Dimension;
import java.net.InetSocketAddress;

import com.github.sarxos.webcam.Webcam;


public class StreamServer {

    /**
     * @author kerr
     * @param args
     */
    public static void main(String[] args) {
        Webcam.setAutoOpenMode(true);
        Webcam webcam = Webcam.getDefault();
        Dimension dimension = new Dimension(320, 240);
        webcam.setViewSize(dimension);

        StreamServerAgent serverAgent = new StreamServerAgent(webcam, dimension);
        serverAgent.start(new InetSocketAddress("localhost", 20000));
    }

}

第二类是StreamClient:

package us.sosia.video.stream.agent;

import java.awt.Dimension;
import java.awt.image.BufferedImage;
import java.net.InetSocketAddress;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import us.sosia.video.stream.agent.ui.SingleVideoDisplayWindow;
import us.sosia.video.stream.handler.StreamFrameListener;

public class StreamClient {
    /**
     * @author kerr
     * */
    private final static Dimension dimension = new Dimension(320,240);
    private final static SingleVideoDisplayWindow displayWindow = new SingleVideoDisplayWindow("Stream example",dimension);
    protected final static Logger logger = LoggerFactory.getLogger(StreamClient.class);
    public static void main(String[] args) {
        //setup the videoWindow
        displayWindow.setVisible(true);

        //setup the connection
        logger.info("setup dimension :{}",dimension);
        StreamClientAgent clientAgent = new StreamClientAgent(new StreamFrameListenerIMPL(),dimension);
        clientAgent.connect(new InetSocketAddress("localhost", 20000));
    }


    protected static class StreamFrameListenerIMPL implements StreamFrameListener{
        private volatile long count = 0;
        @Override
        public void onFrameReceived(BufferedImage image) {
            logger.info("frame received :{}",count++);
            displayWindow.updateImage(image);
        }

    }


}

我需要一种方法来克服这个错误。 提前谢谢。

1 个答案:

答案 0 :(得分:0)

两个文件中的前两行是:

package us.sosia.video.stream.agent;

这意味着这些文件应位于以下路径中 “/ us / sosia / video / stream / agent /”

从这两个文件中删除此行。