Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sample code for using callbacks #1

Open
mohaps opened this issue Nov 12, 2015 · 2 comments
Open

sample code for using callbacks #1

mohaps opened this issue Nov 12, 2015 · 2 comments

Comments

@mohaps
Copy link

mohaps commented Nov 12, 2015

Awesome library! :) using it for a "toy" project to build my son a present for xmas.

I'm trying to use sinks=['callbacks'] in the constructor, but when I do camera.snap_picture() I get an error:

File "cam_capture.py", line 103, in capture_from_camera
    f = self.camera.snap_picture(blocking=blocking)
  File "/src/avf.pyx", line 244, in pyavfcam.AVFCam.snap_picture (src/avf.cpp:3125)
ValueError: image video sink not initialized

My camera class is constructed as

class Camera (pyavfcam.AVFCam): 
    def __init__(self, sinks = ['callback'], *args, **kwargs):
        pyavfcam.AVFCam.__init__(self, sinks, *args, **kwargs)
    def file_output_done(self, errorOccured):
        logging.info('file output done : %s' % errorOccured)
    def video_output(self, frame):
        logging.info('video output done : %s' % frame)
    def image_output(self, frame):
        logging.info('image output done : %s' % frame)

Would really appreciate a sample for using callbacks.

@dashesy
Copy link
Owner

dashesy commented Nov 12, 2015

Sorry I did not finish the callback, but will look at it soon.
If you want to snap pictures you do not need the callback, you can use image sink like this and many times as you want to take pictures. Callback is for live video/webcam processing with no dropped frames, and I need to buffer them to make this possible. BTW, with image sink if you do not provide a name it will not save a file and just returns the frame.

@landersson
Copy link

I also just tried to use pyavfcam, which looks nice and simple, for real-time webcam video processing using the semi-documented callback functionality before realising that it's not working. I'd be interested in trying it if you en up finishing it.

dashesy pushed a commit that referenced this issue Oct 15, 2018
Merge pull request #4 from bicv/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants