title: C Pointer convert to numpy array
body: <p>I am new C and Python.</p>
  <p>When I use the callback function of the Hikvision IP camera to play the video. The cached data given to me by the callback function is of C pointer type, and I need to convert it to numpy for processing. But I don't know how to do it. Below is my callback function.</p>
  <pre><code>def DecCBFun(self, nPort, pBuf, nSize, pFrameInfo, nUser, nReserved2):
      # Decode the returned video YUV data and convert it into numpy array
      if pFrameInfo.contents.nType == 3:
          nWidth = pFrameInfo.contents.nWidth
          nHeight = pFrameInfo.contents.nHeight
          
          print(type(pBuf))
          
          pData = (c_ubyte * nWidth * nHeight * 2)
          ctypes.memmove(byref(pData), pBuf,nWidth * nHeight * 2)
          data = np.frombuffer(pData, count=int(nWidth *nHeight * 2),
                                   dtype=np.uint8)
          image = data.reshape(nHeight,nWidth, 2)
          image = cv2.cvtColor(image, cv2.COLOR_YUV2RGB_YUYV)
  </code></pre>
  <p>output type of bBuf is <code>&lt;class 'ctypes.LP_c_char'&gt;</code></p>
  <p>When I use <code>ctypes.memmove</code>,it return an error</p>
  <pre><code>TypeError: byref() argument must be a ctypes instance, not '_ctypes.PyCArrayType'
  </code></pre>