# Description

Check if the input image is symmetric and return a boolean value.

# Synopse

Check for conjugate symmetry

• b = iaisdftsym(F)
• b: Boolean.
• F: Image. Complex image.

# Function Code

```01. import numpy as np
02.
03. def iaisdftsym(F):
04.
05.     if len(F.shape) == 1: F = F[np.newaxis,np.newaxis,:]
06.     if len(F.shape) == 2: F = F[np.newaxis,:,:]
07.
08.     n,m,p = F.shape
09.     x,y,z = np.indices((n,m,p))
10.
11.     Xnovo = np.mod(-1*x,n)
12.     Ynovo = np.mod(-1*y,m)
13.     Znovo = np.mod(-1*z,p)
14.
15.     aux = np.conjugate(F[Xnovo,Ynovo,Znovo])
16.
17.     return (abs(F-aux)<10E-4).all()```

# Examples

## Numeric Example: 1D data

```1. import numpy as np
2. import ia636 as ia
3.
4. F = np.arange(5)
5. print 'Is 1d odd dimension vetor symmetric?',ia.iaisdftsym(F),'\n'
6. F =  np.arange(6)
7. print 'Is 1d even dimension vetor symmetric?',ia.iaisdftsym(F),'\n'
8. F = np.array( [1j,1j,0,1j,1j] )
9. print 'Is 1d even dimension vetor symmetric?',ia.iaisdftsym(F),'\n'```
```Is 1d odd dimension vetor symmetric? False

Is 1d even dimension vetor symmetric? False

Is 1d even dimension vetor symmetric? False
```

## Numeric Example: real matrix

```1. F = np.array( [ [0,1],
2.                 [2,3] ] )
3. print 'Is function F symmetric?',ia.iaisdftsym(F),'\n'```
```Is function F symmetric? True
```

## Numeric Example: imaginary matrix

```1. F = np.array([ [2j,1j],
2.                [1j,2j] ] )
3. print 'Is function F symmetric?',ia.iaisdftsym(F),'\n'
4.
5. F = np.array( [ [ 2j,0, 1j],
6.                 [-1j,0,-2j] ] )
7. print 'Is function F symmetric?',ia.iaisdftsym(F),'\n'```
```Is function F symmetric? False

Is function F symmetric? False
```

## Numeric Example: Fourier transformation of a real image is symmetric

```1. import numpy as np
2.
3. print 'Is this function symmetric?'
4. print ia.iaisdftsym(np.fft.fft2(np.random.rand(100,100))) # dimension variation
5. print ia.iaisdftsym(np.fft.fft2(np.random.rand(101,100)))
6. print ia.iaisdftsym(np.fft.fft2(np.random.rand(101,101)))```
```Is this function symmetric?
True
True
True
```

## Image Example: circular filter

```1. img = adreadgray('cameraman.tif')
3. imgc = 1 * ia.iacircle(img.shape, 50, [img.shape[0]/2, img.shape[1]/2])
4. imgct = ia.iaptrans(imgc, array(imgc.shape)/2)
6. res = F * imgct
8. print 'Is this filter symmetric?', ia.iaisdftsym(res)```
```Is this filter symmetric? True
```

## Image Example 2: retangular filter

```1. mquadra = ia.iarectangle(img.shape, [50,50], [img.shape[0]/2, img.shape[1]/2])
```Is this filter symmetric? False