Ejemplo n.º 1
0
    /**
     * Method to calculate alpha and t as indices from the radon transformed image of a view.
     * Neccessary are the inverse projection image (as SimpleMatrix) and the epipolar plane E
     *
     * @param E: epipolar plane E as SimpleVector (4 entries)
     * @return: line integral value as double
     */
    private double getValueByAlphaAndT(SimpleVector E) {

      // compute corresponding epipolar lines //
      // (epipolar lines are of 3x1 = 3x4 * 4x1)
      SimpleVector l_kappa = SimpleOperators.multiply(this.P_Inverse.transposed(), E);

      // init the coordinate shift //
      int t_u = this.projectionWidth / 2;
      int t_v = this.projectionHeight / 2;

      // compute angle alpha and distance to origin t //
      double l0 = l_kappa.getElement(0);
      double l1 = l_kappa.getElement(1);
      double l2 = l_kappa.getElement(2);

      double alpha_kappa_RAD = Math.atan2(-l0, l1) + Math.PI / 2;

      double t_kappa = -l2 / Math.sqrt(l0 * l0 + l1 * l1);
      // correct the coordinate shift //
      t_kappa -= t_u * Math.cos(alpha_kappa_RAD) + t_v * Math.sin(alpha_kappa_RAD);

      // correct some alpha falling out of the radon window //
      if (alpha_kappa_RAD < 0) {
        alpha_kappa_RAD *= -1.0;
      } else if (alpha_kappa_RAD > Math.PI) {
        alpha_kappa_RAD = 2.0 * Math.PI - alpha_kappa_RAD;
      }

      // write back to l_kappa //
      l_kappa.setElementValue(0, Math.cos(alpha_kappa_RAD));
      l_kappa.setElementValue(1, Math.sin(alpha_kappa_RAD));
      l_kappa.setElementValue(2, -t_kappa);

      // calculate x and y coordinates for derived radon transformed image //
      double x = t_kappa * this.lineIncrement + 0.5 * this.radonWidth;
      double y = alpha_kappa_RAD * this.angleIncrement;

      // get intensity value out of radon transformed image //
      // (interpolation needed)
      return InterpolationOperators.interpolateLinear(this.radon, x, y);
    }
Ejemplo n.º 2
0
  /**
   * method to compute the epipolar line integrals that state the epipolar consistency conditions by
   * comparison of two views
   *
   * @param kappa_RAD: angle of epipolar plane
   * @return double[] array containing two values (one for each view's line integral)
   */
  public double[] computeEpipolarLineIntegrals(double kappa_RAD) {

    // compute points on unit-circle (3x1) //
    SimpleVector x_kappa = new SimpleVector(Math.cos(kappa_RAD), Math.sin(kappa_RAD), 1);

    // compute epipolar plane E_kappa (4x1 = 4x3 * 3x1) //
    SimpleVector E_kappa = SimpleOperators.multiply(this.K, x_kappa);

    // compute line integral out of derived radon transform //
    double value1 = view1.getValueByAlphaAndT(E_kappa);
    double value2 = view2.getValueByAlphaAndT(E_kappa);

    // both values are returned //
    return new double[] {value1, value2};
  }