@@ -81,17 +81,25 @@ void Usage() {
8181 " ./ImageTransform <image> <rotation-angle>" <<
8282 std::endl;
8383}
84+
8485/* !
8586* \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)
8788*/
8889int main (int argc, char *argv[])
8990{
91+ for (auto i = 0 ; i < argc; i++)
92+ std::cout << argv[i] << std::endl;
9093 auto start = std::chrono::steady_clock::now ();
91- if (argc == 0 || argc < 3 )
94+ if (argc < 4 )
9295 Usage ();
9396 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 ]);
95103 double angle = degree * CV_PI / 180 .;
96104 cv::Mat src_img = cv::imread (argv[1 ]);
97105 std::pair<int , int > null_trans = std::make_pair (0 , 0 );
@@ -117,6 +125,7 @@ int main(int argc, char *argv[])
117125 cv::Mat trans_mat2 = CreateTransMat (0 , translation_final);
118126 ImageTransform (interim_img, trans_mat2, dest_img);
119127 cv::imshow (" Final image" , dest_img);
128+ cv::imwrite (argv[2 ], dest_img);
120129 cv::waitKey (0 );
121130 }
122131 auto end = std::chrono::steady_clock::now ();
0 commit comments