Are you asking how to compute the "center" or how to get the points with which to do so? I'll assume -- and answer for -- the latter:
Once you have the buffer pointer itself, and information about the format of the vertices within and the number of vertices (it appears from your code snippet that you have all of this already), you use the format information to determine where the positional data is for each vertex.
In general this involves iterating the elements of the vertex declaration, updating a byte offset until you reach the element representing the position. However in practice, the position is almost always at offset 0 from the start of a vertex so you may not need to be so pedantic.
Once you have that offset, initialize a cursor pointer to (start of buffer + that offset) and read the next few bytes of data, which will be either XYZ or XYZW floating point values, depending on the format of your buffer. Then increment the cursor pointer by the number of bytes in each vertex (including stride, if it exists) to get to the positional data for the next vertex. Repeat until you've read all the positional data.
You can save off all this positional data into a container (like a
std::vector) and process it after the fact, or you can run your algorithm as you do the extraction, if appropriate.