Create 20 Shapes being Identical in the sense of the CDF-Similarity Measure
The centroid-distance-fourier similarity measure was used as an example for feature based shape similarity.
The measure surely is not a metric: two visually different shapes can have a distance of zero, since their fourier spectra can be identical. In this homework you'll see if this property has an impact on the performance of the measure.
Create 20 versions of a given shape having distance 0 using the CDF-measure.
HERE you find the some shapes and MATLAB programs to load, save and display them.
- Transform the polygonal shape into a 1 dimensional vector by the centroid-distance-transform using equally spaced angels, i.e. create a vector showing the distance of the shape's centroid to the first intersection of rays emanating from the centroid, use rays for every 10 degrees (so the vector will have length 36). The advantage of this transform is that it is invertible (not necessarily giving the same shape though).
- transform the vector gained by the FFT in MATLAB, resulting in 36 pairs of fourier coefficients.
- change the coefficients for each frequency in a way that the spectrum does not change, i.e. create a fourier representation of a shape having the same spectrum but different phases.
- use MATLAB's IFFT to retransform the new fourier vector to a CDF-vector. If the resulting CDF-vector is not real, transform it to a real-vector by the ABS() command.
- retransform the CDF-vector (giving the distances) to a polygonal shape by the inverse CDF and plot the shape.
- Do this 20 times
- You can experiment with different shapes, the files are given below.