Physics, Psychophysics and Physiology of Vision Practical Practical One - Colour Imaging

10%, to be completed by 7/2/2003

1. Objective

In the lectures, you have heard about different colour models or representations and about 'colour constancy'. The aim of this practical is to illustrate some of these concepts and to exercise some of the techniques used in the colour image processing.

2. Procedure

Carry out each of the steps listed below and, as in the Machine Vision practicals last term, write a brief report containing:
  Include any code you write yourself (suitably commented) in an appendix.

3. Exercises

Three sets of images, all in ppm format, may be copied as required from the directories: Select five examples from each set for the exercises below. Note that many of the images are rather dark, so it is best to view (but not process) the originals after histogram equalisation, for example using xv.

3.1 Image Data

Use xv, any other convenient tools, or write your own procedure in IDL to crop or define regions of interest on: It is important to ensure, especially if a cropping tool is used to define the regions by hand, that the selected regions within each image set are exactly the same size, P x Q. It is thus best to use the crop tool and mouse in xv to define the regions of interest and then to select them using IDL. If necessary rows or columns may be deleted from the requisite images afterwards. If you find it difficult to select cropped regions from the images themselves, the white templates (NB. not the grey which is a region of uncertainty that may or may not be part of the object) in the images in: define the requisite objects in each correpondingly named image.Variations in size of the selected regions between sets are unimportant and it does not matter if the selected regions correspond to different parts of the same object, athough they should be representative of the object.

Use xv and IDL to convert image formats and to extract the RGB components of the images so they can be accessed as matrices for processing as described in sections 3.2-3.5 below. See the notes prepared earlier by Ioannis Douros for the second MV practical on image preparation for further details, in particular on how to set up image matrices for each colour channel. As usual, it is probably best to perform all of the operations indicated on one of the images or image sets first in order to be sure that your implementation works and to minimise the number of images and intermediate results you have to store.

3.2 Colour variation in RGB space

Compute the mean colour of each chosen image in RGB space, construct the scatter matrix and find the principal components of the colour distribution for each image. Repeat the calculation of the mean and principal components using data from all the chosen images within each of the three sets (ie take the mean over all five of your chosen images etc.).

View the images and image regions used and consider the variations in the results of means and PCA within each set, comment on them in light of what you would expect from Schafer's dichromatic reflectivity model and indicate what the results tell you (if anything) about the lighting conditions under which each of the three sets of images was taken.

If time allows, it may help to plot the mean colour and a representation of the principal components of variation; eg the principal (eigen)vectors, the eigenvectors scaled by the standard deviation along that vector, or an ellipsoidal surface of the corresponding Gaussian probability distrubtion. Remember, if you do this, to use the mean colour as a reference yfor plotting the components of variation or a surface of the probability distribution.

3.3 Colour (row) normalisation and analysis of chromaticity

Compute the normalised colour representastion rgb of each of the chosen images, calculate the mean rgb colours or chromaticity and repeat the PCA analysis in the rgb space. If the images are regarded as PQ x 3 rectangular matrices as in the work of Finlayson et al (1998), colour normalisation corresponds to row normalistion of the rectangular matrices.

One of the principal components should now be zero with its axis oriented along the white direction. Explain why this should be so and check that your results are consistent with it. View the images resulting from the normalisation, compare the results of the PCA obtained in the rgb space with those obtained previously and comment on what you find. Be as quantitative as possible in making this comparison.

If time allows, investigate what happens if a Euclidean norm is used to define the normalised colours or chromaticities.

3.4 Pixel (column) normalisation

Normalise each original RGB image within each colour channel by summing over all the pixel values and, as in the work of Finlayson et al (1998), scaling the result by a factor of PQ/3. Calculate the mean colours and principal axes of these normalised images as in 3.2 above, view the resulting images and comment on the results obtained.

Similarly, normalise and scale the images in rgb representaion as obtained in section 3.3 above. Use only the conventional normalisation R+G+B for this step. VIew the images resulting from this normalisation and comment on the results obtained both in comparison to those from the unmodified RGB images imediately above (this section, 3.4) and in comparison to those from the rgb (row) normalised images in 3.3 above.

3.5 Comprehensive normalisation

Carry out a comprehensive normalisation of the images as described in the work of Finlayson et al (1998) by iteratively repeating the row normalisation described in section 3.3 and the column normalisation in section 3.4.

Comment on the convergence of this iterative procedure and view the comprehensively normalised images. Calculate the mean colour of the comprehensively normalised images and carry out a similar PCA analysis of their distributions in colour space to those described above. Comment on the results obtained and on the potential significance of each of the three types of normalisation procedure.

4. Reporting

As usual, beware of labouring long and hard to produce a pretty report. There is a rapidly diminishing rate of return for such efforts. Evidence that the exercise has been completed and content of the report is much more important than presentation. Adequate presentation and analysis of the original and normalised images should however, be included in your report, as part of this evidence.

Bernard Buxton,
14 January 2002.