swtloc.core.swt_strokes_jitted
- swtloc.core.swt_strokes_jitted(edged_image, hstep_mat, vstep_mat, dstep_mat, max_stroke_width, min_stroke_width, image_height, image_width, check_angle_deviation, image_gradient_theta, max_angle_deviation, include_edges_in_swt)
Core Logic for Stroke Width Transform. Implementing the work of [Boris Epshtein, Eyal Ofek & Yonatan Wexler](https://www.microsoft.com/en-us/research/publication/detecting-text-in-natural-scenes-with-stroke-width-transform/)
Objective of this function is to, given an edged input image, find the stroke widths conforming to the following rules :
Each Stroke Width has be in the range of : min_stroke_width<= stroke_widths<=max_stroke_width
A ray emanating from each edge point, traveling in its gradients direction, when met with another
edge point will terminate its journey only when the difference between their gradient directional angles is np.pi - max_angle_deviation <= theta_diff <= np.pi + max_angle_deviation
- Parameters
edged_image (np.ndarray) – Edges of the Original Input Image. Same size as the original image
hstep_mat (np.ndarray) – For each pixel, cos(gradient_theta), where gradient_theta is the gradient angle for that pixel, representing length of horizontal movement for every unit movement in gradients direction. Same size as the original image
vstep_mat (np.ndarray) – For each pixel, sin(gradient_theta), where gradient_theta is the gradient angle for that pixel, representing length of vertical movement for every unit movement in gradients direction. Same size as the original image
dstep_mat (np.ndarray) – np.sqrt(hstep_mat**2+vstep_mat**2)
max_stroke_width (int) – Maximum Stroke Width which would be permissible
min_stroke_width (int) – Minimum Stroke Width which would be required
image_height (int) – Height of the image
image_width (int) – Width of the image
check_angle_deviation (bool) – Whether to check the angle deviation to terminate the ray
image_gradient_theta (np.ndarray) – Gradient array of the input image
max_angle_deviation (float) – Maximum Angle Deviation which would be permissible
include_edges_in_swt (bool) – Whether to include edges in the final SWT result
- Returns
Stroke Width Transformed Image, each stroke filled with stroke length.
- Return type
(np.ndarray)