public void display() {
    PImage img = kinect.getDepthImage();

    // PImage img = kinect.getVideoImage();
    // Being overly cautious here
    if (depth == null || img == null) return;

    // Going to rewrite the depth image to show which pixels are in threshold
    // A lot of this is redundant, but this is just for demonstration purposes
    display.loadPixels();
    for (int x = 0; x < kw; x++) {
      for (int y = 0; y < kh; y++) {
        // mirroring image
        int offset = kw - x - 1 + y * kw;
        // Raw depth
        int rawDepth = depth[offset];

        int pix = x + y * display.width;
        if (rawDepth < threshold) {
          // A red color instead
          display.pixels[pix] = p.color(150, 50, 50);
        } else {
          display.pixels[pix] = img.pixels[offset];
        }
      }
    }
    display.updatePixels();

    // Draw the image
    p.image(display, 0, 0);
  }
 /**
  * helper function to load the large pixelinvaders logo
  *
  * @return
  */
 public static Image createLargeIcon() {
   PImage img = Collector.getInstance().getPapplet().loadImage("pics/logoBig.jpg");
   if (img != null) {
     return img.getImage();
   }
   img = new PImage(400, 400);
   return img.getImage();
 }
 /**
  * helper function to load the large pixelinvaders logo
  *
  * @return
  */
 public static Image createLargeIcon(PApplet papplet) {
   PImage img = papplet.loadImage("pics/logoBig.jpg");
   if (img != null) {
     return img.getImage();
   }
   LOG.log(Level.WARNING, "failed to load icon image!");
   img = new PImage(400, 400);
   return img.getImage();
 }
 public void getOverviewShut() {
   updatePixels();
   int[] buffer = new int[pixels.length];
   System.arraycopy(pixels, 0, buffer, 0, pixels.length);
   overviewImage = new PImage(width, height);
   overviewImage.format = RGB;
   overviewImage.pixels = buffer;
   // overviewImage.save("image.tif");
   buffer = null;
   System.out.println("shut for overview");
 }
Exemple #5
0
 public PImage get(int index, int fg) {
   PImage msk = font[index];
   PImage img = pa.createImage(msk.width, msk.height, PConstants.RGB);
   msk.loadPixels();
   img.loadPixels();
   for (int i = 0; i < img.pixels.length; i++) {
     img.pixels[i] = fg;
   }
   img.mask(msk);
   return img;
 }
  public void preIntroSetup() {
    try {

      int bgWidth = env.bgImg.getWidth(env);
      int bgHeight = env.bgImg.getHeight(env);
      int[] bgPixels = new int[bgWidth * bgHeight];
      for (int i = 0; i < bgPixels.length; i++) if (bgPixels[i] != 0) System.out.print(bgPixels[i]);
      overlay = new PImage(bgWidth, bgHeight);
      overlay.format = ARGB;
      overlay.pixels = bgPixels;
      runNum = 0;
      controls.setEnabled(false);

      /** * get into looping */
      afterFirstStreaming = true;
      /** overview shut */
      draw();
      /*theCamera.moveToNow(new FVector(0.0f, 0.0f, 1000));
      theCamera.lookAtNow(new FVector(0.0f, 1.0f, 0));
      */
      draw();
      ortho(-1500, 800, -800, 800, 1000, 2000);
      loadPixels();
      noStroke();
      getOverviewShut();
      afterOverviewShot = true;
      draw();
      loop();

      /** give the environment the hint to swop the surfaces */
      env.addThem();
      /** * intro */
      theCamera.moveToNow(new FVector(-200.0f, 950.0f, 1000));
      theCamera.lookAtNow(new FVector(-200.51917f, 851.8057f, 0));
      theCamera.lookAtInter(
          new FVector(1341.8213f, 757.865f, 0), new Integer(4000), new Integer(3));
      Object[] actionObjects = {new FVector(0, 0, -88), new Integer(2000), new Integer(0)};
      theCamera.queueAction("lookAtInter", 4000, actionObjects);
      theCamera.moveToNow(new FVector(-500.51917f, 951.8057f, 200));
      theCamera.moveToInter(
          new FVector(1341.8213f, 857.865f, 200), new Integer(4000), new Integer(3));
      Object[] actionObjects2 = {
        new FVector(0, 800, Camera.maxCameraHeight), new Integer(2000), new Integer(1)
      };
      theCamera.queueAction("moveToInter", 0, actionObjects2);
      Object[] actionObjects3 = {Boolean.valueOf(true)};
      theCamera.queueAction("setControlsEnabled", 3500, actionObjects3);
    } catch (Exception e) {
      e.printStackTrace();
      env.setErrorDisplay(
          "Das Applet konnte nicht gestartet werden. Eventuell ist dies ein Speicherproblem. Bitte stoppen sie alle anderen Java-Anwendungen. GGf. muss der Browser neu gestartet werden um den Cache zu leeren.");
    }
  }
Exemple #7
0
 public PImage get(int index, int fg, int bg) {
   PImage msk = font[index];
   PImage img = pa.createImage(msk.width, msk.height, PConstants.RGB);
   msk.loadPixels();
   img.loadPixels();
   for (int i = 0; i < msk.pixels.length; i++) {
     if (msk.pixels[i] == Colors.WHITE) {
       img.pixels[i] = fg;
     } else {
       img.pixels[i] = bg;
     }
   }
   return img;
 }
Exemple #8
0
 boolean createTransition(final int frames) { // NOPMD
   boolean rtn = false;
   fill(0, 1);
   noStroke();
   rect(0, 0, width, height);
   if (trans <= 250) {
     for (int i = 0; i < 100; i++) {
       final int xPos = (int) (random(ICON_BACKGROUND.width));
       final int Pos = (int) (random(ICON_BACKGROUND.height));
       // int pix = (int)map(a.get(posX, posY), 0, 255, 0, 255-alpha);
       final int pix = ICON_BACKGROUND.get(xPos, Pos);
       fill(pix, 10);
       final int randx = (int) (random(width));
       final int randy = (int) (random(height));
       ellipse(randx, randy, i, i);
       fill(0, trans);
       ellipse(randx, randy, i, i);
     }
     if (trans <= 10) { // 1
       if (frames % 4 == 0) {
         trans += 1;
       }
     } else if (trans >= 200) {
       trans = 255;
     } else {
       trans += 1;
     }
   } else {
     fill(0, 255);
     noStroke();
     rect(0, 0, width, height);
     rtn = true;
   }
   return rtn;
 }
Exemple #9
0
  public Gif(PApplet parent, String filename) {
    // this creates a fake image so that the first time this
    // attempts to draw, something happens that's not an exception
    super(1, 1, ARGB);

    this.parent = parent;

    // create the GifDecoder
    GifDecoder gifDecoder = createDecoder(parent, filename);

    // fill up the PImage and the delay arrays
    frames = extractFrames(gifDecoder);
    delays = extractDelays(gifDecoder);

    // get the GIFs repeat count
    repeatSetting = gifDecoder.getLoopCount();

    // re-init our PImage with the new size
    super.init(frames[0].width, frames[0].height, ARGB);
    jump(0);
    parent.registerMethod("dispose", this);

    // and now, make the magic happen
    runner = new Thread(this);
    runner.start();
  }
Exemple #10
0
 public static PImage invert(Matrix H, PImage img, Point dstDimension) {
   PImage res = new PImage(dstDimension.x, dstDimension.y);
   //		PImage res = new PImage(img.width, img.height);
   for (int x = 0; x < img.width; x++) {
     for (int y = 0; y < img.height; y++) {
       // Point inverse theorique (x0,y0) ?
       double[][] q_array = {{x}, {y}, {1}};
       Matrix P = H.times(new Matrix(q_array));
       double x0 = P.get(0, 0) / P.get(2, 0);
       double y0 = P.get(1, 0) / P.get(2, 0);
       // S'il est hors de l'image originale, on rend le pixel transparant.
       if (x0 < 0 || x0 >= img.width || y0 < 0 || y0 >= img.height) res.set(x, y, 0x00000000);
       else res.set(x, y, img.get((int) x0, (int) y0));
     }
   }
   return res;
 }
 public void setup() {
   size(400, 400);
   background(255);
   stroke(0);
   img = loadImage("http://cseweb.ucsd.edu/~minnes/palmTrees.jpg", "jpg");
   img.resize(0, height);
   image(img, 0, 0);
 }
