ext¶
C extensions and external libraries.
supreme.ext.correlate(A, B[, rows, columns, ...]) | Correlate A and B. |
supreme.ext.interp_bilinear(grey_image[, ...]) | Calculate values at given coordinates using bi-linear interpolation. |
supreme.ext.interp_transf_polygon(...[, oshape]) | |
supreme.ext.line_intersect(x0, y0, x1, y1, ...) | Calculate the intersection between two lines. |
supreme.ext.npnpoly(x_vertices, y_vertices, ...) | Calculate whether points are in a given polygon. |
supreme.ext.poly_clip(x, y, xleft, xright, ...) | Clip a polygon to the given bounding box. |
supreme.ext.poly_interp_op | Construct a linear interpolation operator based on polygon overlap. |
supreme.ext.variance_map(image[, shape]) | Calculate the variance map of a 2D image. |
correlate¶
- supreme.ext.correlate(A, B, rows=None, columns=None, mode_row='zero', mode_column='zero')¶
- Correlate A and B.
interp_bilinear¶
- supreme.ext.interp_bilinear(grey_image, transform_coords_r=None, transform_coords_c=None, mode='N', cval=0, output=None)¶
Calculate values at given coordinates using bi-linear interpolation.
The output is of shape transform_coords_*. For each pair of values (transform_coords_r,transform_coords_c) the input image is interpolated to give the output value at that point.
line_intersect¶
- supreme.ext.line_intersect(x0, y0, x1, y1, x2, y2, x3, y3)¶
Calculate the intersection between two lines.
The first line runs from (x0,y0) to (x1,y1) and the second from (x2,y2) to (x3,y3).
- Return the point of intersection, (x,y), and its type:
- 0 – Normal intersection 1 – Intersects outside given segments 2 – Parallel 3 – Co-incident
npnpoly¶
- supreme.ext.npnpoly(x_vertices, y_vertices, x_points, y_points)¶
Calculate whether points are in a given polygon.
Returns a boolean array of length len(x_points).
poly_clip¶
- supreme.ext.poly_clip(x, y, xleft, xright, ytop, ybottom)¶
Clip a polygon to the given bounding box.
x and y are 1D arrays describing the coordinates of the vertices. xleft, xright, ytop and ybottom specify the borders of the bounding box. Note that a cartesian axis system is used such that the following must hold true:
x_left < x_right y_bottom < y_top
The x and y coordinates of the vertices of the resulting polygon are returned.
poly_interp_op¶
- supreme.ext.poly_interp_op()¶
Construct a linear interpolation operator based on polygon overlap.
Parameters: MM, NN : int
Shape of the high-resolution source frame.
M, N : int
Shape of the low-resolution target frame.
H : (3, 3) ndarray
Transformation matrix that warps the high-resolution image to the low-resolution image.
Returns: op : (M*N, MM*NN) sparse array
Interpolation operator.
variance_map¶
- supreme.ext.variance_map(image, shape=(3, 3))¶
Calculate the variance map of a 2D image.
image – of shape MxN shape – shape of window over which variance is calculated
A window of given shape is moved over the image, and at each point the variance of all the pixels in the window is stored.