~ubuntu-branches/ubuntu/intrepid/digikam/intrepid

« back to all changes in this revision

Viewing changes to digikam/imageplugins/hotpixels/hotpixelfixer.h

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2008-07-17 20:25:39 UTC
  • mfrom: (1.3.2 upstream) (37 hardy)
  • mto: This revision was merged to the branch mainline in revision 39.
  • Revision ID: james.westby@ubuntu.com-20080717202539-1bw3w3nrsso7yj4z
* New upstream release
  - digiKam 0.9.4 Release Plan (KDE3) ~ 13 July 08 (Closes: #490144)
* DEB_CONFIGURE_EXTRA_FLAGS := --without-included-sqlite3
* Debhelper compatibility level V7
* Install pixmaps in debian/*.install
* Add debian/digikam.lintian-overrides

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ============================================================
 
2
 * Authors: Unai Garro <ugarro at users dot sourceforge dot net>
 
3
 *          Gilles Caulier <caulier dot gilles at free dot fr>
 
4
 * Date   : 2005-03-27
 
5
 * Description : Threaded image filter to fix hot pixels
 
6
 * 
 
7
 * Copyright 2005-2007 by Unai Garro and Gilles Caulier
 
8
 *
 
9
 * The algorithm for fixing the hot pixels was based on
 
10
 * the code of jpegpixi, which was released under the GPL license,
 
11
 * and is Copyright (C) 2003, 2004 Martin Dickopp
 
12
 *
 
13
 * This program is free software; you can redistribute it
 
14
 * and/or modify it under the terms of the GNU General
 
15
 * Public License as published by the Free Software Foundation;
 
16
 * either version 2, or (at your option)
 
17
 * any later version.
 
18
 * 
 
19
 * This program is distributed in the hope that it will be useful,
 
20
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
21
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
22
 * GNU General Public License for more details.
 
23
 * 
 
24
 * ============================================================*/
 
25
 
 
26
#ifndef HOTPIXELFIXER_H
 
27
#define HOTPIXELFIXER_H
 
28
 
 
29
// Qt includes.
 
30
 
 
31
#include <qimage.h>
 
32
#include <qobject.h>
 
33
#include <qvaluelist.h>
 
34
#include <qrect.h>
 
35
#include <qstring.h>
 
36
 
 
37
// Digikam includes.
 
38
 
 
39
#include "dimgthreadedfilter.h"
 
40
 
 
41
// Local includes.
 
42
 
 
43
#include "hotpixel.h"
 
44
#include "weights.h"
 
45
 
 
46
namespace DigikamHotPixelsImagesPlugin
 
47
{
 
48
 
 
49
class HotPixelFixer : public Digikam::DImgThreadedFilter
 
50
{
 
51
 
 
52
public:
 
53
    
 
54
    enum InterpolationMethod 
 
55
    {
 
56
        AVERAGE_INTERPOLATION   = 0,
 
57
        LINEAR_INTERPOLATION    = 1,
 
58
        QUADRATIC_INTERPOLATION = 2,
 
59
        CUBIC_INTERPOLATION     = 3
 
60
    };
 
61
    
 
62
    enum Direction
 
63
    {
 
64
        TWODIM_DIRECTION        = 0,
 
65
        VERTICAL_DIRECTION      = 1,
 
66
        HORIZONTAL_DIRECTION    = 2    
 
67
    };
 
68
 
 
69
public:
 
70
        
 
71
    HotPixelFixer(Digikam::DImg *orgImage, QObject *parent, 
 
72
                  const QValueList<HotPixel>& hpList, int interpolationMethod);
 
73
    ~HotPixelFixer();
 
74
 
 
75
private: 
 
76
 
 
77
    virtual void filterImage(void);
 
78
    
 
79
    void interpolate (Digikam::DImg &img,HotPixel &hp, int method);
 
80
    void weightPixels (Digikam::DImg &img, HotPixel &px, int method, Direction dir, int maxComponent);
 
81
    
 
82
    inline bool validPoint(Digikam::DImg &img, QPoint p)
 
83
    {
 
84
        return (p.x()>=0 && p.y()>=0 && p.x()<(long) img.width() && p.y()<(long) img.height());
 
85
    };
 
86
    
 
87
    QValueList <Weights> mWeightList;
 
88
 
 
89
private: 
 
90
 
 
91
    int                  m_interpolationMethod;
 
92
       
 
93
    QValueList<HotPixel> m_hpList;
 
94
};
 
95
 
 
96
}  // NameSpace DigikamHotPixelsImagesPlugin
 
97
 
 
98
#endif  // HOTPIXELFIXER_H