Exemple #12
0
 EImage(NoKinect sce, String file) {
   parent = sce;
   position = new int[3];
   extrude = parent.loadImage(file);
   extrude.loadPixels();
   forDelta = 10;
   values = new int[extrude.width * extrude.height];
   for (int x = forDelta; x < extrude.width; x += forDelta) {
     for (int y = forDelta; y < extrude.height; y += forDelta) {
       values[(x * extrude.width) + y] = (int) (parent.brightness((int) extrude.get(x, y)));
       for (int d = 0; d < forDelta; d++) {
         values[(x * extrude.width) + y] +=
             (int) (parent.brightness((int) extrude.get(x - d, y - d)));
       }
       values[(x * extrude.width) + y] /= forDelta;
     }
   }
 }
  public void draw() {
    background(0);

    /*    pushMatrix();
        translate(width/2,height/2);
    //    nav.doTransforms();

        translate(-vl.bb().centroid().x,-vl.bb().centroid().y);
        scale(5);
        strokeWeight(0.2f);
        noFill();

        UVertex last=null;
        for(UVertex v:vl) {
          stroke(0);
          v.pellipse(v,0.1f, 0.1f);
          if(last!=null) {
            if(v.dist(last)>15) stroke(200);
            v.pline(v,last);
          }

          last=v;
        }
        popMatrix();
    */
    //    noLights();
    noTint();
    stroke(255, 0, 0);
    //    strokeWeight(2);
    noFill();
    //    translate(100,100);
    translate(width / 2, height / 2);
    nav.doTransforms();
    translate(-img.width / 2, -img.height / 2, -5);

    fill(img.get(300, 300));
    rect(-img.width, -img.height, img.width * 3, img.height * 3);
    translate(0, 0, 5);
    image(img, 0, 0);

    UVertex last = null;
    for (UVertex v : vl) {
      UVertex res = UMapping.mercatorMapping(v, geobb, img.width, img.height);
      fill(255, 100, 0);
      noStroke();
      UMB.pellipse(res, 4);
      stroke(255, 100, 0);
      noFill();
      res.z = 20;
      UMB.pellipse(res, 12);
      //      strokeWeight(0.6f);
      point(res.x, res.y);

      if (last != null) v.pline(res, new UVertex(res.x, res.y, 0));
      last = res;
    }
  }
