How to perform conditional operations based on prediction?

Is it possible to overlay additional information on the stream? If so where in the pipeline do I make this change?

I’m using a CSI camera and want to detect gestures in real time, essentially I would want to use a syntax like

if prediction=“person” and gesture time>3 seconds
do this
else
do this

Additional information-
Deepstream 4.0 running on Jetpack 4.2.3 on Jetson Nano
e-con CUNANO30 CSI camera
Running the source1_csi_primary_nano example on the deepstream app using
$ deepstream-app -c <path_to_config_file>

Hi,
Please check existing implementation in nvdsosd:
https://docs.nvidia.com/metropolis/deepstream/dev-guide/index.html#page/DeepStream_Development_Guide%2Fdeepstream_app_config.3.2.html%23wwpID0EQHA

If these properties do not fit your requirement, you may need to implement it. There are NvBufSurface APIs that can be leveraged to access buffers.