|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @publishedAll |
|
19 @released |
|
20 */ |
|
21 |
|
22 #ifndef PANORAMA_H |
|
23 #define PANORAMA_H |
|
24 |
|
25 #include <icl/imagecodecdata.h> |
|
26 |
|
27 const TInt KPanoramaDefaultOverlap = 63; //Default overlap value in percent. |
|
28 const TInt KPanoramaDefaultDirectionTrigger = 10; //Default direction value in percent. |
|
29 const TInt KPanLensIndex = 2; //Focal length and principal point index value |
|
30 const TInt KPanLensDist = 5; //Distortion index value |
|
31 |
|
32 //fwd ref |
|
33 class CImagePanoramaImpl; |
|
34 class CVFTrackerImpl; |
|
35 class CPanoramaTransformImpl; |
|
36 class CImageFrame; |
|
37 |
|
38 /** |
|
39 Defines the direction |
|
40 */ |
|
41 enum TDirection |
|
42 { |
|
43 EPanoramaDirectionUnknown = 0, |
|
44 EPanoramaDirectionRight, |
|
45 EPanoramaDirectionLeft, |
|
46 EPanoramaDirectionUp, |
|
47 EPanoramaDirectionDown |
|
48 }; |
|
49 |
|
50 /** |
|
51 This class provides the lens parameters that describe the internal camera characteristics. |
|
52 */ |
|
53 class TPanoramaLens |
|
54 { |
|
55 public: |
|
56 IMPORT_C TPanoramaLens(); |
|
57 IMPORT_C TPanoramaLens(TReal32* aFocalLength, TReal32* aPrincipalPoint, TReal32 aSkew, TReal32* aDist, TUint32 aWidth, TUint32 aHeight); |
|
58 |
|
59 public: |
|
60 TReal32 iFocalLength[KPanLensIndex]; //Focal length coordinates |
|
61 TReal32 iPrincipalPoint[KPanLensIndex]; //Principal point coordinates |
|
62 TReal32 iSkew; //Skew coefficient. @remark 0.0f means no skew |
|
63 TReal32 iDist[KPanLensDist];// Distortion coefficients. If there are fewer parameter values available, fill the last values with zeros |
|
64 TUint32 iWidth; // Image width when the camera was calibrated |
|
65 TUint32 iHeight; // Image height when the camera was calibrated |
|
66 |
|
67 private: |
|
68 // Future proof |
|
69 TAny* iPad1; |
|
70 TAny* iPad2; |
|
71 TAny* iPad3; |
|
72 TAny* iPad4; |
|
73 }; |
|
74 |
|
75 /** |
|
76 This class provides help functions for handling the result of the viewfinder tracking. |
|
77 It contains getters and setters. |
|
78 */ |
|
79 class CPanoramaTransform : public CBase |
|
80 { |
|
81 public: |
|
82 IMPORT_C static CPanoramaTransform* NewL(); |
|
83 |
|
84 IMPORT_C void GetTranslation(TPoint& aDxDy, TSize& aDims) const; |
|
85 IMPORT_C void SetTranslationL(const TPoint& aDxDy, const TSize& aDims); |
|
86 IMPORT_C void GetDirection(TDirection& aDirection); |
|
87 IMPORT_C void GetDirection(TDirection& aDirection, TInt& aMinimumDelta); |
|
88 IMPORT_C void SetDirection(TDirection& aDirection); |
|
89 IMPORT_C void SetDirection(TDirection& aDirection, TInt aMinDelta); |
|
90 |
|
91 IMPORT_C ~CPanoramaTransform(); |
|
92 |
|
93 private: |
|
94 CPanoramaTransform(); |
|
95 void ConstructL(); |
|
96 |
|
97 private: |
|
98 CPanoramaTransformImpl* iPanTransImpl; |
|
99 }; |
|
100 |
|
101 /** |
|
102 This class provides functions to register the image that has got from viewfinder |
|
103 and checks the appropriate time to capture that image. |
|
104 */ |
|
105 class CVFTracker : public CBase |
|
106 { |
|
107 public: |
|
108 IMPORT_C static CVFTracker* NewL(); |
|
109 |
|
110 IMPORT_C void RegisterImageL(const CFbsBitmap& aBitmap, CPanoramaTransform& aPanTrans); |
|
111 IMPORT_C void RegisterImageL(const CImageFrame& aImageFrame, CPanoramaTransform& aPanTrans); |
|
112 IMPORT_C TBool IsTimeToCapture(TDirection& aDirection) const; |
|
113 IMPORT_C TBool IsTimeToCapture(TDirection& aDirection, TInt aOverlap) const; |
|
114 IMPORT_C void Reset(); |
|
115 IMPORT_C void InitializeL(const TSize& aSize); |
|
116 |
|
117 IMPORT_C TAny* Extension(TUid aExtension); |
|
118 |
|
119 IMPORT_C ~CVFTracker(); |
|
120 |
|
121 private: |
|
122 CVFTracker(); |
|
123 void ConstructL(); |
|
124 |
|
125 private: |
|
126 CVFTrackerImpl* iVFTrackImpl; |
|
127 }; |
|
128 |
|
129 /** |
|
130 This class provides functions to get basic stitching. Input can be a file, |
|
131 descriptor, bitmap, imageframe. |
|
132 */ |
|
133 class CImagePanorama : public CBase |
|
134 { |
|
135 public: |
|
136 IMPORT_C static CImagePanorama* NewL(); |
|
137 |
|
138 IMPORT_C void AddFileL(const TDesC& aFilename, CPanoramaTransform& aPanTrans); |
|
139 IMPORT_C void AddBufferL(const TDesC8& aData, CPanoramaTransform& aPanTrans); |
|
140 IMPORT_C void AddImageL(const CFbsBitmap& aBitmap, CPanoramaTransform& aPanTrans); |
|
141 IMPORT_C void AddImageL(const CImageFrame& aImageFrame, CPanoramaTransform& aPanTrans); |
|
142 |
|
143 IMPORT_C void CurrentImageSizeL(TSize& aSize); |
|
144 |
|
145 IMPORT_C void RenderL(const TDesC& aFilename); |
|
146 IMPORT_C void RenderL(const TDesC& aFilename, const TSize& aSize, const TBool aMaintainAspectRatio, const TUid& aImageTypeUid); |
|
147 |
|
148 IMPORT_C void RenderL(RFile& aFile); |
|
149 IMPORT_C void RenderL(RFile& aFile, const TSize& aSize, const TBool aMaintainAspectRatio, const TUid& aImageTypeUid); |
|
150 |
|
151 IMPORT_C void RenderL(HBufC8*& aDestData); |
|
152 IMPORT_C void RenderL(HBufC8*& aDestData, TUint32 aMaxBufferSize, const TSize& aSize, const TBool aMaintainAspectRatio, const TUid& aImageTypeUid); |
|
153 |
|
154 IMPORT_C void RenderL(const CFbsBitmap& aBitmap); |
|
155 IMPORT_C void RenderL(const CFbsBitmap& aBitmap, const TBool aMaintainAspectRatio); |
|
156 |
|
157 IMPORT_C void RenderL(const CImageFrame& aImageFrame); |
|
158 IMPORT_C void RenderL(const CImageFrame& aImageFrame, const TBool aMaintainAspectRatio); |
|
159 |
|
160 IMPORT_C void InitializeL(const TSize & aSize, const TPanoramaLens& aPanoramaLens, const TDirection& aDirection); |
|
161 |
|
162 IMPORT_C TAny* Extension(TUid aExtension); |
|
163 |
|
164 IMPORT_C ~CImagePanorama(); |
|
165 |
|
166 private: |
|
167 CImagePanorama(); |
|
168 void ConstructL(); |
|
169 |
|
170 private: |
|
171 CImagePanoramaImpl* iImgPanImpl; |
|
172 }; |
|
173 |
|
174 #endif //PANORAMA_H |