rotateImage.h
Go to the documentation of this file.
1 /**************************************************************************************************
2  Software License Agreement (BSD License)
3 
4  Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or without modification, are permitted
8  provided that the following conditions are met:
9 
10  *Redistributions of source code must retain the above copyright notice, this list of
11  conditions and the following disclaimer.
12  *Redistributions in binary form must reproduce the above copyright notice, this list of
13  conditions and the following disclaimer in the documentation and/or other materials provided
14  with the distribution.
15  *Neither the name of the University of Aveiro nor the names of its contributors may be used to
16  endorse or promote products derived from this software without specific prior written permission.
17 
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
19  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 ***************************************************************************************************/
27 
48 #ifndef ROTATE_IMAGE_H
49 #define ROTATE_IMAGE_H
50 
51 
52 #include <opencv2/features2d/features2d.hpp>
53 #include <opencv2/highgui/highgui.hpp>
54 #include <opencv2/imgproc/imgproc.hpp>
55 #include <opencv2/calib3d/calib3d.hpp>
56 #include <opencv2/nonfree/nonfree.hpp>
57 #include <opencv2/core/core.hpp>
58 #include <opencv2/opencv.hpp>
59 #include <stdlib.h>
60 #include <iostream>
61 #include <stdio.h>
62 #include <string>
63 #include <math.h>
64 #include <vector>
65 #include <map>
66 
67 using namespace cv;
68 using namespace std;
69 
70 struct Equ {
71  double m;
72  double c;
73  bool isVertical;
75 };
76 
78 {
79 public:
80 
81  static void rotate_image(Mat & src, Mat & dst,const double degree);
82 
83 
84 protected:
85 
86  static double round(double number);
87 
88  static double degreeToRadian(double degree);
89 
90  static double radianToDegree(double radian);
91 
92  static Size rotationNewCanvasSize(double degree,double angle,double h);
93 
94  static double solveEquationY(Equ e,double x);
95 
96  static double solveEquationX(Equ e, double y);
97 
98  static map<string,int> rotationExtraMargins(Size &original, Size &newSize);
99 
100  static map<string,Point> getCorners(Size &original,map<string,int> &margins);
101 
102  static map<string,Point> getProjectedCorners(Size &s,double h,double degree,double angle);
103 
104  static Point getCentreBetweenPoints(Point &a, Point &b) ;
105 
106  static map<string,Point> getCentreBetweenOriginalsAndProjections(map<string,Point> &originals,map<string,Point> &projections);
107 
108  static Equ getLinearEquation(Point &a,Point &b);
109 
110  static Equ getPerpendicular(Equ e,Point p);
111 
112  static map<string,Equ> getLinearEquationBetweenOriginalsAndProjections(map<string,Point> &originals,map<string,Point> &projections);
113 
114  static map<string,Equ> getPerpendicularLinearEquation(map<string,Point> &originals,map<string,Point> &projections,map<string,Point> &centre);
115 
116  static Point getColisionPoint(Equ e1,Equ e2);
117 
118 };
119 
120 
121 #endif // ROTATE_IMAGE_H
122 
double c
Definition: rotateImage.h:72
bool isHorizontal
Definition: rotateImage.h:74
double m
Definition: rotateImage.h:71
bool isVertical
Definition: rotateImage.h:73


arrow_detection
Author(s): César Sousa
autogenerated on Mon Mar 2 2015 01:31:21