In this notebook, we will demonstrate how to use the mirror filter. We utilize Pynq’s ability to buffer HDMI signals in order to perform a filter. The mirror filter is relatively simple. The image is flip horizontally, this mimics the reflection of a mirror
In order to perform this function, we need to buffer a row of RBG values. During the first row the HDMI signals are stalled. During the rest of the frame the previous row is displayed backwards while the current row is buffered. The delay cause by this buffering is very small and not noticeable to the human eye.
In [1]:
from pynq.drivers.video import HDMI
from pynq import Bitstream_Part
from pynq.board import Register
from pynq import Overlay
Overlay("demo.bit").download()
In [2]:
hdmi_in = HDMI('in')
hdmi_out = HDMI('out', frame_list=hdmi_in.frame_list)
hdmi_out.mode(3)
hdmi_out.start()
hdmi_in.start()
In [3]:
Bitstream_Part("mirror_p.bit").download()
In [4]:
import ipywidgets as widgets
from ipywidgets import Button, HBox, VBox, Label
words = ['HDMI Reset']
items = [Button(description=w) for w in words]
def on_hdmi_clicked(b):
hdmi_out.stop()
hdmi_in.stop()
hdmi_out.start()
hdmi_in.start()
items[0].on_click(on_hdmi_clicked)
widgets.VBox([items[0]])
In [4]:
hdmi_out.stop()
hdmi_in.stop()
del hdmi_out
del hdmi_in