Reputation: 319
I want to save images in number.jpg for each time.
For example, first I will save it as 1.jpg
, 2.jpg
, ...
I will be writing the images using imwrite()
function.
Upvotes: 3
Views: 2648
Reputation: 33864
You should really have researched this a little more but making numbered filenames is very easy:
int filecount = 0; //increment this
stringstream filename;
filename << "filename_" << std::setw(4) << std::setfill('0') << filecount << ".jpg";
setfill
and setw
make the width of the number 4 and ill it out with 0 so it will look like:
filename_0000.jpg
filename_0001.jpg
...
You can then use imwrite like this:
imwrite(filename.str().c_str(), image);
Upvotes: 9