Ask Your Question

Revision history [back]

  1. This is an older tutorial, using the legacy C-API, which is basically not recommended anymore.
  2. Here is the new version using C++ API.
  3. To read an image, instead of the line capture.open( -1 ); you could use the URL of the image: capture.open( "/path/to/my/image.png" ); This will use VideoCapture to read the image (but according to the following code it will close rapidly...). And it is not really recommended to use VideoCapture for image reading (different results possible from the usual image reading due to the codec used).
  4. You could replace the VideoCapture usage by a simple imread call. But if you wonder how to do that, I suggest you have a look at the beginner tutorial of OpenCV (complete list).