本文整理汇总了Java中motej.event.IrCameraEvent类的典型用法代码示例。如果您正苦于以下问题:Java IrCameraEvent类的具体用法?Java IrCameraEvent怎么用?Java IrCameraEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IrCameraEvent类属于motej.event包,在下文中一共展示了IrCameraEvent类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import motej.event.IrCameraEvent; //导入依赖的package包/类
public static void main(String[] args) throws InterruptedException {
IrCameraListener listener = new IrCameraListener() {
public void irImageChanged(IrCameraEvent evt) {
System.out.println(evt.getIrPoint(0).getX() + " : " + evt.getIrPoint(0).getY());
}
};
SimpleMoteFinder simpleMoteFinder = new SimpleMoteFinder();
Mote mote = simpleMoteFinder.findMote();
mote.addIrCameraListener(listener);
mote.enableIrCamera();
mote.setReportMode(ReportModeRequest.DATA_REPORT_0x36);
Thread.sleep(60000l);
mote.setReportMode(ReportModeRequest.DATA_REPORT_0x30);
mote.disableIrCamera();
mote.disconnect();
}
示例2: irImageChanged
import motej.event.IrCameraEvent; //导入依赖的package包/类
@Override
public void irImageChanged(IrCameraEvent event) {
synchronized (this) {
mousePosX = 0;
mousePosY = 0;
int size = 0;
for (int i = 0; i < 4; i++) {
if (event.getIrPoint(i).x != 1023 && event.getIrPoint(i).y != 1023) {
mousePosX += event.getIrPoint(i).x;
mousePosY += event.getIrPoint(i).y;
size++;
}
}
if (size != 0) {
mousePosX /= size;
mousePosY /= size;
}
}
}
示例3: irImageChanged
import motej.event.IrCameraEvent; //导入依赖的package包/类
public void irImageChanged(IrCameraEvent evt) {
if (lastEvent != null) {
for (int i = 0; i < 4; i++) {
if (!evt.getIrPoint(i).equals(lastEvent.getIrPoint(i))) {
IrPoint currentPoint = evt.getIrPoint(i);
IrPoint lastPoint = lastEvent.getIrPoint(i);
if (isValid(currentPoint) && !isValid(lastPoint)) {
pointAppeared(i, currentPoint);
} else if (!isValid(currentPoint) && isValid(lastPoint)) {
pointDisappeared(i, lastPoint);
} else {
pointChanged(i, currentPoint);
}
}
}
}
lastEvent = evt;
}
示例4: fireIrCameraEvent
import motej.event.IrCameraEvent; //导入依赖的package包/类
protected void fireIrCameraEvent(IrCameraMode mode, IrPoint p0, IrPoint p1, IrPoint p2, IrPoint p3) {
IrCameraListener[] listeners = listenerList.getListeners(IrCameraListener.class);
IrCameraEvent evt = new IrCameraEvent(this, mode, p0, p1, p2, p3);
for (IrCameraListener l : listeners) {
l.irImageChanged(evt);
}
}