00001 // -*- c++ -*- 00002 // Copyright 2008 Isis Innovation Limited 00003 00004 #ifndef __CALIB_CORNER_PATCH_H 00005 #define __CALIB_CORNER_PATCH_H 00006 #include <TooN/TooN.h> 00007 using namespace TooN; 00008 #include <cvd/image.h> 00009 #include <cvd/byte.h> 00010 00011 class CalibCornerPatch 00012 { 00013 public: 00014 struct Params 00015 { 00016 Params(); 00017 Matrix<2> m2Warp(); 00018 Vector<2> v2Pos; 00019 Vector<2> v2Angles; 00020 double dMean; 00021 double dGain; 00022 }; 00023 00024 CalibCornerPatch(int nSideSize = 8); 00025 bool IterateOnImage(Params ¶ms, CVD::Image<CVD::byte> &im); 00026 bool IterateOnImageWithDrawing(Params ¶ms, CVD::Image<CVD::byte> &im); 00027 00028 protected: 00029 void MakeTemplateWithCurrentParams(); 00030 void FillTemplate(CVD::Image<float> &im, Params params); 00031 double Iterate(CVD::Image<CVD::byte> &im); 00032 Params mParams; 00033 CVD::Image<float> mimTemplate; 00034 CVD::Image<Vector<2> > mimGradients; 00035 CVD::Image<Vector<2> > mimAngleJacs; 00036 00037 void MakeSharedTemplate(); 00038 static CVD::Image<float> mimSharedSourceTemplate; 00039 00040 double mdLastError; 00041 }; 00042 00043 00044 00045 00046 #endif