Let's jump into the code.
First we have the class, the VideoPlayer:
public class VideoPlayer { private static final String AUTONOMOUS_DRIVING_RAMOK_TECH = "Autonomous Driving(ramok.tech)"; private String windowName; private volatile boolean stop = false; private Yolo yolo; private final OpenCVFrameConverter.ToMat converter = new OpenCVFrameConverter.ToMat(); public final static AtomicInteger atomicInteger = new AtomicInteger(); public void startRealTimeVideoDetection(String videoFileName, Speed selectedIndex, boolean yoloModel) throws java.lang.Exception { log.info("Start detecting video " + videoFileName); int id = atomicInteger.incrementAndGet(); windowName = AUTONOMOUS_DRIVING_RAMOK_TECH + id; log.info(windowName); ...