config.setOpticalFlowNumFramesToReset(3);
config.setOpticalFlowAngleOffset(0);
rois.add(new RegionOfInterest(points, config, "roi0"));
CrowdDetectorFilter crowdDetectorFilter = mp.newCrowdDetectorFilter(
rois).build();
playerEP.connect(crowdDetectorFilter);
crowdDetectorFilter.connect(httpEP);
final List<EndOfStreamEvent> eosEvents = new ArrayList<>();
playerEP.addEndOfStreamListener(new MediaEventListener<EndOfStreamEvent>() {
@Override
public void onEvent(EndOfStreamEvent event) {
eosEvents.add(event);
}
});
final List<CrowdDetectorOccupancyEvent> crowdDetectedOccupancyEvents = new ArrayList<>();
final List<CrowdDetectorFluidityEvent> crowdDetectedFluidityEvents = new ArrayList<>();
crowdDetectorFilter
.addCrowdDetectorOccupancyListener(new MediaEventListener<CrowdDetectorOccupancyEvent>() {
@Override
public void onEvent(CrowdDetectorOccupancyEvent event) {
crowdDetectedOccupancyEvents.add(event);
}
});
crowdDetectorFilter
.addCrowdDetectorFluidityListener(new MediaEventListener<CrowdDetectorFluidityEvent>() {
@Override
public void onEvent(CrowdDetectorFluidityEvent event) {
crowdDetectedFluidityEvents.add(event);
}