@@ -81,17 +81,25 @@ void Usage() {
81
81
" ./ImageTransform <image> <rotation-angle>" <<
82
82
std::endl;
83
83
}
84
+
84
85
/* !
85
86
* \brief main function to read a user input location for an image and then apply the
86
- required transformations (rotation / translation)
87
+ * required transformations (rotation / translation)
87
88
*/
88
89
int main (int argc, char *argv[])
89
90
{
91
+ for (auto i = 0 ; i < argc; i++)
92
+ std::cout << argv[i] << std::endl;
90
93
auto start = std::chrono::steady_clock::now ();
91
- if (argc == 0 || argc < 3 )
94
+ if (argc < 4 )
92
95
Usage ();
93
96
else {
94
- double degree = std::stod (argv[2 ]);
97
+ double degree = 0 ;
98
+ if (argv[3 ] < 0 ) {
99
+ degree = static_cast <double >(std::atof (argv[3 ]));
100
+ }
101
+ else
102
+ degree = std::stod (argv[3 ]);
95
103
double angle = degree * CV_PI / 180 .;
96
104
cv::Mat src_img = cv::imread (argv[1 ]);
97
105
std::pair<int , int > null_trans = std::make_pair (0 , 0 );
@@ -117,6 +125,7 @@ int main(int argc, char *argv[])
117
125
cv::Mat trans_mat2 = CreateTransMat (0 , translation_final);
118
126
ImageTransform (interim_img, trans_mat2, dest_img);
119
127
cv::imshow (" Final image" , dest_img);
128
+ cv::imwrite (argv[2 ], dest_img);
120
129
cv::waitKey (0 );
121
130
}
122
131
auto end = std::chrono::steady_clock::now ();
0 commit comments