00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00023 #include "iclexample.h"
00024 #include <panorama/panorama.h>
00025
00026 void CIclExample::BasicPanoramaStitchingL()
00027 {
00028 TSize imageSize(1200, 1000);
00029
00030 TDirection direction = EPanoramaDirectionRight;
00031
00032
00033
00034 TPanoramaLens lens;
00035
00036
00037 CPanoramaTransform* panTrans = CPanoramaTransform::NewL();
00038 CleanupStack::PushL(panTrans);
00039
00040
00041 CImagePanorama* panImage = CImagePanorama::NewL();
00042 CleanupStack::PushL(panImage);
00043
00044
00045 panImage->InitializeL(imageSize, lens, direction);
00046
00047
00048
00049 panTrans->SetTranslationL(TPoint(0, 0), imageSize);
00050 panImage->AddFileL(KTestFileName1, *panTrans);
00051
00052 panTrans->SetTranslationL(TPoint(900, -30), imageSize);
00053 panImage->AddFileL(KTestFileName2, *panTrans);
00054
00055 panTrans->SetTranslationL(TPoint(900, 60), imageSize);
00056 panImage->AddFileL(KTestFileName3, *panTrans);
00057
00058 panTrans->SetTranslationL(TPoint(400, -30), imageSize);
00059 panImage->AddFileL(KTestFileName4, *panTrans);
00060
00061
00062 TSize size;
00063 panImage->CurrentImageSizeL(size);
00064
00065
00066 panImage->RenderL(KTestBSOutputFileName);
00067
00068 CleanupStack::PopAndDestroy(2);
00069 }
00070
00071 void CIclExample::ViewFinderImageTrackingL()
00072 {
00073 _LIT(KFileOutput, "c:\\ICLExample\\viewfinder%d.mbm");
00074 _LIT(KFileCapturedImage, "c:\\ICLExample\\pancapture%d.jpg");
00075 TInt i = 0;
00076
00077 TSize imageSize(1200,1000);
00078
00079 CFbsBitmap* bmp = new (ELeave) CFbsBitmap;
00080 CleanupStack::PushL(bmp);
00081
00082
00083
00084
00085
00086 TFileName vfFileName;
00087 vfFileName.Format(KFileOutput(),i);
00088 User::LeaveIfError(bmp->Load(vfFileName));
00089
00090
00091 TSize bmpSize = bmp->SizeInPixels();
00092
00093 CPanoramaTransform* panTrans = CPanoramaTransform::NewL();
00094 CleanupStack::PushL(panTrans);
00095
00096 CVFTracker* vfTracker = CVFTracker::NewL();
00097 CleanupStack::PushL(vfTracker);
00098
00099 vfTracker->InitializeL(bmpSize);
00100
00101 CImagePanorama* panImage = CImagePanorama::NewL();
00102 CleanupStack::PushL(panImage);
00103
00104 TDirection direction = EPanoramaDirectionRight;
00105
00106
00107
00108 TPanoramaLens lens;
00109 panImage->InitializeL(imageSize, lens, direction);
00110
00111
00112 TFileName capturedFileName;
00113 capturedFileName.Format(KFileCapturedImage(),i);
00114 panImage->AddFileL(capturedFileName, *panTrans);
00115
00116 do
00117 {
00118
00119 vfTracker->RegisterImageL(*bmp, *panTrans);
00120
00121
00122 if(vfTracker->IsTimeToCapture(direction, KPanoramaDefaultOverlap))
00123 {
00124
00125 capturedFileName.Format(KFileCapturedImage(),i);
00126
00127 panImage->AddFileL(capturedFileName, *panTrans);
00128 vfTracker->Reset();
00129 }
00130
00131
00132
00133 i += 10;
00134 vfFileName.Format(KFileOutput(),i);
00135 TInt err = bmp->Load(vfFileName);
00136
00137
00138 if ( err != KErrNone )
00139 {
00140
00141 break;
00142 }
00143 }
00144 while (1);
00145
00146 panImage->RenderL(KTestVFTOutputFileName);
00147
00148 CleanupStack::PopAndDestroy(4,bmp);
00149 }
00150