pysdic.Image.evaluate_at_pixel_points#
- Image.evaluate_at_pixel_points(pixel_points, derivatives=((0, 0),))[source]#
Evaluate the image and/or several of its derivatives at given
pixel_points(ie \((u, v)\)-axis), in a single pass.For each order \((d_u, d_v)\) of
derivatives, the derivative \(\frac{\partial^{d_u + d_v} I}{\partial u^{d_u} \partial v^{d_v}}\) is returned (the image itself with \((0, 0)\)). Crossed derivatives are allowed. The search of the knots and the B-spline basis functions are computed once for all the orders and all the channels (seepysdic.imaging.rect_bivariate_spline.RectBivariateSpline).Points out of the ROI (ie out of \([y, y + height - 1] \times [x, x + width - 1]\)) or with non-finite coordinates get the value
default_value(for all the orders).Warning
pixel_pointsare a swap of the camera’s image points! Useevaluate_at_image_points()for image points.- Parameters:
pixel_points (ArrayLike) – The pixel points with shape \((N_p, 2)\), each point represented by its (row, column) coordinates.
derivatives (ArrayLike, optional (default:
((0, 0),))) – The orders \((d_u, d_v)\) to compute, shape \((R, 2)\), with \(0 \leq d_u < ku\) along the \(u\)-axis (ie the \(y\)-axis ofimage_coordinates) and \(0 \leq d_v < kv\) along the \(v\)-axis (ie the \(x\)-axis). For example((0, 0), (1, 0), (0, 1))for the image and its gradient \((\partial_u I, \partial_v I)\).
- Returns:
\(R\) arrays in float64 dtype, one per order of
derivatives(in the same order), with shape \((N_p,)\) for a grayscale image or \((N_p, C)\) for a color image.- Return type:
Tuple[numpy.ndarray, …]
- Raises:
ValueError – If the interpolation function is not constructed or a derivative order is out of range.
Examples
1import numpy 2from pysdic import Image 3 4image = Image.from_array(numpy.random.rand(480, 640)) 5pixel_points = numpy.array([[100.5, 200.25], [300.0, 10.75]]) 6 7(values,) = image.evaluate_at_pixel_points(pixel_points) 8values, d_du, d_dv = image.evaluate_at_pixel_points(pixel_points, ((0, 0), (1, 0), (0, 1)))