# Evaluate image symmetry

I am trying to evaluate the symmetry of an image with Matlab. My approach is far is based on:

• convert image to BW
• get 2D gaussian from the BW pixel cloud
• get center and axis
• rotate to get horizontal and vertical axis
• mirror from center to the right
• compare (left side) with (mirrored right side) using MSE

The results are usually ok but I think that maybe this could be improved for shapes with unusual contours.

Any alternative or suggestion for improvement?

• Could you share an image for reference? – Royi May 12 '18 at 8:31
• What is “get 2D Gaussian”? Are you fitting a Gaussian? Applying a Gaussian filter? – Cris Luengo May 22 '18 at 12:47
• I am working with medical images (usually with symmetry) but they are not always centered. If you consider all the white points (image) as calculate a gaussian (1 cluster) then you can find the horizontal and vertical center. – Filipe Pinto May 22 '18 at 14:54

A practical approach with centering, filtering, derivative, etc. may provide some results. Taking a step back on associated properties, for instance in the Fourier domain, may give you different insights, since symmetry is not well-defined per se (local or global, radial or axis, etc.). I am thinking specifically of the phase-based approach in Peter Kovesi, Symmetry and Asymmetry from Local Phase, 1997:

Symmetry is an important mechanism by which we identify the structure of objects. Man-made objects, plants and animals are usually highly recognizable from the symmetry, or partial symmetries that they often exhibit. Two difficulties found in most symmetry detection algorithms are firstly, that they usually require objects to be segmented prior to any symmetry analysis, and secondly, that they do not provide any absolute measure of the degree of symmetry at any point in an image. This paper presents a new measure of symmetry that is based on the analysis of local frequency information. It is shown that points of symmetry and asymmetry give rise to easily recognized patterns of local phase. This phase information can be used to construct a contrast invariant measure of symmetry that does not require any prior recognition or segmentation of objects.

Here are examples for testing local symmetry:

And some Matlab code, for instance phasesym.m in Peter Kovesi Matlab functions.

One suggestion could be using image derivative. To get rid of effects of different shading and light, instead of BW, use derivative of the image in step 1.