Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(102)

Unified Diff: files/source/CompareArgs.cpp

Issue 89059: add ignore edge function in pdiff. SVN Base: http://o3d.googlecode.com/svn/trunk/googleclient/third_party/pdiff/
Patch Set: '' Created 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side by-side-diff with in-line comments
Download patch
Index: files/source/CompareArgs.cpp
===================================================================
--- files/source/CompareArgs.cpp (revision 87)
+++ files/source/CompareArgs.cpp (working copy)
@@ -32,6 +32,9 @@
Compares image1.tif and image2.tif using a perceptually based image metric\n\
Options:\n\
\t-verbose : Turns on verbose mode\n\
+\t-ignoreEdges e : Ignore edges in comparison. e (0 to 7) is the\n\
+\t max number of neighbors the pixel can have to\n\
+\t be considered as edge.\n\
\t-fov deg : Field of view in degrees (0.1 to 89.9)\n\
\t-threshold p : #pixels p below which differences are ignored\n\
\t-gamma g : Value to convert rgb into linear space (default 2.2)\n\
@@ -52,6 +55,8 @@
ImgDiff = NULL;
Verbose = false;
LuminanceOnly = false;
+ IgnoreEdge = false;
+ EdgeNeighborNum = 0;
FieldOfView = 45.0f;
Gamma = 2.2f;
ThresholdPixels = 100;
@@ -81,6 +86,15 @@
if (++i < argc) {
FieldOfView = (float) atof(argv[i]);
}
+ } else if (strcmp(argv[i], "-ignoreEdges") == 0) {
+ if (++i < argc) {
+ IgnoreEdge = true;
+ EdgeNeighborNum = (float) atoi(argv[i]);
+ if (EdgeNeighborNum < 0)
+ EdgeNeighborNum = 0;
+ if (EdgeNeighborNum > 7)
+ EdgeNeighborNum = 7;
+ }
} else if (strcmp(argv[i], "-verbose") == 0) {
Verbose = true;
} else if (strcmp(argv[i], "-threshold") == 0) {
@@ -144,10 +158,18 @@
ImgB = tmp;
}
}
- if(output_file_name) {
- ImgDiff = new RGBAImage(ImgA->Get_Width(), ImgA->Get_Height(), output_file_name);
- }
- return true;
+
+ if(output_file_name) {
+ ImgDiff = new RGBAImage(ImgA->Get_Width(), ImgA->Get_Height(),
+ output_file_name);
+ }
+ // if no output_file_name is specified, and edge detection is enabled.
+ // create ImgDiff with default name.
+ else if (IgnoreEdge)
+ {
+ ImgDiff = new RGBAImage(ImgA->Get_Width(), ImgA->Get_Height());
+ }
+ return true;
}
void CompareArgs::Print_Args()

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld r497