Exemple #14
0
  public BFont(PApplet pa, String filename) {
    this.pa = pa;
    PImage fontImage = pa.loadImage(filename);
    int rows = (int) Math.floor(fontImage.height / GameConstants.TILE_H);
    int columns = (int) Math.floor(fontImage.width / GameConstants.TILE_W);

    characters = rows * columns;
    font = new PImage[characters];

    for (int j = 0; j < rows; j++) {
      for (int i = 0; i < columns; i++) {
        font[(j * columns) + i] =
            fontImage.get(
                i * GameConstants.TILE_W,
                j * GameConstants.TILE_H,
                GameConstants.TILE_W,
                GameConstants.TILE_H);
      }
    }
  }
  // Takes a PImage and compresses it into a JPEG byte stream
  // Adapted from Dan Shiffman's UDP Sender code
  public byte[] compressImage(PImage img) {
    // We need a buffered image to do the JPG encoding
    BufferedImage bimg = new BufferedImage(img.width, img.height, BufferedImage.TYPE_INT_RGB);

    img.loadPixels();
    bimg.setRGB(0, 0, img.width, img.height, img.pixels, 0, img.width);

    // Need these output streams to get image as bytes for UDP communication
    ByteArrayOutputStream baStream = new ByteArrayOutputStream();
    BufferedOutputStream bos = new BufferedOutputStream(baStream);

    // Turn the BufferedImage into a JPG and put it in the BufferedOutputStream
    // Requires try/catch
    try {
      ImageIO.write(bimg, "jpg", bos);
    } catch (IOException e) {
      e.printStackTrace();
    }

    // Get the byte array, which we will send out via UDP!
    return baStream.toByteArray();
  }
  public void draw() {

    Date date = new Date(); // given date
    Calendar calendar = GregorianCalendar.getInstance(); // creates a new calendar instance
    calendar.setTime(date); // assigns calendar to given date
    calendar.get(Calendar.HOUR_OF_DAY); // gets hour in 24h format
    calendar.get(Calendar.HOUR); // gets hour in 12h format
    calendar.get(Calendar.MONTH);
    backgroundImg.resize(0, height);
    image(backgroundImg, 0, 0);
    int r = 0;
    int g = 0;
    int b = 0;
    int hour = (calendar.get(Calendar.HOUR_OF_DAY));
    int second = (calendar.get(Calendar.SECOND));
    switch (second % 5) {
      case 0:
        fill(255, 0, 0);
        break;
      case 1:
        fill(0, 255, 0);
        break;
      case 2:
        fill(0, 0, 255);
        break;
      case 3:
        fill(227, 227, 0);
        break;
      case 4:
        fill(227, 0, 227);
        break;
      default:
        fill(0, 227, 227);
        break;
    }

    ellipse(width / 4, height / 6, width / 5, height / 5);
  }
  public void setImages(PImage i_mainImage, PImage i_gridImage) {

    mainImage = i_mainImage.get();
    gridImage = i_gridImage.get();

    if (size.x / (i_mainImage.width + 0.0) < size.y / (i_mainImage.height + 0.0)) {
      mainImage.resize((int) this.size.x, 0);
      gridImage.resize((int) this.size.x, 0);
    } else {
      mainImage.resize(0, (int) this.size.y);
      gridImage.resize(0, (int) this.size.y);
    }

    imageOffset =
        new PVector(
            this.size.x / 2.0f - mainImage.width / 2.0f,
            this.size.y / 2.0f - mainImage.height / 2.0f);
    redrawNow();
  }
Exemple #18
0
 public PImage copyImage(PImage img) {
   // A more efficient method may be possible - e.g. TimeDisplacement example P5 sketch.
   return img.get();
 }
  // FUNCTION THAT WILL BE CALLED IN PARENT CLASS
  public void createbg() {

    PImage canvas;
    // addational value
    float r = 1;

    // MASKE erstellen (Vignette)
    // begindraw and endraw are needed for pgraphics to work properly
    mask.beginDraw();
    // make a black background
    mask.background(0);
    // center the anchorpoint
    mask.shapeMode(PConstants.CENTER);
    // make a white ellipse half as large as the canvas
    mask.fill(255);
    mask.ellipse(width / 2, height / 2, width / 1.3f, height / 1.3f);
    // resize for better blur compability (prevent crashes)
    mask.resize(width / 5, height / 5);
    mask.filter(PConstants.BLUR, 19);
    // restire full size. this will blur the image even further
    mask.resize(width / 2, height / 2);
    mask.endDraw();

    // CREATE Picture
    pimg.beginDraw();
    // make a black background
    pimg.background(0);

    // this will generate bubbles specified by the image (NOT FINISHED)
    for (int i = 0; i < img.width; i += parent.random(200)) {
      for (int j = 0; j < img.height; j += parent.random(200)) {
        pimg.fill(img.get(i, j));
        pimg.noStroke();
        pimg.shapeMode(PConstants.CENTER);
        pimg.ellipse(i + 1, j + 1, r, r);
        r = parent.random(0.2f, 200);
      }
      r = parent.random(0.2f, 200);
    }

    // resize for better blur compability (prevent crashes)
    pimg.resize(width / 5, height / 5);
    pimg.filter(PConstants.BLUR, 9);

    // create a temp canvas to use te mask
    canvas = pimg.get();
    canvas.filter(PConstants.BLUR, 15);
    canvas.resize(width / 2, height / 2);

    // apply mask on the generated image
    pimg.resize(width / 2, height / 2);
    pimg.image(canvas, 0, 0);
    pimg.mask(mask.get());
    pimg.endDraw();

    // set the transparent image on a black background
    // save the vignetted image
    stage.beginDraw();
    stage.image(pimg.get(), 0, 0);
    stage.endDraw();
    stage.save(output_path + output_data);
  }
