OpenCV Programming the Raspberry Pi:Tutorial-8 Video Capture with C++ and Python


Video is ready, Click Here to View ×

OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library. OpenCV was built to provide a common infrastructure for computer vision applications and to accelerate the use of machine perception in the commercial products. Being a BSD-licensed product, OpenCV makes it easy for businesses to utilize and modify the code.
The library has more than 2500 optimized algorithms, which includes a comprehensive set of both classic and…

16 thoughts on “OpenCV Programming the Raspberry Pi:Tutorial-8 Video Capture with C++ and Python

  1. Hello Francesco,

    I am currently working on OpenCV(C++) project. I get exactly same error messages of "Corrupt JPEG data: extraneous bytes before marker". Do you know what is the reason for that and how to solve it?


  2. Hello Francesco, I need an advice. I have never used opencv before now. Today I have done some projects, learning from your videos. The problem is that I understand (not all) the code but if I wanna create a project from 0, I can't, because I don't know how opencv works. Can you advise me a book for beginner? Is the book on the video good for that? Thanks. PS I use C++ and C.

  3. Hello my friend. (sorry for bad english) I'm working in a project whre i want to detect peoples in video images…i dont want record the video…just detect and count the number of peoples on the image. Im using a raspicam, and i cannot open it, do you have a tutorial where you teach the same thing of this video, but using the raspicam?

  4. Hi +Francesco Piscani ,
    Thank you again for you great tutorials and your last answer! I am moving my OpenCV project (C++) to my new Raspberry Pi2,which has a 900MHz quadcore CPU. I wanted to ask you, before running make to compile opencv, is it necessary to enable TBB support in order to take advantage of the multiple cores of the CPU, and therefore achieving significantly better performance, in terms of speed of execution? So far I failed to enable TBB, but if you tell me that openCv will somehow make advantage of the multi cores anyway, then I won't spend time trying to enable it right now. However, if you think there's a significant increase in performance to gain, how do you enable it? running "sudo apt-get install libtbb-dev" doesn't work anymore, and people get this error:

    Package libtbb-dev is not available,but is refered to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    E: Package 'libtbb-dev' has no installation candidate.

    Thanks again for your great help,


  5. Nice tutorial sir. I am currently working on a project that requires me to play and process a video. I can easily do this in windows using c++ and opencv. However, once i use my code and build it in pi, nothing happens. Simply put, I cannot open and play videos in raspberry pi. Do i need to install something in order to play videos? omxplayer plays videos in my pi. Please help and Thanks 🙂

  6. Dear Francesco Piscani,
    Thanks for great tutorials! I'm using logitech 270c camera but speed very slow.So, i change to pi camera module but i have some problem when load video from camera. 
    Have you worked on pi camera?

  7. Hello Francesco, great tutorials. I'm using the c++ API. When I use:
    VideoCapture cap(0);
    cap >> frame;
    about 50% of the times I get a sort of cropped image, and noisy. Do you know why this might be? Is the raspi not quick enough to decompress the webcam frame?
    Anyone that can shed some light can help.

  8. Hi, I´m new in this kind of stuff. I have a school project: it involves a code developed in OpenCv, which gives a position (coordinates), and them have to be sent to the raspberry py,which control the position of two servomotors; do you know any way to comunicate opencv, which is running in the computer, with the raspberri py? thanks in advance

  9. By the way, there is something wrong with the links to all the source codes on your website. Source codes for tutorial 7, 8 and 9 are all pointing to the source code of tutorial 6. Oh well, I can just type it over from the video but thought I'd let you know!

  10. Hi Francesso, I connect to my pi using ssh, putty and xming. I can run the opencv samples with a usb web cam but I haven't tried using tha raspicam yet. The code I'm using is c++. I will take a look at your link. Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *