summaryrefslogtreecommitdiffstats
path: root/src/imageplugins/hotpixels/hotpixelfixer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/imageplugins/hotpixels/hotpixelfixer.h')
-rw-r--r--src/imageplugins/hotpixels/hotpixelfixer.h98
1 files changed, 98 insertions, 0 deletions
diff --git a/src/imageplugins/hotpixels/hotpixelfixer.h b/src/imageplugins/hotpixels/hotpixelfixer.h
new file mode 100644
index 00000000..2bf8131c
--- /dev/null
+++ b/src/imageplugins/hotpixels/hotpixelfixer.h
@@ -0,0 +1,98 @@
+/* ============================================================
+ * Authors: Unai Garro <ugarro at users dot sourceforge dot net>
+ * Gilles Caulier <caulier dot gilles at free dot fr>
+ * Date : 2005-03-27
+ * Description : Threaded image filter to fix hot pixels
+ *
+ * Copyright 2005-2007 by Unai Garro and Gilles Caulier
+ *
+ * The algorithm for fixing the hot pixels was based on
+ * the code of jpegpixi, which was released under the GPL license,
+ * and is Copyright (C) 2003, 2004 Martin Dickopp
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation;
+ * either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * ============================================================*/
+
+#ifndef HOTPIXELFIXER_H
+#define HOTPIXELFIXER_H
+
+// TQt includes.
+
+#include <tqimage.h>
+#include <tqobject.h>
+#include <tqvaluelist.h>
+#include <tqrect.h>
+#include <tqstring.h>
+
+// Digikam includes.
+
+#include "dimgthreadedfilter.h"
+
+// Local includes.
+
+#include "hotpixel.h"
+#include "weights.h"
+
+namespace DigikamHotPixelsImagesPlugin
+{
+
+class HotPixelFixer : public Digikam::DImgThreadedFilter
+{
+
+public:
+
+ enum InterpolationMethod
+ {
+ AVERAGE_INTERPOLATION = 0,
+ LINEAR_INTERPOLATION = 1,
+ QUADRATIC_INTERPOLATION = 2,
+ CUBIC_INTERPOLATION = 3
+ };
+
+ enum Direction
+ {
+ TWODIM_DIRECTION = 0,
+ VERTICAL_DIRECTION = 1,
+ HORIZONTAL_DIRECTION = 2
+ };
+
+public:
+
+ HotPixelFixer(Digikam::DImg *orgImage, TQObject *parent,
+ const TQValueList<HotPixel>& hpList, int interpolationMethod);
+ ~HotPixelFixer();
+
+private:
+
+ virtual void filterImage(void);
+
+ void interpolate (Digikam::DImg &img,HotPixel &hp, int method);
+ void weightPixels (Digikam::DImg &img, HotPixel &px, int method, Direction dir, int maxComponent);
+
+ inline bool validPoint(Digikam::DImg &img, TQPoint p)
+ {
+ return (p.x()>=0 && p.y()>=0 && p.x()<(long) img.width() && p.y()<(long) img.height());
+ };
+
+ TQValueList <Weights> mWeightList;
+
+private:
+
+ int m_interpolationMethod;
+
+ TQValueList<HotPixel> m_hpList;
+};
+
+} // NameSpace DigikamHotPixelsImagesPlugin
+
+#endif // HOTPIXELFIXER_H