digiKam
lensdistortionpixelaccess.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2004-12-27
7  * Description : access pixels method for lens distortion algorithm.
8  *
9  * Copyright (C) 2004-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2006-2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_LENS_DISTORTION_PIXEL_ACCESS_H
26 #define DIGIKAM_LENS_DISTORTION_PIXEL_ACCESS_H
27 
28 #define LensDistortionPixelAccessRegions 20
29 #define LensDistortionPixelAccessWidth 40
30 #define LensDistortionPixelAccessHeight 20
31 #define LensDistortionPixelAccessXOffset 3
32 #define LensDistortionPixelAccessYOffset 3
33 
34 // Local includes
35 
36 #include "dimg.h"
37 #include "digikam_export.h"
38 
39 namespace Digikam
40 {
41 
56 class DIGIKAM_EXPORT LensDistortionPixelAccess
57 {
58 
59 public:
60 
61  explicit LensDistortionPixelAccess(DImg* srcImage);
63 
64  void pixelAccessGetCubic(double srcX, double srcY, double brighten, uchar* dst);
65 
66 protected:
67 
68  inline uchar* pixelAccessAddress(int i, int j);
69  void pixelAccessSelectRegion(int n);
70  void pixelAccessDoEdge(int i, int j);
71  void pixelAccessReposition(int xInt, int yInt);
72  void cubicInterpolate(uchar* src, int rowStride, uchar* dst,
73  bool sixteenBit, double dx, double dy, double brighten);
74 
75 private:
76 
77  DImg* m_image;
78 
80 
81  int m_width;
82  int m_height;
83  int m_depth;
84  int m_imageWidth;
85  int m_imageHeight;
86  bool m_sixteenBit;
87  int m_tileMinX[LensDistortionPixelAccessRegions];
88  int m_tileMaxX[LensDistortionPixelAccessRegions];
89  int m_tileMinY[LensDistortionPixelAccessRegions];
90  int m_tileMaxY[LensDistortionPixelAccessRegions];
91 };
92 
93 } // namespace Digikam
94 
95 #endif // DIGIKAM_LENS_DISTORTION_PIXEL_ACCESS_H
Definition: dimg.h:62
Definition: lensdistortionpixelaccess.h:57
#define LensDistortionPixelAccessRegions
Definition: lensdistortionpixelaccess.h:28
Definition: datefolderview.cpp:43