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?

enter image description here

img =(Image);

ListPlot3D[ImageData[GradientFilter[img, 2]], PlotRange -> All, 
 ImageSize -> 600]

enter image description here

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

segmentation = 
  Image[WatershedComponents[GradientFilter[img, 2], Image[markers]]]]
components = 
   segmentation, {"Area", "Centroid", "Orientation"}];

enter image description here

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

   Line[{centroid + w*direction, centroid - w*direction}]}]]

enter image description here

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

  • 1
    $\begingroup$ Clarifying question: how are you getting depth for calculating the volume of the lake? $\endgroup$
    – ydd
    Commented Sep 21, 2023 at 23:09
  • $\begingroup$ Calculated from the solid volume of rotation of each pixel And we merge this for the split pixels. $\endgroup$
    – Erfan
    Commented Sep 22, 2023 at 5:50
  • $\begingroup$ 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. $\endgroup$
    – ydd
    Commented Sep 23, 2023 at 13:45
  • 1
    $\begingroup$ 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 $\endgroup$
    – ydd
    Commented Sep 24, 2023 at 14:47
  • 1
    $\begingroup$ 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. $\endgroup$
    – ydd
    Commented Sep 24, 2023 at 21:39


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.