-
Notifications
You must be signed in to change notification settings - Fork 29
/
perceptualdiff.cpp
78 lines (68 loc) · 2.08 KB
/
perceptualdiff.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
PerceptualDiff - a program that compares two images using a perceptual metric
based on the paper :
A perceptual metric for production testing. Journal of graphics tools,
9(4):33-40, 2004, Hector Yee
Copyright (C) 2006-2011 Yangli Hector Yee
Copyright (C) 2011-2015 Steven Myint, Jeff Terrace
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "compare_args.h"
#include "lpyramid.h"
#include "metric.h"
#include "rgba_image.h"
#include <cstdlib>
#include <iostream>
#include <string>
#include <iso646.h>
int main(const int argc, char **argv)
{
CompareArgs args;
try
{
if (not args.parse_args(argc, argv))
{
std::cerr << args.error_string_;
return EXIT_FAILURE;
}
else
{
if (args.verbose_)
{
args.print_args();
}
}
const auto passed = yee_compare(args);
if (passed)
{
if (args.verbose_)
{
std::cout << "PASS: " << args.error_string_;
}
}
else
{
std::cout << "FAIL: " << args.error_string_;
}
return passed ? EXIT_SUCCESS : EXIT_FAILURE;
}
catch (const ParseException &exception)
{
std::cerr << exception.what() << std::endl;
return EXIT_FAILURE;
}
catch (const RGBImageException &exception)
{
std::cerr << exception.what() << std::endl;
return EXIT_FAILURE;
}
}