buffer=idata, ) image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR) cv2.imshow('output', image) cv2.waitKey(1) elements = [ Element('v4l2src', [ ('device', DEVICE), ]), Element('ffmpegcolorspace'), Element('videoscale'), Element('capsfilter', [ ('caps', 'video/x-raw-rgb,width=%s,height=%s,bpp=%s' % (WIDTH, HEIGHT, DEPTH * 8)), ]), Element('fakesink'), ] pipe = Pipeline() for index in range(len(elements)): pipe.add(elements[index]) if index: elements[index - 1].link(elements[index]) elements[-1].addSinkProbe(onVideoBuffer) print(pipe) pipe.start() raw_input('Hit <enter> to stop.')
shape=(HEIGHT, WIDTH, DEPTH), dtype=np.uint8, buffer=idata, ) image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR) cv2.imshow('output', image) cv2.waitKey(1) elements = [ Element('v4l2src', [('device', DEVICE), ]), Element('ffmpegcolorspace'), Element('videoscale'), Element('capsfilter', [ ('caps', 'video/x-raw-rgb,width=%s,height=%s,bpp=%s'%( WIDTH, HEIGHT, DEPTH*8)), ]), Element('fakesink'), ] pipe = Pipeline() for index in range(len(elements)): pipe.add(elements[index]) if index: elements[index-1].link(elements[index]) elements[-1].addSinkProbe(onVideoBuffer) print(pipe) pipe.start() raw_input('Hit <enter> to stop.')
from gstwrap import Element, Pipeline e1 = Element('v4l2src') e2 = Element('xvimagesink') pipe = Pipeline() pipe.add(e1) pipe.add(e2) e1.link(e2) print(pipe) pipe.start() raw_input('Hit <enter> to stop.')