How to add extra function in the deepstream like edge detection?

NO. Please refer to the 142683 to learn how to get the raw data from the NvbufSurface.