Python convert to C++

asked 2015-07-04 14:26:13 -0600

updated 2018-12-03 18:34:09 -0600

I know very little about python and I was hoping that someone on here would be willing to convert this short python script to C++. I found the script here, but here it is.

Thanks!

def merge(frames, alpha, display=None):
    '''Average a list of frames with a weight of alpha,
    optionally display the process in an OpenCV NamedWindow.
    '''
    first = frames.next()
    acc = first * alpha
    for frame in frames:
        acc += frame * alpha
        if display:
            display_acc = copy(acc)
            display_acc = video._array_to_cv(display_acc)
            cv.ShowImage(display, display_acc)
            k = cv.WaitKey(1)
            k = k & 255
            if k == ord('q'):
                break
            elif k == ord('z'):
                acc.fill(0)
    return acc


if __name__ == '__main__':
    pass
edit retag flag offensive close merge delete