Google+ My Python Projects: Accessing Web Camera using Python OpenCV Google+

Tuesday, July 16, 2013

Accessing Web Camera using Python OpenCV

Accessing videos and images from file is fun,but sometimes you may need to process videos/images captured real time(where you will have to use a camera).

The program to access webcam is not so different from program to access video from file.

Program:

down load as text from_cam.py.txt
I hope no explanations needed except the use of '0' as argument to cv2.VideoCapture() .The devices are identified by certain numbers in OpenCV,this is important in cases where multiple camera devices need to be accessed.Here we will stick with single camera which is the default capture device(The webcam in a laptop/the usb webcam in a desktop PC).

The use of other codes are explained in the previous post.

The 'if' conditional is dropped here assuming you have your camera connected properly.

Sample window:


So that's it now the Python have eyes which work on real time.

3 comments:

  1. can you make web cam take picture during boot time ?
    along with time stamp ?
    if u can can you pls do one script on it.

    ReplyDelete
  2. whether i am running the script as server code then ,whether it can able to open client side camera.

    ReplyDelete