measure_polygon_edges#
- esis.optics.measure_polygon_edges(frame, vertices, half=30, band=6, trim=0.12, clip=3.0, margin=4)[source]#
Measure every side of a polygon’s image in a frame, whatever its angle.
measure_edges()reads a side along the rows or columns it crosses, which leaves out the sides that run at 45 degrees to them, the diagonals of the octagon. Here each side, from vertexkto vertexk + 1, is resampled first: the frame is interpolated bilinearly on a grid of points one pixel apart along the side and across it, outward positive, so that the side runs down the rows of the resampled image, and fit there as one blurred straight edge by_fit_side(), the fitmeasure_edges()makes. All the sides are measured alike.- Parameters:
frame (ndarray) – The frame, indexed
[y, x]in pixels.vertices (ndarray) – The predicted vertices of the polygon, an array of shape
(N, 2)ofx, yin pixels, where pixelispans[i, i + 1), in order around it.half (int) – How far from the predicted side the edge is searched for, in pixels.
band (int) – Half the length of the profile fit across the edge, in pixels.
trim (float) – The fraction of each side left out at either end, where the corners of the polygon round it off.
clip (float) – Samples whose residual is more than this multiple of the side’s median are left out.
margin (int) – Profiles with a point closer than this to the edge of the frame are left out.
- Returns:
A table with a row per sample kept (
side(the side from vertex)sideto the next),along(the distance from that vertex alongthe predicted side),
xandy, where the fitted edge crosses thesample’s normal,
error, the formal error of that crossing alongthe normal, and
width, the standard deviation of the side’s blur,all in pixels.
- Return type: