Software Listing of Author : "David Young"
- 2-D convolution using the FFT
- License: Shareware
- Price:


This function can be used instead of CONV2 (with the same arguments). It will produce the same results to within a small tolerance, and may be faster in some cases (and slower in others). Two additional shape options are included, offering periodic and reflective boundary conditions. The Convolution Theorem states that convolution in the time or space domain is equivalent to multiplication in the frequency domain. Convolution may therefore be implemented using ifft2(fft(x) .* fft(m)), where x and m are the arrays to be convolved. The fiddly part is getting the array positioning and padding right so that the results are consistent with the conventional convolution function, CONV2. CONV_FFT2 handles these problems, offering a potentially more efficent plug-in replacement for CONV2. In practice, whether this is faster depends on many...
- Publisher: David Young
- Date Released: 24-04-2013
- Download Size: 10 KB
- Download
- Platform: Matlab, Scripts
- A multidimensional map class
- License: Shareware
- Price:


MapN provides a multidimensional map container. A MapN object contains key lists and values. A value is some unit of data that you want stored in the MapN object, and a key list is a unique reference to that data. MapN is modelled on containers.Map, but whereas a containers.Map object is indexed by a single scalar or string key, a MapN object is indexed by an ordered set of such keys, expressed as a comma-separated list of arguments. A MapN object is constructed like this: M = MapN(); Values are stored using M(key1, key2, ...) = value, for example: M(1, 'a') = 'a string value'; M(1, 'b') = 287.2; M(2) = [1 2 3; 4 5 6]; M(2, 'x', pi) = {'a' 'cell' 'array'}; and values are retrieved using M(key1, key2, ...), for example v = M(1, 'b'); u = M(2); This contribution also includes a memoize function, inspired by the...
- Publisher: David Young
- Date Released: 06-06-2013
- Download Size: 10 KB
- Download
- Platform: Matlab, Scripts
- Affine optic flow
- License: Shareware
- Price:


An affine (or first-order) optic flow model has 6 parameters, describing image translation, dilation, rotation and shear. The class affine_flow provides methods to estimates these parameters for two frames of an image sequence. The class implements a least-squares fit of the parameters to estimates of the spatial and temporal grey-level gradients. This is an extension of the well-known Lucas-Kanade method. The images are either sampled conventionally, on a rectilinear grid, or on a log-polar grid. In the latter case, the class may iteratively refine its estimates by moving the sampling grid to track the motion. Options to specify a region of interest and smoothing and sampling parameters are provided. The file includes a demonstration of the class, and test images for this. The functions for smoothing images and estimating gradients...
- Publisher: David Young
- Date Released: 05-05-2013
- Download Size: 502 KB
- Download
- Platform: Matlab, Scripts
- Elementary Cellular Automata
- License: Shareware
- Price:


There are 256 elementary cellular automata, where "elementary" means that there is a single row of cells, with binary values, and update rules that depend only on nearest-neighbour interactions. They are described at http://mathworld.wolfram.com/ElementaryCel...rAutomaton.html Our artist in residence asked if anyone had a program that would generate the patterns produced by these simple automata. I said it would only take a few minutes to write one in Matlab. Here's the result. It demonstrates the use of sub2ind to write very compact code. In this function, the width of the pattern (the length of the array of cells) may be restricted, in which case the 1D array is taken to be circular to determine the states of the end elements. Random noise may also be added to the processing if required.
- Publisher: David Young
- Date Released: 24-06-2013
- Download Size: 10 KB
- Download
- Platform: Matlab, Scripts
- Extended array indexing
- License: Shareware
- Price:


Given an array, it is possible to imagine a virtual array formed by padding the original array out in all directions. Valid subscripts for this virtual array range through all the negative and positive integers, without regard to the size of the original. This function implements this idea. The padding out can be done in many ways. The following are implemented: using a constant value; replicating the border elements of the original; tiling the virtual array with copies of the original; tiling the virtual array with copies that have been flipped so that there is mirror symmetry along the borders of every copy. A different rule may be specified for each dimension. The function is related to padarray, repmat and circshift, and padarray's option strings have been retained for consistency. However, exindex is more flexible than any of...
- Publisher: David Young
- Date Released: 07-06-2013
- Download Size: 10 KB
- Download
- Platform: Matlab, Scripts
- Extended Brookshear Machine emulator and assembler
- License: Shareware
- Price:


