Sending frame from PYNQ z2 PS to FPGA

I want to send video camera frame from Pynq-z2 Jupiter notebook to the FPGA PL side and vice-versa. So how do I create video IP in PL and process that in PS? Any kind of suggestion is welcomed.

1 Like

Hi @dpk1,

Did you check the composable overlay?


Here is some code I put together using some references (noted in the code) that sends 800x600 frames from my USB webcam to the PL. On the PL side, it makes video frames from them and sends it out the HDMI output. This runs on my ZCU104.


from pynq.overlays.base import BaseOverlay
from import *
import time
import cv2

base = BaseOverlay("base.bit")

#camera (input) configuration

frame_in_w = 800
frame_in_h = 600

# configure video output
Mode = VideoMode(frame_in_w,frame_in_h,24)
hdmi_out =

# configure monitor (output) frame buffer size
frame_out_w = 1920
frame_out_h = 1080

# used to record the time when we processed last frame
prev_frame_time = 0
# used to record the time at which we processed current frame
new_frame_time = 0

# initialize camera from OpenCV

cap = cv2.VideoCapture(0)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, frame_in_w);
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, frame_in_h);
print("Capture device is open: " + str(cap.isOpened()))

#Capture webcam video

while (True):
  ret, frame =
  if ret:
     outframe = hdmi_out.newframe()
     outframe[:] = frame
     new_frame_time = time.time()
     fps = int(1/(new_frame_time-prev_frame_time))
     prev_frame_time = new_frame_time
     print("Frames per second : {0}". format(fps))

# print the camera fps settings 

Good luck,

Is this only for HDMI_in camera? This is a way to call the video IP which is build on PL into the PS? I want to send frame of any type of camera to the PL.

That code is using the OpenCV capture device (i.e. a USB webcam), not HDMI-IN.

This code would copy HDMI-IN to HDMI-OUT (without using the PS)


from pynq.overlays.base import BaseOverlay
from import *
import time

base = BaseOverlay("base.bit")

hdmi_in =
hdmi_out =

while True:
        frame = hdmi_in.readframe()
    except KeyboardInterrupt:


1 Like

Thank you for your response. Just to confirm,
This "from import * " library is used to transfer frames between PS and PL?
Also Video Pipeline IP is built in PL side. By using pynq.lib, we are accessing that IP using PS jupiter notebook. Is it so?
Is this method work for all types of cameras like USB monocular, pyrealsense etc.?

Any support on how to create IP for Video camera in VIVADO and use of that IP in PS using jupiter notebook?

Hii, I am having issue while installing composible overlay package. When I am doing
“pip install PYNQ_Composable_Pipeline/” , pynq-2.7.0.tar.gz is installing and it is giving me error “ERROR: Package ‘pynq-composable’ requires a different Python: 3.6.5 not in ‘>=3.8.0’”. I am using pynq-z2 and image pynq_z2_v2.6.0. Any solution how can I install it in my board?

Hi @dpk1,

The latest version of the composable overlay depends on PYNQ 2.7. You will need to burn an SD card with PYNQ 2.7.


Thanks, pynq 2.7 worked.
I want to confirm one thing, Is this composable overlay using OpenCV for accessing video frames or video IP is built on PL and we are accessing that IP in PS?


OpenCV is only used to capture frames from a webcam or file in the PS. Then quickly moved to PynqBuffer.
All of the vision function implemented on hardware are accelerated hardware version of their corresponding OpenCV counterpart.


1 Like


Where can I find hardware-accelerated IP so that I can modify or take references for my work?
Also, I want to send a video frame from a USB camera. Will this composable pipeline would work for USB type camera?

Between the documentation page an the repo your question should be answer.
The vision IP come from the Vitis accelerated libraries.


1 Like