00001 #ifndef TRV_TESTS_HPP
00002 #define TRV_TESTS_HPP
00003
00004 #include "kernel/jafarException.hpp"
00005 #include "jmath/jblas.hpp"
00006 #include "jmath/ublasExtra.hpp"
00007 #include <boost/numeric/ublas/storage.hpp>
00008
00009
00010 #include "traversability/traversability.hpp"
00011 #include "traversability/trv_rotations.hpp"
00012 #include "traversability/trv_util.hpp"
00013 #include "traversability/trv_homography.hpp"
00014 #include "traversability/trv_dataProvider.hpp"
00015
00016 #include "datareader/PositionReader.hpp"
00017 #include "datareader/ImageReader.hpp"
00018
00019 #include "geom/t3d.hpp"
00020 #include "geom/t3dEuler.hpp"
00021
00022 #include <image/Image.hpp>
00023 #include <fstream>
00024 #include <string>
00025
00026 #include "fdetect/DetectionResult.hpp"
00027 #include "gfm/MatchingResult.hpp"
00028 #include "fdetect/InterestFeature.hpp"
00029
00030 namespace jafar {
00031 namespace traversability {
00032
00033
00034 void testRotations ( double psi, double theta, double phi );
00035 jafar::image::Image testHomographyGeom ( int idx, int stepSize );
00036 void testZNCC ( const jafar::image::Image &img0, const int centerX, const int centerY,
00037 int winHalfwidth, int winHalfHeight, int halfnos, double minShift, double maxShift );
00038 void testZNCCData ( const jafar::image::Image &img0, const jafar::image::Image &img1,
00039 const jafar::gfm::MatchingResult &rm, int winHalfwidth, int winHalfHeight, int fileIndex );
00040
00041
00042 int elementwiseMatrixComparison (jblas::mat33 A,jblas::mat33 B );
00043
00044
00045
00046
00047 jafar::datareader::PositionReader* initPositionReader ( FileInfoDataSet fileInfo );
00048 jafar::datareader::ImageReader* initImageReader ( FileInfoDataSet fileInfo );
00049 jblas::vec6 getPoseDataFromSource ( jafar::datareader::PositionReader* posReader, int idx );
00050 CameraPoseParameters getPoseDataFromSourceStr ( jafar::datareader::PositionReader* posReader, int idx );
00051 MatchesContainer readMatches ( std::string filename );
00052
00053
00054
00055 void calcMaskImage ( const jafar::image::Image &img0, const jafar::image::Image &img1, jafar::image::Image &img2 );
00056 void calcMeanImage ( const jafar::image::Image &img0, const jafar::image::Image &img1, jafar::image::Image &img2 );
00057 void calcDiffImage ( const jafar::image::Image &img0, const jafar::image::Image &img1, jafar::image::Image &img2 );
00058 void moveImage ( const jafar::image::Image &img0, jafar::image::Image &img1, const double dx, const double dy);
00059 void calcZnccImage ( const jafar::image::Image &img0, const jafar::image::Image &img1, jafar::image::Image &imgZncc,
00060 const int winHalfWidth, const int winHalfHeight, const int threshold = 0);
00061 void calcZnccImageO ( const jafar::image::Image &im0, const jafar::image::Image &im1, jafar::image::Image &imZncc,
00062 const int winHalfWidth, const int winHalfHeight, const int threshold = 0);
00063 void calcZnccImageOO ( const jafar::image::Image &im0, const jafar::image::Image &im1,
00064 const jafar::image::Image &maskCFoV, jafar::image::Image &imZncc,
00065 const int winHalfWidth, const int winHalfHeight, const int threshold = 0);
00066 inline double pow2(double a) { return a * a; }
00067
00068
00076
00077 void nastyDesaturation ( jafar::image::Image &img );
00078
00079
00080 CameraDeltaParameters calcCameraDeltaParameters ( CameraPoseParameters camPose0,
00081 CameraPoseParameters camPose1 );
00082 jblas::mat33 calcHomographyGeom ( const CameraDeltaParameters &dCam, const CameraIntrinsicParameters &internals,
00083 const PlaneParameters &plane );
00084 void applyHomography( const jblas::mat33 &H_C0C1, const jafar::image::Image &img0, jafar::image::Image &img1 );
00085 void estimateHomography ( const jafar::gfm::MatchingResult &rm, jblas::mat33& H );
00086 void calcA_i ( const fdetect::InterestFeature* x0, const fdetect::InterestFeature* x1, jblas::mat &A_i );
00087 void calcJ_i( const fdetect::InterestFeature* x0, const fdetect::InterestFeature* x1, jblas::mat &J_i );
00088
00089
00090 void matchRepartition ( MatchesContainer &mc, const int m, const int n, const int width, const int height );
00091
00092
00093
00094 void calcExpectedDisparity(int u0, int v0, const jblas::mat33 &H_C1C0,
00095 const CameraIntrinsicParameters &internals,
00096 const CameraDeltaParameters &deltaC01, const jafar::image::Image &mask1);
00097
00098
00099 void calcDensificator0 ( const jafar::image::Image &im0, const jafar::image::Image &im1,
00100 const jafar::image::Image &maskCFoV0, jafar::image::Image &imZncc,
00101 const int winHalfWidth, const int winHalfHeight);
00102
00103 void calcHomographyDecomposition ( const jblas::mat33 &H_C1C0, const jblas::mat33 K,
00104 jblas::mat33 &R_C1C0, jblas::vec3 &t_C1, jblas::vec3 &n_C0 );
00105 }
00106 }
00107
00108 #endif