Exemplo n.º 1
0
  @Test
  public void meanShift() {
    int w = 32;

    CirculantTracker<ImageFloat32> alg =
        new CirculantTracker<ImageFloat32>(1f / 16, 0.2, 1e-2, 0.075, 1.0, w, 255, interp);

    int peakX = 13;
    int peakY = 17;

    alg.getResponse().reshape(w, w);
    for (int i = 0; i < w; i++) {
      double b = Math.exp(-(i - peakY) * (i - peakY) / 3.0);
      for (int j = 0; j < w; j++) {
        double a = Math.exp(-(j - peakX) * (j - peakX) / 3.0);

        alg.getResponse().set(j, i, a * b);
      }
    }

    alg.subpixelPeak(peakX - 2, peakY + 1);

    assertEquals(2, alg.offX, 0.3);
    assertEquals(-1, alg.offY, 0.3);
  }