@Override
  public final void stop() {
    super.stop();
    this.opModeStarted = false;
    this.rgba.release();
    this.gray.release();

    if (!this.threader.isReady()) {
      this.thread.interrupt();
    }

    this.timer.reset();

    while (!this.threader.isReady() && this.timer.time() < 0.5D) {
      Thread.yield();
    }

    if (!this.threader.isReady()) {
      RobotLog.e("*****************************************************************");
      RobotLog.e("User Linear Op Mode took too long to exit; emergency killing app.");
      RobotLog.e("Possible infinite loop in user code?");
      RobotLog.e("*****************************************************************");
      System.exit(-1);
    }
  }
 @Override
 public final void init() {
   super.init();
   hasNewFrame = false;
   this.rgba = Color.createMatRGBA(width, height);
   this.gray = Color.createMatGRAY(width, height);
   this.threader = new Threader(this);
   this.thread = new Thread(this.threader, "Linear OpMode Helper");
   this.thread.start();
 }
 @Override
 public final void loop() {
   super.loop();
   this.notifyOrThrowError();
 }