Exemplo n.º 1
0
  /**
   * Creates Gaussian derivative kernels.
   *
   * @param sigmas DOCUMENT ME!
   */
  private void makeKernels2D(float[] sigmas) {
    int xkDim, ykDim;
    int[] derivOrder = new int[2];

    kExtents = new int[2];
    derivOrder[0] = 2;
    derivOrder[1] = 0;

    xkDim = Math.round(8 * sigmas[0]);

    if ((xkDim % 2) == 0) {
      xkDim++;
    }

    if (xkDim < 3) {
      xkDim = 3;
    }

    kExtents[0] = xkDim;

    ykDim = Math.round(8 * sigmas[1]);

    if ((ykDim % 2) == 0) {
      ykDim++;
    }

    if (ykDim < 3) {
      ykDim = 3;
    }

    kExtents[1] = ykDim;

    GxxData = new float[xkDim * ykDim];

    GenerateGaussian Gxx = new GenerateGaussian(GxxData, kExtents, sigmas, derivOrder);

    Gxx.calc(false);

    derivOrder[0] = 0;
    derivOrder[1] = 2;
    GyyData = new float[xkDim * ykDim];

    GenerateGaussian Gyy = new GenerateGaussian(GyyData, kExtents, sigmas, derivOrder);

    Gyy.calc(false);

    float tmp;

    for (int i = 0; i < GyyData.length; i++) {
      tmp = -(GxxData[i] + GyyData[i]);

      if (tmp > 0) {
        tmp *= amplificationFactor;
      }

      GxxData[i] = tmp;
    }
  }
  /** Creates Gaussian derivative kernels. */
  private void makeKernels2D() {
    int xkDim, ykDim;
    int[] derivOrder = new int[2];

    kExtents = new int[2];
    derivOrder[0] = 2;
    derivOrder[1] = 0;

    xkDim = Math.round(8 * sigmas[0]);

    if ((xkDim % 2) == 0) {
      xkDim++;
    }

    if (xkDim < 3) {
      xkDim = 3;
    }

    kExtents[0] = xkDim;

    ykDim = Math.round(8 * sigmas[1]);

    if ((ykDim % 2) == 0) {
      ykDim++;
    }

    if (ykDim < 3) {
      ykDim = 3;
    }

    kExtents[1] = ykDim;

    GxxData = new float[xkDim * ykDim];

    GenerateGaussian Gxx = new GenerateGaussian(GxxData, kExtents, sigmas, derivOrder);

    Gxx.calc(false);
    Gxx.finalize();
    Gxx = null;

    derivOrder[0] = 0;
    derivOrder[1] = 2;
    GyyData = new float[xkDim * ykDim];

    GenerateGaussian Gyy = new GenerateGaussian(GyyData, kExtents, sigmas, derivOrder);

    Gyy.calc(false);
    Gyy.finalize();
    Gyy = null;
  }