File indexing completed on 2025-01-19 03:57:41
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam 0004 * 0005 * Date : 2012-01-03 0006 * Description : Calculates the TanTriggs Preprocessing as described in: 0007 * Tan, X., and Triggs, B. "Enhanced local texture feature sets for face 0008 * recognition under difficult lighting conditions.". IEEE Transactions 0009 * on Image Processing 19 (2010), 1635–650. 0010 * Default parameters are taken from the paper. 0011 * 0012 * SPDX-FileCopyrightText: 2012-2013 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> 0013 * SPDX-FileCopyrightText: 2012 Philipp Wagner <bytefish at gmx dot de> 0014 * 0015 * SPDX-License-Identifier: GPL-2.0-or-later 0016 * 0017 * ============================================================ */ 0018 0019 #ifndef DIGIKAM_TAN_TRIGGS_PREPROCESSOR_H 0020 #define DIGIKAM_TAN_TRIGGS_PREPROCESSOR_H 0021 0022 // Locak includes 0023 0024 #include "digikam_opencv.h" 0025 0026 namespace Digikam 0027 { 0028 0029 class TanTriggsPreprocessor 0030 { 0031 public: 0032 0033 explicit TanTriggsPreprocessor(); 0034 0035 /** 0036 * Performs the Tan Triggs preprocessing to reduce the influence of lightning conditions. 0037 * Returns a grey-scale 8-bit image. 0038 */ 0039 cv::Mat preprocess(const cv::Mat& inputImage); 0040 0041 /** 0042 * Performs the Tan Triggs preprocessing to reduce the influence of lightning conditions. 0043 * Expects a one-channel image. 0044 * Returns a one-channel floating point (CV_32F1) image. 0045 */ 0046 cv::Mat preprocessRaw(const cv::Mat& inputImage); 0047 0048 /** 0049 * Converts CV_32F1 -> CV_8UC1 0050 */ 0051 cv::Mat normalize(const cv::Mat& preprocessedImage); 0052 0053 public: 0054 0055 /// Parameters, initialized with the default values from the paper. 0056 float alpha; 0057 float tau; 0058 float gamma; 0059 float sigma0; 0060 float sigma1; 0061 }; 0062 0063 } // namespace Digikam 0064 0065 #endif // DIGIKAM_TAN_TRIGGS_PREPROCESSOR_H