AlignFeatures.h revision e295e32b68cf04f0d99138bf4a6d25555f3aef99
1/* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17/////////////////////////////////////////////////// 18// Align.h 19// S.O. # : 20// Author(s): zkira 21// $Id: AlignFeatures.h,v 1.13 2011/06/17 13:35:47 mbansal Exp $ 22 23#ifndef ALIGN_H 24#define ALIGN_H 25 26#include "dbreg/dbreg.h" 27#include <db_utilities_camera.h> 28 29#include "ImageUtils.h" 30#include "MatrixUtils.h" 31 32class Align { 33 34public: 35 // Types of alignment possible 36 static const int ALIGN_TYPE_PAN = 1; 37 38 // Return codes 39 static const int ALIGN_RET_ERROR = -1; 40 static const int ALIGN_RET_OK = 0; 41 42 ///// Settings for feature-based alignment 43 // Number of features to use from corner detection 44 static const int DEFAULT_NR_CORNERS=750; 45 static const double DEFAULT_MAX_DISPARITY=0.1;//0.4; 46 // Type of homography to model 47 static const int DEFAULT_MOTION_MODEL=DB_HOMOGRAPHY_TYPE_R_T; 48// static const int DEFAULT_MOTION_MODEL=DB_HOMOGRAPHY_TYPE_PROJECTIVE; 49// static const int DEFAULT_MOTION_MODEL=DB_HOMOGRAPHY_TYPE_AFFINE; 50 static const unsigned int DEFAULT_REFERENCE_UPDATE_PERIOD=1500; // Manual reference frame update so set this to a large number 51 52 Align(); 53 ~Align(); 54 55 // Initialization of structures, etc. 56 int initialize(int width, int height, bool quarter_res, float thresh_still); 57 58 // Add a frame. Note: The alignment computation is performed 59 // in this function 60 int addFrameRGB(ImageType image); 61 int addFrame(ImageType image); 62 63 // Obtain the TRS matrix from the last two frames 64 int getLastTRS(double trs[3][3]); 65 char* getRegProfileString(); 66 67protected: 68 69 db_FrameToReferenceRegistration reg; 70 71 int frame_number; 72 double Happly[9]; // Homography to apply 73 double Hcurr[9]; // Homography from last frame 74 // (right now same as above) 75 double Hprev[9]; // Homography up until the last frame 76 77 int width,height; 78 79 bool quarter_res; // Whether to process at quarter resolution 80 float thresh_still; // Translation threshold in pixels to detect still camera 81 ImageType imageGray; 82}; 83 84 85#endif 86