This is an emulator for the machine described in Computer Science: An Overview, 10th edition, by J. Glenn Brookshear (Pearson Education, 2008). It is extended with some additional instructions and the machine is equipped with a bitmapped display. The emulator is intended for teaching and learning. It has been used successfully in an introductory computer systems course in the first term (semester) of a computer science programme. The machine has 256 1-byte memory cells, 16 1-byte registers, and an instruction set with 16 operations. It may be programmed by entering machine code into the emulator, or using a simple assembly language. The emulator is managed using a GUI, started by executing bmachine, which is in the top level of the directory. The GUI allows memory and register contents to be viewed in a variety of ways (as binary,...
- Publisher: David Young
- Date Released: 01-06-2013
- Download Size: 102 KB
- Download
- Platform: Matlab, Scripts
- Fast 2-D convolution
- License: Shareware
- Price:


CONVOLVE2 can be used wherever CONV2 is used, taking the same arguments and returning the same results to within a small tolerance. The computation is speeded up by using the singular value decomposition of the mask to express it as a sum of outer products. Each of these can be computed efficiently as convolution with a row and a column vector. CONV2 is used to carry out the individual convolutions. Separable masks are a particular case and are handled by CONVOLVE2 much as FILTER2 does. Many other masks which are not separable have low rank (e.g. Gabor function masks) and are handled more efficiently by CONVOLVE2. The function will also compute a reduced-rank approximation to a given mask if required and will use this if it will speed up the computation. An extra argument allows control over the error. Additional shape options...
- Publisher: David Young
- Date Released: 12-04-2013
- Download Size: 10 KB
- Download
- Platform: Matlab, Scripts
- Fourier transform demonstration
- License: Shareware
- Price:


This demonstration is intended for people who know something about the theory of the discrete Fourier transform, and who would find it helpful to see some its properties demonstrated graphically, using a programming language. The demonstration shows the form of the Fourier components of a signal in 1-D and in 2-D, and shows how elementary filtering can be applied in the Fourier domain.
- Publisher: David Young
- Date Released: 20-05-2013
- Download Size: 788 KB
- Download
- Platform: Matlab, Scripts
- Image correspondences using cross-correlation
- License: Shareware
- Price:


Finding corresponding features in a pair of images is the basis of many optic flow, stereo vision and image registration algorithms. One straightforward approach to finding a match is to take a small patch of one image, compute its sliding cross-correlation with the other image, and find a peak. This submission supplies a class which implements this method. There are many other ways of finding correspondences, but normalised cross-correlation is relatively easy to understand, and fairly effective if a sparse set of matches is sufficient and the change in viewpoint is not too large. This submission is intended largely as a learning aid, though it may be usable for some applications. A demonstration script is therefore included. The algorithm extends the basic idea in two ways. First, a reverse match may be done on each feature pair to...
- Publisher: David Young
- Date Released: 19-03-2013
- Download Size: 758 KB
- Download
- Platform: Matlab, Scripts
- Image gradients with Gaussian smoothing
- License: Shareware
- Price:


Carries out Gaussian smoothing followed by differencing as a way of estimating the gradients of a grey-level image in the X and Y directions. This is the initial stage of the well-known Canny edge detector, but the gradients can be used for many other applications. The function offers independent control of the smoothing parameters. Particular care is taken of how pixels close to the image boundaries are treated. By default, the output gradient arrays are smaller than the image so that only valid values need be computed, but an option allows them to be the same size as the image. Values close to the boundaries are then computed by extrapolation of the image using reflection or tiling. The zip file includes a separate function, gsmooth2, that carries out Gaussian smoothing, and the convenience function exindex that simplifies...
- Publisher: David Young
- Date Released: 10-05-2013
- Download Size: 10 KB
- Download
- Platform: Matlab, Scripts
- Log-polar image sampling
- License: Shareware
- Price:


Images sampled on a log-polar grid have interesting and useful properties. Rotation and scaling are trivial operations, and this can lead to efficient algorithms for straight line detection and optic flow estimation. Such sampling schemes also provide a rough model of biological foveal vision, of interest in the development of active computer vision systems. The functions in this file carry out resampling from a conventional image to a log-polar image, and back. There is usually considerable information loss in each direction, but resampling to log-polar can still be useful for computational experiments. The toolbox function imtransform does the main work; these functions are a front end to it.
- Publisher: David Young
- Date Released: 15-05-2013
- Download Size: 10 KB
- Download
- Platform: Matlab, Scripts
- Logarithm of complex sine and cosine avoiding overflow
- License: Shareware
- Price:


log(cos(Z)) and log(sin(Z)) return infinities for abs(imag(Z)) > 711 in double precision, or abs(imag(Z)) > 90 in single precision. The overflow occurs in the trigonometric function; the correct final result has about the same magnitude as Z, and can be readily computed. Using logcos(Z) or logsin(Z) instead of log(cos(Z)) or log(sin(Z)) respectively avoids the overflow, greatly extending the range of arguments which give a useful result. The functions exploit a simple approximation; this is only applied when the approximation error is less than the precision to which numbers can be represented, so there is no loss of accuracy. Both single and double precision computation are supported. Note that there is no point in using these functions when computing with real numbers, or with complex numbers if it is known that the imaginary part...
- Publisher: David Young
- Date Released: 19-04-2013
- Download Size: 10 KB
- Download
- Platform: Matlab, Scripts