Skip to content

FastIC samples

AvadoAvakado edited this page Dec 1, 2020 · 5 revisions

Here is some examples of using FastIC's Comparator with different set ups:

1) Default contructor for comparing same pictures


`new Comparator().compareImages(new File("firstImagePath"), new File("firstImagePath"));`

Returns: true

Image: Resized image 10x10 (zoomed):

Simplified image 10x10 (zoomed):

2) Default constructor for comparing different pictures


`new Comparator().compareImages(new File("firstImagePath"), new File("secondImagePath"));`

Returns: false

First image Second image
First image resized 10x10(zoomed) Second image resized 10x10(zoomed)
First image simplified 10x10(zoomed) Second image simplified 10x10(zoomed)

3) Default constructor for comparing image and it's extended copy


`new Comparator().compareImages(new File("firstImagePath"), new File("firstExtendedImagePath"));`

Returns: true

First image(png 512x512) Extended copy (png 512x650)
First image resized 10x10(zoomed) Extended copy resized 10x10(zoomed)
First image simplified 10x10(zoomed) Extended copy simplified 10x10(zoomed)

4) Default constructor for comparing image and it's copy with line


`new Comparator().compareImages(new File("firstImagePath"), new File("firstImageWithLinePath"));`

Returns: false

First image Copy with line
First image resized 10x10(zoomed) Copy with line resized 10x10(zoomed)
First image simplified 10x10(zoomed) Copy with line simplified 10x10(zoomed)

5) Comparator with tuned 'PercentageOfAllowableDifference' value for comparing image and it's copy with line


`Comparator comp = new Comparator();`

comp.setPercentageOfAllowableDifference(4);

comp.compareImages(new File("firstImagePath"), new File("firstImageWithLinePath"));

Returns: true

NOTE:

if you look at the simplified pictures, you can notice that only 4 pixels differ in the simplified pictures, which at a picture resolution of 10x10 is exactly 4 percent indicated during tuning

First image Copy with line
First image resized 10x10(zoomed) Copy with line resized 10x10(zoomed)
First image simplified 10x10(zoomed) Copy with line simplified 10x10(zoomed)

6) Fully tuned comparator for comparing image and it's copy with line


`Comparator comp = new Comparator(HashDetailing.HASH_DETAILING_6, 20, 4);` `comp.compareImages(new File("firstImagePath"), new File("firstImageWithLinePath"));`

Returns: false

First image Copy with line
First image resized 20x20(zoomed) Copy with line resized 20x20(zoomed)
First image simplified 20x20(zoomed) Copy with line simplified 20x20(zoomed)