This image must have the same size as the size you gave to the writer when you configured it in the first
place. If you told the writer that the frames would be in color, this must also be a three-channel image. If
you indicated to the writer (via isColor) that the images is just one channel, you should supply a single-
channel (grayscale) image.
Writing Frames with cv::VideoWriter::operator<<()
The video writer also supports the idiom of the overloaded output stream operator (operator<<()). In
this case, once you have your video writer open, you can write images to the video stream in the same
manner you would write to cout or a file ofstream object:
my_video_writer << my_frame;
Working with Windows
The HighGUI toolkit provides some rudimentary built-in features for creating windows, displaying images
in those windows, and for making some user interaction possible with those windows. The native OpenCV
graphical user interface (GUI) functions have been part of the library for a very long time, and have the
advantage of being stable, portable,
9
and very easy to use.
On the other hand, the native GUI features have the disadvantage of being not particularly complete. As a
result, there has been an effort to modernize the GUI portion of HighGUI, and to add a number of useful
new features. This was done by converting from “native” interfaces to the use