# How to estimate Lake area and volume in Mathematica?

I have a satellite image of the lake and I want to estimate its area and volume.

Actual volume:1.49*10e8 m^3

Actual Area:36.9 km^2

I did the following command to find the volume, but it is not very accurate. Can someone help me make the volume more accurate and find the area?

img =(Image);

ImageSize -> 600]


{h, w} = Dimensions[ImageData[img]][[;; 2]];
markers =
SparseArray[{Round[{h, w}/2] -> 1, {1, _} -> 1, {-1, _} ->
1, {_, 1} -> 1, {_, -1} -> 1}, {h, w}];

segmentation =
DeleteBorderComponents[
components =
ComponentMeasurements[
segmentation, {"Area", "Centroid", "Orientation"}];


{area, centroid, orientation} =
SortBy[components[[All, 2]], First][[-1]]
direction = {Cos[orientation], Sin[orientation]};

Show[segmentation,
Graphics[{Red,
Line[{centroid + w*direction, centroid - w*direction}]}]]


xs = Array[#2 - 1. &, {h, w}];
ys = Array[N[h - #1] &, {h, w}];

distCenterAxis =
Abs[direction . {{0, 1}, {-1, 0}} . ({xs, ys} - centroid)];

volume = distCenterAxis*\[Pi];

Total[volume*ImageData[Binarize[segmentation]], 2]


out put is 2.38782*10^7

• Clarifying question: how are you getting depth for calculating the volume of the lake?
– ydd
Commented Sep 21, 2023 at 23:09
• Calculated from the solid volume of rotation of each pixel And we merge this for the split pixels. Commented Sep 22, 2023 at 5:50
• I guess I don't understand how this is a valid way to estimate the depth of the lake at each position. If I am understanding correctly, you are rotating the pixels around the longest axis of the lake? So the "depth" at each position is dependent on how far the pixel is from the longest axis, but I don't actually understand how this would correlate at all with the actual depth of the lake at each position. I would think the only way to estimate lake volume would be to have bathymetry data on it.
– ydd
Commented Sep 23, 2023 at 13:45
• Do you have the depth data at each pixel point in the image? It kind of looks like depth is encoded by color in this image but I could be wrong about that, and I don't know what the color-depth function looks like if this is the case. But If you do have depth data at each pixel, just first calculate the area of each pixel by calculating the pixel length of the 3 km bar in the image, sum all the depths, and multiply them by the pixel area Here's an example nb
– ydd
Commented Sep 24, 2023 at 14:47
• You would have to know the function and depth. If this is not known, then I can't see a way to get depth from the information in this image.
– ydd
Commented Sep 24, 2023 at 21:39