sightmachine / SimpleCV

The Open Source Framework for Machine Vision
http://simplecv.org
BSD 3-Clause "New" or "Revised" License
2.68k stars 798 forks source link

Unable to unitialize Camera #627

Open previ opened 10 years ago

previ commented 10 years ago

There is no way of shutting down the Camera object, once initialized. There should be a way to reverse the initialization performed in cam = Camera()

jxieeducation commented 10 years ago

I can confirm that there is currently not a way to uninitiate the camera. It can be a very useful feature if you want to free up the camera for other purposes without shutting down the simplecv scripts.

The section responsible for opening the camera (in linux) is: import pygame.camera pygame.camera.init()

I propose that we can create a function: e.g. Camera - def stop() The function will disconnect the camera without getting rid of the camera instance. We can simply stop pygame.camera.

The pseudocode will look something like:

  1. is the camera on?
  2. if on, then stop the camera.

pygame API useful: http://www.pygame.org/docs/ref/camera.html#pygame.camera.Camera.stop

Can someone else confirm this?