00001 // ReinhardLocalOperator.h 00002 // 00003 // Copyright 2010 Jérémy Laumon <jeremy.laumon@gmail.com> 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 2 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 00018 // MA 02110-1301, USA. 00019 00020 #ifndef REINHARDLOCALOPERATOR_H 00021 #define REINHARDLOCALOPERATOR_H 00022 00023 #include <QtGui> 00024 #include <ToneMappingOperator.h> 00025 #include <fftw3.h> 00026 #include <ui_ReinhardLocalOperator.h> 00027 00028 class ReinhardLocalOperator : public ToneMappingOperator 00029 { 00030 Q_OBJECT 00031 public: 00032 ReinhardLocalOperator(); 00033 virtual ~ReinhardLocalOperator(); 00034 00035 virtual void setupUi(QWidget* widget); 00036 virtual const HdrImage* getToneMappedImage() const; 00037 virtual void setImage(const HdrImage *image); 00038 virtual QString name() const; 00039 00040 public slots: 00041 void updateKeyValue(int value); 00042 void updateSharpening(int value); 00043 void toneMap(); 00044 00045 private: 00046 fftw_complex* convolveFft(fftw_complex* f1, fftw_complex* f2); 00047 00048 Ui::ReinhardLocalOperator ui; 00049 const HdrImage* inputImage; 00050 HdrImage* outputImage; 00051 int width; 00052 int height; 00053 double avLum; 00054 double keyValue; 00055 double sharpening; 00056 QString msg; 00057 fftw_complex* responses[9]; 00058 }; 00059 00060 class ReinhardLocalOperatorFactory : public QObject, public ToneMappingOperatorFactory 00061 { 00062 Q_OBJECT 00063 Q_INTERFACES(ToneMappingOperatorFactory) 00064 00065 public: 00066 virtual ToneMappingOperatorPtr createOperator() const; 00067 virtual QString operatorName() const; 00068 }; 00069 00070 #endif