$search
00001 /* 00002 * planar.h 00003 * outlet_model 00004 * 00005 * Created by Victor Eruhimov on 1/16/09. 00006 * Copyright 2009 Argus Corp. All rights reserved. 00007 * 00008 */ 00009 00010 //***************************************************************************************** 00011 // Warning: this is research code with poor architecture, performance and no documentation! 00012 //***************************************************************************************** 00013 00014 #if !defined(_PLANAR_H) 00015 #define _PLANAR_H 00016 00017 #include <cv.h> 00018 00019 const float pi = 3.1415926; 00020 00021 // mat is 2x2 matrix, the function maps 4 corners of an image of given size 00022 // and calculates a bounding rectangle around the resulting quadrangle 00023 CvRect calc_mapped_rectangle(CvRect roi, CvMat* mat); 00024 00025 // generating random affine transform. mat should be allocated as flt 2x3. 00026 CvSize gen_random_homog_transform(CvRect roi, CvMat* mat); 00027 00028 // the function gets an src image (possibly with ROI set) and transforms it randomly. 00029 // The transform matrix is T = R(t)R^{-1}(p)SR(p), where R is rotation matrix, S is scaling matrix. 00030 // Scaling parameters (two -- along x and y) are sampled from [0.6,1.5], 00031 // angles t and p -- [-pi,pi]. 00032 00033 void gen_random_homog_patches(IplImage* src, int count, IplImage** dst); 00034 void test_homog_transform(IplImage* src); 00035 00036 void save_image_array(const char* folder, const char* filename, int count, IplImage** images); 00037 00038 namespace cv{ 00039 void findPlanarObjectPose(const Mat& object_points, const Mat& image_points, const Point3f& normal, 00040 const Mat& intrinsic_matrix, const Mat& distortion_coeffs, std::vector<Point3f>& object_points_crf); 00041 } 00042 00043 00044 #endif //_PLANAR_H