예제 #1
0
  public double calculateFrameWidthPix() {
    if (farEdge == null || farEdge.stdDev > worstEdgeStdDevAllowed) {
      if (sprocketEdge == null || sprocketEdge.stdDev > worstEdgeStdDevAllowed) return -1.0;
      else {
        // The frame center in the image will happen along the sprocket hole line
        //  right in between the two images. This will also need to change to the appropriate
        //  place along that line (not right between the two edges. .. actually, to
        //  make things even simpler for now I will make it exactly between the sprocket
        //  hole and the far edge.
        //
        // first determine the scale factor ...
        //
        double distPix = PolarLineFit.perpendicularDistance(fit, sprocketEdge.c, sprocketEdge.r);
        // we need to increase this amount by the percentage
        //   that the frame occupies when going from sprocket
        //   center to the far edge
        double scaleScale =
            FilmSpec.filmAttribute(filmType, FilmSpec.frameWidthIndex)
                / ((FilmSpec.filmAttribute(filmType, FilmSpec.edgeToEdgeIndex)
                    + (FilmSpec.filmAttribute(filmType, FilmSpec.widthIndex) / 2.0)));
        distPix *= scaleScale;

        // distPix is now the calculated frame width in pixels for this frame.

        return distPix;
      }
    } else {
      // The frame center in the image will happen along the sprocket hole line
      //  right in between the two images. This will also need to change to the appropriate
      //  place along that line (not right between the two edges. .. actually, to
      //  make things even simpler for now I will make it exactly between the sprocket
      //  hole and the far edge.
      //
      // first determine the scale factor ...
      //
      double distPix = PolarLineFit.perpendicularDistance(fit, farEdge.c, farEdge.r);

      // we need to reduce this amount by the percentage
      //   that the frame occupies when going from sprocket
      //   center to the far edge
      double scaleScale =
          FilmSpec.filmAttribute(filmType, FilmSpec.frameWidthIndex) / centerSprocketToFarEdgemm;

      // scaleScale is now the ratio of the frame width to the
      //  distance from the center of the sprocket to the far edge. This
      //  will be less than 1.0
      distPix *= scaleScale;

      // distPix is now the calculated frame width in pixels for this frame.

      return distPix;
    }
  }