Skip to main content
Home
plus.maths.org

Secondary menu

  • My list
  • About Plus
  • Sponsors
  • Subscribe
  • Contact Us
  • Log in
  • Main navigation

  • Home
  • Articles
  • Collections
  • Podcasts
  • Maths in a minute
  • Puzzles
  • Videos
  • Topics and tags
  • For

    • cat icon
      Curiosity
    • newspaper icon
      Media
    • graduation icon
      Education
    • briefcase icon
      Policy

      Popular topics and tags

      Shapes

      • Geometry
      • Vectors and matrices
      • Topology
      • Networks and graph theory
      • Fractals

      Numbers

      • Number theory
      • Arithmetic
      • Prime numbers
      • Fermat's last theorem
      • Cryptography

      Computing and information

      • Quantum computing
      • Complexity
      • Information theory
      • Artificial intelligence and machine learning
      • Algorithm

      Data and probability

      • Statistics
      • Probability and uncertainty
      • Randomness

      Abstract structures

      • Symmetry
      • Algebra and group theory
      • Vectors and matrices

      Physics

      • Fluid dynamics
      • Quantum physics
      • General relativity, gravity and black holes
      • Entropy and thermodynamics
      • String theory and quantum gravity

      Arts, humanities and sport

      • History and philosophy of mathematics
      • Art and Music
      • Language
      • Sport

      Logic, proof and strategy

      • Logic
      • Proof
      • Game theory

      Calculus and analysis

      • Differential equations
      • Calculus

      Towards applications

      • Mathematical modelling
      • Dynamical systems and Chaos

      Applications

      • Medicine and health
      • Epidemiology
      • Biology
      • Economics and finance
      • Engineering and architecture
      • Weather forecasting
      • Climate change

      Understanding of mathematics

      • Public understanding of mathematics
      • Education

      Get your maths quickly

      • Maths in a minute

      Main menu

    • Home
    • Articles
    • Collections
    • Podcasts
    • Maths in a minute
    • Puzzles
    • Videos
    • Topics and tags
    • Audiences

      • cat icon
        Curiosity
      • newspaper icon
        Media
      • graduation icon
        Education
      • briefcase icon
        Policy

      Secondary menu

    • My list
    • About Plus
    • Sponsors
    • Subscribe
    • Contact Us
    • Log in
    • Face to face

      5 July, 2011
      Back to the Maths inside 2011 page

      How would it feel to look in a mirror and see not your own reflection but instead how you would look as the opposite sex? You can explore this strange alternate reality at this year's Royal Society Summer Science Exhibition where Peter McOwan and his colleagues from Queen Mary, University of London and University College London will use mathematical wizardry to produce gender reversed images of faces.

      Despite the crisp clear details and blended colours, a photo is just a series of dots, called pixels, of different colours. Any photo, including one of your own lovely visage, is represented in a computer as a long string of numbers, each representing the colour at a particular pixel. Just as a string of three numbers marks a point in three-dimensional space (it gives its coordinates), so a string of N numbers sits in what mathematicians think of as N-dimensional space: so mathematically you can think of a photo as a point in an N-dimensional space, where N is the number of pixels in the photo.

      McOwan and his colleagues are interested in how faces differ and so have gathered thousands of photos of different faces, male and female, young and old and of different ethnicities. After the photos are tweaked slightly to make the major features, such as the eyes, nose and mouth, roughly align, the points corresponding to the photos in N-dimensional space will cluster together. This is because the fact that they all represent faces gives rise to similarities in the coloured pixels (eg similar coloured pixels across the cheeks and forehead, darker pixels in the eye regions and defining the nose shape).

      The researchers are only interested in this region of N-dimensional space containing the photos of faces — a region called the face space. And to map out this region they use a statistical technique called principal component analysis or PCA.

      The average female and average male face.

      First of all the researchers calculate the average face by simply averaging the values at each pixel over all the photos in the set. This new string of numbers represents the average face and the position of the points representing the other faces show how they differ from the average face.

      Principal component analysis uses a statistical concept called variance to measure how the set of faces, viewed as points in N-dimensional space, is spread out. It calculates the first principal component to be the direction from the average face in which the set spreads out the most. Then it looks for the second principal component: the direction that is perpendicular to the first component, in which the set spreads out the most. Then for a third principal component, perpendicular to the first two, in which the set spreads out the most, and so on.

      Using PCA, McOwan and his colleagues produced a face space in which each face is represented by a string of 20, rather than N, numbers, giving a much more manageable 20 dimensions. These dimensions correspond to the first 20 principal components. Any face is represented by a point in the face space, with the coordinates describing just how that face differs from the average face with respect to each of these principal components.

      Faces change as you move along one of the principal components. The left-most image sits at one end of the principal component vector, then moves closer to the average face (centre image), until finally it reaches the antiface (the right-most image) of the left-most image, at the opposite end of the principal component vector.

      The researchers have established a female and a male face space using thousands of photos of faces, showing how faces differ from other faces of the same gender. And what's more they can map these male and female face spaces to each other. At the exhibit you can explore these face spaces and create a face by choosing its position in the female face space. And then, before your very eyes the researchers will show you the male face that lies at the same sport in the male face space — the male reflection of your created female face!

      In addition to changing genders, the maths of PCA also allows the researchers to transport the facial expressions from one face to another. So if you are intrigued by how your facial expressions would look like on a member of the opposite sex, then visit McOwan and his colleagues at the Royal Society Summer Exhibition in July 2011. You'll never look at yourself, or mathematics, in the same way again!

      Further reading

      You can read more about this research and the Facing up to faces exhibit in the latest issue of cs4fn.

      This article accompanies an exhibit at the Royal Society Summer Science Exhibition 2011 entitled Facing up to faces: perception from brains to robots. It is part of the Maths Inside project, run by the Mathematics Promotion Unit (a collaboration between the London Mathematical Society and the Institute of Mathematics and its Applications) in conjunction with Plus and the Royal Society.



      Read more about...
      public understanding of mathematics
      linear algebra
      maths inside
      principal component analysis
      • Log in or register to post comments

      Read more about...

      public understanding of mathematics
      linear algebra
      maths inside
      principal component analysis
      University of Cambridge logo

      Plus is part of the family of activities in the Millennium Mathematics Project.
      Copyright © 1997 - 2025. University of Cambridge. All rights reserved.

      Terms