CS 253 geometric solution guide
CS 253 geometric solution guide from __future__ import division import math import numpy as np from scipy import spatial from .._ import get_bound_method_class, safe_as_int def _to_ndimage_mode(mode): """Convert from `` mode name to the corresponding ndimage mode.""" mode_translation_dict = dict(edge='nearest', symmetric='reflect', reflect='mirror') if mode in mode_translation_dict: mode = mode_translation_dict[mode] return mode def _center_and_normalize_points(points): """Center and normalize image points. The points are transformed in a two-step procedure that is expressed as a transformation matrix. The matrix of the resulting points is usually better conditioned than the matrix of the original points. Center the image points, such that the new coordinate system has its origin at the centroid of the image points. Normalize the image points, such that the mean distance from the points to the origin of the coordinate system is sqrt(2). Parameters ---------- points : (N, 2) array The coordinates of the image points. Returns ------- matrix : (3, 3) array The transformation matrix to obtain the new points. new_points : (N, 2) array The transformed image points. References ---------- .. [1] Hartley, Richard I. "In defense of the eight-point algorithm." Pattern Analysis and Machine Intelligence, IEEE Transactions on 19.6 (1997): 580-593. """ centroid = (points, axis=0) rms = (((points - centroid) ** 2) / [0]) norm_factor = (2) / rms matrix = ([[norm_factor, 0, -norm_factor * centroid[0]], [0, norm_factor, -norm_factor * centroid[1]], [0, 0, 1]]) pointsh = _stack([points.T, (([0]),)]) new_pointsh = (matrix, pointsh).T
Written for
- Institution
-
Georgia Institute Of Technology
- Course
-
CS 253
Document information
- Uploaded on
- August 5, 2021
- Number of pages
- 22
- Written in
- 2021/2022
- Type
- Other
- Person
- Unknown
Subjects
Also available in package deal