Monday, June 13, 2005

Automatic testing System.Drawing

I have finished the prototype of automatic testing System.Drawing:

1. Use W3C SVG conformance test suite as input test files

2. Convert the SVG files into Bitmaps using SharpVectorGraphics library (aka SVG#):

3. Compare the Bitmaps with the expected PNG images using FFT (Fast Fourier Transform) and MSE (Mean Square Error).
It is the Cumulative squared error between the compressed and the original image.

M N 2
MSE = 1/MN ∑ ∑ [I (x, y) –I’ (x, y)]
Y=1 X=1

I (x, y) = original image,
I’ (x, y)= approximation of decompressed image
M, N = dimensions of the images

The FFT of the images was calculated using the ExocortexDSP library.

More Info:
ImageMagick also using MSE for image comparison.
If MSE is not "fine" enough, we will add more compare algorithms to the process, and combine the results into a value which will estimate the similarities.

* FFT of 8x8 sub regions
* have images using the same file format
* resize images to be the same size
* reduce images colors
* lowering resolution
A percentage match can be found by measuring the level of similarity of several processes:
* Color - strip boarders, compare histograms to get top colors and areas.
* Edge Detect - edge detection, and line generation, compare line lists.
* Histogram to detect shapes

No comments: