Updating Difference Metric score calculation

This commit is contained in:
Kushal K S V S 2017-08-02 12:25:38 -07:00
parent 6277cc4600
commit d66639a95c
8 changed files with 27 additions and 4 deletions

View File

@ -25,3 +25,4 @@ clean:

View File

@ -624,3 +624,19 @@ IMAGE* Append_Rows(IMAGE* small, IMAGE* big){
return result;
}
int Image_Diff( IMAGE* base, IMAGE* test){
int diff = 0;
int max_width = MAX(base->width, test->width);
int min_width = MIN(base->width, test->width);
int max_height = MAX(base->height, test->height);
int min_height = MIN(base->height, test->height);
diff = (max_width - min_width) * max_height;
diff += (max_height - min_height) * min_width;
return diff;
}

View File

@ -21,6 +21,7 @@
#define BITS_PER_PIXEL_RGBA 32
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
typedef struct { /* To store 32bit Hash */
FT_UInt32 hash;
@ -89,3 +90,5 @@ int First_Row(IMAGE* input);
IMAGE* Append_Columns(IMAGE* small, IMAGE* big);
/* Appening white columns with image alignment */
IMAGE* Append_Rows(IMAGE* small, IMAGE* big);
/* calculating the Pixel Differences */
int Image_Diff( IMAGE* base, IMAGE* test);

View File

@ -1 +1,2 @@
This folder includes all the images generated
This folder includes all the images generated

View File

@ -448,6 +448,8 @@ int main(int argc, char const *argv[])
test_png = Append_Columns(test_png, base_png);
}
pixel_diff += Image_Diff( base_png, test_png);
Add_effect( base_png, test_png, after_effect_1, 1);
pixel_diff = Add_effect( base_png, test_png, after_effect_2,2);
@ -505,4 +507,4 @@ int main(int argc, char const *argv[])
dlclose(test_handle);
return 0;
}
}

View File

@ -304,4 +304,3 @@ void MurmurHash3_x64_128 ( const void * key, const int len,
}
/*------------------------------------------------------------------*/

View File

@ -19,4 +19,4 @@ function sort_t(tbody, col, asc){
arr[i] = "<td>"+arr[i].join("</td><td>")+"</td>";
}
tbody.innerHTML = "<tr>"+arr.join("</tr><tr>")+"</tr>";
}
}

View File

@ -35,3 +35,4 @@ th {
#hash{
font-size: 12px;
}