Various patterns to scan pixels on a grid. Rectangular patterns are scanned first along the x-coordinate then the y-coordinate. Radial patterns are scanned clockwise. Transformation filters are available to apply standard transformations (e.g., rotation, scale, translation) on the coordinates.
pixelscan.pixelscan.chebyshev(point1, point2)¶Computes distance between 2D points using chebyshev metric
| Parameters: | |
|---|---|
| Returns: | Distance between point1 and point2 |
| Return type: |
pixelscan.pixelscan.circlescan(x0, y0, r1, r2)¶Scan pixels in a circle pattern around a center point
| Parameters: | |
|---|---|
| Returns: | Coordinate generator |
| Return type: | function |
pixelscan.pixelscan.clip(scan, minx=-2147483647, maxx=2147483647, miny=-2147483647, maxy=2147483647, predicate=None, abort=False)¶Bases: object
Clip coordinates that exceed boundary
| Parameters: |
|
|---|
next()¶Next point in iteration
pixelscan.pixelscan.gridscan(xi, yi, xf, yf, stepx=1, stepy=1)¶Scan pixels in a grid pattern along the x-coordinate then y-coordinate
| Parameters: | |
|---|---|
| Returns: | Coordinate generator |
| Return type: | function |
pixelscan.pixelscan.hilbertrot(n, x, y, rx, ry)¶Rotates and flips a quadrant appropriately for the Hilbert scan generator. See https://en.wikipedia.org/wiki/Hilbert_curve.
pixelscan.pixelscan.hilbertscan(size, distance)¶Scan pixels in a Hilbert curve pattern in the first quadrant. Modified algorithm from https://en.wikipedia.org/wiki/Hilbert_curve.
| Parameters: | |
|---|---|
| Returns: | Coordinate generator |
| Return type: | function |
pixelscan.pixelscan.manhattan(point1, point2)¶Computes distance between 2D points using manhattan metric
| Parameters: | |
|---|---|
| Returns: | Distance between point1 and point2 |
| Return type: |
pixelscan.pixelscan.reflection(scan, rx=False, ry=False)¶Bases: object
Reflect coordinates about x and y axes
| Parameters: |
|---|
next()¶Next point in iteration
pixelscan.pixelscan.reservoir(scan, npoints)¶Bases: object
Randomly sample points using the reservoir sampling method. This is only useful if you need exactly ‘npoints’ sampled. Otherwise use the ‘sample’ transformation to randomly sample at a given rate. This method requires storing ‘npoints’ in memory and precomputing the random selection so it may be slower than ‘sample’.
| Parameters: |
|
|---|
next()¶Next point in iteration
pixelscan.pixelscan.ringscan(x0, y0, r1, r2, metric=<function chebyshev at 0x000000000428F0B8>)¶Scan pixels in a ring pattern around a center point clockwise
| Parameters: | |
|---|---|
| Returns: | Coordinate generator |
| Return type: | function |
pixelscan.pixelscan.rotation(scan, angle=0)¶Bases: object
Rotate coordinates by given angle. If the final transformation axes do not align with the x and y axes then it may yield duplicate coordinates during scanning.
| Parameters: |
|
|---|
next()¶Next point in iteration
pixelscan.pixelscan.sample(scan, probability=1)¶Bases: object
Randomly sample points at the given probability.
| Parameters: |
|
|---|
next()¶Next point in iteration
pixelscan.pixelscan.scale(scan, sx=1, sy=1)¶Bases: object
Scale coordinates by given factor
| Parameters: |
|---|
next()¶Next point in iteration
pixelscan.pixelscan.skip(scan, start=0, stop=2147483647, step=1)¶Bases: object
Skip points at the given step size
| Parameters: |
|---|
next()¶Next point in iteration
pixelscan.pixelscan.snakescan(xi, yi, xf, yf)¶Scan pixels in a snake pattern along the x-coordinate then y-coordinate
| Parameters: | |
|---|---|
| Returns: | Coordinate generator |
| Return type: | function |
pixelscan.pixelscan.snap(scan)¶Bases: object
Snap x and y coordinates to a grid point
| Parameters: | scan (function) – Pixel scan generator |
|---|
next()¶Next point in iteration
pixelscan.pixelscan.swap(scan)¶Bases: object
Swap x and y coordinates
| Parameters: | scan (function) – Pixel scan generator |
|---|
next()¶Next point in iteration
pixelscan.pixelscan.translation(scan, tx=0, ty=0)¶Bases: object
Translate coordinates by given offset
| Parameters: |
|---|
next()¶Next point in iteration
pixelscan.pixelscan.walkscan(x0, y0, xn=0.25, xp=0.25, yn=0.25, yp=0.25)¶Scan pixels in a random walk pattern with given step probabilities. The random walk will continue indefinitely unless a skip transformation is used with the ‘stop’ parameter set or a clip transformation is used with the ‘abort’ parameter set to True. The probabilities are normalized to sum to 1.
| Parameters: |
|
|---|