Exemple #20
0
  /** Setup processing. */
  public void setup() { // NOPMD

    receivedGestures[BLUE] = new ArrayList<String>();
    receivedGestures[GREEN] = new ArrayList<String>();

    // Create Enviroment.
    size(screen.width - 1, screen.height - 1, OPENGL);
    textMode(MODEL);
    background(255);
    noStroke();
    smooth();
    createRandomness();

    thisInteractome = new Interactome(this, MAX_SIZE, MIN_SIZE, CIRCLE_COUNT, SCREENS, splayer);
    initializeTitles(); // starting, ending
    kare = 0;
    trans = 0;

    // Initialize gestures Map.
    gestMap.put(0, "TOWhor");
    gestMap.put(1, "TOWver");
    gestMap.put(2, "TOWfor");

    for (int i = 1; i < 13; i++) {
      final PImage tmpImage =
          loadImage("eu/funinnumbers/games/sg/tow/engine/ui/visualoutput/img/TOWhor_" + i + ".gif");
      tmpImage.resize(tmpImage.width / 4, tmpImage.height / 4);
      horFrames.add(tmpImage);
    }

    for (int i = 1; i < 16; i++) {
      final PImage tmpImage =
          loadImage("eu/funinnumbers/games/sg/tow/engine/ui/visualoutput/img/TOWver_" + i + ".gif");
      tmpImage.resize(tmpImage.width / 4, tmpImage.height / 4);
      verFrames.add(tmpImage);
    }

    for (int i = 1; i < 8; i++) {
      final PImage tmpImage =
          loadImage("eu/funinnumbers/games/sg/tow/engine/ui/visualoutput/img/TOWfor_" + i + ".gif");
      tmpImage.resize(tmpImage.width / 4, tmpImage.height / 4);
      forFrames.add(tmpImage);
    }

    for (int i = 0; i < 6; i++) {
      PImage tmpImage =
          loadImage("eu/funinnumbers/games/sg/tow/engine/ui/visualoutput/img/any.gif");
      tmpImage.resize(tmpImage.width / 2, tmpImage.height / 2);
      anyFrames.add(tmpImage);

      tmpImage = loadImage("eu/funinnumbers/games/sg/tow/engine/ui/visualoutput/img/null.gif");
      tmpImage.resize(tmpImage.width / 2, tmpImage.height / 2);
      anyFrames.add(tmpImage);
    }

    imagesForGestures.put("TOWhor", horFrames);
    imagesForGestures.put("TOWver", verFrames);
    imagesForGestures.put("TOWfor", forFrames);

    team1gesA = horFrames.get(0);
    team2gesA = horFrames.get(0);

    stage1Team1width = width / 4 - team1gesA.width / 2;
    stage1Team2width = 3 * width / 4 - team2gesA.width / 2;

    stage1height = height - team1gesA.height;

    // fillImageVectors();
    timer.scheduleAtFixedRate(new ChangeCurrentImages(), 2000, IMG_REFRESHRATE);
    timer.scheduleAtFixedRate(new CheckStage(), 4000, STAGE_REFRESHRATE);

    // Set the default font
    textFont(fontCounter, 255);
    textSize(48);

    // Setup Counters
    teamWidth = width / SCREENS;

    // Counter settings
    counterBoxX[0] = 100 - 5;
    counterBoxX[1] = width - 100 - 5;
    counterBoxY = height - 95;
    counterX[0] = 100;
    counterX[1] = width - 100;
    counterY = height - 50;
  }
Exemple #21
0
  public void draw() {
    img.loadPixels();
    colorMode(HSB, 1, 1, 1);

    // for(int i = 0; i < settings.passesperupdate; i++ ){
    initBuckets();
    runBuckets();
    // }

    totalphotonscast = 0;

    // settings.exposure = (float) mouseX / 100;

    colorMode(RGB, 1);
    for (int x = 0; x < w; x++) {
      for (int y = 0; y < h; y++) {
        double div = count[x + y * h] / settings.exposure;
        totalphotonscast += count[x + y * h];
        int i = (x + y * w) * 3;
        int c = 0;
        if (mousePressed && mouseButton == LEFT) {
          // show grayscale, so early color renders dont look like shit
          c = color((float) ((plate[i + 0] + plate[i + 1] + plate[i + 2]) / div / 3));
        } else { // show color
          c =
              color(
                  (float) (plate[i + 0] / div),
                  (float) (plate[i + 1] / div),
                  (float) (plate[i + 2] / div));
        }
        img.pixels[x + y * w] = c;
      }
    }

    img.updatePixels();
    image(img, 0, 0, (float) (w * settings.scale), (float) (h * settings.scale));

    println(
        "Ms: "
            + (millis() - millis)
            + " - Pass: "******" - "
            + totalphotonscast
            + " rays cast so far - "
            + (totalphotonscast - lastphotonscast) / (millis() - millis) * 1000
            + " rays per second.");
    millis = millis();
    lastphotonscast = totalphotonscast;
    // if( frameCount % 1 == 0 ){
    if (keyPressed) {
      savedframecount += 1;
      saveFrame("out2/" + savedframecount + "_box.tiff");
      println("Saved a frame.");
      // wipePlate();
    }

    if (mousePressed && mouseButton == RIGHT) {
      FilmGraph.DrawGraph(this);
    }
  }
Exemple #22
0
  public void draw() {
    t++;
    if (cam.available()) {
      prevFrame.copy(cam, 0, 0, cam.width, cam.height, 0, 0, cam.width, cam.height);
      // prevFrame.updatePixels();
      cam.read();
    }

    // cam.loadPixels();
    // prevFrame.loadPixels();
    loadPixels();

    ArrayList<Ponto> motionAtual = new ArrayList<Ponto>();
    for (int x = 0; x < cam.width; x++) {
      for (int y = 0; y < cam.height; y++) {
        int loc = x + y * cam.width;
        int current = cam.pixels[loc];
        int previous = prevFrame.pixels[loc];

        float r1 = red(current);
        float g1 = green(current);
        float b1 = blue(current);
        float r2 = red(previous);
        float g2 = green(previous);
        float b2 = blue(previous);
        float diff = dist(r1, g1, b1, r2, g2, b2);

        // How different are the colors?
        if (diff > threshold) {
          Ponto atual = new Ponto(current, loc);
          motionAtual.add(atual);
        } else {
          pixels[loc] = color(0);
        }
      }
    }

    if (t > rastroSize) { // after x draws
      rastros.add(motionAtual);
      if (rastros.size() == rastroSize) { // array completo? excluir rastro 0
        rastros.remove(0);
      }

      // aplicar rastro
      for (int x = 0; x < rastros.size(); x++) {
        ArrayList<Ponto> motion = rastros.get(x);
        // para cada motion
        for (int y = 0; y < motion.size(); y++) {
          // para cada ponto
          Ponto ponto = motion.get(y);

          //                  Float R = (new Float(-x*x*10 +255) / rastroSize) * 255;
          //					Float G = (new Float(-(x-rastroSize/2)*(x-rastroSize/2)*10+255) / rastroSize) *
          // 105;
          //					Float B = (new Float(-(x-rastroSize)*(x-rastroSize)*20+255) / rastroSize) * 55;
          //					Float A = R;
          //					Float cor = (new Float(x)/rastros.size())*255;

          int a = 255 / (x + 1);
          // System.out.println(a);

          pixels[ponto.getPosition()] = color(0, 0, 156, a); // Math.round(ponto.getCor());
        }
      }
    }

    updatePixels();

    if (debug) {
      text("rastros: " + rastroSize, 10, 30);
      text("contexto: " + threshold, 10, 60);
    }
  }
