write image output
This commit is contained in:
parent
855c62b8fc
commit
9dff0deb8e
1 changed files with 9 additions and 2 deletions
11
lines.cpp
11
lines.cpp
|
@ -28,7 +28,7 @@ int main(int argc, char *argv[])
|
||||||
char const *fname = "files/masckera.png";
|
char const *fname = "files/masckera.png";
|
||||||
if( 1<argc )
|
if( 1<argc )
|
||||||
fname = argv[1];
|
fname = argv[1];
|
||||||
if( 2<argc) {
|
if( 3<argc) {
|
||||||
std::cerr << "Too many arguments" << std::endl;
|
std::cerr << "Too many arguments" << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
@ -135,8 +135,15 @@ int main(int argc, char *argv[])
|
||||||
if( (char)cv::waitKey(0) == 113 )
|
if( (char)cv::waitKey(0) == 113 )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
img.release();
|
|
||||||
#endif
|
#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;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue