Optical flow overlay on video

Halo, I follow the optical flow sample app link which I can run sucessfully. If I want to overlay the optical flow result back to the video, do I need to add a converter to RGBA and use pyds.get_nvds_buf_surface for screen capture before nvof.

Or, is there any parallel pipeline for screen capture?

I know I have to resize the frame so that the dimension is match to the optical flow output.

Thanks.