├── .gitignore ├── 3rdparty ├── 3rdparty.pro ├── perceptualdiff │ ├── CMakeLists.txt │ ├── CompareArgs.cpp │ ├── CompareArgs.h │ ├── FreeImageLoader.cpp │ ├── FreeImageLoader.h │ ├── LPyramid.cpp │ ├── LPyramid.h │ ├── Metric.cpp │ ├── Metric.h │ ├── PerceptualDiff.cpp │ ├── README.txt │ ├── RGBAImage.cpp │ ├── RGBAImage.h │ ├── gpl.txt │ └── perceptualdiff.pri └── qtpropertybrowser │ ├── CMakeLists.txt │ ├── images │ ├── cursor-arrow.png │ ├── cursor-busy.png │ ├── cursor-closedhand.png │ ├── cursor-cross.png │ ├── cursor-forbidden.png │ ├── cursor-hand.png │ ├── cursor-hsplit.png │ ├── cursor-ibeam.png │ ├── cursor-openhand.png │ ├── cursor-sizeall.png │ ├── cursor-sizeb.png │ ├── cursor-sizef.png │ ├── cursor-sizeh.png │ ├── cursor-sizev.png │ ├── cursor-uparrow.png │ ├── cursor-vsplit.png │ ├── cursor-wait.png │ └── cursor-whatsthis.png │ ├── qteditorfactory.cpp │ ├── qteditorfactory.h │ ├── qtpropertybrowser.cpp │ ├── qtpropertybrowser.h │ ├── qtpropertybrowser.pri │ ├── qtpropertybrowser.qrc │ ├── qtpropertybrowserutils.cpp │ ├── qtpropertybrowserutils_p.h │ ├── qtpropertymanager.cpp │ ├── qtpropertymanager.h │ ├── qttreepropertybrowser.cpp │ ├── qttreepropertybrowser.h │ ├── qtvariantproperty.cpp │ └── qtvariantproperty.h ├── AUTHORS.txt ├── CMakeLists.txt ├── COPYING.txt ├── CREDITS.txt ├── Changelog.txt ├── INSTALL.txt ├── LICENSE.txt ├── NEWS.txt ├── README.txt ├── TODO.txt ├── cmake └── FindQwt.cmake ├── diffimg.pro ├── lang ├── diffimg_cs.ts ├── diffimg_de.ts ├── diffimg_fr.ts ├── diffimg_it.ts ├── diffimg_pt.ts ├── diffimg_ro.ts ├── diffimg_ru.ts ├── diffimg_sv.ts ├── diffimg_vi.ts └── diffimg_zh.ts ├── misc ├── Info.plist ├── Info.plist.sh ├── diffimg-desktop.sh ├── diffimg-manpage.sh └── postbuild-macx.sh ├── res ├── Info.plist ├── about.png ├── allgood.png ├── bad.png ├── check2.png ├── closetab.png ├── comment.png ├── delete.png ├── diffimg.icns ├── diffimg.ico ├── diffimg.png ├── diffimg.qrc ├── diffimg.rc ├── help.png ├── icon_diff.png ├── icon_difference.png ├── icon_mag1.png ├── icon_magfit.png ├── icon_modified.png ├── icon_open.png ├── icon_original.png ├── icon_quit.png ├── journal.png ├── modified.png ├── next.png ├── original.png ├── perceptual.png ├── perchannel.png ├── perchannelmean.png ├── perluminance.png ├── preferences.png ├── prev.png ├── red.png ├── refresh.png ├── save.png ├── somebad.png ├── splashscreen.png ├── unknown.png ├── window_split_hor.png ├── wipe_effect.png └── yellow.png ├── setup ├── banner.bmp ├── icon.ico ├── icon_install.ico ├── icon_uninstall.ico ├── setup-x64.nsi ├── setup.nsi ├── splashscreen-x64.bmp ├── splashscreen.bmp └── welcome.bmp ├── src ├── AboutDialog.cpp ├── AboutDialog.h ├── AppSettings.cpp ├── AppSettings.h ├── ChannelCurve.cpp ├── ChannelCurve.h ├── DiffImgWindow.cpp ├── DiffImgWindow.h ├── FilesDialog.cpp ├── FilesDialog.h ├── FilesManager.cpp ├── FilesManager.h ├── IMessageHandler.h ├── ImageNavigator.cpp ├── ImageNavigator.h ├── ImageView.cpp ├── ImageView.h ├── LogHandler.cpp ├── LogHandler.h ├── MiscFunctions.cpp ├── MiscFunctions.h ├── PropertyWidget.cpp ├── PropertyWidget.h ├── WipeItem.cpp ├── WipeItem.h ├── WipeMethod.h ├── main.cpp └── metrics │ ├── BaseMetric.cpp │ ├── BaseMetric.h │ ├── MetricsManager.cpp │ ├── MetricsManager.h │ ├── MetricsRegistering.cpp │ ├── MetricsRegistering.h │ ├── PerChannelMeanMetric.cpp │ ├── PerChannelMeanMetric.h │ ├── PerChannelMetric.cpp │ ├── PerChannelMetric.h │ ├── PerLuminanceMetric.cpp │ ├── PerLuminanceMetric.h │ ├── PerceptualMetric.cpp │ └── PerceptualMetric.h ├── test ├── img1 │ ├── 16bits-2.tif │ ├── 32bits-2.tif │ ├── IMG_0044.bmp │ ├── IMG_0044.png │ ├── IMG_0052.png │ ├── IMG_0144.png │ ├── IMG_0145.png │ ├── IMG_0149.png │ ├── IMG_0149.png.txt │ ├── IMG_testsuffix.png │ ├── bigimg │ │ ├── README.txt │ │ └── bigimg.jpg │ ├── memorial.exr │ ├── testjp2000.jp2 │ └── yuv │ │ ├── README.txt │ │ ├── tulips_yuv420_prog_planar_qcif_176x144.yuv │ │ ├── tulips_yuv422_prog_planar_qcif_176x144.yuv │ │ ├── tulips_yuv444_prog_planar_qcif_176x144.yuv │ │ └── tulips_yuyv422_prog_packed_qcif_176x144.yuv └── img2 │ ├── 16bits-2.tif │ ├── 32bits-2.tif │ ├── IMG_0044.bmp │ ├── IMG_0044.png │ ├── IMG_0052.png │ ├── IMG_0144.png │ ├── IMG_0145.png │ ├── IMG_0149.png │ ├── IMG_0149.png.txt │ ├── IMG_testsuffix.jpg │ ├── bigimg │ ├── README.txt │ └── bigimg.jpg │ ├── descript.ion │ ├── memorial.exr │ ├── testjp2000.jp2 │ └── yuv │ ├── tulips_yuv420_prog_planar_qcif_176x144.yuv │ ├── tulips_yuv422_prog_planar_qcif_176x144.yuv │ ├── tulips_yuv444_prog_planar_qcif_176x144.yuv │ └── tulips_yuyv422_prog_packed_qcif_176x144.yuv └── ui ├── AboutDialog.ui ├── DiffImgWindow.ui └── FilesDialog.ui /.gitignore: -------------------------------------------------------------------------------- 1 | release/ 2 | moc_*.h 3 | moc_*.cpp 4 | qrc_*.cpp 5 | *.moc 6 | .qmake.stash 7 | build/Makefile* 8 | *.o 9 | *.a 10 | *.qm 11 | -------------------------------------------------------------------------------- /3rdparty/3rdparty.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | CONFIG += warn_on debug_and_release 4 | 5 | SUBDIRS += qtpropertybrowser perceptualdiff 6 | 7 | win32|os2-g++ { 8 | 9 | SUBDIRS += qwt opencv 10 | 11 | } 12 | 13 | macx { 14 | 15 | SUBDIRS += qwt 16 | 17 | } 18 | 19 | -------------------------------------------------------------------------------- /3rdparty/perceptualdiff/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT (PerceptualDiff) 2 | 3 | CMAKE_MINIMUM_REQUIRED(VERSION 2.4) 4 | 5 | SET(DIFF_SRC LPyramid.cpp RGBAImage.cpp CompareArgs.cpp Metric.cpp OpenCVImageLoader.cpp) 6 | 7 | ADD_LIBRARY(PerceptualDiff STATIC ${DIFF_SRC} ${}) 8 | 9 | IF (MSVC) 10 | # Turn off deprecation warnings 11 | ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) 12 | ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_WARNINGS) 13 | ENDIF(MSVC) 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /3rdparty/perceptualdiff/CompareArgs.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Comapre Args 4 | Copyright (C) 2006 Yangli Hector Yee 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the 7 | GNU General Public License as published by the Free Software Foundation; either version 2 of the License, 8 | or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 11 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along with this program; 15 | if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #include "CompareArgs.h" 19 | #include "RGBAImage.h" 20 | #ifdef FREEIMAGE_LOADER 21 | #include "FreeImageLoader.h" 22 | #endif 23 | #include "RGBAImage.h" 24 | #include 25 | #include 26 | #include 27 | 28 | static const char* copyright = 29 | "PerceptualDiff version 1.1.1, Copyright (C) 2006 Yangli Hector Yee\n\ 30 | PerceptualDiff comes with ABSOLUTELY NO WARRANTY;\n\ 31 | This is free software, and you are welcome\n\ 32 | to redistribute it under certain conditions;\n\ 33 | See the GPL page for details: http://www.gnu.org/copyleft/gpl.html\n\n"; 34 | 35 | static const char *usage = 36 | "PeceptualDiff image1.tif image2.tif\n\n\ 37 | Compares image1.tif and image2.tif using a perceptually based image metric\n\ 38 | Options:\n\ 39 | \t-verbose : Turns on verbose mode\n\ 40 | \t-fov deg : Field of view in degrees (0.1 to 89.9)\n\ 41 | \t-threshold p : #pixels p below which differences are ignored\n\ 42 | \t-gamma g : Value to convert rgb into linear space (default 2.2)\n\ 43 | \t-luminance l : White luminance (default 100.0 cdm^-2)\n\ 44 | \t-luminanceonly : Only consider luminance; ignore chroma (color) in the comparison\n\ 45 | \t-colorfactor : How much of color to use, 0.0 to 1.0, 0.0 = ignore color.\n\ 46 | \t-downsample : How many powers of two to down sample the image.\n\ 47 | \t-output o.ppm : Write difference to the file o.ppm\n\ 48 | \n\ 49 | \n Note: Input or Output files can also be in the PNG or JPG format or any format\ 50 | \n that FreeImage supports.\ 51 | \n"; 52 | 53 | CompareArgs::CompareArgs() 54 | { 55 | ImgA = NULL; 56 | ImgB = NULL; 57 | ImgDiff = NULL; 58 | Verbose = false; 59 | LuminanceOnly = false; 60 | FieldOfView = 45.0f; 61 | Gamma = 2.2f; 62 | ThresholdPixels = 100; 63 | Luminance = 100.0f; 64 | ColorFactor = 1.0f; 65 | DownSample = 0; 66 | } 67 | 68 | CompareArgs::~CompareArgs() 69 | { 70 | if (ImgA) 71 | delete ImgA; 72 | if (ImgB) 73 | delete ImgB; 74 | if (ImgDiff) 75 | delete ImgDiff; 76 | } 77 | 78 | bool CompareArgs::Parse_Args(int argc, char **argv) 79 | { 80 | if (argc < 3) 81 | { 82 | ErrorStr = copyright; 83 | ErrorStr += usage; 84 | return false; 85 | } 86 | int image_count = 0; 87 | const char* output_file_name = NULL; 88 | for (int i = 1; i < argc; i++) 89 | { 90 | if (strcmp(argv[i], "-fov") == 0) 91 | { 92 | if (++i < argc) 93 | { 94 | FieldOfView = (float) atof(argv[i]); 95 | } 96 | } 97 | else if (strcmp(argv[i], "-verbose") == 0) 98 | { 99 | Verbose = true; 100 | } 101 | else if (strcmp(argv[i], "-threshold") == 0) 102 | { 103 | if (++i < argc) 104 | { 105 | ThresholdPixels = atoi(argv[i]); 106 | } 107 | } 108 | else if (strcmp(argv[i], "-gamma") == 0) 109 | { 110 | if (++i < argc) 111 | { 112 | Gamma = (float) atof(argv[i]); 113 | } 114 | } 115 | else if (strcmp(argv[i], "-luminance") == 0) 116 | { 117 | if (++i < argc) 118 | { 119 | Luminance = (float) atof(argv[i]); 120 | } 121 | } 122 | else if (strcmp(argv[i], "-luminanceonly") == 0) 123 | { 124 | LuminanceOnly = true; 125 | } 126 | else if (strcmp(argv[i], "-colorfactor") == 0) 127 | { 128 | if (++i < argc) 129 | { 130 | ColorFactor = (float) atof(argv[i]); 131 | } 132 | } 133 | else if (strcmp(argv[i], "-downsample") == 0) 134 | { 135 | if (++i < argc) 136 | { 137 | DownSample = (int) atoi(argv[i]); 138 | } 139 | } 140 | else if (strcmp(argv[i], "-output") == 0) 141 | { 142 | if (++i < argc) 143 | { 144 | output_file_name = argv[i]; 145 | } 146 | } 147 | else if (image_count < 2) 148 | { 149 | #ifdef FREEIMAGE_LOADER 150 | RGBAImage* img = FreeImageLoader::ReadFromFile(argv[i]); 151 | 152 | if (!img) 153 | { 154 | ErrorStr = "FAIL: Cannot open "; 155 | ErrorStr += argv[i]; 156 | ErrorStr += "\n"; 157 | return false; 158 | } 159 | else 160 | { 161 | ++image_count; 162 | if(image_count == 1) 163 | ImgA = img; 164 | else 165 | ImgB = img; 166 | } 167 | #endif 168 | } 169 | else 170 | { 171 | fprintf(stderr, "Warning: option/file \"%s\" ignored\n", argv[i]); 172 | } 173 | } // i 174 | if(!ImgA || !ImgB) 175 | { 176 | ErrorStr = "FAIL: Not enough image files specified\n"; 177 | return false; 178 | } 179 | for (int i = 0; i < DownSample; i++) 180 | { 181 | if (Verbose) 182 | printf( "Downsampling by %d\n", 1 << (i + 1) ); 183 | RGBAImage *tmp = ImgA->DownSample(); 184 | if (tmp) 185 | { 186 | delete ImgA; 187 | ImgA = tmp; 188 | } 189 | tmp = ImgB->DownSample(); 190 | if (tmp) 191 | { 192 | delete ImgB; 193 | ImgB = tmp; 194 | } 195 | } 196 | if(output_file_name) 197 | { 198 | ImgDiff = new RGBAImage(ImgA->Get_Width(), ImgA->Get_Height(), output_file_name); 199 | } 200 | return true; 201 | } 202 | 203 | void CompareArgs::Print_Args() 204 | { 205 | printf("Field of view is %f degrees\n", FieldOfView); 206 | printf("Threshold pixels is %d pixels\n", ThresholdPixels); 207 | printf("The Gamma is %f\n", Gamma); 208 | printf("The Display's luminance is %f candela per meter squared\n", Luminance); 209 | } 210 | -------------------------------------------------------------------------------- /3rdparty/perceptualdiff/CompareArgs.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Comapre Args 4 | Copyright (C) 2006 Yangli Hector Yee 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the 7 | GNU General Public License as published by the Free Software Foundation; either version 2 of the License, 8 | or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 11 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along with this program; 15 | if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #ifndef _COMPAREARGS_H 19 | #define _COMPAREARGS_H 20 | 21 | #include 22 | 23 | class RGBAImage; 24 | 25 | // Args to pass into the comparison function 26 | class CompareArgs 27 | { 28 | public: 29 | CompareArgs(); 30 | ~CompareArgs(); 31 | bool Parse_Args(int argc, char **argv); 32 | void Print_Args(); 33 | 34 | RGBAImage *ImgA; // Image A 35 | RGBAImage *ImgB; // Image B 36 | RGBAImage *ImgDiff; // Diff image 37 | bool Verbose; // Print lots of text or not 38 | bool LuminanceOnly; // Only consider luminance; ignore chroma channels in the comparison. 39 | float FieldOfView; // Field of view in degrees 40 | float Gamma; // The gamma to convert to linear color space 41 | float Luminance; // the display's luminance 42 | unsigned int ThresholdPixels; // How many pixels different to ignore 43 | std::string ErrorStr; // Error string 44 | // How much color to use in the metric. 45 | // 0.0 is the same as LuminanceOnly = true, 46 | // 1.0 means full strength. 47 | float ColorFactor; 48 | 49 | // How much to down sample image before comparing, in powers of 2. 50 | int DownSample; 51 | }; 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /3rdparty/perceptualdiff/FreeImageLoader.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | FreeImageLoader.cpp 4 | Copyright (C) 2006 Yangli Hector Yee 5 | 6 | (This entire file was rewritten by Jim Tilander) 7 | 8 | This program is free software; you can redistribute it and/or modify it under the terms of the 9 | GNU General Public License as published by the Free Software Foundation; either version 2 of the License, 10 | or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 13 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 | See the GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License along with this program; 17 | if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #include "RGBAImage.h" 21 | #include "FreeImageLoader.h" 22 | #include 23 | #include 24 | #include 25 | 26 | 27 | bool FreeImageLoader::WriteToFile(RGBAImage *image, const char* filename) 28 | { 29 | if (!image) 30 | return false; 31 | 32 | const FREE_IMAGE_FORMAT fileType = FreeImage_GetFIFFromFilename(filename); 33 | if(FIF_UNKNOWN == fileType) 34 | { 35 | printf("Can't save to unknown filetype %s\n", filename); 36 | return false; 37 | } 38 | 39 | int Width = image->Get_Width(); 40 | int Height = image->Get_Height(); 41 | 42 | FIBITMAP* bitmap = FreeImage_Allocate(Width, Height, 32, 0x000000ff, 0x0000ff00, 0x00ff0000); 43 | if(!bitmap) 44 | { 45 | printf("Failed to create freeimage for %s\n", filename); 46 | return false; 47 | } 48 | 49 | const unsigned int* source = image->Get_Data(); 50 | for( int y = 0; y < Height; y++, source += Width ) 51 | { 52 | unsigned int* scanline = (unsigned int*)FreeImage_GetScanLine(bitmap, Height - y - 1 ); 53 | memcpy(scanline, source, sizeof(source[0]) * Width); 54 | } 55 | 56 | FreeImage_SetTransparent(bitmap, false); 57 | FIBITMAP* converted = FreeImage_ConvertTo24Bits(bitmap); 58 | 59 | const bool result = !!FreeImage_Save(fileType, converted, filename); 60 | if(!result) 61 | printf("Failed to save to %s\n", filename); 62 | 63 | FreeImage_Unload(converted); 64 | FreeImage_Unload(bitmap); 65 | return result; 66 | } 67 | 68 | RGBAImage* FreeImageLoader::ReadFromFile(const char* filename) 69 | { 70 | const FREE_IMAGE_FORMAT fileType = FreeImage_GetFileType(filename); 71 | if(FIF_UNKNOWN == fileType) 72 | { 73 | printf("Unknown filetype %s\n", filename); 74 | return 0; 75 | } 76 | 77 | FIBITMAP* freeImage = 0; 78 | if( FIBITMAP * temporary = FreeImage_Load(fileType, filename, 0) ) 79 | { 80 | freeImage = FreeImage_ConvertTo32Bits(temporary); 81 | FreeImage_Unload(temporary); 82 | } 83 | if(!freeImage) 84 | { 85 | printf( "Failed to load the image %s\n", filename); 86 | return 0; 87 | } 88 | 89 | const int w = FreeImage_GetWidth(freeImage); 90 | const int h = FreeImage_GetHeight(freeImage); 91 | 92 | RGBAImage* result = new RGBAImage(w, h, filename); 93 | 94 | // Copy the image over to our internal format, FreeImage has the scanlines bottom to top though. 95 | unsigned int* dest = result->Get_Data(); 96 | for( int y = 0; y < h; y++, dest += w ) 97 | { 98 | const unsigned int* scanline = (const unsigned int*)FreeImage_GetScanLine(freeImage, h - y - 1 ); 99 | memcpy(dest, scanline, sizeof(dest[0]) * w); 100 | } 101 | 102 | FreeImage_Unload(freeImage); 103 | return result; 104 | } 105 | -------------------------------------------------------------------------------- /3rdparty/perceptualdiff/FreeImageLoader.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | FreeImageLoader.h 4 | Copyright (C) 2006 Yangli Hector Yee 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the 7 | GNU General Public License as published by the Free Software Foundation; either version 2 of the License, 8 | or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 11 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along with this program; 15 | if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #ifndef _FREEIMAGELOADER_H 19 | #define _FREEIMAGELOADER_H 20 | 21 | #include 22 | 23 | /** Class encapsulating an image containing R,G,B,A channels. 24 | * 25 | * Internal representation assumes data is in the ABGR format, with the RGB 26 | * color channels premultiplied by the alpha value. Premultiplied alpha is 27 | * often also called "associated alpha" - see the tiff 6 specification for some 28 | * discussion - http://partners.adobe.com/asn/developer/PDFS/TN/TIFF6.pdf 29 | * 30 | */ 31 | 32 | class RGBAImage; 33 | 34 | class FreeImageLoader 35 | { 36 | 37 | public: 38 | 39 | static bool WriteToFile(RGBAImage *, const char* filename); 40 | static RGBAImage* ReadFromFile(const char* filename); 41 | 42 | }; 43 | 44 | #endif // _FREEIMAGELOADER_H 45 | -------------------------------------------------------------------------------- /3rdparty/perceptualdiff/LPyramid.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Laplacian Pyramid 4 | Copyright (C) 2006 Yangli Hector Yee 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the 7 | GNU General Public License as published by the Free Software Foundation; either version 2 of the License, 8 | or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 11 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along with this program; 15 | if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #include "LPyramid.h" 19 | 20 | ////////////////////////////////////////////////////////////////////// 21 | // Construction/Destruction 22 | ////////////////////////////////////////////////////////////////////// 23 | 24 | LPyramid::LPyramid(float *image, int width, int height) : 25 | Width(width), 26 | Height(height) 27 | { 28 | // Make the Laplacian pyramid by successively 29 | // copying the earlier levels and blurring them 30 | for (int i = 0; i=Width) 83 | nx = 2 * Width - nx - 1; 84 | if (ny>=Height) 85 | ny = 2 * Height - ny - 1; 86 | a[index] += Kernel[i + 2] * Kernel[j + 2] * b[ny * Width + nx]; 87 | } 88 | } 89 | } 90 | 91 | float LPyramid::Get_Value(int x, int y, int level) 92 | { 93 | int index = x + y * Width; 94 | int l = level; 95 | if (l > MAX_PYR_LEVELS) 96 | l = MAX_PYR_LEVELS; 97 | return Levels[level][index]; 98 | } 99 | -------------------------------------------------------------------------------- /3rdparty/perceptualdiff/LPyramid.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Laplacian Pyramid 4 | Copyright (C) 2006 Yangli Hector Yee 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the 7 | GNU General Public License as published by the Free Software Foundation; either version 2 of the License, 8 | or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 11 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along with this program; 15 | if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | #ifndef _LPYRAMID_H 18 | #define _LPYRAMID_H 19 | 20 | #define MAX_PYR_LEVELS 8 21 | 22 | class LPyramid 23 | { 24 | public: 25 | LPyramid(float *image, int width, int height); 26 | virtual ~LPyramid(); 27 | float Get_Value(int x, int y, int level); 28 | protected: 29 | float * Copy(float *img); 30 | void Convolve(float *a, float *b); 31 | 32 | // Succesively blurred versions of the original image 33 | float *Levels[MAX_PYR_LEVELS]; 34 | 35 | int Width; 36 | int Height; 37 | }; 38 | 39 | #endif // _LPYRAMID_H 40 | -------------------------------------------------------------------------------- /3rdparty/perceptualdiff/Metric.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Metric 4 | Copyright (C) 2006 Yangli Hector Yee 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the 7 | GNU General Public License as published by the Free Software Foundation; either version 2 of the License, 8 | or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 11 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along with this program; 15 | if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #ifndef _METRIC_H 19 | #define _METRIC_H 20 | 21 | class CompareArgs; 22 | 23 | // Image comparison metric using Yee's method 24 | // References: A Perceptual Metric for Production Testing, Hector Yee, Journal of Graphics Tools 2004 25 | bool Yee_Compare(CompareArgs &args); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /3rdparty/perceptualdiff/PerceptualDiff.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | PerceptualDiff - a program that compares two images using a perceptual metric 3 | based on the paper : 4 | A perceptual metric for production testing. Journal of graphics tools, 9(4):33-40, 2004, Hector Yee 5 | Copyright (C) 2006 Yangli Hector Yee 6 | 7 | This program is free software; you can redistribute it and/or modify it under the terms of the 8 | GNU General Public License as published by the Free Software Foundation; either version 2 of the License, 9 | or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | See the GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along with this program; 16 | if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include "LPyramid.h" 24 | #include "RGBAImage.h" 25 | #include "CompareArgs.h" 26 | #include "Metric.h" 27 | 28 | int main(int argc, char **argv) 29 | { 30 | CompareArgs args; 31 | 32 | if (!args.Parse_Args(argc, argv)) { 33 | printf("%s", args.ErrorStr.c_str()); 34 | return -1; 35 | } else { 36 | if (args.Verbose) args.Print_Args(); 37 | } 38 | 39 | const bool passed = Yee_Compare(args); 40 | if (passed) { 41 | if(args.Verbose) 42 | printf("PASS: %s\n", args.ErrorStr.c_str()); 43 | } else { 44 | printf("FAIL: %s\n", args.ErrorStr.c_str()); 45 | } 46 | 47 | return passed ? 0 : 1; 48 | } 49 | -------------------------------------------------------------------------------- /3rdparty/perceptualdiff/README.txt: -------------------------------------------------------------------------------- 1 | perceptualdiff - a program that compares two images using 2 | a perceptually based image metric. 3 | Copyright (C) 2006 Yangli Hector Yee 4 | yeehector@users.sourceforge.net 5 | http://pdiff.sourceforge.net/ 6 | 7 | This program is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2 of the License, 10 | or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, but 13 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | or FITNESS FOR A PARTICULAR PURPOSE. 15 | See the GNU General Public License for more details in the file gpl.txt. 16 | 17 | Build Instructions 18 | 1. Download cross platform make from http://www.cmake.org 19 | 2. Download freeimage from https://sourceforge.net/projects/freeimage 20 | 3. Edit CMakeLists.txt to tell it where to find your free image build 21 | 4. Type cmake . 22 | 5. Type make . (or on Windows systems cmake makes a Visual Studio 23 | Project file) 24 | 6. To specify the install directory, use make install DESTDIR="/home/me/mydist" 25 | 26 | Usage 27 | 28 | perceptualdiff image1.(tif | png) image2.(tif | png) [options] 29 | -verbose : Turns on verbose mode 30 | -fov deg: field of view, deg, in degrees. Usually between 10.0 to 85.0. 31 | This controls how much of the screen the oberserver is seeing. Front row of 32 | a theatre has a field of view of around 25 degrees. Back row has a field of 33 | view of around 60 degrees. 34 | -threshold p : Sets the number of pixels, p, to reject. For example if p is 35 | 100, then the test fails if 100 or more pixels are perceptably different. 36 | -gamma g : The gamma to use to convert to RGB linear space. Default is 2.2 37 | -luminance l: The luminance of the display the observer is seeing. Default 38 | is 100 candela per meter squared 39 | -colorfactor : How much of color to use, 0.0 to 1.0, 0.0 = ignore color. 40 | -downsample : How many powers of two to down sample the image. 41 | -output foo.ppm : Saves the difference image to foo.ppm 42 | 43 | Credits 44 | 45 | Hector Yee, project administrator and originator - hectorgon.blogspot.com 46 | Scott Corley, for png file IO code 47 | Tobias Sauerwein, for make install, package_source Cmake configuration 48 | Cairo Team for bugfixes 49 | Jim Tilander, Rewrote the IO to use FreeImage. 50 | 51 | Version History 52 | 53 | 1.0 - Initial distribution 54 | 1.0.1 - Fixed off by one convolution error and libpng interface to 1.2.8 55 | 1.0.2 - [jt] Converted the loading and saving routines to use FreeImage 56 | 1.1 - Added colorfactor and downsample options. Also always output 57 | difference file if requested. Always print out differing pixels even if the test passes. 58 | 1.1.1 - Turn off color test in low lighting conditions. 59 | -------------------------------------------------------------------------------- /3rdparty/perceptualdiff/RGBAImage.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | RGBAImage.cpp 4 | Copyright (C) 2006 Yangli Hector Yee 5 | 6 | (This entire file was rewritten by Jim Tilander) 7 | 8 | This program is free software; you can redistribute it and/or modify it under the terms of the 9 | GNU General Public License as published by the Free Software Foundation; either version 2 of the License, 10 | or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 13 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 | See the GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License along with this program; 17 | if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #include "RGBAImage.h" 21 | //#include "FreeImage.h" 22 | #include 23 | #include 24 | 25 | RGBAImage* RGBAImage::DownSample() const 26 | { 27 | if (Width <=1 || Height <=1) 28 | return NULL; 29 | 30 | int nw = Width / 2; 31 | int nh = Height / 2; 32 | RGBAImage* img = new RGBAImage( nw, nh, Name.c_str() ); 33 | for (int y = 0; y < nh; y++) 34 | for (int x = 0; x < nw; x++) 35 | { 36 | int d[4]; 37 | 38 | // Sample a 2x2 patch from the parent image. 39 | d[0] = Get(2 * x + 0, 2 * y + 0); 40 | d[1] = Get(2 * x + 1, 2 * y + 0); 41 | d[2] = Get(2 * x + 0, 2 * y + 1); 42 | d[3] = Get(2 * x + 1, 2 * y + 1); 43 | int rgba = 0; 44 | 45 | // Find the average color. 46 | for (int i = 0; i < 4; i++) 47 | { 48 | int c = ( d[0] >> (8 * i) ) & 0xFF; 49 | c += ( d[1] >> (8 * i) ) & 0xFF; 50 | c += ( d[2] >> (8 * i) ) & 0xFF; 51 | c += ( d[3] >> (8 * i) ) & 0xFF; 52 | c /= 4; 53 | rgba |= (c & 0xFF) << (8 * i); 54 | } 55 | img->Set(x, y, rgba); 56 | } 57 | return img; 58 | } 59 | 60 | -------------------------------------------------------------------------------- /3rdparty/perceptualdiff/RGBAImage.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | RGBAImage.h 4 | Copyright (C) 2006 Yangli Hector Yee 5 | 6 | This program is free software; you can redistribute it and/or modify it under the terms of the 7 | GNU General Public License as published by the Free Software Foundation; either version 2 of the License, 8 | or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 11 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along with this program; 15 | if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | */ 17 | 18 | #ifndef _RGBAIMAGE_H 19 | #define _RGBAIMAGE_H 20 | 21 | #include 22 | 23 | /** Class encapsulating an image containing R,G,B,A channels. 24 | * 25 | * Internal representation assumes data is in the ABGR format, with the RGB 26 | * color channels premultiplied by the alpha value. Premultiplied alpha is 27 | * often also called "associated alpha" - see the tiff 6 specification for some 28 | * discussion - http://partners.adobe.com/asn/developer/PDFS/TN/TIFF6.pdf 29 | * 30 | */ 31 | class RGBAImage 32 | { 33 | RGBAImage(const RGBAImage&); 34 | RGBAImage& operator=(const RGBAImage&); 35 | public: 36 | RGBAImage(int w, int h, const char *name = 0) 37 | { 38 | Width = w; 39 | Height = h; 40 | if (name) 41 | Name = name; 42 | Data = new unsigned int[w * h]; 43 | } 44 | 45 | ~RGBAImage() 46 | { 47 | if (Data) 48 | delete[] Data; 49 | } 50 | 51 | unsigned char Get_Red(unsigned int i) 52 | { 53 | return (Data[i] & 0xFF); 54 | } 55 | 56 | unsigned char Get_Green(unsigned int i) 57 | { 58 | return ( (Data[i] >> 8) & 0xFF ); 59 | } 60 | 61 | unsigned char Get_Blue(unsigned int i) 62 | { 63 | return ( (Data[i] >> 16) & 0xFF ); 64 | } 65 | 66 | unsigned char Get_Alpha(unsigned int i) 67 | { 68 | return ( (Data[i] >> 24) & 0xFF ); 69 | } 70 | 71 | void Set(unsigned char r, unsigned char g, unsigned char b, unsigned char a, unsigned int i) 72 | { 73 | Data[i] = r | (g << 8) | (b << 16) | (a << 24); 74 | } 75 | 76 | int Get_Width(void) const 77 | { 78 | return Width; 79 | } 80 | 81 | int Get_Height(void) const 82 | { 83 | return Height; 84 | } 85 | 86 | void Set(int x, int y, unsigned int d) 87 | { 88 | Data[x + y * Width] = d; 89 | } 90 | 91 | unsigned int Get(int x, int y) const 92 | { 93 | return Data[x + y * Width]; 94 | } 95 | 96 | unsigned int Get(int i) const 97 | { 98 | return Data[i]; 99 | } 100 | 101 | const std::string &Get_Name(void) const 102 | { 103 | return Name; 104 | } 105 | 106 | unsigned int *Get_Data() const 107 | { 108 | return Data; 109 | } 110 | 111 | RGBAImage* DownSample() const; 112 | 113 | protected: 114 | int Width; 115 | int Height; 116 | std::string Name; 117 | unsigned int *Data; 118 | }; 119 | 120 | #endif 121 | -------------------------------------------------------------------------------- /3rdparty/perceptualdiff/perceptualdiff.pri: -------------------------------------------------------------------------------- 1 | HEADERS += \ 2 | $$PWD/LPyramid.h \ 3 | $$PWD/Metric.h \ 4 | $$PWD/CompareArgs.h \ 5 | $$PWD/RGBAImage.h 6 | 7 | SOURCES += \ 8 | $$PWD/LPyramid.cpp \ 9 | $$PWD/Metric.cpp \ 10 | $$PWD/CompareArgs.cpp \ 11 | $$PWD/RGBAImage.cpp 12 | 13 | INCLUDEPATH += $$PWD/ 14 | -------------------------------------------------------------------------------- /3rdparty/qtpropertybrowser/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_package(Qt5 COMPONENTS Widgets REQUIRED) 2 | # Tell CMake to run moc when necessary: 3 | set(CMAKE_AUTOMOC ON) 4 | 5 | # As moc files are generated in the binary dir, tell CMake 6 | # to always look for includes there: 7 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 8 | 9 | set(_SRCS 10 | qteditorfactory.cpp 11 | qtpropertybrowser.cpp 12 | qtpropertybrowserutils.cpp 13 | qtpropertymanager.cpp 14 | qttreepropertybrowser.cpp 15 | qtvariantproperty.cpp 16 | ) 17 | 18 | file(GLOB _IMPL_HDRS *.h) 19 | file(GLOB _PUBLIC_HDRS Qt*) 20 | 21 | set(_UI_FORMS 22 | ) 23 | 24 | set(_RESOURCES 25 | qtpropertybrowser.qrc 26 | ) 27 | 28 | 29 | set(TARGET_NAME ${PROJECT_NAME}) 30 | 31 | add_library(${TARGET_NAME} 32 | ${_SRCS} 33 | ${_UI_SRCS} 34 | ${_QRC_SRCS} 35 | ${_IMPL_HDRS} 36 | ) 37 | 38 | target_link_libraries(${TARGET_NAME} Qt5::Widgets) 39 | 40 | ######################### Installation Stuff ########################### 41 | include(GenerateExportHeader) 42 | generate_export_header(${TARGET_NAME}) 43 | -------------------------------------------------------------------------------- /3rdparty/qtpropertybrowser/images/cursor-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/3rdparty/qtpropertybrowser/images/cursor-arrow.png -------------------------------------------------------------------------------- /3rdparty/qtpropertybrowser/images/cursor-busy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/3rdparty/qtpropertybrowser/images/cursor-busy.png -------------------------------------------------------------------------------- /3rdparty/qtpropertybrowser/images/cursor-closedhand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/3rdparty/qtpropertybrowser/images/cursor-closedhand.png -------------------------------------------------------------------------------- /3rdparty/qtpropertybrowser/images/cursor-cross.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/3rdparty/qtpropertybrowser/images/cursor-cross.png -------------------------------------------------------------------------------- /3rdparty/qtpropertybrowser/images/cursor-forbidden.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/3rdparty/qtpropertybrowser/images/cursor-forbidden.png -------------------------------------------------------------------------------- /3rdparty/qtpropertybrowser/images/cursor-hand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/3rdparty/qtpropertybrowser/images/cursor-hand.png -------------------------------------------------------------------------------- /3rdparty/qtpropertybrowser/images/cursor-hsplit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/3rdparty/qtpropertybrowser/images/cursor-hsplit.png -------------------------------------------------------------------------------- /3rdparty/qtpropertybrowser/images/cursor-ibeam.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/3rdparty/qtpropertybrowser/images/cursor-ibeam.png -------------------------------------------------------------------------------- /3rdparty/qtpropertybrowser/images/cursor-openhand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/3rdparty/qtpropertybrowser/images/cursor-openhand.png -------------------------------------------------------------------------------- /3rdparty/qtpropertybrowser/images/cursor-sizeall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/3rdparty/qtpropertybrowser/images/cursor-sizeall.png -------------------------------------------------------------------------------- /3rdparty/qtpropertybrowser/images/cursor-sizeb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/3rdparty/qtpropertybrowser/images/cursor-sizeb.png -------------------------------------------------------------------------------- /3rdparty/qtpropertybrowser/images/cursor-sizef.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/3rdparty/qtpropertybrowser/images/cursor-sizef.png -------------------------------------------------------------------------------- /3rdparty/qtpropertybrowser/images/cursor-sizeh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/3rdparty/qtpropertybrowser/images/cursor-sizeh.png -------------------------------------------------------------------------------- /3rdparty/qtpropertybrowser/images/cursor-sizev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/3rdparty/qtpropertybrowser/images/cursor-sizev.png -------------------------------------------------------------------------------- /3rdparty/qtpropertybrowser/images/cursor-uparrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/3rdparty/qtpropertybrowser/images/cursor-uparrow.png -------------------------------------------------------------------------------- /3rdparty/qtpropertybrowser/images/cursor-vsplit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/3rdparty/qtpropertybrowser/images/cursor-vsplit.png -------------------------------------------------------------------------------- /3rdparty/qtpropertybrowser/images/cursor-wait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/3rdparty/qtpropertybrowser/images/cursor-wait.png -------------------------------------------------------------------------------- /3rdparty/qtpropertybrowser/images/cursor-whatsthis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/3rdparty/qtpropertybrowser/images/cursor-whatsthis.png -------------------------------------------------------------------------------- /3rdparty/qtpropertybrowser/qtpropertybrowser.pri: -------------------------------------------------------------------------------- 1 | HEADERS += \ 2 | $$PWD/qttreepropertybrowser.h \ 3 | $$PWD/qtvariantproperty.h \ 4 | $$PWD/qtpropertymanager.h \ 5 | $$PWD/qtpropertybrowser.h \ 6 | $$PWD/qteditorfactory.h \ 7 | $$PWD/qtpropertybrowserutils_p.h 8 | 9 | SOURCES += \ 10 | $$PWD/qttreepropertybrowser.cpp \ 11 | $$PWD/qtvariantproperty.cpp \ 12 | $$PWD/qtpropertymanager.cpp \ 13 | $$PWD/qtpropertybrowser.cpp \ 14 | $$PWD/qteditorfactory.cpp \ 15 | $$PWD/qtpropertybrowserutils.cpp 16 | 17 | INCLUDEPATH += $$PWD/ 18 | -------------------------------------------------------------------------------- /3rdparty/qtpropertybrowser/qtpropertybrowser.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | images/cursor-arrow.png 4 | images/cursor-busy.png 5 | images/cursor-closedhand.png 6 | images/cursor-cross.png 7 | images/cursor-forbidden.png 8 | images/cursor-hand.png 9 | images/cursor-hsplit.png 10 | images/cursor-ibeam.png 11 | images/cursor-openhand.png 12 | images/cursor-sizeall.png 13 | images/cursor-sizeb.png 14 | images/cursor-sizef.png 15 | images/cursor-sizeh.png 16 | images/cursor-sizev.png 17 | images/cursor-uparrow.png 18 | images/cursor-vsplit.png 19 | images/cursor-wait.png 20 | images/cursor-whatsthis.png 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /3rdparty/qtpropertybrowser/qtpropertybrowserutils_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 | ** All rights reserved. 5 | ** 6 | ** Contact: Nokia Corporation (qt-info@nokia.com) 7 | ** 8 | ** This file is part of a Qt Solutions component. 9 | ** 10 | ** You may use this file under the terms of the BSD license as follows: 11 | ** 12 | ** "Redistribution and use in source and binary forms, with or without 13 | ** modification, are permitted provided that the following conditions are 14 | ** met: 15 | ** * Redistributions of source code must retain the above copyright 16 | ** notice, this list of conditions and the following disclaimer. 17 | ** * Redistributions in binary form must reproduce the above copyright 18 | ** notice, this list of conditions and the following disclaimer in 19 | ** the documentation and/or other materials provided with the 20 | ** distribution. 21 | ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor 22 | ** the names of its contributors may be used to endorse or promote 23 | ** products derived from this software without specific prior written 24 | ** permission. 25 | ** 26 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 37 | ** 38 | ****************************************************************************/ 39 | 40 | 41 | // 42 | // W A R N I N G 43 | // ------------- 44 | // 45 | // This file is not part of the Qt API. It exists for the convenience 46 | // of Qt Designer. This header 47 | // file may change from version to version without notice, or even be removed. 48 | // 49 | // We mean it. 50 | // 51 | 52 | #ifndef QTPROPERTYBROWSERUTILS_H 53 | #define QTPROPERTYBROWSERUTILS_H 54 | 55 | #include 56 | #include 57 | #include 58 | #include 59 | 60 | #if QT_VERSION >= 0x040400 61 | QT_BEGIN_NAMESPACE 62 | #endif 63 | 64 | class QMouseEvent; 65 | class QCheckBox; 66 | class QLineEdit; 67 | 68 | class QtCursorDatabase 69 | { 70 | public: 71 | QtCursorDatabase(); 72 | 73 | QStringList cursorShapeNames() const; 74 | QMap cursorShapeIcons() const; 75 | QString cursorToShapeName(const QCursor &cursor) const; 76 | QIcon cursorToShapeIcon(const QCursor &cursor) const; 77 | int cursorToValue(const QCursor &cursor) const; 78 | #ifndef QT_NO_CURSOR 79 | QCursor valueToCursor(int value) const; 80 | #endif 81 | private: 82 | void appendCursor(Qt::CursorShape shape, const QString &name, const QIcon &icon); 83 | QStringList m_cursorNames; 84 | QMap m_cursorIcons; 85 | QMap m_valueToCursorShape; 86 | QMap m_cursorShapeToValue; 87 | }; 88 | 89 | class QtPropertyBrowserUtils 90 | { 91 | public: 92 | static QPixmap brushValuePixmap(const QBrush &b); 93 | static QIcon brushValueIcon(const QBrush &b); 94 | static QString colorValueText(const QColor &c); 95 | static QPixmap fontValuePixmap(const QFont &f); 96 | static QIcon fontValueIcon(const QFont &f); 97 | static QString fontValueText(const QFont &f); 98 | }; 99 | 100 | class QtBoolEdit : public QWidget { 101 | Q_OBJECT 102 | public: 103 | QtBoolEdit(QWidget *parent = 0); 104 | 105 | bool textVisible() const { return m_textVisible; } 106 | void setTextVisible(bool textVisible); 107 | 108 | Qt::CheckState checkState() const; 109 | void setCheckState(Qt::CheckState state); 110 | 111 | bool isChecked() const; 112 | void setChecked(bool c); 113 | 114 | bool blockCheckBoxSignals(bool block); 115 | 116 | Q_SIGNALS: 117 | void toggled(bool); 118 | 119 | protected: 120 | void mousePressEvent(QMouseEvent * event); 121 | void paintEvent(QPaintEvent *); 122 | 123 | private: 124 | QCheckBox *m_checkBox; 125 | bool m_textVisible; 126 | }; 127 | 128 | class QtKeySequenceEdit : public QWidget 129 | { 130 | Q_OBJECT 131 | public: 132 | QtKeySequenceEdit(QWidget *parent = 0); 133 | 134 | QKeySequence keySequence() const; 135 | bool eventFilter(QObject *o, QEvent *e); 136 | public Q_SLOTS: 137 | void setKeySequence(const QKeySequence &sequence); 138 | Q_SIGNALS: 139 | void keySequenceChanged(const QKeySequence &sequence); 140 | protected: 141 | void focusInEvent(QFocusEvent *e); 142 | void focusOutEvent(QFocusEvent *e); 143 | void keyPressEvent(QKeyEvent *e); 144 | void keyReleaseEvent(QKeyEvent *e); 145 | void paintEvent(QPaintEvent *); 146 | bool event(QEvent *e); 147 | private slots: 148 | void slotClearShortcut(); 149 | private: 150 | void handleKeyEvent(QKeyEvent *e); 151 | int translateModifiers(Qt::KeyboardModifiers state, const QString &text) const; 152 | 153 | int m_num; 154 | QKeySequence m_keySequence; 155 | QLineEdit *m_lineEdit; 156 | }; 157 | 158 | #if QT_VERSION >= 0x040400 159 | QT_END_NAMESPACE 160 | #endif 161 | 162 | #endif 163 | -------------------------------------------------------------------------------- /AUTHORS.txt: -------------------------------------------------------------------------------- 1 | xbee (xbee at xbee.net) http://thehive.xbee.net/ 2 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.9) 2 | 3 | project(diffimg LANGUAGES CXX) 4 | 5 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 6 | 7 | set(CMAKE_AUTOUIC ON) 8 | set(CMAKE_AUTOUIC_SEARCH_PATHS ui) 9 | set(CMAKE_AUTOMOC ON) 10 | set(CMAKE_AUTORCC ON) 11 | 12 | set(CMAKE_CXX_STANDARD 11) 13 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 14 | 15 | list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) 16 | find_package(Qwt REQUIRED) 17 | 18 | find_package(Qt5 COMPONENTS Widgets REQUIRED) 19 | add_executable(diffimg 20 | # Main sources 21 | src/AboutDialog.cpp 22 | src/AboutDialog.h 23 | src/AppSettings.cpp 24 | src/AppSettings.h 25 | src/ChannelCurve.cpp 26 | src/ChannelCurve.h 27 | src/DiffImgWindow.cpp 28 | src/DiffImgWindow.h 29 | src/FilesDialog.cpp 30 | src/FilesDialog.h 31 | src/FilesManager.cpp 32 | src/FilesManager.h 33 | src/ImageNavigator.cpp 34 | src/ImageNavigator.h 35 | src/ImageView.cpp 36 | src/ImageView.h 37 | src/IMessageHandler.h 38 | src/LogHandler.cpp 39 | src/LogHandler.h 40 | src/main.cpp 41 | src/MiscFunctions.cpp 42 | src/MiscFunctions.h 43 | src/PropertyWidget.cpp 44 | src/PropertyWidget.h 45 | src/WipeItem.cpp 46 | src/WipeItem.h 47 | src/WipeMethod.h 48 | 49 | # Metrics 50 | src/metrics/BaseMetric.cpp 51 | src/metrics/BaseMetric.h 52 | src/metrics/MetricsManager.cpp 53 | src/metrics/MetricsManager.h 54 | src/metrics/MetricsRegistering.cpp 55 | src/metrics/MetricsRegistering.h 56 | src/metrics/PerceptualMetric.cpp 57 | src/metrics/PerceptualMetric.h 58 | src/metrics/PerChannelMeanMetric.cpp 59 | src/metrics/PerChannelMeanMetric.h 60 | src/metrics/PerChannelMetric.cpp 61 | src/metrics/PerChannelMetric.h 62 | src/metrics/PerLuminanceMetric.cpp 63 | src/metrics/PerLuminanceMetric.h 64 | 65 | # UI files 66 | ui/AboutDialog.ui 67 | ui/DiffImgWindow.ui 68 | ui/FilesDialog.ui 69 | 70 | # Resource files 71 | res/diffimg.qrc 72 | 73 | ## 3rd party 74 | # Perceptual diff 75 | 3rdparty/perceptualdiff/LPyramid.h 76 | 3rdparty/perceptualdiff/Metric.h 77 | 3rdparty/perceptualdiff/CompareArgs.h 78 | 3rdparty/perceptualdiff/RGBAImage.h 79 | 3rdparty/perceptualdiff/LPyramid.cpp 80 | 3rdparty/perceptualdiff/Metric.cpp 81 | 3rdparty/perceptualdiff/CompareArgs.cpp 82 | 3rdparty/perceptualdiff/RGBAImage.cpp 83 | 84 | # Qt property browser 85 | 3rdparty/qtpropertybrowser/qteditorfactory.cpp 86 | 3rdparty/qtpropertybrowser/qteditorfactory.h 87 | 3rdparty/qtpropertybrowser/qtpropertybrowser.cpp 88 | 3rdparty/qtpropertybrowser/qtpropertybrowser.h 89 | 3rdparty/qtpropertybrowser/qtpropertybrowserutils.cpp 90 | 3rdparty/qtpropertybrowser/qtpropertybrowserutils_p.h 91 | 3rdparty/qtpropertybrowser/qtpropertymanager.cpp 92 | 3rdparty/qtpropertybrowser/qtpropertymanager.h 93 | 3rdparty/qtpropertybrowser/qttreepropertybrowser.cpp 94 | 3rdparty/qtpropertybrowser/qttreepropertybrowser.h 95 | 3rdparty/qtpropertybrowser/qtvariantproperty.cpp 96 | 3rdparty/qtpropertybrowser/qtvariantproperty.h 97 | ) 98 | 99 | target_include_directories(diffimg PRIVATE 100 | src 101 | src/metrics 102 | 103 | 3rdparty/perceptualdiff 104 | 3rdparty/qtpropertybrowser 105 | ) 106 | target_link_libraries(diffimg PRIVATE Qwt::Qwt Qt5::Widgets) 107 | install(TARGETS diffimg DESTINATION bin) 108 | -------------------------------------------------------------------------------- /COPYING.txt: -------------------------------------------------------------------------------- 1 | See LICENSE file. 2 | 3 | -------------------------------------------------------------------------------- /CREDITS.txt: -------------------------------------------------------------------------------- 1 | DiffImg: an image difference viewer 2 | 3 | porting tasks: 4 | * OS/2 package: thanks to Elbert Pol (elbert.pol at gmail.com) 5 | 6 | translations: 7 | * french: thanks to xbee (xbee at xbee dot net) 8 | * Czech: thanks to Pavel Fric (pavelfric at seznam dot cz) 9 | * Italian: thanks to Nicola Giacobbe ( nicolagiacobbe at users dot sourceforge dot net ) 10 | * Romanian: Jaff 11 | * Russian: montonero 12 | * Swedish: eson 13 | * Chinese: Mikechang 14 | * Portuguese: rafaelff1 15 | * Vietnamese: ppanhh 16 | * German: sixforone, Arnol 17 | 18 | Some parts are derived, inspired, extracted or use these great projects: 19 | * Qwt : The Qwt Widget Library (http://qwt.sf.net) 20 | * Wally: Qt4 wallpaper/background changer (http://www.becrux.com/index.php?page=projects&name=wally) 21 | * wwWidgets: (http://www.wysota.eu.org/wwwidgets) 22 | * Fresh library: Filipe AZEVEDO aka Nox P@sNox, (https://github.com/pasnox/fresh) 23 | * libyuv: https://code.google.com/p/libyuv/ 24 | * OpenCV: http://opencv.org/ 25 | 26 | -------------------------------------------------------------------------------- /Changelog.txt: -------------------------------------------------------------------------------- 1 | Version 2.2.0 2 | * Features: 3 | - add a "wipe effect" to enhance difference between images 4 | 5 | Version 2.1.x 6 | * Features: 7 | - add keys for zooming with keyboard (Ctrl+/Ctrl-) 8 | - add YUV format 9 | * Bugs 10 | - Invalid restore of maximized window state 11 | Version 2.0.2 12 | * Features: 13 | - Change default location of translation file on linux ("/share/diffimg/locale" instead of "/share/locale") 14 | - Add OSX target 15 | - Add debian package files 16 | - Add portable option 17 | * Bugs 18 | - minor fixes 19 | Version 2.0.1 20 | * Features: 21 | - ability to add a comment on loaded images 22 | - ability to display difference histogram with or without zero level 23 | - Add Chinese translation. Thanks to mikechang. 24 | - Add Romanian translation. Thanks to Jaff. 25 | - Add German translation. Thanks to sixforone. 26 | * Bugs 27 | - find the correct path for translation files on linux in some cases 28 | - incorrect display on multiple screen configuration in some cases 29 | - incorrect display of splashscreen on linux in some cases 30 | Version 2.0.0 31 | * Features: 32 | - new metric engine allowing easy addition of new metric 33 | - support of 16 bits and 32 bits mono channel image (tiff) 34 | - add drag&drop 35 | - add a new metric "perceptual diff" from http://pdiff.sourceforge.net/ 36 | - add gain/offset on displayed image 37 | - add an interactive "navigator" window 38 | - slideshow mode can use files with differents suffix (e.g. compare a file.png with a file.jpg) 39 | - Add Vietnamese translation. Thanks to ppanhh. 40 | - Add Swedish translation. Thanks to eson. 41 | - Add Portuguese translation. Thanks to rafaelff1 . 42 | * Bugs 43 | - incorrect loading of translation file in some cases 44 | - incorrect layout (switch mono/dual panel mode) 45 | Version 1.5.1 46 | - some code refactoring 47 | - add a direct link to website for help 48 | - update .pro file for missed translation files 49 | Version 1.5.0 50 | * Features 51 | - add the ability to save image difference in batch mode 52 | * Misc 53 | - clean code (cppcheck) 54 | Version 1.4.0 55 | * Features 56 | - add new mode to compute image difference (channel mean difference and lightness difference) 57 | * Fix 58 | - incorrect error number reporting 59 | Version 1.3.1 60 | * Features 61 | - add italian translation. Thanks to thanks to Nicola Giacobbe ( nicolagiacobbe at users dot sourceforge dot net ) 62 | Version 1.3.0 63 | * Features 64 | - add a basic batch mode 65 | Version 1.2.1 66 | * Features 67 | - add Czech translation. Thanks to Pavel Fric (pavelfric at seznam dot cz) 68 | * Fix 69 | - add flag for splashscreen incorectly displayed on some plaforms 70 | Version 1.2.0 71 | * Features 72 | - add command line argument to reset the stored preference 73 | - fix incorrect .desktop definition 74 | Version 1.1.0 75 | * Features 76 | - add changelog access in interface 77 | - add some test files in the Windows setup.exe 78 | - add opacity of error mask in preferences 79 | - add the ability to set a threshold in RMS value to compare the two images 80 | * Bugs 81 | - correct missing DLLs in the Windows installer for mingw compilation 82 | Version 1.0.0 83 | - First official release 84 | -------------------------------------------------------------------------------- /INSTALL.txt: -------------------------------------------------------------------------------- 1 | * Linux (test on ubuntu/kubuntu/Fedora/openSuse/CentOS/debian) 2 | 3 | #> dos2unix tounix.sh 4 | #> sh ./tounix.sh 5 | #> cd ./build 6 | #> qmake-qt4 -recursive diffimg.pro 7 | 8 | or 9 | 10 | #> cd build 11 | #> qmake -recursive diffimg.pro 12 | #> make 13 | #>sudo make install 14 | 15 | or with cmake 16 | #> cd build 17 | #> cmake . 18 | #> make 19 | #>sudo make install 20 | 21 | Linux dependencies: 22 | - opencv (ubuntu: libopencv-dev) 23 | - qwt (ubuntu: libqwt-dev) 24 | - Optionally freeimage (ubuntu: libfreeimage-dev) 25 | 26 | 27 | You can also use qtcreator from qt-sdk 28 | 29 | # For Centos 5.x user (need a valid Qt4 release in order to compil) 30 | sudo rpm -ivh http://software.freivald.com/centos/software.freivald.com-1.0.0-1.noarch.rpm 31 | sudo yum update fontconfig fontconfig-devel qt4 qt4-devel qt4-doc qt4-postgresql qt4-odbc qt4-sqlite qt-creator 32 | sudo rpm --import http://software.freivald.com/centos/RPM-GPG-KEY-software.freivald.com 33 | 34 | # Package creation for debian, Ubuntu, Mepis, ... 35 | #> cd build 36 | #> dpkg-buildpackage -tc -b -rfakeroot 37 | 38 | * Windows (tested on XP/Seven x64) 39 | 40 | Opencv and qwt are bundled for practicality 41 | 42 | Use qtcreator, cmake or the Visual Qt plugin 43 | There a NSI script for building a setup.exe file in the setup directory 44 | 45 | * MAC OSX 46 | qmake diffimg.pro -r -spec macx-g++ CONFIG+=release CONFIG+=x86_64 47 | 48 | * OS2 49 | see README.os2 50 | -------------------------------------------------------------------------------- /NEWS.txt: -------------------------------------------------------------------------------- 1 | see Changelog.txt -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | DiffImg is a simple image comparison tool which take two RGB images with the same size as input. Some statitics are computed and the positions where pixel differ are displayed as a color mask. 2 | Because DiffImg is written with Qt, it runs on Windows, Linux, OS/2 (MacOSX isn't tested yet). 3 | 4 | You want to help ? You can proposed you as translator on transifex.com (DiffImg project) or post feedbacks on SourceForge: 5 | - http://sourceforge.net/p/diffimg/tickets for bug report or feature request 6 | - http://sourceforge.net/p/diffimg/discussion/ for general feedbacks 7 | 8 | You can also help me by correcting my brief help page (I'm sure you've noticed that English is not my mother tongue! :)) Contact me xbee at xbee dot net -------------------------------------------------------------------------------- /TODO.txt: -------------------------------------------------------------------------------- 1 | - Bug hunt 2 | - more translations (I need help !). Send them to xbee at xbee dot net or project is referenced on www.transifex.com, feel free to give help. 3 | - Add more metrics ? 4 | - Add zoom with +/- keys 5 | - And Feel free to write feedback, bug-reports and patches ! 6 | -------------------------------------------------------------------------------- /cmake/FindQwt.cmake: -------------------------------------------------------------------------------- 1 | # Qt Widgets for Technical Applications 2 | # available at http://www.http://qwt.sourceforge.net/ 3 | # 4 | # The module defines the following variables: 5 | # Qwt_FOUND - the system has Qwt 6 | # QWT_INCLUDE_DIR - where to find qwt_plot.h 7 | # QWT_INCLUDE_DIRS - qwt includes 8 | # QWT_LIBRARY - where to find the Qwt library 9 | # QWT_LIBRARIES - aditional libraries 10 | # QWT_VERSION_STRING - version (ex. 5.2.1) 11 | # 12 | # It also defines this imported target: 13 | # Qwt::Qwt 14 | 15 | #============================================================================= 16 | # Copyright 2010-2013, Julien Schueller 17 | # Copyright 2018-2020, Rolf Eike Beer 18 | # All rights reserved. 19 | # 20 | # Redistribution and use in source and binary forms, with or without 21 | # modification, are permitted provided that the following conditions are met: 22 | # 23 | # 1. Redistributions of source code must retain the above copyright notice, this 24 | # list of conditions and the following disclaimer. 25 | # 2. Redistributions in binary form must reproduce the above copyright notice, 26 | # this list of conditions and the following disclaimer in the documentation 27 | # and/or other materials provided with the distribution. 28 | # 29 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 30 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 31 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 32 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 33 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 34 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 35 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 36 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 38 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | 40 | # The views and conclusions contained in the software and documentation are those 41 | # of the authors and should not be interpreted as representing official policies, 42 | # either expressed or implied, of the FreeBSD Project. 43 | #============================================================================= 44 | 45 | if (Qt5Gui_FOUND) 46 | get_target_property(QT_INCLUDE_DIR Qt5::Gui INTERFACE_INCLUDE_DIRECTORIES) 47 | endif () 48 | 49 | find_path ( QWT_INCLUDE_DIR 50 | NAMES qwt_plot.h 51 | HINTS ${QT_INCLUDE_DIR} 52 | PATH_SUFFIXES qwt qwt-qt5 qwt6 53 | ) 54 | 55 | set ( QWT_INCLUDE_DIRS ${QWT_INCLUDE_DIR} ) 56 | 57 | # version 58 | set ( _VERSION_FILE ${QWT_INCLUDE_DIR}/qwt_global.h ) 59 | if ( EXISTS ${_VERSION_FILE} ) 60 | file ( STRINGS ${_VERSION_FILE} _VERSION_LINE REGEX "define[ ]+QWT_VERSION_STR" ) 61 | if ( _VERSION_LINE ) 62 | string ( REGEX REPLACE ".*define[ ]+QWT_VERSION_STR[ ]+\"([^\"]*)\".*" "\\1" QWT_VERSION_STRING "${_VERSION_LINE}" ) 63 | endif () 64 | endif () 65 | unset ( _VERSION_FILE ) 66 | 67 | find_library ( QWT_LIBRARY 68 | NAMES qwt qwt-qt5 69 | HINTS ${QT_LIBRARY_DIR} 70 | ) 71 | 72 | set ( QWT_LIBRARIES ${QWT_LIBRARY} ) 73 | 74 | include ( FindPackageHandleStandardArgs ) 75 | find_package_handle_standard_args( Qwt REQUIRED_VARS QWT_LIBRARY QWT_INCLUDE_DIR VERSION_VAR QWT_VERSION_STRING ) 76 | 77 | if (Qwt_FOUND AND NOT TARGET Qwt::Qwt) 78 | add_library(Qwt::Qwt UNKNOWN IMPORTED) 79 | set_target_properties(Qwt::Qwt PROPERTIES 80 | INTERFACE_INCLUDE_DIRECTORIES "${QWT_INCLUDE_DIRS}" 81 | IMPORTED_LOCATION "${QWT_LIBRARIES}") 82 | endif () 83 | 84 | mark_as_advanced ( 85 | QWT_LIBRARY 86 | QWT_INCLUDE_DIR 87 | ) 88 | -------------------------------------------------------------------------------- /diffimg.pro: -------------------------------------------------------------------------------- 1 | QT += core gui widgets 2 | 3 | TARGET = diffimg 4 | TEMPLATE = app 5 | 6 | include(3rdparty/perceptualdiff/perceptualdiff.pri) 7 | include(3rdparty/qtpropertybrowser/qtpropertybrowser.pri) 8 | 9 | # directories setup 10 | isEmpty( INSTALL_MANDIR ) : INSTALL_MANDIR = $$[QT_INSTALL_PREFIX]/share/man 11 | isEmpty( INSTALL_DATADIR ) : INSTALL_DATADIR = $$[QT_INSTALL_PREFIX]/share 12 | 13 | isEmpty( MYAPP_INSTALL_DESKTOP ) : MYAPP_INSTALL_DESKTOP = $$INSTALL_DATADIR/applications 14 | isEmpty( MYAPP_INSTALL_PIXMAPS ) : MYAPP_INSTALL_PIXMAPS = $$INSTALL_DATADIR/pixmaps 15 | isEmpty( MYAPP_INSTALL_DATA ) : MYAPP_INSTALL_DATA = $$INSTALL_DATADIR/$$TARGET 16 | isEmpty( MYAPP_INSTALL_DIR ) : MYAPP_INSTALL_DIR = $$INSTALL_LIBDIR/$$TARGET 17 | isEmpty( MYAPP_INSTALL_BINDIR ) : MYAPP_INSTALL_BINDIR = $$[QT_INSTALL_BINS] 18 | isEmpty( MYAPP_INSTALL_MAN ) : MYAPP_INSTALL_MAN = $$INSTALL_MANDIR/man1 19 | isEmpty( MYAPP_INSTALL_TRANS ) : MYAPP_INSTALL_TRANS = $$INSTALL_DATADIR/$$TARGET/locale 20 | 21 | HEADERS += \ 22 | $$PWD/src/AboutDialog.h \ 23 | $$PWD/src/AppSettings.h \ 24 | $$PWD/src/DiffImgWindow.h \ 25 | $$PWD/src/FilesDialog.h \ 26 | $$PWD/src/FilesManager.h \ 27 | $$PWD/src/ImageNavigator.h \ 28 | $$PWD/src/ImageView.h \ 29 | $$PWD/src/LogHandler.h \ 30 | $$PWD/src/WipeItem.h \ 31 | $$PWD/src/WipeMethod.h \ 32 | $$PWD/src/metrics/BaseMetric.h \ 33 | $$PWD/src/metrics/MetricsManager.h \ 34 | $$PWD/src/metrics/MetricsRegistering.h \ 35 | $$PWD/src/metrics/PerceptualMetric.h \ 36 | $$PWD/src/metrics/PerChannelMeanMetric.h \ 37 | $$PWD/src/metrics/PerChannelMetric.h \ 38 | $$PWD/src/metrics/PerLuminanceMetric.h \ 39 | $$PWD/src/MiscFunctions.h \ 40 | $$PWD/src/PropertyWidget.h \ 41 | $$PWD/src/ChannelCurve.h 42 | 43 | #$$PWD/src/formats/BaseFormat.h \ 44 | #$$PWD/src/formats/FormatsManager.h \ 45 | #$$PWD/src/formats/FormatsRegistering.h \ 46 | #$$PWD/src/formats/YUVFormat.h \ 47 | 48 | SOURCES += \ 49 | $$PWD/src/AboutDialog.cpp \ 50 | $$PWD/src/AppSettings.cpp \ 51 | $$PWD/src/DiffImgWindow.cpp \ 52 | $$PWD/src/FilesDialog.cpp \ 53 | $$PWD/src/FilesManager.cpp \ 54 | $$PWD/src/ImageNavigator.cpp \ 55 | $$PWD/src/ImageView.cpp \ 56 | $$PWD/src/LogHandler.cpp \ 57 | $$PWD/src/WipeItem.cpp \ 58 | $$PWD/src/main.cpp \ 59 | $$PWD/src/metrics/BaseMetric.cpp \ 60 | $$PWD/src/metrics/MetricsManager.cpp \ 61 | $$PWD/src/metrics/MetricsRegistering.cpp \ 62 | $$PWD/src/metrics/PerceptualMetric.cpp \ 63 | $$PWD/src/metrics/PerChannelMeanMetric.cpp \ 64 | $$PWD/src/metrics/PerChannelMetric.cpp \ 65 | $$PWD/src/metrics/PerLuminanceMetric.cpp \ 66 | $$PWD/src/MiscFunctions.cpp \ 67 | $$PWD/src/PropertyWidget.cpp \ 68 | $$PWD/src/ChannelCurve.cpp 69 | 70 | #$$PWD/src/formats/BaseFormat.cpp \ 71 | #$$PWD/src/formats/FormatsManager.cpp \ 72 | #$$PWD/src/formats/FormatsRegistering.cpp \ 73 | #$$PWD/src/formats/YUVFormat.cpp \ 74 | 75 | FORMS += \ 76 | $$PWD/ui/AboutDialog.ui \ 77 | $$PWD/ui/DiffImgWindow.ui \ 78 | $$PWD/ui/FilesDialog.ui 79 | 80 | INCLUDEPATH += \ 81 | $${DESTDIR} \ 82 | $$PWD/src \ 83 | $$PWD/src/metrics \ 84 | $$PWD/src/formats 85 | 86 | INCLUDEPATH += /usr/include/qwt 87 | LIBS += -lqwt 88 | 89 | RESOURCES += $$PWD/res/$${TARGET}.qrc 90 | 91 | TRANSLATIONS += $$PWD/lang/$${TARGET}_fr.ts # french 92 | TRANSLATIONS += $$PWD/lang/$${TARGET}_cs.ts # Czech 93 | TRANSLATIONS += $$PWD/lang/$${TARGET}_it.ts # Italian 94 | TRANSLATIONS += $$PWD/lang/$${TARGET}_vi.ts # Vietnamese 95 | TRANSLATIONS += $$PWD/lang/$${TARGET}_pt.ts # Portuguese 96 | TRANSLATIONS += $$PWD/lang/$${TARGET}_sv.ts # Swedish 97 | TRANSLATIONS += $$PWD/lang/$${TARGET}_zh.ts # Chinese 98 | TRANSLATIONS += $$PWD/lang/$${TARGET}_ro.ts # Romanian 99 | TRANSLATIONS += $$PWD/lang/$${TARGET}_de.ts # German 100 | TRANSLATIONS += $$PWD/lang/$${TARGET}_ru.ts # Russian 101 | 102 | macx:ICON = res/$${TARGET}.icns 103 | macx:QMAKE_INFO_PLIST = build/Info.plist 104 | macx:QMAKE_POST_LINK += ./postbuild-macx.sh 105 | 106 | win32:RC_FILE = $$PWD/res/$${TARGET}.rc 107 | 108 | win32-msvc*:DEFINES += _CRT_NONSTDC_NO_DEPRECATE _CRT_SECURE_NO_WARNINGS 109 | 110 | macx { 111 | # add auto creation of info.plist file 112 | VERSION = $$system(grep VERSION $$PWD/src/AppSettings.h | awk \' { print $NF }\' | sed \'s/\"//g\') 113 | createplist.commands = $$PWD/misc/Info.plist.sh $$VERSION > $$PWD/misc/Info.plist 114 | createplist.target = Info.plist1 115 | createplist.depends = FORCE 116 | PRE_TARGETDEPS += Info.plist1 117 | QMAKE_EXTRA_TARGETS += createplist 118 | } 119 | 120 | # .qm file for mingw and before setup.nsi 121 | win32-g++ { 122 | # add auto compilation of .ts files 123 | QMAKE_EXTRA_COMPILERS += copyQtTrans 124 | for(TRANS,TRANSLATIONS){ 125 | lang = $$replace(TRANS, .*_([^/]*)\\.ts, \\1) 126 | GLOBALTRANSLATIONS += $$[QT_INSTALL_TRANSLATIONS]/qt_$${lang}.qm 127 | } 128 | copyQtTrans.input = GLOBALTRANSLATIONS 129 | copyQtTrans.output = ${QMAKE_FILE_BASE}.qm 130 | copyQtTrans.commands = cp ${QMAKE_FILE_IN} $$PWDlang/ 131 | copyQtTrans.CONFIG += no_link target_predeps 132 | 133 | # add auto compilation of .ts files 134 | QMAKE_EXTRA_COMPILERS += lrelease 135 | lrelease.input = TRANSLATIONS 136 | lrelease.output = ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.qm 137 | lrelease.commands = $$[QT_INSTALL_BINS]/lrelease ${QMAKE_FILE_IN} -qm $$PWD/lang/${QMAKE_FILE_BASE}.qm 138 | lrelease.CONFIG += no_link target_predeps 139 | } 140 | 141 | 142 | unix:!macx { 143 | # add auto compilation of .ts files 144 | QMAKE_EXTRA_COMPILERS += lrelease 145 | lrelease.input = TRANSLATIONS 146 | lrelease.output = ${QMAKE_FILE_BASE}.qm 147 | lrelease.commands = $$[QT_INSTALL_BINS]/lrelease ${QMAKE_FILE_IN} -qm $$PWD/lang/${QMAKE_FILE_BASE}.qm 148 | lrelease.CONFIG += no_link target_predeps 149 | 150 | target.path = $$MYAPP_INSTALL_BINDIR 151 | 152 | transl.files = $$PWD/lang/*.qm 153 | transl.path = $$MYAPP_INSTALL_TRANS 154 | 155 | data.files += $$PWD/CREDITS.txt $$PWD/README.txt $$PWD/AUTHORS.txt $$PWD/Changelog.txt 156 | data.path = $$MYAPP_INSTALL_DATA 157 | 158 | # generate desktop file 159 | VERSION = $$system(grep VERSION $$PWD/src/AppSettings.h | awk \' { print $NF }\' | sed \'s/\"//g\') 160 | system( sh $$PWD/misc/diffimg-desktop.sh $$[QT_INSTALL_PREFIX] $$VERSION > diffimg.desktop ) 161 | desktop.files += $${TARGET}.desktop 162 | desktop.path = $$MYAPP_INSTALL_DESKTOP 163 | 164 | icons.files += $$PWD/res/$${TARGET}.png 165 | icons.path = $$MYAPP_INSTALL_PIXMAPS 166 | 167 | # generate manpage 168 | system( sh $$PWD/misc/diffimg-manpage.sh > diffimg.1 ) 169 | system( gzip -9 -f diffimg.1 ) 170 | manual.files += diffimg.1.gz 171 | manual.path = $$MYAPP_INSTALL_MAN 172 | 173 | INSTALLS += target transl data desktop icons manual 174 | } 175 | 176 | 177 | 178 | -------------------------------------------------------------------------------- /misc/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | DiffImg 9 | CFBundleGetInfoString 10 | DiffImg 2.0.0, Copyright 2011-2014 Xbee, GNU General Public License 11 | CFBundleIconFile 12 | diffimg 13 | CFBundleIdentifier 14 | com.TheHive.DiffImg 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 2.0.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 2.0.0 25 | CSResourcesFileMapped 26 | 27 | NSHumanReadableCopyright 28 | Copyright 2011-2014 http://thehive.xbee.net/ 29 | CFBundleDocumentTypes 30 | 31 | 32 | -------------------------------------------------------------------------------- /misc/Info.plist.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cat < 4 | 5 | 6 | 7 | CFBundleDevelopmentRegion 8 | English 9 | CFBundleExecutable 10 | DiffImg 11 | CFBundleGetInfoString 12 | DiffImg $1, Copyright 2011-2014 Xbee, GNU General Public License 13 | CFBundleIconFile 14 | diffimg 15 | CFBundleIdentifier 16 | com.TheHive.DiffImg 17 | CFBundleInfoDictionaryVersion 18 | 6.0 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | $1 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | $1 27 | CSResourcesFileMapped 28 | 29 | NSHumanReadableCopyright 30 | Copyright 2011-2014 http://thehive.xbee.net/ 31 | CFBundleDocumentTypes 32 | 33 | 34 | -------------------------------------------------------------------------------- /misc/diffimg-desktop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cat < /dev/null 6 | macdeployqt Release/diffimg.app -dmg 7 | -------------------------------------------------------------------------------- /res/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIconFile 6 | diffimg.icns 7 | CFBundlePackageType 8 | APPL 9 | CFBundleGetInfoString 10 | Created by Qt/QMake 11 | CFBundleSignature 12 | ???? 13 | CFBundleExecutable 14 | DiffImg 15 | CFBundleIdentifier 16 | net.xbee.diffimg 17 | NOTE 18 | Author: xbee 19 | NSHumanReadableCopyright 20 | Copyright 2011 http://thehive.xbee.net 21 | 22 | 23 | -------------------------------------------------------------------------------- /res/about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/about.png -------------------------------------------------------------------------------- /res/allgood.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/allgood.png -------------------------------------------------------------------------------- /res/bad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/bad.png -------------------------------------------------------------------------------- /res/check2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/check2.png -------------------------------------------------------------------------------- /res/closetab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/closetab.png -------------------------------------------------------------------------------- /res/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/comment.png -------------------------------------------------------------------------------- /res/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/delete.png -------------------------------------------------------------------------------- /res/diffimg.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/diffimg.icns -------------------------------------------------------------------------------- /res/diffimg.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/diffimg.ico -------------------------------------------------------------------------------- /res/diffimg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/diffimg.png -------------------------------------------------------------------------------- /res/diffimg.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | wipe_effect.png 4 | delete.png 5 | comment.png 6 | save.png 7 | check2.png 8 | perceptual.png 9 | perchannel.png 10 | perchannelmean.png 11 | perluminance.png 12 | journal.png 13 | help.png 14 | allgood.png 15 | bad.png 16 | somebad.png 17 | refresh.png 18 | preferences.png 19 | diffimg.png 20 | modified.png 21 | original.png 22 | about.png 23 | splashscreen.png 24 | window_split_hor.png 25 | red.png 26 | yellow.png 27 | icon_difference.png 28 | prev.png 29 | next.png 30 | icon_open.png 31 | icon_diff.png 32 | icon_mag1.png 33 | icon_magfit.png 34 | icon_modified.png 35 | icon_original.png 36 | icon_quit.png 37 | 38 | 39 | -------------------------------------------------------------------------------- /res/diffimg.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON DISCARDABLE "diffimg.ico" 2 | 3 | -------------------------------------------------------------------------------- /res/help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/help.png -------------------------------------------------------------------------------- /res/icon_diff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/icon_diff.png -------------------------------------------------------------------------------- /res/icon_difference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/icon_difference.png -------------------------------------------------------------------------------- /res/icon_mag1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/icon_mag1.png -------------------------------------------------------------------------------- /res/icon_magfit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/icon_magfit.png -------------------------------------------------------------------------------- /res/icon_modified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/icon_modified.png -------------------------------------------------------------------------------- /res/icon_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/icon_open.png -------------------------------------------------------------------------------- /res/icon_original.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/icon_original.png -------------------------------------------------------------------------------- /res/icon_quit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/icon_quit.png -------------------------------------------------------------------------------- /res/journal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/journal.png -------------------------------------------------------------------------------- /res/modified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/modified.png -------------------------------------------------------------------------------- /res/next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/next.png -------------------------------------------------------------------------------- /res/original.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/original.png -------------------------------------------------------------------------------- /res/perceptual.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/perceptual.png -------------------------------------------------------------------------------- /res/perchannel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/perchannel.png -------------------------------------------------------------------------------- /res/perchannelmean.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/perchannelmean.png -------------------------------------------------------------------------------- /res/perluminance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/perluminance.png -------------------------------------------------------------------------------- /res/preferences.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/preferences.png -------------------------------------------------------------------------------- /res/prev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/prev.png -------------------------------------------------------------------------------- /res/red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/red.png -------------------------------------------------------------------------------- /res/refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/refresh.png -------------------------------------------------------------------------------- /res/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/save.png -------------------------------------------------------------------------------- /res/somebad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/somebad.png -------------------------------------------------------------------------------- /res/splashscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/splashscreen.png -------------------------------------------------------------------------------- /res/unknown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/unknown.png -------------------------------------------------------------------------------- /res/window_split_hor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/window_split_hor.png -------------------------------------------------------------------------------- /res/wipe_effect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/wipe_effect.png -------------------------------------------------------------------------------- /res/yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/res/yellow.png -------------------------------------------------------------------------------- /setup/banner.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/setup/banner.bmp -------------------------------------------------------------------------------- /setup/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/setup/icon.ico -------------------------------------------------------------------------------- /setup/icon_install.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/setup/icon_install.ico -------------------------------------------------------------------------------- /setup/icon_uninstall.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/setup/icon_uninstall.ico -------------------------------------------------------------------------------- /setup/setup.nsi: -------------------------------------------------------------------------------- 1 | 2 | ; NSIS install script 3 | ; use makensis /DVERSION=x.y.z setup.nsi 4 | ; 5 | 6 | XPStyle on 7 | !define PROGRAM_NAME "DiffImg" 8 | !define TARGET_NAME "${PROGRAM_NAME}" 9 | !define ORGANIZATION_NAME "TheHive" 10 | !define SHCNE_ASSOCCHANGED 0x8000000 11 | !define SHCNF_IDLIST 0 12 | 13 | 14 | BrandingText "${PROGRAM_NAME} installation"; remove the nsis release on the gui 15 | 16 | ########################################################################################### 17 | # init functions 18 | ########################################################################################### 19 | 20 | Function .onInit 21 | 22 | # fading splashscreen !! 23 | # the plugins dir is automatically deleted when the installer exits 24 | InitPluginsDir 25 | File /oname=$PLUGINSDIR\splash.bmp "splashscreen.bmp" 26 | #optional 27 | #File /oname=$PLUGINSDIR\splash.wav "C:\myprog\sound.wav" 28 | 29 | advsplash::show 2000 600 400 -1 $PLUGINSDIR\splash 30 | 31 | Pop $0 ; $0 has '1' if the user closed the splash screen early, 32 | ; '0' if everything closed normally, and '-1' if some error occurred. 33 | 34 | Delete $PLUGINSDIR\splash.bmp 35 | 36 | # uninstall previous release before installing a new one 37 | ReadRegStr $R0 HKLM \ 38 | "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}" \ 39 | "UninstallString" 40 | StrCmp $R0 "" done 41 | 42 | MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \ 43 | "${PROGRAM_NAME} is already installed. $\n$\nClick `OK` to remove the \ 44 | previous version or `Cancel` to cancel this upgrade." \ 45 | IDOK uninst 46 | Abort 47 | 48 | ;Run the uninstaller 49 | uninst: 50 | ClearErrors 51 | ExecWait "$INSTDIR\uninstall.exe /S" 52 | 53 | done: 54 | 55 | FunctionEnd 56 | 57 | ;-------------------------------- 58 | 59 | Function LaunchLink 60 | ExecShell "" "$INSTDIR\${PROGRAM_NAME}.exe" 61 | FunctionEnd 62 | 63 | ;-------------------------------- 64 | ;Include Modern UI 65 | 66 | !include "MUI2.nsh" 67 | 68 | ;-------------------------------- 69 | ;General 70 | 71 | ;Name and file 72 | !ifndef VERSION 73 | !define VERSION 'bxx' 74 | !endif 75 | 76 | ;Name and file 77 | Name "${PROGRAM_NAME}" 78 | 79 | ;-------------------------------- 80 | ;Configuration 81 | 82 | ; output directory if not set by batch 83 | !ifndef SETUP_DIR 84 | !define SETUP_DIR '.\' 85 | !endif 86 | 87 | ; output setup file 88 | !ifdef OUTFILE 89 | OutFile "${SETUP_DIR}\${OUTFILE}" 90 | !else 91 | OutFile "${SETUP_DIR}\${PROGRAM_NAME}-${VERSION}-setup.exe" 92 | !endif 93 | 94 | ;Default installation folder 95 | InstallDir $PROGRAMFILES\${ORGANIZATION_NAME}\${PROGRAM_NAME} 96 | 97 | ;Get installation folder from registry if available 98 | InstallDirRegKey HKLM "Software\${ORGANIZATION_NAME}\${PROGRAM_NAME}" "Install_Dir" 99 | 100 | ;Request application privileges for Windows Vista 101 | RequestExecutionLevel admin 102 | 103 | ;-------------------------------- 104 | ;Interface Settings 105 | 106 | !define MUI_HEADERIMAGE 107 | !define MUI_HEADERIMAGE_RIGHT 108 | !define MUI_HEADERIMAGE_BITMAP "banner.bmp" ; optional installer pages 109 | !define MUI_HEADERIMAGE_UNBITMAP "banner.bmp" ; uninstaller pages 110 | !define MUI_ABORTWARNING 111 | !define MUI_ICON "icon_install.ico" 112 | !define MUI_UNICON "icon_uninstall.ico" 113 | !define MUI_WELCOMEFINISHPAGE_BITMAP "welcome.bmp" ; welcome/finish banner 114 | !define MUI_WELCOMEPAGE_TITLE "Welcome to the ${PROGRAM_NAME} ${VERSION} Setup Wizard" 115 | !define MUI_FINISHPAGE_NOAUTOCLOSE 116 | 117 | !define MUI_FINISHPAGE_RUN 118 | !define MUI_FINISHPAGE_RUN_NOTCHECKED 119 | !define MUI_FINISHPAGE_RUN_TEXT "Start ${PROGRAM_NAME} after install" 120 | !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink" 121 | !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED 122 | 123 | ;-------------------------------- 124 | ;Pages 125 | 126 | ;!insertmacro MUI_PAGE_LICENSE "License.txt" 127 | ;!insertmacro MUI_PAGE_COMPONENTS 128 | !insertmacro MUI_PAGE_WELCOME ; affiche un welcome 129 | !insertmacro MUI_PAGE_DIRECTORY 130 | !insertmacro MUI_PAGE_INSTFILES 131 | !insertmacro MUI_PAGE_FINISH ; affiche une page de fin 132 | 133 | !insertmacro MUI_UNPAGE_CONFIRM 134 | !insertmacro MUI_UNPAGE_INSTFILES 135 | 136 | ;-------------------------------- 137 | ;Languages 138 | 139 | !insertmacro MUI_LANGUAGE "English" 140 | 141 | ;-------------------------------- 142 | ;Installer Sections 143 | 144 | Section "Dummy Section" SecDummy 145 | 146 | SectionIn RO 147 | 148 | ; Program files there 149 | SetOutPath $INSTDIR 150 | File "..\build\Release\${PROGRAM_NAME}.exe" 151 | File "$%QTDIR%\bin\QtCore4.dll" 152 | File "$%QTDIR%\bin\QtGui4.dll" 153 | 154 | ; Minggw case ... 155 | File /nonfatal "$%QTDIR%\bin\mingwm10.dll" 156 | File /nonfatal "$%QTDIR%\bin\zlib1.dll" 157 | File /nonfatal "$%QTDIR%\bin\libgcc_s_dw2-1.dll" 158 | 159 | 160 | ; qt image plugin 161 | SetOutPath "$INSTDIR\plugins\imageformats" 162 | File "$%QTDIR%\plugins\imageformats\*.dll" 163 | 164 | ; Lang files 165 | SetOutPath "$INSTDIR\lang" 166 | File /nonfatal "..\lang\*.qm" 167 | File /nonfatal "*.qm" 168 | 169 | ; test files 170 | SetOutPath "$INSTDIR\test" 171 | File /r "..\test\*.*" 172 | 173 | ; Other files 174 | SetOutPath $INSTDIR 175 | File "..\CREDITS.txt" 176 | File "..\AUTHORS.txt" 177 | File "..\LICENSE.txt" 178 | File "..\Changelog.txt" 179 | File "..\diffimg-portable.bat" 180 | 181 | ; resources files 182 | SetOutPath $INSTDIR 183 | File "icon.ico" 184 | 185 | ; Write the installation path into the registry 186 | WriteRegStr HKLM SOFTWARE\${ORGANIZATION_NAME}\${PROGRAM_NAME} "Install_Dir" "$INSTDIR" 187 | WriteRegStr HKLM SOFTWARE\${ORGANIZATION_NAME}\${PROGRAM_NAME} "Version" "${VERSION}" 188 | 189 | ; Write the uninstall keys for Windows 190 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}" "DisplayName" "${PROGRAM_NAME}" 191 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}" "UninstallString" '"$INSTDIR\uninstall.exe"' 192 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}" "DisplayIcon" '"$INSTDIR\icon.ico"' 193 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}" "Publisher" "${ORGANIZATION_NAME}" 194 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}" "DisplayVersion" "${VERSION}" 195 | 196 | WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}" "NoModify" 1 197 | WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}" "NoRepair" 1 198 | WriteUninstaller "$INSTDIR\uninstall.exe" 199 | 200 | SectionEnd 201 | 202 | ;-------------------------------- 203 | ; Optional section (can be disabled by the user) 204 | Section "Start Menu Shortcuts" 205 | 206 | SetShellVarContext all ; scope is "All Users" 207 | CreateDirectory "$SMPROGRAMS\${ORGANIZATION_NAME}\${PROGRAM_NAME}" 208 | CreateShortCut "$SMPROGRAMS\${ORGANIZATION_NAME}\${PROGRAM_NAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 209 | CreateShortCut "$SMPROGRAMS\${ORGANIZATION_NAME}\${PROGRAM_NAME}\${PROGRAM_NAME}.lnk" "$INSTDIR\${PROGRAM_NAME}.exe" "" "$INSTDIR\${PROGRAM_NAME}.exe" 0 210 | 211 | ;create desktop shortcut 212 | CreateShortCut "$DESKTOP\${PROGRAM_NAME}.lnk" "$INSTDIR\${PROGRAM_NAME}.exe" "" "$INSTDIR\icon.ico" 213 | 214 | SectionEnd 215 | 216 | ;-------------------------------- 217 | ;Uninstaller Section 218 | 219 | Section "Uninstall" 220 | 221 | ; Remove registry keys 222 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}" 223 | DeleteRegKey HKLM SOFTWARE\${ORGANIZATION_NAME}\${PROGRAM_NAME} 224 | 225 | ; Remove files and uninstaller 226 | Delete "$INSTDIR\*.*" 227 | 228 | ; Remove shortcuts, if any 229 | SetShellVarContext all ; scope is "All Users" 230 | Delete "$SMPROGRAMS\${ORGANIZATION_NAME}\${PROGRAM_NAME}\*.*" 231 | 232 | ; remove desktop link 233 | Delete "$DESKTOP\${PROGRAM_NAME}.lnk" 234 | 235 | ; Remove directories used 236 | RMDir "$SMPROGRAMS\${ORGANIZATION_NAME}\${PROGRAM_NAME}" 237 | RMDir "$SMPROGRAMS\${ORGANIZATION_NAME}\" 238 | RMDir /r "$INSTDIR\plugins" 239 | RMDir /r "$INSTDIR" 240 | 241 | SectionEnd 242 | -------------------------------------------------------------------------------- /setup/splashscreen-x64.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/setup/splashscreen-x64.bmp -------------------------------------------------------------------------------- /setup/splashscreen.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/setup/splashscreen.bmp -------------------------------------------------------------------------------- /setup/welcome.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/setup/welcome.bmp -------------------------------------------------------------------------------- /src/AboutDialog.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #ifndef _DIALOGABOUT_H_ 22 | #define _DIALOGABOUT_H_ 23 | 24 | #include 25 | #include "ui_AboutDialog.h" 26 | 27 | using namespace Ui; 28 | 29 | class QDoubleValidator; 30 | class QIntValidator; 31 | 32 | class AboutDialog : public QDialog, public AboutDialogClass 33 | { 34 | Q_OBJECT 35 | 36 | public: 37 | 38 | AboutDialog(QWidget *parent = 0); 39 | ~AboutDialog(); 40 | 41 | void showAbout(); 42 | void showPreferences(); 43 | 44 | void setCurrentLanguage(const QString &); 45 | 46 | public slots: 47 | 48 | void on_pushButtonClearLog_pressed(); 49 | void on_comboBoxLanguage_activated(int index); 50 | void on_listWidgetTranslations_itemClicked(QListWidgetItem *item); 51 | void on_comboBoxMetrics_currentIndexChanged(int); 52 | void on_comboBoxOutputParam_currentIndexChanged(int); 53 | void on_comboBoxInputParam_currentIndexChanged(int); 54 | void on_lineEditThreshold_textEdited(const QString &text); 55 | void on_lineEditInputParam_textEdited(const QString &text); 56 | void on_pushButtonApplyInputParam_pressed(); 57 | void on_pushButtonApplyImageParam_pressed(); 58 | void on_groupBoxEnableThreshold_toggled(bool on); 59 | void on_tabWidget_currentChanged(int index); 60 | 61 | signals: 62 | 63 | void restart(); 64 | 65 | private: 66 | 67 | void updateAbout(); 68 | void updateCredits(); 69 | void updateChangelog(); 70 | void fillTextedit(const QString &file, QTextEdit *); 71 | void updatePrefsLanguages(); 72 | void updateInfosLanguages(); 73 | void updateInfosImageFormats(); 74 | void updateWipeEffects(); 75 | void initMetrics(); 76 | void changePalette(bool modified, QLineEdit *lineEdit, QPushButton *button); 77 | void setupParam(int index, QComboBox *combo, QLineEdit *lineEdit, QPushButton *button); 78 | void applyParam(QComboBox *combo, QLineEdit *lineEdit, QPushButton *button); 79 | 80 | QString m_currentLanguage; 81 | QMap m_descMethodHash; 82 | QDoubleValidator *m_dValidator; 83 | QIntValidator *m_iValidator; 84 | }; 85 | 86 | #endif // _DIALOGABOUT_H_ 87 | -------------------------------------------------------------------------------- /src/AppSettings.cpp: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #include "AppSettings.h" 22 | 23 | AppSettings::AppSettings() 24 | : QSettings() 25 | { 26 | } 27 | -------------------------------------------------------------------------------- /src/AppSettings.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #ifndef _APPETTINGS_H_ 22 | #define _APPETTINGS_H_ 23 | 24 | #include 25 | 26 | #define PACKAGE_ORGANIZATION "TheHive" 27 | #define PACKAGE_NAME "DiffImg" 28 | #define PACKAGE_VERSION "2.2.0" 29 | #define PACKAGE_ONLINE_HELP_URL "http://thehive.xbee.net/index.php?module=pages&func=display&pageid=11" 30 | #define PACKAGE_CHECK_RELEASE_URL "http://sourceforge.net/projects/diffimg/files" 31 | #define PACKAGE_DESCRIPTION "Image difference viewer" 32 | 33 | class AppSettings : public QSettings 34 | { 35 | Q_OBJECT 36 | 37 | public: 38 | 39 | AppSettings(); 40 | 41 | protected: 42 | }; 43 | 44 | #endif // _APPETTINGS_H_ 45 | -------------------------------------------------------------------------------- /src/ChannelCurve.cpp: -------------------------------------------------------------------------------- 1 | #include "ChannelCurve.h" 2 | 3 | ChannelCurve::ChannelCurve(const QString &title) : 4 | QwtPlotCurve(title) 5 | { 6 | setRenderHint(QwtPlotItem::RenderAntialiased); 7 | } 8 | 9 | void ChannelCurve::setColor(const QColor &color) 10 | { 11 | QColor c = color; 12 | c.setAlpha(50); 13 | 14 | setPen(c); 15 | setBrush(c); 16 | } 17 | -------------------------------------------------------------------------------- /src/ChannelCurve.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // QWT 4 | #include 5 | #include 6 | #include 7 | 8 | class ChannelCurve : public QwtPlotCurve 9 | { 10 | public: 11 | ChannelCurve(const QString &title); 12 | 13 | void setColor(const QColor &color); 14 | }; 15 | -------------------------------------------------------------------------------- /src/DiffImgWindow.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #ifndef _DIFFIMGWINDOW_H_ 22 | #define _DIFFIMGWINDOW_H_ 23 | 24 | #include 25 | #include "ui_DiffImgWindow.h" 26 | 27 | // forward declarations 28 | class FilesDialog; 29 | class AboutDialog; 30 | class ChannelCurve; 31 | class QLabel; 32 | class QTimer; 33 | class QActionGroup; 34 | 35 | struct DiffStruct; 36 | 37 | class DiffImgWindow : public QMainWindow, private Ui::DiffImgWindowClass 38 | { 39 | Q_OBJECT 40 | 41 | public: 42 | 43 | 44 | 45 | DiffImgWindow(QWidget *parent = 0); 46 | ~DiffImgWindow(); 47 | 48 | public slots: 49 | 50 | void setFiles(const QString &original, const QString &modified); 51 | void load(); 52 | 53 | void on_actionDifferenceMask_toggled(bool val); 54 | void on_actionImage1_toggled(bool val); 55 | void on_actionImage2_toggled(bool val); 56 | void on_actionDifferenceImage_toggled(bool val); 57 | 58 | void on_actionQuit_triggered(); 59 | void on_actionFitToWindow_triggered(); 60 | void on_actionFullResolution_triggered(); 61 | 62 | void on_actionRefresh_triggered(); 63 | 64 | void on_actionNext_triggered(); 65 | void on_actionPrev_triggered(); 66 | 67 | void on_actionOpen_triggered(); 68 | void on_actionHelp_triggered(); 69 | void on_actionSaveDifference_triggered(); 70 | void on_actionShowComment_toggled(bool); 71 | 72 | void on_actionShowDocks_triggered(); 73 | 74 | void on_actionDualPanel_toggled(bool val); 75 | void on_actionDisplayWipe_toggled(bool val); 76 | 77 | void openFile1(const QString &fileName); 78 | void openFile2(const QString &fileName); 79 | 80 | void computeDifferenceNew(); 81 | 82 | void on_pushButtonFile1_pressed(); 83 | void on_pushButtonFile2_pressed(); 84 | void on_pushButtonDifference_pressed(); 85 | 86 | void resetView(); 87 | void setModeSingleImage(); 88 | void setModeDualImage(); 89 | 90 | void setModeDualPanel(bool val); 91 | 92 | void synchronizePanels(); 93 | void syncPanels(); 94 | 95 | void on_actionAbout_triggered(); 96 | void on_actionPreferences_triggered(); 97 | 98 | void printToLog(const QString &mess); 99 | 100 | void restart(); 101 | void setPreferences(); 102 | 103 | void on_checkBoxShowHistoZero_toggled(bool); 104 | 105 | void setPanel1Visibility(bool); 106 | void setPanel2Visibility(bool); 107 | 108 | protected slots: 109 | void dragEnterEvent(QDragEnterEvent *event) override; 110 | void dragMoveEvent(QDragMoveEvent *event) override; 111 | void dropEvent(QDropEvent *event) override; 112 | void keyPressEvent(QKeyEvent *event) override; 113 | void resizeEvent(QResizeEvent *event) override; 114 | 115 | private slots: 116 | 117 | void acceptFiles(); 118 | void displayZoomFactor(qreal zoom); 119 | void displayMousePosition(const QPointF &pt); 120 | void etHop(); 121 | 122 | void on_sliderGain_valueChanged(int); 123 | void on_checkBoxGain_toggled(bool); 124 | void on_doubleSpinBoxGain_valueChanged(double); 125 | void on_sliderOffset_valueChanged(int); 126 | void on_checkBoxOffset_toggled(bool); 127 | void on_doubleSpinBoxOffset_valueChanged(double); 128 | 129 | void on_pushButtonClearComment1_pressed(); 130 | void on_pushButtonClearComment2_pressed(); 131 | void on_pushButtonValidComment1_pressed(); 132 | void on_pushButtonValidComment2_pressed(); 133 | 134 | void on_lineEditComment1_textChanged(const QString &); 135 | void on_lineEditComment2_textChanged(const QString &); 136 | void on_lineEditComment1_returnPressed(); 137 | void on_lineEditComment2_returnPressed(); 138 | 139 | void updateDisplay(); 140 | 141 | private: 142 | 143 | void updateUi(); 144 | void updateAbout(); 145 | 146 | void saveSettings(); 147 | void loadSettings(); 148 | 149 | void updateTitle(); 150 | void updateTooltips(); 151 | 152 | void updateApplicationIdentity(); 153 | void initHistoNew(); 154 | void applyHisto(); 155 | void showRGBHistogramNew(); 156 | 157 | void updateImage1(const QImage &image); 158 | void updateImage2(const QImage &image); 159 | void updateDifference(const QImage &image); 160 | 161 | void updateSmileyStatus(); 162 | QString readComment(const QString &imageFile); 163 | void writeComment(const QString &comment, const QString &imageFile); 164 | void updateImageComment(); 165 | 166 | enum typImage { 167 | TYPE_ORIGINAL = 0, 168 | TYPE_MODIFIED, 169 | TYPE_DIFFERENCE 170 | }; 171 | 172 | enum typPage { 173 | PAGE_DUALVIEW = 0, 174 | PAGE_WIPEVIEW 175 | }; 176 | 177 | bool m_displayOverlayDiff; 178 | bool m_displayOriginalImage; 179 | bool m_displayModifiedImage; 180 | bool m_displayDifferenceImage; 181 | bool m_displayDualPanel; 182 | bool m_displayHistoZeroValue; 183 | bool m_displayImageComment; 184 | 185 | QString m_file1; 186 | QStringList m_lFiles1Deprecated; 187 | QString m_file1pathDeprecated; 188 | bool m_newFile1m_newFile1; 189 | 190 | QString m_file2; 191 | QStringList m_lFiles2m_newFile1; 192 | QString m_file2pathm_newFile1; 193 | bool m_newFile2m_newFile1; 194 | 195 | FilesDialog *m_dfiles; 196 | 197 | QString m_version; 198 | QString m_appName; 199 | bool m_firstTime; 200 | 201 | QImage m_image1; 202 | QImage m_image1Thumbnail; 203 | QImage m_image2; 204 | QImage m_image2Thumbnail; 205 | QImage m_diffImage; 206 | QImage m_diffImageThumbnail; 207 | 208 | QImage m_maskDiffImage; 209 | 210 | QString m_currentLanguage; 211 | 212 | AboutDialog *m_about; 213 | int m_logLevel; 214 | 215 | ChannelCurve *m_widgetHistoCurveR; 216 | ChannelCurve *m_widgetHistoCurveG; 217 | ChannelCurve *m_widgetHistoCurveB; 218 | 219 | bool m_resetConfig; 220 | int m_maskOpacity; 221 | 222 | bool m_compareWithThreshold; 223 | int m_metricType; 224 | int m_thresholdType; 225 | 226 | DiffStruct *m_diffRes; 227 | int m_currentDisplayType; 228 | QLabel *m_labelZoom; 229 | QLabel *m_labelPos; 230 | QLabel *m_labelInfos; 231 | bool m_applyGain; 232 | bool m_applyOffset; 233 | qreal m_currentGain; 234 | qreal m_currentOffset; 235 | 236 | QTimer *m_timerUpdate; 237 | QActionGroup *m_actionGroup; 238 | 239 | int m_wipeMethod; 240 | }; 241 | 242 | #endif // _DIFFIMGWINDOW_H_ 243 | -------------------------------------------------------------------------------- /src/FilesDialog.cpp: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #include 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #include "FilesDialog.h" 28 | #include "MiscFunctions.h" 29 | #include "LogHandler.h" 30 | #include "FilesManager.h" 31 | 32 | FilesDialog::FilesDialog(QWidget *parent) 33 | : QDialog(parent) 34 | { 35 | Q_INIT_RESOURCE(diffimg); 36 | setupUi(this); 37 | 38 | // add completer to line edit 39 | QCompleter *completerDir = new QCompleter(this); 40 | QFileSystemModel *dirModelDir = new QFileSystemModel(completerDir); 41 | dirModelDir->setFilter(QDir::Dirs); 42 | completerDir->setModel(dirModelDir); 43 | lineEditFile1->setCompleter(completerDir); 44 | lineEditFile2->setCompleter(completerDir); 45 | } 46 | 47 | FilesDialog::~FilesDialog() 48 | { 49 | } 50 | 51 | void FilesDialog::getPath(const QString &f1, const QString &f2) 52 | { 53 | // get the directory 54 | if (!f1.isEmpty()) { 55 | QFileInfo fi(f1); 56 | m_path = fi.absolutePath(); 57 | } else if (!f2.isEmpty()) { 58 | QFileInfo fi(f2); 59 | m_path = fi.absolutePath(); 60 | } 61 | } 62 | 63 | void FilesDialog::on_pushButtonFile1_pressed() 64 | { 65 | getPath(lineEditFile1->text(), lineEditFile2->text()); 66 | 67 | QString formats = MiscFunctions::getAvailablesImageFormats(); 68 | QString file = QFileDialog::getOpenFileName(this, tr("Open File"), 69 | m_path, 70 | formats); 71 | 72 | if (!file.isEmpty()) { 73 | lineEditFile1->setText(file); 74 | } 75 | } 76 | 77 | void FilesDialog::on_pushButtonFile2_pressed() 78 | { 79 | getPath(lineEditFile2->text(), lineEditFile1->text()); 80 | 81 | QString formats = MiscFunctions::getAvailablesImageFormats(); 82 | QString file = QFileDialog::getOpenFileName(this, tr("Open File"), 83 | m_path, 84 | formats); 85 | 86 | if (!file.isEmpty()) { 87 | lineEditFile2->setText(file); 88 | } 89 | } 90 | 91 | void FilesDialog::on_lineEditFile1_textChanged(const QString &text) 92 | { 93 | validPath(text, lineEditFile1); 94 | } 95 | 96 | void FilesDialog::on_lineEditFile2_textChanged(const QString &text) 97 | { 98 | validPath(text, lineEditFile2); 99 | } 100 | 101 | void FilesDialog::validPath(const QString &path, QWidget *w) 102 | { 103 | if (!w) { 104 | return; 105 | } 106 | 107 | if (!QFileInfo(path).exists()) { 108 | QPalette pal; 109 | pal.setColor(QPalette::Text, Qt::red); 110 | w->setPalette(pal); 111 | } else { 112 | // restore normal palette 113 | QPalette pal; 114 | pal.setColor(QPalette::Text, Qt::black); 115 | w->setPalette(pal); 116 | } 117 | } 118 | 119 | void FilesDialog::getCurrentFiles(QString &file1, QString &file2) 120 | { 121 | file1 = lineEditFile1->text(); 122 | file2 = lineEditFile2->text(); 123 | 124 | FilesManager::getCurrentFiles(file1, file2); 125 | } 126 | 127 | void FilesDialog::setFile1(const QString &f) 128 | { 129 | lineEditFile1->setText(f); 130 | } 131 | 132 | void FilesDialog::setFile2(const QString &f) 133 | { 134 | lineEditFile2->setText(f); 135 | } 136 | -------------------------------------------------------------------------------- /src/FilesDialog.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #ifndef _DIALOGFILES_H_ 22 | #define _DIALOGFILES_H_ 23 | 24 | #include 25 | #include "ui_FilesDialog.h" 26 | 27 | using namespace Ui; 28 | 29 | class FilesDialog : public QDialog, public FilesDialogClass 30 | { 31 | Q_OBJECT 32 | 33 | public: 34 | 35 | FilesDialog(QWidget *parent = 0); 36 | ~FilesDialog(); 37 | 38 | void getCurrentFiles(QString &file1, QString &file2); 39 | 40 | void setFile1(const QString &); 41 | void setFile2(const QString &); 42 | 43 | public slots: 44 | 45 | void on_pushButtonFile1_pressed(); 46 | void on_pushButtonFile2_pressed(); 47 | void on_lineEditFile1_textChanged(const QString &text); 48 | void on_lineEditFile2_textChanged(const QString &text); 49 | 50 | private: 51 | 52 | void getPath(const QString &f1, const QString &f2); 53 | void validPath(const QString &path, QWidget *w); 54 | 55 | QString m_path; 56 | }; 57 | 58 | #endif // _DIALOGFILES_H_ 59 | -------------------------------------------------------------------------------- /src/FilesManager.cpp: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #include 22 | #include 23 | 24 | #include "FilesManager.h" 25 | #include "MiscFunctions.h" 26 | #include "LogHandler.h" 27 | 28 | QStringList FilesManager::m_lFiles1; 29 | QString FilesManager::m_refPath1; 30 | QString FilesManager::m_refPath2; 31 | QStringList FilesManager::m_lFiles2; 32 | 33 | void FilesManager::getPrevFiles(QString &file1, QString &file2) 34 | { 35 | getFollowingFiles(file1, file2, -1); 36 | } 37 | 38 | void FilesManager::getNextFiles(QString &file1, QString &file2) 39 | { 40 | getFollowingFiles(file1, file2); 41 | } 42 | 43 | void FilesManager::getFollowingFiles(QString &file1, QString &file2, int increment) 44 | { 45 | QFileInfo fi1(file1); 46 | QFileInfo fi2(file2); 47 | 48 | // reference is always 1 49 | int currIndex = m_lFiles1.indexOf(fi1.fileName()); 50 | 51 | if (currIndex >= 0 && !m_lFiles1.isEmpty()) { 52 | int loop = 0; 53 | bool ok = false; 54 | currIndex += increment; 55 | 56 | while (!ok) { 57 | if (increment > 0) { 58 | currIndex %= m_lFiles1.size(); 59 | } else { 60 | if (currIndex < 0) { 61 | currIndex = m_lFiles1.size() - 1; 62 | } 63 | } 64 | 65 | file1 = m_refPath1 + "/" + m_lFiles1[(currIndex) % m_lFiles1.size()]; 66 | file2 = getValidFile(QFileInfo(file1).fileName(), m_refPath2, m_lFiles2); 67 | 68 | if (!file2.isEmpty()) { 69 | ok = true; 70 | } 71 | 72 | loop++; 73 | currIndex += increment; 74 | 75 | if (loop > 2 * m_lFiles1.size()) { 76 | ok = true; 77 | file1 = ""; 78 | file2 = ""; 79 | break; 80 | } 81 | } 82 | } 83 | } 84 | 85 | void FilesManager::rescan(const QString &file, QString &refPath, QStringList &refList) 86 | { 87 | bool rescan = false; 88 | 89 | if (QFileInfo(file).isDir()) { 90 | if (refPath != file) { 91 | refPath = file; 92 | rescan = true; 93 | } 94 | } else if (QFileInfo(file).isFile()) { 95 | if (QFileInfo(file).absolutePath() != refPath) { 96 | refPath = QFileInfo(file).absolutePath(); 97 | rescan = true; 98 | } 99 | } 100 | 101 | if (rescan) { 102 | QString formats = MiscFunctions::getAvailablesImageFormats(); 103 | refList = QDir(refPath).entryList(formats.split(" "), QDir::Files | QDir::Readable, QDir::Name); 104 | } 105 | } 106 | 107 | void FilesManager::rescan1(const QString &file) 108 | { 109 | rescan(file, m_refPath1, m_lFiles1); 110 | } 111 | 112 | void FilesManager::rescan2(const QString &file) 113 | { 114 | rescan(file, m_refPath2, m_lFiles2); 115 | } 116 | 117 | QString FilesManager::getValidFile(const QString &basename, const QString &refPath, const QStringList &refList) 118 | { 119 | // file exist in the second directory ? 120 | if (refList.contains(basename)) { 121 | return refPath + "/" + basename; 122 | } 123 | 124 | // try to find a file with another suffix 125 | QRegExp rx(QString("^%1.*").arg(QFileInfo(basename).completeBaseName())); 126 | int index = refList.indexOf(rx); 127 | 128 | if (index >= 0) { 129 | return refPath + "/" + refList.at(index); 130 | } 131 | 132 | return ""; 133 | } 134 | 135 | void FilesManager::getCurrentFiles(QString &file1, QString &file2) 136 | { 137 | // basic check 138 | if (QFileInfo(file1).isDir() && QFileInfo(file2).isDir()) { 139 | LogHandler::getInstance()->reportError(QString("Can't compare two directory, only two files or a file and a directory (%1/%2)").arg(file1).arg(file2)); 140 | file1 = ""; 141 | file2 = ""; 142 | return; 143 | } 144 | 145 | rescan1(file1); 146 | rescan2(file2); 147 | 148 | if (QFileInfo(file1).isDir()) { 149 | // try to find the same basename 150 | file1 = getValidFile(QFileInfo(file2).fileName(), m_refPath1, m_lFiles1); 151 | } 152 | 153 | if (QFileInfo(file2).isDir()) { 154 | // try to find the same basename 155 | file2 = getValidFile(QFileInfo(file1).fileName(), m_refPath2, m_lFiles2); 156 | } 157 | } 158 | 159 | const QStringList &FilesManager::getFilelist1() 160 | { 161 | return m_lFiles1; 162 | } 163 | 164 | const QStringList &FilesManager::getFilelist2() 165 | { 166 | return m_lFiles2; 167 | } 168 | -------------------------------------------------------------------------------- /src/FilesManager.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #ifndef _FILESMANAGER_H_ 22 | #define _FILESMANAGER_H_ 23 | 24 | #include 25 | #include 26 | 27 | //! Class for manage proposed filename across widget 28 | 29 | class FilesManager 30 | { 31 | public: 32 | 33 | static void getCurrentFiles(QString &file1, QString &file2); 34 | static void getNextFiles(QString &file1, QString &file2); 35 | static void getPrevFiles(QString &file1, QString &file2); 36 | static const QStringList &getFilelist1(); 37 | static const QStringList &getFilelist2(); 38 | 39 | private: 40 | 41 | static QString getValidFile(const QString &basename, const QString &refpath, const QStringList &refList); 42 | static void getFollowingFiles(QString &file1, QString &file2, int increment = 1); 43 | 44 | static void rescan1(const QString &); 45 | static void rescan2(const QString &); 46 | static void rescan(const QString &file, QString &refPath, QStringList &refList); 47 | 48 | static QStringList m_lFiles1; 49 | static QString m_refPath1; 50 | static QString m_refPath2; 51 | static QStringList m_lFiles2; 52 | }; 53 | 54 | #endif // _FilesManager_H_ 55 | -------------------------------------------------------------------------------- /src/IMessageHandler.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #ifndef _IMESSAGEHANDLER_H_ 22 | #define _IMESSAGEHANDLER_H_ 23 | 24 | #include 25 | 26 | //! The Message handler, which can be implemented by the client 27 | 28 | class IMessageHandler 29 | { 30 | public: 31 | 32 | enum MessageLevel { 33 | MSG_DEBUG = 0, /*!< Message only for debugging purpose. */ 34 | MSG_INFO, /*!< Information message. */ 35 | MSG_WARNING, /*!< Warning, abnormal event. */ 36 | MSG_ERROR /*!< Error, invalid file. */ 37 | }; 38 | 39 | //! Virtual destructor 40 | virtual ~IMessageHandler() {} 41 | 42 | //! This method is called when a message is to be reported to the client 43 | virtual void reportMessage(MessageLevel level, const QString &message) = 0; 44 | 45 | //! Report only a debug message 46 | virtual void reportDebug(const QString &message) = 0; 47 | 48 | //! Report only a debug message 49 | virtual void reportInfo(const QString &message) = 0; 50 | 51 | //! Report only a debug message 52 | virtual void reportWarning(const QString &message) = 0; 53 | 54 | //! Report only a debug message 55 | virtual void reportError(const QString &message) = 0; 56 | }; 57 | 58 | //! Sets the error handler to be used for error and warning reporting 59 | 60 | /*! 61 | * This allows the user to set the current Message handler. If the 62 | * parameter is nullptr, API reverts back to the default error handler, 63 | * which redirects all warnings and errors to std::cerr. 64 | * 65 | * \sa IMessageHandler 66 | */ 67 | void setMessageHandler(IMessageHandler *Hdl); 68 | 69 | #endif // _IMESSAGEHANDLER_H_ 70 | -------------------------------------------------------------------------------- /src/ImageNavigator.cpp: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include "ImageNavigator.h" 27 | 28 | const double factorMaxSize = 0.15; // max xx% of parent widget 29 | 30 | // ImageNavigator -------------------------------------------------------------------- 31 | 32 | ImageNavigator::ImageNavigator(QGraphicsView *parent) : QWidget(parent), 33 | m_worldMatrix(new QTransform()), 34 | m_imgMatrix(new QTransform()), 35 | m_backgroundColor(QColor(0, 0, 0, 150)), 36 | m_view(parent) 37 | { 38 | } 39 | 40 | void ImageNavigator::setImage(const QImage &img) 41 | { 42 | m_img = img; 43 | resizeImg(); 44 | } 45 | 46 | void ImageNavigator::setTransforms(QTransform *worldMatrix, QTransform *imgMatrix) 47 | { 48 | m_worldMatrix = worldMatrix; 49 | m_imgMatrix = imgMatrix; 50 | } 51 | 52 | void ImageNavigator::setViewPortRect(const QRectF &viewPortRect) 53 | { 54 | m_viewPortRect = viewPortRect; 55 | resizeImg(); 56 | } 57 | 58 | void ImageNavigator::paintEvent(QPaintEvent * /*event */) 59 | { 60 | if (m_img.isNull() /*|| !m_imgMatrix || !m_worldMatrix*/) { 61 | return; 62 | } 63 | 64 | QPainter painter(this); 65 | 66 | //draw the image's location 67 | painter.setBrush(m_backgroundColor); 68 | painter.setPen(QColor(200, 200, 200)); 69 | 70 | painter.setOpacity(0.8f); 71 | painter.drawImage(0, 0, m_imgT); 72 | painter.drawRect(m_imgT.rect().adjusted(0, 0, 0, 0)); 73 | 74 | // compute view rect 75 | QRectF viewRect = m_view->mapToScene(m_view->rect()).boundingRect(); 76 | QRectF viewRectInImage = m_view->scene()->sceneRect().intersected(viewRect); 77 | 78 | QRectF viewRectInThumbnail = viewRectInImage.intersected(m_img.rect()); 79 | float reducFactor = m_imgT.height() / (float)m_img.height(); 80 | viewRectInThumbnail = QRectF(viewRectInThumbnail.topLeft() * reducFactor, viewRectInThumbnail.size() * reducFactor); 81 | 82 | painter.setOpacity(1.0f); 83 | painter.setPen(QColor(255, 0, 0)); 84 | painter.setBrush(QColor(255, 0, 0, 100)); 85 | painter.drawRect(viewRectInThumbnail); 86 | } 87 | 88 | void ImageNavigator::mousePressEvent(QMouseEvent *event) 89 | { 90 | m_enterPos = event->pos(); 91 | m_lastPos = event->pos(); 92 | } 93 | 94 | void ImageNavigator::mouseReleaseEvent(QMouseEvent *event) 95 | { 96 | QPointF dxy = m_enterPos - QPointF(event->pos()); 97 | 98 | if (dxy.manhattanLength() < 4) { 99 | // compute view rect 100 | QRectF viewRect = m_view->mapToScene(m_view->rect()).boundingRect(); 101 | QRectF viewRectInImage = m_view->scene()->sceneRect().intersected(viewRect); 102 | 103 | QRectF viewRectInThumbnail = viewRectInImage.intersected(m_img.rect()); 104 | float reducFactor = m_imgT.height() / (float)m_img.height(); 105 | viewRectInThumbnail = QRectF(viewRectInThumbnail.topLeft() * reducFactor, viewRectInThumbnail.size() * reducFactor); 106 | 107 | if (viewRectInThumbnail.contains(event->pos())) { 108 | QPointF newPt = event->pos() / reducFactor; 109 | emit moveView(newPt); 110 | event->accept(); 111 | } 112 | } 113 | } 114 | 115 | void ImageNavigator::mouseMoveEvent(QMouseEvent *event) 116 | { 117 | if (event->buttons() != Qt::LeftButton) { 118 | return; 119 | } 120 | 121 | // compute view rect 122 | QRectF viewRect = m_view->mapToScene(m_view->rect()).boundingRect(); 123 | QRectF viewRectInImage = m_view->scene()->sceneRect().intersected(viewRect); 124 | 125 | //QRectF viewRectInThumbnail = QRectF(viewRectInImage.topLeft()*factorMaxSize,viewRectInImage.size()*factorMaxSize); 126 | QRectF viewRectInThumbnail = viewRectInImage.intersected(m_img.rect()); 127 | float reducFactor = m_imgT.height() / (float)m_img.height(); 128 | viewRectInThumbnail = QRectF(viewRectInThumbnail.topLeft() * reducFactor, viewRectInThumbnail.size() * reducFactor); 129 | 130 | if (viewRectInThumbnail.contains(event->pos())) { 131 | QPointF newPt = event->pos() / reducFactor; 132 | emit moveView(newPt); 133 | event->accept(); 134 | } 135 | } 136 | 137 | void ImageNavigator::resizeEvent(QResizeEvent *event) 138 | { 139 | if (event->size() == size()) { 140 | return; 141 | } 142 | 143 | QWidget::resizeEvent(event); 144 | } 145 | 146 | QSize ImageNavigator::sizeHint() const 147 | { 148 | return m_imgT.rect().adjusted(-1, -1, 1, 1).size(); 149 | } 150 | 151 | void ImageNavigator::resizeImg() 152 | { 153 | if (m_img.isNull()) { 154 | return; 155 | } 156 | 157 | QSizeF maxSize = m_viewPortRect.size() * factorMaxSize; 158 | m_imgT = m_img.scaled(maxSize.toSize(), Qt::KeepAspectRatio, Qt::SmoothTransformation); 159 | resize(sizeHint()); 160 | return; 161 | 162 | QRectF imgRect = QRectF(QPoint(), m_img.size()); 163 | 164 | QTransform overviewImgMatrix = getScaledImageMatrix(); // matrix that always resizes the image to the current viewport 165 | QRectF overviewImgRect = overviewImgMatrix.mapRect(imgRect); 166 | overviewImgRect.setTop(overviewImgRect.top() + 1); 167 | overviewImgRect.setLeft(overviewImgRect.left() + 1); 168 | overviewImgRect.setWidth(overviewImgRect.width() - 1); // we have a border... correct that... 169 | overviewImgRect.setHeight(overviewImgRect.height() - 1); 170 | 171 | // fast downscaling 172 | m_imgT = m_img.scaled(overviewImgRect.size().width(), overviewImgRect.size().height(), Qt::KeepAspectRatio, Qt::SmoothTransformation); 173 | } 174 | 175 | QTransform ImageNavigator::getScaledImageMatrix() 176 | { 177 | if (m_img.isNull()) { 178 | return QTransform(); 179 | } 180 | 181 | // the image resizes as we zoom 182 | QRectF imgRect = QRectF(QPoint(), m_img.size()); 183 | float ratioImg = imgRect.width() / imgRect.height(); 184 | float ratioWin = (float)width() / (float)height(); 185 | 186 | QTransform imgMatrix; 187 | float s; 188 | 189 | if (imgRect.width() == 0 || imgRect.height() == 0) { 190 | s = 1.0f; 191 | } else { 192 | s = (ratioImg > ratioWin) ? (float)width() / imgRect.width() : (float)height() / imgRect.height(); 193 | } 194 | 195 | imgMatrix.scale(s, s); 196 | 197 | QRectF imgViewRect = imgMatrix.mapRect(imgRect); 198 | imgMatrix.translate((width() - imgViewRect.width()) * 0.5f / s, (height() - imgViewRect.height()) * 0.5f / s); 199 | 200 | return imgMatrix; 201 | } 202 | -------------------------------------------------------------------------------- /src/ImageNavigator.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #ifndef _IMAGENAVIGATOR_H_ 22 | #define _IMAGENAVIGATOR_H_ 23 | 24 | #include 25 | 26 | class QGraphicsView; 27 | 28 | class ImageNavigator : public QWidget 29 | { 30 | Q_OBJECT 31 | 32 | public: 33 | 34 | explicit ImageNavigator(QGraphicsView *parent = 0); 35 | virtual ~ImageNavigator() {} 36 | 37 | void setImage(const QImage &img); 38 | 39 | void setTransforms(QTransform *worldMatrix, QTransform *imgMatrix); 40 | 41 | void setViewPortRect(const QRectF &viewPortRect); 42 | 43 | virtual QSize sizeHint() const; 44 | 45 | signals: 46 | 47 | void moveView(const QPointF &dxy); 48 | 49 | protected: 50 | 51 | void resizeImg(); 52 | void paintEvent(QPaintEvent *event); 53 | void mouseMoveEvent(QMouseEvent *event); 54 | void mouseReleaseEvent(QMouseEvent *event); 55 | void mousePressEvent(QMouseEvent *event); 56 | void resizeEvent(QResizeEvent *event); 57 | QTransform getScaledImageMatrix(); 58 | 59 | private: 60 | 61 | QImage m_img; 62 | QImage m_imgT; 63 | QTransform *m_worldMatrix; 64 | QTransform *m_imgMatrix; 65 | QRectF m_viewPortRect; 66 | QPointF m_lastPos; 67 | QPointF m_enterPos; 68 | QColor m_backgroundColor; 69 | QGraphicsView *m_view; 70 | }; 71 | 72 | #endif // _IMAGENAVIGATOR_H_ 73 | -------------------------------------------------------------------------------- /src/ImageView.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #ifndef _EDITORVIEW_H_ 22 | #define _EDITORVIEW_H_ 23 | 24 | // Qt 25 | #include 26 | #include 27 | 28 | class QGraphicsPixmapItem; 29 | class ImageNavigator; 30 | class WipeItem; 31 | 32 | class ImageView : public QGraphicsView 33 | { 34 | Q_OBJECT 35 | 36 | public: 37 | QString filenameLeft; 38 | QString filenameRight; 39 | 40 | ImageView(QWidget *map); 41 | ~ImageView(); 42 | 43 | //virtual void setImage(const QImage &newImg); 44 | 45 | void resetScale(); 46 | void fitScale(); 47 | qreal getScale() const; 48 | void setScale(qreal); 49 | 50 | void setShowOverview(bool); 51 | 52 | void setImage(const QImage &newImg); 53 | void setMask(const QImage &newMask); 54 | 55 | // functions for wipe effect 56 | void setWipeMode(bool); 57 | void setWipeMethod(int); 58 | void setWipeImage1(const QImage &img); 59 | void setWipeImage2(const QImage &img); 60 | 61 | // mask opacity (0.0->1.0) 62 | void setMaskOpacity(qreal); 63 | qreal maskOpacity() const; 64 | void setEnabledMask(bool); 65 | bool isMaskEnabled() const; 66 | void setEnabledMarker(bool); 67 | bool isMarkerEnabled() const; 68 | 69 | // Center 70 | const QPointF &getCenter() const 71 | { 72 | return m_centerPoint; 73 | } 74 | 75 | public slots: 76 | 77 | void updateSceneRect(const QRectF &); 78 | void setCenter(const QPointF &position); 79 | void setMarkerPosition(const QPointF &); 80 | void zoomOut(); 81 | void zoomIn(); 82 | void zoom(double factor); 83 | 84 | signals: 85 | 86 | void mouseMoved(const QPointF &pos); 87 | void scaleChanged(qreal); 88 | void somethingChanged(const QPointF &pt = QPointF()); // scale or center point change 89 | 90 | protected: 91 | 92 | //Take over the interaction 93 | virtual void mouseMoveEvent(QMouseEvent *event); 94 | virtual void mousePressEvent(QMouseEvent *mouseEvent); 95 | virtual void mouseReleaseEvent(QMouseEvent *mouseEvent); 96 | 97 | virtual void wheelEvent(QWheelEvent *event); 98 | virtual void resizeEvent(QResizeEvent *event); 99 | virtual void paintEvent(QPaintEvent *event); 100 | virtual bool event(QEvent *e); 101 | 102 | private: 103 | 104 | void initBackground(); 105 | bool isImageInside(); 106 | void drawMarker(QPainter &p); 107 | void drawLines(const QPointF &, QPainter &p); 108 | 109 | void createWipeItem(); 110 | 111 | //Holds the current centerpoint for the view, used for panning and zooming 112 | QPointF m_centerPoint; 113 | QPixmap m_tileBg; 114 | 115 | ImageNavigator *m_navigator; 116 | 117 | QGraphicsPixmapItem *m_imageItem; 118 | QGraphicsPixmapItem *m_maskItem; 119 | 120 | // overview rendering 121 | float m_navigatorSize; 122 | float m_navigatorMargin; 123 | bool m_showNavigator; 124 | qreal m_maskOpacity; 125 | bool m_showMask; 126 | bool m_drag; 127 | bool m_showMarker; 128 | QPointF m_posMarker; 129 | WipeItem *m_wipeItem; 130 | bool m_wipeMode; 131 | int m_wipeMethod; 132 | }; 133 | 134 | #endif // _EDITORVIEW_H_ 135 | -------------------------------------------------------------------------------- /src/LogHandler.cpp: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #include "LogHandler.h" 22 | #include 23 | 24 | LogHandler *LogHandler::m_Instance = 0; 25 | 26 | LogHandler *LogHandler::getInstance() 27 | { 28 | static QMutex mutex; 29 | 30 | if (!m_Instance) { 31 | mutex.lock(); 32 | 33 | if (!m_Instance) { 34 | m_Instance = new LogHandler; 35 | } 36 | 37 | mutex.unlock(); 38 | } 39 | 40 | return m_Instance; 41 | } 42 | 43 | LogHandler::~LogHandler() 44 | { 45 | static QMutex mutex; 46 | mutex.lock(); 47 | m_Instance = 0; 48 | mutex.unlock(); 49 | } 50 | 51 | LogHandler::LogHandler() : 52 | m_currLevel(MSG_DEBUG), 53 | m_bufferized(true) 54 | { 55 | } 56 | 57 | void LogHandler::reportMessage(MessageLevel level, const QString &message) 58 | { 59 | // message Ignored 60 | if (level < m_currLevel) { 61 | return; 62 | } 63 | 64 | QString msgText(message); 65 | msgText.replace("<", "<"); 66 | msgText.replace(">", ">"); 67 | 68 | // add the current time 69 | msgText = QTime::currentTime().toString("[hh:mm:ss]: ") + msgText; 70 | QString msg; 71 | 72 | switch (level) { 73 | case MSG_DEBUG: { 74 | msg = QString("DEBUG: ") + msgText; 75 | break; 76 | } 77 | 78 | case MSG_INFO: { 79 | msg = QString("INFO: ") + msgText; 80 | break; 81 | } 82 | 83 | case MSG_WARNING: { 84 | msg = QString("WARNING: ") + msgText; 85 | break; 86 | } 87 | 88 | case MSG_ERROR: { 89 | msg = QString(" ERROR:") + msgText; 90 | break; 91 | } 92 | 93 | default: { 94 | msg = msgText; 95 | break; 96 | } 97 | } 98 | 99 | #ifdef _DEBUG 100 | qDebug("%s", msg.toStdString().c_str()); 101 | #endif 102 | 103 | if (m_bufferized) { 104 | m_buffer << msg; 105 | } else { 106 | emit newMessage(msg); 107 | } 108 | } 109 | 110 | void LogHandler::reportDebug(const QString &message) 111 | { 112 | reportMessage(IMessageHandler::MSG_DEBUG, message); 113 | } 114 | 115 | void LogHandler::reportInfo(const QString &message) 116 | { 117 | reportMessage(IMessageHandler::MSG_INFO, message); 118 | } 119 | 120 | void LogHandler::reportWarning(const QString &message) 121 | { 122 | reportMessage(IMessageHandler::MSG_WARNING, message); 123 | } 124 | 125 | void LogHandler::reportError(const QString &message) 126 | { 127 | reportMessage(IMessageHandler::MSG_ERROR, message); 128 | } 129 | 130 | void LogHandler::setBufferization(bool val) 131 | { 132 | m_bufferized = val; 133 | 134 | if (!m_bufferized) { // send all stored messages 135 | foreach (const QString &mess, m_buffer) { 136 | emit newMessage(mess); 137 | } 138 | 139 | m_buffer.clear(); 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /src/LogHandler.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #ifndef _LOGHANDLER_H_ 22 | #define _LOGHANDLER_H_ 23 | 24 | #include "IMessageHandler.h" 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | //! A dialog for displaying message from reader/writer 31 | 32 | /*! 33 | * Displaying colored message by taking care of the message level 34 | */ 35 | 36 | class LogHandler : 37 | public QObject, public IMessageHandler 38 | { 39 | Q_OBJECT 40 | 41 | public: 42 | 43 | static LogHandler *getInstance(); 44 | ~LogHandler(); 45 | 46 | void setMessageLevel(MessageLevel level) 47 | { 48 | m_currLevel = level; 49 | } 50 | 51 | void setBufferization(bool); 52 | 53 | public slots: 54 | 55 | void reportMessage(MessageLevel level, const QString &message); 56 | void reportDebug(const QString &message); 57 | void reportInfo(const QString &message); 58 | void reportWarning(const QString &message); 59 | void reportError(const QString &message); 60 | 61 | signals: 62 | 63 | void newMessage(const QString &); 64 | 65 | private: 66 | 67 | LogHandler(); 68 | 69 | LogHandler(const LogHandler &); // hide copy constructor 70 | LogHandler &operator=(const LogHandler &); // hide assign op 71 | // we leave just the declarations, so the compiler will warn us 72 | // if we try to use those two functions by accident 73 | 74 | private: 75 | 76 | static LogHandler *m_Instance; 77 | MessageLevel m_currLevel; 78 | QStringList m_buffer; 79 | bool m_bufferized; 80 | }; 81 | 82 | #endif // _LOGHANDLER_H_ 83 | -------------------------------------------------------------------------------- /src/MiscFunctions.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #ifndef _MISCFUNCTIONS_H_ 22 | #define _MISCFUNCTIONS_H_ 23 | 24 | #include 25 | #include 26 | 27 | namespace cv { 28 | class Mat; 29 | } 30 | 31 | struct DiffStruct { 32 | QImage maskDiffImage; // mask image 33 | QImage diffImage; // diff image 34 | unsigned int nbErr; 35 | double meanError; 36 | double stantdardDeviation; 37 | double rmsDiff; 38 | 39 | // histograms 40 | int minError; 41 | int maxError; 42 | double valueR[2 * 256]; 43 | double valueG[2 * 256]; 44 | double valueB[2 * 256]; 45 | }; 46 | 47 | class MiscFunctions 48 | { 49 | public: 50 | 51 | enum DiffMethodType { 52 | METHOD_BYCHANNEL = 0, 53 | METHOD_BYCHANNELMEAN, 54 | METHOD_BYLIGHTNESS, 55 | METHOD_END 56 | }; 57 | 58 | // images function 59 | static QString getAvailablesImageFormats(); 60 | static QStringList getAvailablesImageFormatsList(); 61 | static QMap getLongImageFormats(); 62 | 63 | // translations functions 64 | static QString getTranslationsPath(const QString &refLang = QString()); 65 | static QString getTranslationsFile(const QString &lang); 66 | static QMap getAvailableLanguages(); 67 | static void setDefaultLanguage(); 68 | static void setLanguage(const QString &lang); 69 | 70 | static void updateApplicationIdentity(); 71 | 72 | static bool stringToFile(const QString &data, const QString &filename); 73 | static QString fileToString(const QString &filename); 74 | 75 | static quint64 getFileSize(const QString &file); 76 | static QString bytesToString(quint64 bytes); 77 | static QString pixelsToString(quint64 pixels); 78 | }; 79 | 80 | #endif // _MISCFUNCTIONS_H_ 81 | -------------------------------------------------------------------------------- /src/PropertyWidget.cpp: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #include 26 | 27 | #include "PropertyWidget.h" 28 | #include "qtpropertymanager.h" 29 | #include "BaseMetric.h" 30 | 31 | PropertyWidget::PropertyWidget(QWidget *parent) : 32 | QtTreePropertyBrowser(parent) 33 | { 34 | m_variantManager = new QtVariantPropertyManager(this); 35 | } 36 | 37 | void PropertyWidget::displayData(BaseMetric *met) 38 | { 39 | clear(); 40 | 41 | if (!met) { 42 | return; 43 | } 44 | 45 | displayProperties(met); 46 | displayStatistics(met); 47 | } 48 | 49 | void PropertyWidget::displayProperties(BaseMetric *met) 50 | { 51 | QtVariantProperty *parent; 52 | 53 | const QList &props = met->getProperties(); 54 | 55 | // Range list 56 | parent = m_variantManager->addProperty(QVariant::String, tr("Properties")); 57 | parent->setValue(""); 58 | addProperty(parent); 59 | 60 | foreach (const ImageProperty &prop, props) { 61 | QtVariantProperty *property = m_variantManager->addProperty(QVariant::String, prop.name); 62 | property->setValue(prop.value); 63 | property->setToolTip(prop.desc); 64 | property->setStatusTip(prop.value); 65 | parent->addSubProperty(property); 66 | } 67 | } 68 | 69 | void PropertyWidget::displayStatistics(BaseMetric *met) 70 | { 71 | QtVariantProperty *property; 72 | QtVariantProperty *parent; 73 | 74 | const QList params = met->getOutputParams(); 75 | 76 | // Range list 77 | parent = m_variantManager->addProperty(QVariant::String, tr("Statistics")); 78 | parent->setValue(""); 79 | addProperty(parent); 80 | 81 | foreach (MetricParam *param, params) { 82 | if (!param->isValid()) { 83 | property = m_variantManager->addProperty(QVariant::String, param->name + " (*)"); 84 | } else { 85 | property = m_variantManager->addProperty(QVariant::String, param->name); 86 | } 87 | 88 | switch(QMetaType::Type(param->value.type())) { 89 | case QMetaType::Double: 90 | case QMetaType::Float: 91 | property->setValue(QString::number(param->value.toFloat(), 'f', 5)); 92 | break; 93 | default: 94 | property->setValue(param->value); 95 | break; 96 | } 97 | 98 | property->setToolTip(param->desc); 99 | parent->addSubProperty(property); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/PropertyWidget.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #ifndef _PROPERTYWIDGET_H_ 22 | #define _PROPERTYWIDGET_H_ 23 | 24 | #include 25 | #include 26 | 27 | #include "qttreepropertybrowser.h" 28 | #include "qtvariantproperty.h" 29 | 30 | class BaseMetric; 31 | 32 | class PropertyWidget : public QtTreePropertyBrowser 33 | { 34 | Q_OBJECT 35 | 36 | public: 37 | 38 | PropertyWidget(QWidget *parent = 0); 39 | ~PropertyWidget() {} 40 | 41 | void displayData(BaseMetric *met); 42 | 43 | public slots: 44 | 45 | signals: 46 | 47 | protected: 48 | 49 | private: 50 | 51 | void displayProperties(BaseMetric *met); 52 | void displayStatistics(BaseMetric *met); 53 | 54 | QtVariantPropertyManager *m_variantManager; 55 | }; 56 | 57 | #endif // _PROPERTYWIDGET_H_ 58 | -------------------------------------------------------------------------------- /src/WipeItem.cpp: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | // Qt 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include "WipeItem.h" 28 | #include "WipeMethod.h" 29 | 30 | 31 | WipeItem::WipeItem(QGraphicsItem *parent) : QGraphicsItem(parent), 32 | m_wipe(false), 33 | m_wipeMethod(WipeMethod::WIPE_HORIZONTAL) 34 | { 35 | //setFlag(QGraphicsItem::ItemIsSelectable,true); 36 | //setAcceptedMouseButtons(Qt::LeftButton|Qt::RightButton); 37 | setCursor(Qt::SplitHCursor); 38 | } 39 | 40 | WipeItem::~WipeItem() 41 | { 42 | } 43 | 44 | QRectF WipeItem::boundingRect() const 45 | { 46 | QRectF rect; 47 | 48 | if (!m_pix1.isNull() || 49 | !m_pix2.isNull()) { 50 | if (m_pix1.isNull()) { 51 | rect = QRectF(QPointF(0, 0), m_pix2.size()); 52 | } else { 53 | rect = QRectF(QPointF(0, 0), m_pix1.size()); 54 | } 55 | } 56 | 57 | //qDebug() << "boundingRect" << rect; 58 | return rect; 59 | } 60 | 61 | void WipeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 62 | QWidget *widget) 63 | { 64 | Q_UNUSED(option); 65 | Q_UNUSED(widget); 66 | 67 | painter->setRenderHint(QPainter::SmoothPixmapTransform); 68 | 69 | switch (m_wipeMethod) { 70 | case WipeMethod::WIPE_VERTICAL: { 71 | painter->drawPixmap(QPoint(0, 0), 72 | m_pix2, 73 | QRect(0, 0, m_pix2.width(), m_wipePoint.y())); 74 | painter->drawPixmap(QPoint(0, m_wipePoint.y()), 75 | m_pix1, 76 | QRect(0, m_wipePoint.y(), m_pix1.width(), m_pix1.height() - m_wipePoint.y())); 77 | break; 78 | } 79 | 80 | default: 81 | case WipeMethod::WIPE_HORIZONTAL: { 82 | painter->drawPixmap(QPoint(0, 0), 83 | m_pix2, 84 | QRect(0, 0, m_wipePoint.x(), m_pix2.height())); 85 | painter->drawPixmap(QPoint(m_wipePoint.x(), 0), 86 | m_pix1, 87 | QRect(m_wipePoint.x(), 0, m_pix1.width() - m_wipePoint.x(), m_pix1.height())); 88 | break; 89 | } 90 | } 91 | 92 | } 93 | 94 | void WipeItem::setImage1(const QImage &img) 95 | { 96 | m_pix1 = QPixmap::fromImage(img); 97 | 98 | if (m_wipePoint.isNull()) { 99 | m_wipePoint = img.rect().center(); 100 | } 101 | 102 | prepareGeometryChange(); 103 | update(); 104 | } 105 | 106 | void WipeItem::setImage2(const QImage &img) 107 | { 108 | m_pix2 = QPixmap::fromImage(img); 109 | 110 | if (m_wipePoint.isNull()) { 111 | m_wipePoint = img.rect().center(); 112 | } 113 | 114 | prepareGeometryChange(); 115 | update(); 116 | } 117 | 118 | void WipeItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) 119 | { 120 | 121 | if (m_wipe) { 122 | m_wipePoint = event->pos(); 123 | update(); 124 | } else { 125 | event->ignore(); 126 | QGraphicsItem::mouseMoveEvent(event); 127 | } 128 | } 129 | 130 | void WipeItem::mousePressEvent(QGraphicsSceneMouseEvent *event) 131 | { 132 | const int distance = (m_wipeMethod == WipeMethod::WIPE_HORIZONTAL) ? 133 | qAbs(event->pos().x() - m_wipePoint.x()) : 134 | qAbs(event->pos().y() - m_wipePoint.y()) ; 135 | 136 | if (event->button() == Qt::RightButton || distance < 40) { 137 | m_wipe = true; 138 | m_wipePoint = event->pos(); 139 | update(); 140 | } else { 141 | QGraphicsItem::mousePressEvent(event); 142 | } 143 | } 144 | 145 | void WipeItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) 146 | { 147 | if (m_wipe) { 148 | m_wipe = false; 149 | } else { 150 | QGraphicsItem::mouseReleaseEvent(event); 151 | } 152 | } 153 | 154 | void WipeItem::setWipeMethod(int method) 155 | { 156 | if (m_wipeMethod != method) { 157 | m_wipeMethod = method; 158 | 159 | if (m_wipePoint.isNull()) { 160 | if (!m_pix1.isNull()) { 161 | m_wipePoint = m_pix1.rect().center(); 162 | } else if (!m_pix2.isNull()) { 163 | m_wipePoint = m_pix2.rect().center(); 164 | } 165 | } 166 | 167 | if (m_wipeMethod == WipeMethod::WIPE_HORIZONTAL) { 168 | setCursor(Qt::SplitHCursor); 169 | } else { 170 | setCursor(Qt::SplitVCursor); 171 | } 172 | 173 | update(); 174 | } 175 | } 176 | -------------------------------------------------------------------------------- /src/WipeItem.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #ifndef _WIPEITEM_H_ 22 | #define _WIPEITEM_H_ 23 | 24 | // Qt 25 | #include 26 | 27 | class QGraphicsSceneMouseEvent; 28 | 29 | class WipeItem : public QGraphicsItem 30 | { 31 | 32 | public: 33 | 34 | WipeItem(QGraphicsItem *parent = 0); 35 | ~WipeItem(); 36 | 37 | virtual QRectF boundingRect() const; 38 | virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); 39 | 40 | void setImage1(const QImage &img); 41 | void setImage2(const QImage &img); 42 | void setWipeMethod(int method); 43 | 44 | protected: 45 | 46 | virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); 47 | virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); 48 | virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); 49 | 50 | private: 51 | 52 | QPixmap m_pix1; 53 | QPixmap m_pix2; 54 | bool m_wipe; 55 | QPointF m_wipePoint; 56 | int m_wipeMethod; 57 | 58 | }; 59 | 60 | #endif // _WIPEITEM_H_ 61 | -------------------------------------------------------------------------------- /src/WipeMethod.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _WIPEMETHOD_H_ 3 | #define _WIPEMETHOD_H_ 4 | 5 | class WipeMethod 6 | { 7 | public: 8 | 9 | enum Method { 10 | WIPE_HORIZONTAL = 0, 11 | WIPE_VERTICAL 12 | }; 13 | 14 | }; 15 | 16 | #endif // _WIPEMETHOD_H_ 17 | -------------------------------------------------------------------------------- /src/metrics/BaseMetric.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #ifndef _BASEMETRIC_H_ 22 | #define _BASEMETRIC_H_ 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | struct ImageProperty { 29 | ImageProperty(const QString &n, const QString &d, const QString &v) : 30 | name(n), 31 | desc(d), 32 | value(v) 33 | { 34 | } 35 | 36 | QString name; 37 | QString desc; 38 | QString value; 39 | }; 40 | 41 | class MetricParam 42 | { 43 | public: 44 | 45 | MetricParam(const QString &t, const QString &n, const QString &d, const QVariant &v) : 46 | type(t), 47 | name(n), 48 | desc(d), 49 | threshold(v), 50 | value(v), 51 | defaultValue(v), 52 | used(false) 53 | { 54 | } 55 | 56 | virtual ~MetricParam() {} 57 | 58 | bool isValid(); 59 | void reset(bool all = true); 60 | void setThreshold(const QString &valText); 61 | 62 | QString type; 63 | QString name; 64 | QString desc; 65 | QVariant threshold; 66 | QVariant value; 67 | QVariant defaultValue; 68 | bool used; 69 | }; 70 | 71 | class BaseMetric : public QObject 72 | { 73 | Q_OBJECT 74 | 75 | public: 76 | 77 | explicit BaseMetric(QObject *parent = 0); 78 | virtual ~BaseMetric(); 79 | 80 | virtual QPixmap getLogo() const; 81 | 82 | const QString &getType() const; 83 | const QString &getName() const; 84 | const QString &getDesc() const; 85 | 86 | const QList &getProperties() const; 87 | const QList &getOutputParams(); 88 | const QList &getInputParams(); 89 | 90 | virtual void checkDifferences(const QString &file1, const QString &file2); 91 | 92 | static int defaultThresholdNumPixel; 93 | static float defaultThresholdMeanError; 94 | static float defaultThresholdRMSError; 95 | static int defaultThresholdMinError; 96 | static int defaultThresholdMaxError; 97 | static float defaultThresholdStandardDeviation; 98 | 99 | QImage getImage1WithGain(double gain, double offset); 100 | QImage getImage2WithGain(double gain, double offset); 101 | QImage getImageDifferenceWithGain(double gain, double offset); 102 | const QImage &getImage1() const; 103 | const QImage &getImage2() const; 104 | const QImage &getImageDifference() const; 105 | const QImage &getImageMask() const; 106 | 107 | const QList &getHistogramImage1(); 108 | const QList &getHistogramImage2(); 109 | const QList &getHistogramImageDiff(bool showZero); 110 | 111 | void setDiscriminatingParam(MetricParam *); 112 | MetricParam *getDiscriminatingParam() const; 113 | 114 | bool isValid() const; 115 | 116 | int getPixelError() const; 117 | float getMaxError() const; 118 | float getMinError() const; 119 | int getDifferenceChannels() const; 120 | int getImage2Channels() const; 121 | int getImage1Channels() const; 122 | bool saveDifference(const QString &) const; 123 | 124 | double getMaxImage1() const; 125 | double getMaxImage2() const; 126 | double getMinImage1() const; 127 | double getMinImage2() const; 128 | 129 | QString getImage1Data(int x, int y) const; 130 | QString getImage2Data(int x, int y) const; 131 | QString getErrorData(int x, int y) const; 132 | QString getImage1Data(const QPoint &) const; 133 | QString getImage2Data(const QPoint &) const; 134 | QString getErrorData(const QPoint &) const; 135 | 136 | virtual bool selectedStatsIsValid() const; 137 | 138 | MetricParam *getOutputParam(const QString &name); 139 | MetricParam *getInputParam(const QString &name); 140 | 141 | public slots: 142 | 143 | protected slots: 144 | 145 | protected: 146 | 147 | void init(); 148 | MetricParam *addOutputParam(MetricParam *); 149 | MetricParam *addInputParam(MetricParam *); 150 | 151 | void computeStandardProperties(); 152 | void clearOutputParams(); 153 | void resetOutputParams(); 154 | virtual void createOutputParams(); 155 | virtual void createInputParams(); 156 | void saveSettings(); 157 | void loadSettings(); 158 | bool checkImages(); 159 | 160 | virtual void computeStatistics(); 161 | virtual void performDifference() = 0; 162 | 163 | void computeHisto(const QImage &input, QList &polys, bool skipZeroLevel = false); 164 | QImage createDiffMask(const QImage &img); 165 | 166 | QString m_type; 167 | QString m_name; 168 | QString m_desc; 169 | 170 | // properties = size, type, ... 171 | QList m_properties; 172 | 173 | // input param if needed 174 | QList m_inputParams; 175 | 176 | // params RMS, ... 177 | QList m_outputParams; 178 | 179 | QString m_file1; 180 | QString m_file2; 181 | 182 | QImage m_image1; 183 | QImage m_image2; 184 | QImage m_imageDiff; 185 | QImage m_imageMask; 186 | 187 | bool m_valid; 188 | int m_nbPixelError; 189 | double m_maxError; 190 | double m_minError; 191 | double m_meanError; 192 | 193 | double m_minImage1; 194 | double m_minImage2; 195 | double m_maxImage1; 196 | double m_maxImage2; 197 | 198 | QList m_histoImage1; 199 | QList m_histoImage2; 200 | QList m_histoImageDiff; 201 | 202 | bool m_init; 203 | bool m_prevShowHistoZero; 204 | }; 205 | 206 | #endif // _BASEMETRIC_H_ 207 | -------------------------------------------------------------------------------- /src/metrics/MetricsManager.cpp: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #include 22 | 23 | #include "MetricsManager.h" 24 | #include "BaseMetric.h" 25 | 26 | QList MetricsManager::m_metrics; 27 | 28 | MetricsManager::MetricsManager(QObject *parent) : QObject(parent) 29 | { 30 | } 31 | 32 | MetricsManager::~MetricsManager() 33 | { 34 | clear(); 35 | } 36 | 37 | void MetricsManager::clear() 38 | { 39 | qDeleteAll(m_metrics); 40 | m_metrics.clear(); 41 | } 42 | 43 | void MetricsManager::registerMetrics(BaseMetric *metric) 44 | { 45 | m_metrics << metric; 46 | } 47 | 48 | const QList &MetricsManager::getMetrics() 49 | { 50 | return m_metrics; 51 | } 52 | 53 | BaseMetric *MetricsManager::getMetricByType(const QString &type) 54 | { 55 | foreach (BaseMetric *met, m_metrics) { 56 | if (met->getType() == type) { 57 | return met; 58 | } 59 | } 60 | 61 | return nullptr; 62 | } 63 | -------------------------------------------------------------------------------- /src/metrics/MetricsManager.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #ifndef _METRICSMANAGER_H_ 22 | #define _METRICSMANAGER_H_ 23 | 24 | #include 25 | 26 | class BaseMetric; 27 | 28 | class MetricsManager : public QObject 29 | { 30 | Q_OBJECT 31 | 32 | public: 33 | 34 | explicit MetricsManager(QObject *parent = 0); 35 | virtual ~MetricsManager(); 36 | 37 | static void registerMetrics(BaseMetric *); 38 | 39 | static const QList &getMetrics(); 40 | static BaseMetric *getMetricByType(const QString &type); 41 | 42 | static void clear(); 43 | 44 | private: 45 | 46 | static QList m_metrics; 47 | }; 48 | 49 | #endif // _METRICSMANAGER_H_ 50 | -------------------------------------------------------------------------------- /src/metrics/MetricsRegistering.cpp: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #include "MetricsRegistering.h" 22 | 23 | #include "MetricsManager.h" 24 | 25 | #include "PerChannelMetric.h" 26 | #include "PerChannelMeanMetric.h" 27 | #include "PerLuminanceMetric.h" 28 | #include "PerceptualMetric.h" 29 | 30 | int MetricsRegistering::registerAll() 31 | { 32 | if (MetricsManager::getMetrics().isEmpty()) { // avoid multiple init 33 | MetricsManager::registerMetrics(new PerChannelMetric()); 34 | MetricsManager::registerMetrics(new PerChannelMeanMetric()); 35 | MetricsManager::registerMetrics(new PerLuminanceMetric()); 36 | MetricsManager::registerMetrics(new PerceptualMetric()); 37 | } 38 | 39 | return MetricsManager::getMetrics().size(); 40 | } 41 | 42 | void MetricsRegistering::unregisterAll() 43 | { 44 | MetricsManager::clear(); 45 | } 46 | -------------------------------------------------------------------------------- /src/metrics/MetricsRegistering.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | #ifndef _METRICSREGISTERING_H_ 21 | #define _METRICSREGISTERING_H_ 22 | 23 | class MetricsRegistering 24 | { 25 | public: 26 | 27 | static int registerAll(); 28 | static void unregisterAll(); 29 | 30 | private: 31 | }; 32 | 33 | #endif // _METRICSREGISTERING_H_ 34 | -------------------------------------------------------------------------------- /src/metrics/PerChannelMeanMetric.cpp: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #include 22 | 23 | #include "PerChannelMeanMetric.h" 24 | 25 | #include "MiscFunctions.h" 26 | #include "LogHandler.h" 27 | 28 | PerChannelMeanMetric::PerChannelMeanMetric(QObject *parent) : BaseMetric(parent) 29 | { 30 | m_type = metaObject()->className(); 31 | m_name = tr("Difference per channel mean"); 32 | m_desc = tr("Difference is computed between both mean values defined as mean(x,y) = (R(x,y)+G(x,y)+B(x,y))/3"); 33 | 34 | // init settings 35 | //loadSettings(); 36 | } 37 | 38 | PerChannelMeanMetric::~PerChannelMeanMetric() 39 | { 40 | } 41 | 42 | QPixmap PerChannelMeanMetric::getLogo() const 43 | { 44 | return QPixmap(":/diffimg/perchannelmean.png"); 45 | } 46 | 47 | void PerChannelMeanMetric::performDifference() 48 | { 49 | Q_ASSERT(m_image1.size() == m_image2.size()); 50 | 51 | QImage output(m_image1.width(), m_image2.height(), QImage::Format_Grayscale8); 52 | 53 | QImage img1 = m_image1; 54 | 55 | if (img1.depth() < 32) { 56 | img1 = img1.convertToFormat(img1.hasAlphaChannel() ? QImage::Format_ARGB32 : QImage::Format_RGB32); 57 | } 58 | 59 | QImage img2 = m_image2; 60 | 61 | if (img2.depth() < 32) { 62 | img2 = img2.convertToFormat(img2.hasAlphaChannel() ? QImage::Format_ARGB32 : QImage::Format_RGB32); 63 | } 64 | 65 | if (img1.format() == QImage::Format_ARGB32_Premultiplied && img2.format() == QImage::Format_ARGB32_Premultiplied) { 66 | qDebug() << "premult"; 67 | 68 | for (int y = 0; y < output.height(); y++) { 69 | uchar *dst = output.scanLine(y); 70 | const QRgb *src1 = (QRgb *)img1.constScanLine(y); 71 | const QRgb *src2 = (QRgb *)img2.constScanLine(y); 72 | 73 | for (int x = 0; x < output.width(); ++x, ++src1, ++src2, ++dst) { 74 | const QRgb pixel1 = qUnpremultiply(*src1); 75 | const QRgb pixel2 = qUnpremultiply(*src2); 76 | 77 | const uint8_t r1 = qRed(pixel1) / 3; 78 | const uint8_t r2 = qRed(pixel2) / 3; 79 | const uint8_t g1 = qGreen(pixel1) / 3; 80 | const uint8_t g2 = qGreen(pixel2) / 3; 81 | const uint8_t b1 = qBlue(pixel1) / 3; 82 | const uint8_t b2 = qBlue(pixel2) / 3; 83 | 84 | const uint8_t rd = qAbs(r1 - r2); 85 | const uint8_t rg = qAbs(g1 - g2); 86 | const uint8_t rb = qAbs(b1 - b2); 87 | 88 | *dst = rd + rg + rb; 89 | } 90 | } 91 | } else if (img1.format() == QImage::Format_ARGB32_Premultiplied && img2.format() != QImage::Format_ARGB32_Premultiplied) { 92 | // TODO blah 93 | Q_ASSERT(img1.format() == QImage::Format_ARGB32_Premultiplied && img2.format() == QImage::Format_ARGB32_Premultiplied); 94 | } else { 95 | for (int y = 0; y < output.height(); y++) { 96 | uchar *dst = output.scanLine(y); 97 | const QRgb *src1 = (QRgb *)img1.constScanLine(y); 98 | const QRgb *src2 = (QRgb *)img2.constScanLine(y); 99 | 100 | for (int x = 0; x < output.width(); ++x, ++src1, ++src2, ++dst) { 101 | const QRgb pixel1 = *src1; 102 | const QRgb pixel2 = *src2; 103 | 104 | const uint8_t r1 = qRed(pixel1) / 3; 105 | const uint8_t r2 = qRed(pixel2) / 3; 106 | const uint8_t g1 = qGreen(pixel1) / 3; 107 | const uint8_t g2 = qGreen(pixel2) / 3; 108 | const uint8_t b1 = qBlue(pixel1) / 3; 109 | const uint8_t b2 = qBlue(pixel2) / 3; 110 | 111 | const uint8_t rd = qAbs(r1 - r2); 112 | const uint8_t rg = qAbs(g1 - g2); 113 | const uint8_t rb = qAbs(b1 - b2); 114 | 115 | *dst = rd + rg + rb; 116 | } 117 | } 118 | } 119 | 120 | m_imageDiff = output; 121 | } 122 | -------------------------------------------------------------------------------- /src/metrics/PerChannelMeanMetric.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | #ifndef _BYCHANNELMEANMETRIC_H_ 21 | #define _BYCHANNELMEANMETRIC_H_ 22 | 23 | #include "BaseMetric.h" 24 | 25 | class PerChannelMeanMetric : public BaseMetric 26 | { 27 | Q_OBJECT 28 | 29 | public: 30 | 31 | explicit PerChannelMeanMetric(QObject *parent = 0); 32 | virtual ~PerChannelMeanMetric(); 33 | 34 | virtual QPixmap getLogo() const; 35 | 36 | signals: 37 | 38 | protected: 39 | 40 | virtual void performDifference(); 41 | }; 42 | 43 | #endif // _BYCHANNELMEANMETRIC_H_ 44 | -------------------------------------------------------------------------------- /src/metrics/PerChannelMetric.cpp: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #include 22 | 23 | #include "PerChannelMetric.h" 24 | 25 | #include "MiscFunctions.h" 26 | #include "LogHandler.h" 27 | 28 | PerChannelMetric::PerChannelMetric(QObject *parent) : BaseMetric(parent) 29 | { 30 | m_type = metaObject()->className(); 31 | m_name = tr("Difference per channel"); 32 | m_desc = tr("Difference is computed channel per channel"); 33 | 34 | updateParameters(); 35 | 36 | // init settings 37 | //loadSettings(); 38 | } 39 | 40 | PerChannelMetric::~PerChannelMetric() 41 | { 42 | } 43 | 44 | QPixmap PerChannelMetric::getLogo() const 45 | { 46 | return QPixmap(":/diffimg/perchannel.png"); 47 | } 48 | 49 | void PerChannelMetric::performDifference() 50 | { 51 | Q_ASSERT(m_image1.size() == m_image2.size()); 52 | 53 | QImage output(m_image1.width(), m_image2.height(), QImage::Format_RGB32); 54 | 55 | QImage img1 = m_image1; 56 | 57 | if (img1.depth() < 32) { 58 | img1 = img1.convertToFormat(img1.hasAlphaChannel() ? QImage::Format_ARGB32 : QImage::Format_RGB32); 59 | } 60 | 61 | QImage img2 = m_image2; 62 | 63 | if (img2.depth() < 32) { 64 | img2 = img2.convertToFormat(img2.hasAlphaChannel() ? QImage::Format_ARGB32 : QImage::Format_RGB32); 65 | } 66 | 67 | if (img1.format() == QImage::Format_ARGB32_Premultiplied && img2.format() == QImage::Format_ARGB32_Premultiplied) { 68 | qDebug() << "premult"; 69 | 70 | for (int y = 0; y < output.height(); y++) { 71 | uchar *dst = output.scanLine(y); 72 | const QRgb *src1 = (QRgb *)img1.constScanLine(y); 73 | const QRgb *src2 = (QRgb *)img2.constScanLine(y); 74 | 75 | for (int x = 0; x < output.width(); ++x, ++src1, ++src2, ++dst) { 76 | const QRgb pixel1 = qUnpremultiply(*src1); 77 | const QRgb pixel2 = qUnpremultiply(*src2); 78 | 79 | const uint8_t r = qAbs(qRed(pixel1) - qRed(pixel2)); 80 | const uint8_t g = qAbs(qGreen(pixel1) - qGreen(pixel2)); 81 | const uint8_t b = qAbs(qBlue(pixel1) - qBlue(pixel2)); 82 | const uint8_t a = qMax(qAlpha(pixel1), qAlpha(pixel2)); 83 | 84 | *dst = qPremultiply(qRgba(r, g, b, a)); 85 | } 86 | } 87 | } else if (img1.format() == QImage::Format_ARGB32_Premultiplied && img2.format() != QImage::Format_ARGB32_Premultiplied) { 88 | // TODO blah 89 | Q_ASSERT(img1.format() == QImage::Format_ARGB32_Premultiplied && img2.format() == QImage::Format_ARGB32_Premultiplied); 90 | } else { 91 | qDebug() << "not pre"; 92 | 93 | for (int y = 0; y < output.height(); y++) { 94 | QRgb *dst = (QRgb *)output.scanLine(y); 95 | const QRgb *src1 = (QRgb *)img1.constScanLine(y); 96 | const QRgb *src2 = (QRgb *)img2.constScanLine(y); 97 | 98 | for (int x = 0; x < output.width(); ++x, ++src1, ++src2, ++dst) { 99 | const QRgb pixel1 = *src1; 100 | const QRgb pixel2 = *src2; 101 | 102 | const uint8_t r = qAbs(qRed(pixel1) - qRed(pixel2)); 103 | const uint8_t g = qAbs(qGreen(pixel1) - qGreen(pixel2)); 104 | const uint8_t b = qAbs(qBlue(pixel1) - qBlue(pixel2)); 105 | const uint8_t a = qMax(qAlpha(pixel1), qAlpha(pixel2)); 106 | *dst = qRgba(r, g, b, a); // qAbs(pixel1 - pixel2); 107 | } 108 | } 109 | } 110 | 111 | m_imageDiff = output; 112 | } 113 | 114 | void PerChannelMetric::updateParameters() 115 | { 116 | // m_params << new MetricParam("RMSError",tr("RMS error"),tr("Root Mean Square error"),BaseMetric::defaultThresholdRMSError); 117 | // m_params << new MetricParam("MeanError",tr("Mean error"),tr("Mean absolute error"),BaseMetric::defaultThresholdMeanError); 118 | // m_params << new MetricParam("MaxError",tr("Max error"),tr("Maximal error"),BaseMetric::defaultThresholdMaxError); 119 | //m_params << new MetricParam("StandardDeviation",tr("Standard deviation"),tr("Standard deviation"),BaseMetric::defaultThresholdStandardDeviation); 120 | //m_params << new MetricParam("ErrorNum",tr("Error num (pixels)"),tr("Number of different pixels"),BaseMetric::defaultThresholdNumPixel); 121 | } 122 | -------------------------------------------------------------------------------- /src/metrics/PerChannelMetric.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #ifndef _BYCHANNELMETRIC_H_ 22 | #define _BYCHANNELMETRIC_H_ 23 | 24 | #include "BaseMetric.h" 25 | 26 | class PerChannelMetric : public BaseMetric 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | 32 | explicit PerChannelMetric(QObject *parent = 0); 33 | virtual ~PerChannelMetric(); 34 | 35 | virtual QPixmap getLogo() const; 36 | 37 | signals: 38 | 39 | protected: 40 | 41 | virtual void performDifference(); 42 | 43 | private slots: 44 | 45 | private: 46 | 47 | void updateParameters(); 48 | }; 49 | 50 | #endif // _BYCHANNELMETRIC_H_ 51 | -------------------------------------------------------------------------------- /src/metrics/PerLuminanceMetric.cpp: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #include 22 | 23 | #include "PerLuminanceMetric.h" 24 | 25 | #include "MiscFunctions.h" 26 | #include "LogHandler.h" 27 | 28 | PerLuminanceMetric::PerLuminanceMetric(QObject *parent) : BaseMetric(parent) 29 | { 30 | m_type = metaObject()->className(); 31 | m_name = tr("Difference per image luminance"); 32 | m_desc = tr("Difference is computed between both luminance values defined as luminance(x,y) = 0.3*R(x,y)+0.59*G(x,y)+0.11*B(x,y)"); 33 | 34 | // init settings 35 | //loadSettings(); 36 | } 37 | 38 | PerLuminanceMetric::~PerLuminanceMetric() 39 | { 40 | } 41 | 42 | QPixmap PerLuminanceMetric::getLogo() const 43 | { 44 | return QPixmap(":/diffimg/perluminance.png"); 45 | } 46 | 47 | #define Q_MAX_3(a, b, c) ( ( a > b && a > c) ? a : (b > c ? b : c) ) 48 | #define Q_MIN_3(a, b, c) ( ( a < b && a < c) ? a : (b < c ? b : c) ) 49 | 50 | // from HSL 51 | static inline int getLightness(const QRgb rgb) 52 | { 53 | const int r = qRed(rgb); 54 | const int g = qGreen(rgb); 55 | const int b = qBlue(rgb); 56 | const int max = Q_MAX_3(r, g, b); 57 | const int min = Q_MIN_3(r, g, b); 58 | return qreal(0.5) * (max + min); 59 | } 60 | 61 | void PerLuminanceMetric::performDifference() 62 | { 63 | Q_ASSERT(m_image1.size() == m_image2.size()); 64 | 65 | QImage output(m_image1.width(), m_image2.height(), QImage::Format_Grayscale8); 66 | 67 | QImage img1 = m_image1; 68 | 69 | if (img1.depth() < 32) { 70 | img1 = img1.convertToFormat(img1.hasAlphaChannel() ? QImage::Format_ARGB32 : QImage::Format_RGB32); 71 | } 72 | 73 | QImage img2 = m_image2; 74 | 75 | if (img2.depth() < 32) { 76 | img2 = img2.convertToFormat(img2.hasAlphaChannel() ? QImage::Format_ARGB32 : QImage::Format_RGB32); 77 | } 78 | 79 | if (img1.format() == QImage::Format_ARGB32_Premultiplied && img2.format() == QImage::Format_ARGB32_Premultiplied) { 80 | qDebug() << "premult"; 81 | 82 | for (int y = 0; y < output.height(); y++) { 83 | uchar *dst = output.scanLine(y); 84 | const QRgb *src1 = (QRgb *)img1.constScanLine(y); 85 | const QRgb *src2 = (QRgb *)img2.constScanLine(y); 86 | 87 | for (int x = 0; x < output.width(); ++x, ++src1, ++src2, ++dst) { 88 | const QRgb pixel1 = qUnpremultiply(*src1); 89 | const QRgb pixel2 = qUnpremultiply(*src2); 90 | 91 | *dst = qAbs(getLightness(pixel1) - getLightness(pixel2)); 92 | } 93 | } 94 | } else if (img1.format() == QImage::Format_ARGB32_Premultiplied && img2.format() != QImage::Format_ARGB32_Premultiplied) { 95 | // TODO blah 96 | Q_ASSERT(img1.format() == QImage::Format_ARGB32_Premultiplied && img2.format() == QImage::Format_ARGB32_Premultiplied); 97 | } else { 98 | for (int y = 0; y < output.height(); y++) { 99 | uchar *dst = output.scanLine(y); 100 | const QRgb *src1 = (QRgb *)img1.constScanLine(y); 101 | const QRgb *src2 = (QRgb *)img2.constScanLine(y); 102 | 103 | for (int x = 0; x < output.width(); ++x, ++src1, ++src2, ++dst) { 104 | *dst = qAbs(getLightness(*src1) - getLightness(*src2)); 105 | } 106 | } 107 | } 108 | 109 | m_imageDiff = output; 110 | } 111 | -------------------------------------------------------------------------------- /src/metrics/PerLuminanceMetric.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #ifndef _BYLUMINANCEMETRIC_H_ 22 | #define _BYLUMINANCEMETRIC_H_ 23 | 24 | #include "BaseMetric.h" 25 | 26 | class PerLuminanceMetric : public BaseMetric 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | 32 | explicit PerLuminanceMetric(QObject *parent = 0); 33 | virtual ~PerLuminanceMetric(); 34 | 35 | virtual QPixmap getLogo() const; 36 | 37 | signals: 38 | 39 | protected: 40 | 41 | virtual void performDifference(); 42 | 43 | private slots: 44 | 45 | private: 46 | }; 47 | 48 | #endif // _BYLUMINANCEMETRIC_H_ 49 | -------------------------------------------------------------------------------- /src/metrics/PerceptualMetric.cpp: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #include 22 | 23 | #include "PerceptualMetric.h" 24 | 25 | #include "MiscFunctions.h" 26 | #include "LogHandler.h" 27 | 28 | // Perceptual diff includes 29 | #include "CompareArgs.h" 30 | #include "Metric.h" 31 | #include "RGBAImage.h" 32 | 33 | static int defaultLuminanceOnly = 0; 34 | static float defaultFieldOfView = 45.0f; 35 | static float defaultGamma = 2.2f; 36 | static float defaultLuminance = 100.0f; 37 | static float defaultColorFactor = 1.0f; 38 | static int defaultDownSample = 0; 39 | 40 | PerceptualMetric::PerceptualMetric(QObject *parent) : BaseMetric(parent), 41 | m_noDifference(true) 42 | { 43 | m_type = metaObject()->className(); 44 | m_name = tr("Perceptual difference"); 45 | m_desc = tr("A perceptually based image metric. Copyright (C) 2006 Yangli Hector Yee"); 46 | 47 | // init settings 48 | //loadSettings(); 49 | } 50 | 51 | PerceptualMetric::~PerceptualMetric() 52 | { 53 | } 54 | 55 | QPixmap PerceptualMetric::getLogo() const 56 | { 57 | return QPixmap(":/diffimg/perceptual.png"); 58 | } 59 | 60 | void PerceptualMetric::createInputParams() 61 | { 62 | /* 63 | \t-fov deg : Field of view in degrees (0.1 to 89.9)\n\ 64 | \t-threshold p : #pixels p below which differences are ignored\n\ 65 | \t-gamma g : Value to convert rgb into linear space (default 2.2)\n\ 66 | \t-luminance l : White luminance (default 100.0 cdm^-2)\n\ 67 | \t-luminanceonly : Only consider luminance; ignore chroma (color) in the comparison\n\ 68 | \t-colorfactor : How much of color to use, 0.0 to 1.0, 0.0 = ignore color.\n\ 69 | \t-downsample : How many powers of two to down sample the image.\n\ 70 | */ 71 | 72 | // FOV 73 | addInputParam(new MetricParam("FOV", tr("Field of view"), tr("Field of view in degrees (0.1 to 89.9)"), defaultFieldOfView)); 74 | 75 | // Gamma 76 | addInputParam(new MetricParam("Gamma", tr("Gamma of screen"), tr("Value to convert rgb into linear space (default 2.2)"), defaultGamma)); 77 | 78 | // Luminance 79 | addInputParam(new MetricParam("Luminance", tr("White luminance"), tr("White luminance (default 100.0 cdm^-2)"), defaultLuminance)); 80 | 81 | // Luminance only 82 | addInputParam(new MetricParam("LuminanceOnly", tr("Luminance only"), tr("Only consider luminance; ignore chroma (color) in the comparison"), defaultLuminanceOnly)); 83 | 84 | // FOV 85 | addInputParam(new MetricParam("ColorFactor", tr("Color factor"), tr("How much of color to use, 0.0 to 1.0, 0.0 = ignore color."), defaultColorFactor)); 86 | 87 | // FOV 88 | addInputParam(new MetricParam("Downsample", tr("Downsample"), tr("How many powers of two to down sample the image"), defaultDownSample)); 89 | } 90 | 91 | RGBAImage *qImageToRGBAImage(const QImage &input) 92 | { 93 | if (input.isNull()) { 94 | return 0; 95 | } 96 | 97 | QImage img(input); // CoW, so don't care 98 | 99 | 100 | const int w = img.width(); 101 | const int h = img.height(); 102 | 103 | RGBAImage *result = new RGBAImage(w, h, "unknown"); 104 | 105 | if (img.format() != QImage::Format_ARGB32) { 106 | img = img.convertToFormat(QImage::Format_ARGB32); 107 | } 108 | 109 | // Copy the image over to our internal format, FreeImage has the scanlines bottom to top though. 110 | unsigned int *dest = result->Get_Data(); 111 | 112 | for (int y = 0; y < h; y++, dest += w) { 113 | //const unsigned int* scanline = (const unsigned int*)FreeImage_GetScanLine(freeImage, h - y - 1 ); 114 | //const unsigned int * ptr = tmpImg.ptr(y); 115 | memcpy(dest, img.scanLine(y), sizeof(dest[0]) * w); 116 | } 117 | 118 | return result; 119 | } 120 | 121 | QImage RGBAImageToQImage(RGBAImage *image) 122 | { 123 | if (!image) { 124 | return QImage(); 125 | } 126 | 127 | int Width = image->Get_Width(); 128 | int Height = image->Get_Height(); 129 | 130 | QImage output(Width, Height, QImage::Format_RGB32); 131 | 132 | const unsigned int *source = image->Get_Data(); 133 | 134 | for (int y = 0; y < Height; y++, source += Width) { 135 | //unsigned int * ptr = mat.ptr(y); 136 | //unsigned int* scanline = (unsigned int*)FreeImage_GetScanLine(bitmap, Height - y - 1 ); 137 | memcpy(output.scanLine(y), source, sizeof(source[0]) * Width); 138 | } 139 | 140 | return output; 141 | } 142 | 143 | void PerceptualMetric::performDifference() 144 | { 145 | CompareArgs args; 146 | m_noDifference = true; 147 | 148 | // update input params 149 | args.FieldOfView = getInputParam("FOV")->threshold.toFloat(); 150 | args.Gamma = getInputParam("Gamma")->threshold.toFloat(); 151 | args.Luminance = getInputParam("Luminance")->threshold.toFloat(); 152 | args.LuminanceOnly = getInputParam("LuminanceOnly")->threshold.toInt(); 153 | args.ColorFactor = getInputParam("ColorFactor")->threshold.toFloat(); 154 | args.DownSample = getInputParam("Downsample")->threshold.toInt(); 155 | args.ThresholdPixels = getOutputParam("ErrorNum")->threshold.toInt(); 156 | 157 | args.ImgA = qImageToRGBAImage(m_image1); 158 | args.ImgB = qImageToRGBAImage(m_image2); 159 | args.ImgDiff = new RGBAImage(m_image1.width(), m_image2.height(), ""); 160 | 161 | if (!args.ImgA || !args.ImgB) { // convert problem 162 | LogHandler::getInstance()->reportError("PerceptualDiff: Error during image conversion"); 163 | return; 164 | } 165 | 166 | // perform comparison 167 | m_noDifference = Yee_Compare(args); 168 | 169 | // save diff image 170 | m_imageDiff = RGBAImageToQImage(args.ImgDiff).convertToFormat(QImage::Format_Grayscale8).convertToFormat(QImage::Format_RGB32); 171 | } 172 | -------------------------------------------------------------------------------- /src/metrics/PerceptualMetric.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | DiffImg: image difference viewer 4 | Copyright(C) 2011-2014 xbee@xbee.net 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation; either version 2 9 | of the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | *******************************************************************************/ 20 | 21 | #ifndef _PERCEPTUALMETRIC_H_ 22 | #define _PERCEPTUALMETRIC_H_ 23 | 24 | #include "BaseMetric.h" 25 | 26 | class PerceptualMetric : public BaseMetric 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | 32 | explicit PerceptualMetric(QObject *parent = 0); 33 | virtual ~PerceptualMetric(); 34 | 35 | virtual QPixmap getLogo() const; 36 | 37 | signals: 38 | 39 | protected: 40 | 41 | virtual void createInputParams(); 42 | 43 | virtual void performDifference(); 44 | 45 | private slots: 46 | 47 | private: 48 | 49 | bool m_noDifference; 50 | }; 51 | 52 | #endif // _PERCEPTUALMETRIC_H_ 53 | -------------------------------------------------------------------------------- /test/img1/16bits-2.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img1/16bits-2.tif -------------------------------------------------------------------------------- /test/img1/32bits-2.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img1/32bits-2.tif -------------------------------------------------------------------------------- /test/img1/IMG_0044.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img1/IMG_0044.bmp -------------------------------------------------------------------------------- /test/img1/IMG_0044.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img1/IMG_0044.png -------------------------------------------------------------------------------- /test/img1/IMG_0052.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img1/IMG_0052.png -------------------------------------------------------------------------------- /test/img1/IMG_0144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img1/IMG_0144.png -------------------------------------------------------------------------------- /test/img1/IMG_0145.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img1/IMG_0145.png -------------------------------------------------------------------------------- /test/img1/IMG_0149.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img1/IMG_0149.png -------------------------------------------------------------------------------- /test/img1/IMG_0149.png.txt: -------------------------------------------------------------------------------- 1 | original image -------------------------------------------------------------------------------- /test/img1/IMG_testsuffix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img1/IMG_testsuffix.png -------------------------------------------------------------------------------- /test/img1/bigimg/README.txt: -------------------------------------------------------------------------------- 1 | An example of big image (10800x7200) for 64 bits release -------------------------------------------------------------------------------- /test/img1/bigimg/bigimg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img1/bigimg/bigimg.jpg -------------------------------------------------------------------------------- /test/img1/memorial.exr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img1/memorial.exr -------------------------------------------------------------------------------- /test/img1/testjp2000.jp2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img1/testjp2000.jp2 -------------------------------------------------------------------------------- /test/img1/yuv/README.txt: -------------------------------------------------------------------------------- 1 | Download from http://www.sunrayimage.com/examples.html -------------------------------------------------------------------------------- /test/img1/yuv/tulips_yuv420_prog_planar_qcif_176x144.yuv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img1/yuv/tulips_yuv420_prog_planar_qcif_176x144.yuv -------------------------------------------------------------------------------- /test/img1/yuv/tulips_yuv422_prog_planar_qcif_176x144.yuv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img1/yuv/tulips_yuv422_prog_planar_qcif_176x144.yuv -------------------------------------------------------------------------------- /test/img1/yuv/tulips_yuv444_prog_planar_qcif_176x144.yuv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img1/yuv/tulips_yuv444_prog_planar_qcif_176x144.yuv -------------------------------------------------------------------------------- /test/img1/yuv/tulips_yuyv422_prog_packed_qcif_176x144.yuv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img1/yuv/tulips_yuyv422_prog_packed_qcif_176x144.yuv -------------------------------------------------------------------------------- /test/img2/16bits-2.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img2/16bits-2.tif -------------------------------------------------------------------------------- /test/img2/32bits-2.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img2/32bits-2.tif -------------------------------------------------------------------------------- /test/img2/IMG_0044.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img2/IMG_0044.bmp -------------------------------------------------------------------------------- /test/img2/IMG_0044.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img2/IMG_0044.png -------------------------------------------------------------------------------- /test/img2/IMG_0052.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img2/IMG_0052.png -------------------------------------------------------------------------------- /test/img2/IMG_0144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img2/IMG_0144.png -------------------------------------------------------------------------------- /test/img2/IMG_0145.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img2/IMG_0145.png -------------------------------------------------------------------------------- /test/img2/IMG_0149.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img2/IMG_0149.png -------------------------------------------------------------------------------- /test/img2/IMG_0149.png.txt: -------------------------------------------------------------------------------- 1 | modified image !! -------------------------------------------------------------------------------- /test/img2/IMG_testsuffix.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img2/IMG_testsuffix.jpg -------------------------------------------------------------------------------- /test/img2/bigimg/README.txt: -------------------------------------------------------------------------------- 1 | An example of big image (10800x7200) for 64 bits release -------------------------------------------------------------------------------- /test/img2/bigimg/bigimg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img2/bigimg/bigimg.jpg -------------------------------------------------------------------------------- /test/img2/descript.ion: -------------------------------------------------------------------------------- 1 | "IMG_0044.png" test descrption 2 | -------------------------------------------------------------------------------- /test/img2/memorial.exr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img2/memorial.exr -------------------------------------------------------------------------------- /test/img2/testjp2000.jp2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img2/testjp2000.jp2 -------------------------------------------------------------------------------- /test/img2/yuv/tulips_yuv420_prog_planar_qcif_176x144.yuv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img2/yuv/tulips_yuv420_prog_planar_qcif_176x144.yuv -------------------------------------------------------------------------------- /test/img2/yuv/tulips_yuv422_prog_planar_qcif_176x144.yuv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img2/yuv/tulips_yuv422_prog_planar_qcif_176x144.yuv -------------------------------------------------------------------------------- /test/img2/yuv/tulips_yuv444_prog_planar_qcif_176x144.yuv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img2/yuv/tulips_yuv444_prog_planar_qcif_176x144.yuv -------------------------------------------------------------------------------- /test/img2/yuv/tulips_yuyv422_prog_packed_qcif_176x144.yuv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sandsmark/diffimg/aeb23c2d355f158c13339f0874be523cde451915/test/img2/yuv/tulips_yuyv422_prog_packed_qcif_176x144.yuv -------------------------------------------------------------------------------- /ui/FilesDialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | FilesDialogClass 4 | 5 | 6 | 7 | 0 8 | 0 9 | 448 10 | 221 11 | 12 | 13 | 14 | Dialog 15 | 16 | 17 | 18 | 19 | 20 | Base Image File 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | :/diffimg/icon_original.png 30 | 31 | 32 | false 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | :/diffimg/icon_open.png:/diffimg/icon_open.png 47 | 48 | 49 | 50 | 20 51 | 20 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 0 64 | 0 65 | 66 | 67 | 68 | Image to compare 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | :/diffimg/icon_modified.png 78 | 79 | 80 | false 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | :/diffimg/icon_open.png:/diffimg/icon_open.png 95 | 96 | 97 | 98 | 20 99 | 20 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | Qt::Vertical 111 | 112 | 113 | 114 | 20 115 | 37 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | Qt::Horizontal 124 | 125 | 126 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | buttonBox 139 | accepted() 140 | FilesDialogClass 141 | accept() 142 | 143 | 144 | 248 145 | 254 146 | 147 | 148 | 157 149 | 274 150 | 151 | 152 | 153 | 154 | buttonBox 155 | rejected() 156 | FilesDialogClass 157 | reject() 158 | 159 | 160 | 316 161 | 260 162 | 163 | 164 | 286 165 | 274 166 | 167 | 168 | 169 | 170 | 171 | --------------------------------------------------------------------------------