Exemple #23
0
  public void draw() {

    if (_theOther.get_context().get_regionselected()) {
      _cur_image = _theOther.get_current_image();
      if (_theOther.get_context().get_debug()) _theOther.image(_cur_image, 0, 0);

      _roi = _theOther.get_context().get_region_of_interest();
      _diff_image =
          _theOther.createImage(
              _theOther.get_videosource().get_width(),
              _theOther.get_videosource().get_height(),
              PConstants.ARGB);
      _diff_image.copy(
          _theOther
              .get_videosource()
              .diff(Other.get_instance().get_context().get_region_of_interest()),
          _roi.get_start().get_x(),
          _roi.get_start().get_y(),
          _roi.width(),
          _roi.height(),
          _roi.get_start().get_x(),
          _roi.get_start().get_y(),
          _roi.width(),
          _roi.height());
      _diff_image.filter(PConstants.THRESHOLD, _edgeThreshold / 10f);
      _diff_image.filter(PConstants.ERODE);
      for (int i = 1; i < _dilation; i++) {
        _diff_image.filter(PConstants.DILATE);
      }

      if (_theOther.get_context().get_debug())
        _theOther.image(_diff_image, 0, _theOther.get_videosource().get_height());

      //			_edge_image = edges(_theOther.get_current_image());
      //			_edge_image.filter(PConstants.THRESHOLD,  _edgeThreshold/10f);
      //			_theOther.image(_edge_image, 0, 240);

      _screen = _theOther.get_context().get_screen();
      _distance = _theOther.get_context().get_distance();

      _blobs = _flob.track(_diff_image);
      for (int i = 0; i < _blobs.size(); i++) {
        _tb = _flob.getTrackedBlob(i);

        if (i == 0 || _screen.distance_to(_tb.cx, _tb.cy) < _distance) {
          // selectedBlob = tb;
          _distance = _screen.distance_to(_tb.cx, _tb.cy);
        }

        if (_theOther.get_context().get_debug()) {
          _txt = "id: " + _tb.id + " time: " + _tb.presencetime + " ";
          _theOther.strokeWeight(1);
          _theOther.stroke(0, 255, 0);
          _theOther.fill(220, 220, 255, 100);
          _theOther.rect(_tb.cx, _tb.cy, _tb.dimx, _tb.dimy);
          _theOther.fill(0, 255, 0, 200);
          _theOther.rect(_tb.cx, _tb.cy, 5, 5);
          _theOther.fill(0);
          _theOther.line(
              _tb.cx, _tb.cy, _tb.cx + _tb.velx * _velmult, _tb.cy + _tb.vely * _velmult);
          _theOther.text(_txt, _tb.cx - _tb.dimx * 0.10f, _tb.cy + 5f);
        }
      }

      _theOther.get_context().set_distance(_distance);

      //			_blobs = _flob.calc(_diff_image);
      //			int numblobs = _blobs.size();//flob.getNumBlobs();
      //
      //			  for(int i = 0; i < numblobs; i++) {
      //
      //			    ABlob ab = (ABlob)_flob.getABlob(i);
      //			    //trackedBlob tb = (trackedBlob)_flob.getTrackedBlob(i);
      //			    //now access all blobs fields.. float tb.cx, tb.cy, tb.dimx, tb.dimy...
      //
      //			    // test blob coords here
      //			    //b1.test(ab.cx,ab.cy, ab.dimx, ab.dimy);
      //
      //			    //box
      //			    drawBlob(ab);
      //			    //drawBlob(tb);
      //			  }

      //
      //			ocv.cvOpenCVVideoSource ocv = (OpenCVVideoSource)
      // _theOther.get_videosource();.threshold(80);
      //			Blob[] blobs = ocv.cv.blobs(10, ocv.get_width()*ocv.get_height()/2, 100, true,
      // OpenCV.MAX_VERTICES*4);
      //
      //			// draw blob results
      //		    for( int i=0; i<blobs.length; i++ ) {
      //		        _theOther.beginShape();
      //		        for( int j=0; j<blobs[i].points.length; j++ ) {
      //		        	_theOther.vertex( blobs[i].points[j].x, blobs[i].points[j].y );
      //		        }
      //		        _theOther.endShape(PConstants.CLOSE);
      //		    }

      if (_theOther.get_context().get_debug()) {

        _theOther.get_context().get_screen().draw_screen(_theOther);
        _theOther.get_context().get_region_of_interest().draw(_theOther);

        _theOther.fill(0, 0, 255);
        _theOther.text(
            String.format("edge threshold = %d | dilation = %d", _edgeThreshold, _dilation),
            10,
            10);
      }
    }
  }