RLPark 1.0.0
Reinforcement Learning Framework in Java
|
00001 package rlpark.plugin.opencv.runnables; 00002 00003 import rlpark.plugin.opencv.FrameGrabber; 00004 import rlpark.plugin.opencv.ImageTrace; 00005 import zephyr.plugin.core.api.Zephyr; 00006 import zephyr.plugin.core.api.monitoring.annotations.Monitor; 00007 import zephyr.plugin.core.api.synchronization.Clock; 00008 00009 import com.googlecode.javacv.cpp.opencv_core.IplImage; 00010 00011 @Monitor 00012 public class TraceRunnable implements Runnable { 00013 private final Clock clock = new Clock(); 00014 private final FrameGrabber webcam = new FrameGrabber(0); 00015 private final ImageTrace trace = new ImageTrace(0.9, webcam.width(), webcam.height(), webcam.depth(), 00016 webcam.channels()); 00017 00018 public TraceRunnable() { 00019 Zephyr.advertise(clock, this); 00020 } 00021 00022 @Override 00023 public void run() { 00024 while (clock.tick()) { 00025 IplImage image = webcam.grab(); 00026 trace.update(image); 00027 } 00028 } 00029 }