I am setting up a special table to simulate the scenario in this problem in this problem, but instead of finding the geodesics, I want to create a topographical map using the contours.

Here is a picture of a sheet with steel ball bearings on it:

This is an non-ironed sheet with 3 steel ball bearings on it that are separate.

I am using a gray sheet so that way contrast shows up the most (ideally it would be RGBColor[.5,.5,.5]).

I am not sure how to do this using Mathematica.

In essence, this is to create a 'hybrid' computer where the square trampoline, camera, and Mathematica program will be the parts of the digital-analog computer.

UPDATE: I tried it in a darker room, painted balls, ironed the sheet (impossible to do perfectly because of material), and used heavier balls. This allows us to see closed loops.

I took Vitaliy Kaurov's answer below and made it a simple function:

topographicalMap[url_, colorMode_] :=
Module[{image, resizedImage},
    (* Import and convert the image to grayscale *)
    image = ColorConvert[CloudImport[url], "Grayscale"];
    (* Resize image for speed *)
    resizedImage = ImageData[ImageResize[image, 50]];
    (* Generate the topographical map based on colorMode *)
        (* If colorMode is True, use a colored contour plot *)
       Rasterize[ ListContourPlot[resizedImage, Contours -> 7, ColorFunction -> "Rainbow", Frame->False]],
        (* Else, use a black and white contour plot *)
       Rasterize[ ListContourPlot[resizedImage, Contours -> 7, ContourShading -> None,Frame->False]]

Original photo with better conditions.

Analyzed photo with rainbow filler, has closed loops.

Analyzed photo with just black and white contours.

The whole purpose of this is to just demonstrate a concept for a hobby research project. It did not have to be perfect. I just wanted to share this better photo.

  • $\begingroup$ Begin here in Help: example/DetectEdgesInImages, There are EdgeDetect, MorphologicalBinarize $\endgroup$
    – Roland F
    Commented Nov 14, 2023 at 21:39
  • $\begingroup$ @RolandF I have used those two. But they find objects in images. I am not sure how to generalize that to make a topographical map. $\endgroup$
    – Teg Louis
    Commented Nov 14, 2023 at 22:02
  • 2
    $\begingroup$ Do you think it is even possible? I mean from one image of a surface you can not determine elevation of any point. Topographical map of moon is not calculated from one image. The elevation is calculated by the time it takes for a signal to return to a satellite. Images serve only to pair points with their elevation to make a topographical map. $\endgroup$ Commented Nov 14, 2023 at 22:36
  • 2
    $\begingroup$ How do you use the color of the moon or the color of the green meadow to determine the elevation? You have to make the job for you simple as possible. I would take an elastic sheet of one color and draw orthogonal grid on it in different color. Say, white sheet and black grid. Then make a photo with balls on it from predefined distance with lightings from many different points so that there is no shadow and then by deformation of the lines of grid you could compute the elevation. $\endgroup$ Commented Nov 14, 2023 at 22:49
  • 1
    $\begingroup$ If you light the subject from many different angles, you can estimate the normal map, though the depth is another matter. $\endgroup$
    – flinty
    Commented Nov 15, 2023 at 12:38

1 Answer 1


For this you got only the data that image gives you. That's why you must have a good no-shadow no-tint defect-free lightning and surfaces. Then potentially you can do something like this. I will Import your image:


Resize it for faster tests:


Then try getting contours from the ImageData (you can see damaging effects of shadows and other defects - they do not allow closed loops arround the balls):


enter image description here

You can also try going contour-only:

ListContourPlot[iR, Contours -> 7, ContourShading -> None]

enter image description here


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.