Success! Thank you Matti Vuori and Laurent Berger. Below the code to identify a sequence and save as video .avi.
int main()
{
std::vector< cv::String> f_BG;
glob(“C:/Users/Home/OneDrive/Desktop/BG/*.png”, f_BG, false);
std::vector< Mat> BG_images;
size_t count_BG = f_BG.size();for (size_t p = 0; p < count_BG; p++) { BG_images.push_back(imread(f_BG[p], IMREAD_GRAYSCALE)); } VideoWriter writer; int codec = VideoWriter::fourcc('H', 'F', 'Y', 'U'); double fps = 4; std::string filename = "vid.avi"; int p=0; writer.open(filename, codec, fps, BG_images[p].size(), false); for (int p = 0; p < count_BG; p++) { writer.write(BG_images[p]); } writer.release(); return 0;
}
Observation: I shoul put inside the loop as Matti sayed, I should change to use de HFYU codec for better video resolution and I should change my IMREAD to GRAYSCALE instead UNCHANGED or ANYDEPTH because the images that I am using with are PNG 16 bit.
The INFO 0 messages still remain appearing in output, example:
[ INFO:0] global C:\build\master_winpack-build-win64-vc15\opencv\modules\videoio\src\videoio_registry.cpp (197) cv::`anonymous-namespace’::VideoBackendRegistry::VideoBackendRegistry VIDEOIO: Enabled backends(8, sorted by priority): FFMPEG(1000); GSTREAMER(990); INTEL_MFX(980); MSMF(970); DSHOW(960); CV_IMAGES(950); CV_MJPEG(940); UEYE(930)
[ INFO:0] global C:\build\master_winpack-build-win6