/// <summary> /// Initializes a new instance of the <see cref="UVImage"/> class. /// </summary> /// <param name="rawImage">The raw sensor image.</param> /// <param name="lens">The microlens which image to represent.</param> public UVImage(ISampled2D <ColorRgb128Float> rawImage, MicroLens lens) { if (rawImage == null) { throw new ArgumentNullException("rawImage"); } if (lens == null) { throw new ArgumentNullException("lens"); } _rawImage = new InterpolatedImage(rawImage); _lens = lens; _width = rawImage.Width; _height = rawImage.Height; _xMin = -lens.Diameter / 2; _yMin = -lens.Diameter / 2; }
/// <summary> /// Initializes a new instance of the <see cref="XYImage"/> class. /// </summary> /// <param name="rawImage">The raw sensor image.</param> /// <param name="mla">The microlens collection to use.</param> /// <param name="u">Horizontal offset from the microlens center.</param> /// <param name="v">Vertical offset from the microlens center.</param> public XYImage(ISampled2D <ColorRgb128Float> rawImage, MicroLensCollection mla, int u, int v) { if (rawImage == null) { throw new ArgumentNullException("rawImage"); } if (mla == null) { throw new ArgumentNullException("mla"); } _rawImage = new InterpolatedImage(rawImage); _mla = mla; _u = u; _v = v; _width = rawImage.Width; _height = rawImage.Height; int dummy; mla.GetBounds(out _xMin, out dummy, out _yMin, out dummy); }
/// <summary> /// Gets a sample under the microlens. /// </summary> /// <typeparam name="TSample">Type of samples the image uses.</typeparam> /// <param name="image">The image to get the sample from.</param> /// <param name="u">Horizontal offset from the microlens center.</param> /// <param name="v">Vertical offset from the microlens center.</param> /// <returns>a sample from supplied <paramref name="image"/> under the microlens with given coordinates.</returns> public TSample GetUV <TSample>(IContinuous2D <TSample> image, double u, double v) { return(image[CenterX + u, CenterY + v]); }