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 http://www.w3.org/Graphics/SVG/Test


2. Convert the SVG files into Bitmaps using SharpVectorGraphics library (aka SVG#):
http://sourceforge.net/projects/svgdomcsharp
http://www.gotdotnet.com/workspaces/releases/viewuploads.aspx?id=8bcf7f55-ac4f-4778-9792-37d3e69ecf5c

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.
http://sourceforge.net/projects/exocortexdsp

More Info:
ImageMagick also using MSE for image comparison.
http://www.imagemagick.org/script/compare.php
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.

TODO:
* 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: