Videocapture in python

koranthala at gmail.com koranthala at gmail.com
Thu Jan 1 13:28:21 CET 2009


On Jan 1, 1:58 pm, "alex goretoy" <aleksandr.gore... at gmail.com> wrote:
> Can you post your code or a code segment? I would be interested in seeing
> how this works.
>
>
>
> On Thu, Jan 1, 2009 at 3:29 AM, <koranth... at gmail.com> wrote:
> > I face issues in videocapture in python. Cant find anyplace where we
> > can raise bug reports, so mentioning here. Also help required if
> > somebody has solved it earlier.
>
> > On using videocapture (python 2.4), I am facing the following issues
> > while creating a video sort of application.
> > -> Pull out the usb cable : Videocapture gets the data stored
> > initially in the buffer and returns always. The images are not updated
> > - but also there is no error returned.
> > i.e. there is no information to the viewer that it is not working
> > anymore. Especially because since the timestamp is updated everytime
> > (it is done inside videocapture.py - wherein current time is
> > overwritten on the received image), it gives a feeling that video is
> > running.
>
> > Currently I have done a workaround in that every 2 captures, i setup
> > the camera again - but it takes too much time. Anyone has any
> > suggestions on solving this?
> > --
> >http://mail.python.org/mailman/listinfo/python-list
>
> --
> А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я
> а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я

Since the code uses a lot of other variables - due to being a part of
a larger project, I will try to provide pseudocode.
At initialization:
def setup_cam():
  global cam, i
  cam = Device (devnum = 0)
  i = 0

def take_photo(obj):
  i += 1
  if i >2:
    setup_cam()
  obj.img = cam.getImage(timestamp=3)

I actually would like to have the code as
try:
  obj.img = cam.getImage(timestamp=3)
except CamException:
  setup_cam()

But, since no exception is provided, I have to resort to the kludge
shown.
Please let me know if you need any more information.




More information about the Python-list mailing list