From Texture2d it is possible in C++:
However from material, no idea, unless you can get data out of HLSL code.
(there is with render target) and probably no way to get it directly by parameters etc.
For your idea maybe you do not need to use texture, instead use raw data, load it to some structure, and use C++ to get height values.
And add hlsl shader that renders texture from raw data.