# The Image Ray Transform

The image ray transform is a novel technique to aid extraction of circular and tubular structural features and image symmetry. It uses a subset of the laws of optics (refraction and total internal reflection) and a simple ray tracing algorithm to use the paths of rays through an image to produce a transformed image. A demo and examples are also available.

We begin by analogising the input image as a set of glass blocks. These glass blocks have their refractive indices decided by their intensity. They also have a special property that rays are either entirely transmitted through refraction or totally internally reflected, that is, rays do not split into two parts.

### Refractive Indices

The refractive indices of the blocks can be assigned in a number of ways.

Linearly. If i is the intensity of a pixel represented by a block, and nmax is a parameter describing the maximum refractive index, we can space the refractive indices ,i>n, linearly between 1 and nmax.

Exponentially. We can also space the indices exponentially to provide greater variance. This uses the parameter k instead of nmax.

With these schemes the highest refractive index will always be linked to the highest intensity. The intensities of the image can be transformed so that an alternative intensity has the highest value.

Further to this, we can also calculate refractive indices from edge strength rather than intensity in order to extract different features.

### Tracing Rays

The output image is formed from the sum of the course of a number of rays. Each ray is initialised within the image with a random position and direction, and then followed through the image until it either exits the boundaries or undergoes d reflections or refractions or travels the maximum length l.

When a ray is moved along its path and undergoes a change in media, that is moving from a pixel of one refractive index to another, then a new path has to be calculated. If moving from a higher to lower refractive index at an angle of incidence greater than the critical angle then total internal reflection occurs. Otherwise the course of the ray is calculated by Snell's Law. The normals that are used in these calculations are the normals of the edge direction at each pixel rather than those of the pixel boundaries as this provides a better result.

### Beams

By tracing multiple rays simulataneously and forcing them to follow a similar path to each other the result produced by the transform can be improved. A number of rays are initialised in a line and traced normally. After each step in their tracing the direction of all the rays are adjusted towards the mean direction of the beam. γv controls the speed at which the directions converge.

### Symmetry

Reisfeld's generalised symmetry operator [1] finds the reflectional symmetry across an entire image by comparing pairs of points. We can calculate and alternative symmetry image by comparing the course of two initially parallel rays in an edge image using the generalised symmetry operator. We compare every point in the path of the first ray with every point in the path of the second, and accumulate the symmetry value at the midpoint of the two points.

[1] D. Reisfeld, H. Wolfson, and Y. Yeshurun. Context-free attentional operators: the generalized symmetry transform. International Journal of Computer Vision, 14(2):119–130, 1995. 4