Skip to content

Commit

Permalink
Rectified command args issues
Browse files Browse the repository at this point in the history
  • Loading branch information
arunumd committed Aug 2, 2019
1 parent 2550581 commit 2b8641d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,25 @@ void Usage() {
" ./ImageTransform <image> <rotation-angle>" <<
std::endl;
}

/*!
* \brief main function to read a user input location for an image and then apply the
required transformations (rotation / translation)
* required transformations (rotation / translation)
*/
int main(int argc, char *argv[])
{
for (auto i = 0; i < argc; i++)
std::cout << argv[i] << std::endl;
auto start = std::chrono::steady_clock::now();
if (argc == 0 || argc < 3)
if (argc < 4)
Usage();
else {
double degree = std::stod(argv[2]);
double degree = 0;
if (argv[3] < 0) {
degree = static_cast<double>(std::atof(argv[3]));
}
else
degree = std::stod(argv[3]);
double angle = degree * CV_PI / 180.;
cv::Mat src_img = cv::imread(argv[1]);
std::pair<int, int> null_trans = std::make_pair(0, 0);
Expand All @@ -117,6 +125,7 @@ int main(int argc, char *argv[])
cv::Mat trans_mat2 = CreateTransMat(0, translation_final);
ImageTransform(interim_img, trans_mat2, dest_img);
cv::imshow("Final image", dest_img);
cv::imwrite(argv[2], dest_img);
cv::waitKey(0);
}
auto end = std::chrono::steady_clock::now();
Expand Down

0 comments on commit 2b8641d

Please sign in to comment.