write image output

This commit is contained in:
boyska 2017-01-13 00:16:22 +01:00
parent 855c62b8fc
commit 9dff0deb8e

View file

@ -28,7 +28,7 @@ int main(int argc, char *argv[])
char const *fname = "files/masckera.png";
if( 1<argc )
fname = argv[1];
if( 2<argc) {
if( 3<argc) {
std::cerr << "Too many arguments" << std::endl;
return EXIT_FAILURE;
}
@ -135,8 +135,15 @@ int main(int argc, char *argv[])
if( (char)cv::waitKey(0) == 113 )
break;
}
img.release();
#endif
if(2<argc) {
std::vector<int> params;
params.push_back(CV_IMWRITE_PNG_COMPRESSION);
params.push_back(9);
Mat dst;
img.convertTo(dst, CV_8UC3);
cv::imwrite(argv[2], dst, params);
}
return EXIT_SUCCESS;
}