nvsample_cudaprocess Pre-/Post- processing how to get cv::Mat

Hi ,
I have a problem about nvsample_cudaprocess_src package:
I find that in the pre/post function with those parameters :

/**
  * Dummy custom post-process API implematation.
  * It just access mapped surface userspace pointer &
  * memset with specific pattern modifying pixel-data in-place.
  *
  * @param sBaseAddr  : Mapped Surfaces pointers
  * @param smemsize   : surfaces size array
  * @param swidth     : surfaces width array
  * @param sheight    : surfaces height array
  * @param spitch     : surfaces pitch array
  * @param nsurfcount : surfaces count
  */
static void
post_process (void **sBaseAddr,
                unsigned int *smemsize,
                unsigned int *swidth,
                unsigned int *sheight,
                unsigned int *spitch,
                ColorFormat  *sformat,
                unsigned int nsurfcount,
                void ** usrptr)

My question is that how can I get cv::Mat from these parameters?

http://answers.opencv.org/question/45105/use-allocated-buffer-for-mat-data-pointer/