-1

I would like to train 2 D images with the corresponding pixel heigh topography information. I have a bunch of 2 D images taken from a topography where the height of each pixel is also known. Is there any way that I can use deep learning to train the images with height pixel information?

I have already tried to infer some features from the images and pixel heights and relate them by regression method such as SVM, but I did not get satisfactory results yet for predicting new image pixel height features.

  • Can you show at least one pair of height array and image? I assume the 2D images are colour images? Are the elevation arrays always mapped to images with the same colourmap? If you know the colourmap, then you already have the 'weights' that map the elevations to the colours. If you can share an example, it will be clearer how to help you. – Matt Hall Mar 26 '19 at 22:56
  • Is the intent to improve on Digital Elevation Models? If so, please [edit] the question to explain what you are seeking that DEM doesn't provide; accuracy, region, etc. – Jason Aller Mar 27 '19 at 14:53

1 Answers1

0

How about using the pixel height values as labels, and the images (RGB I assume, so 3 channels) as training set. Then you can just run supervised learning. Although I am not sure how you could recover height by just looking at an image, even humans would have trouble doing that even after seeing many images. I think you would need some kind of reference point.

To convert an image into a 3D array of values (3rd dimension are the color channels):

from keras.preprocessing import image

# loads RGB image as PIL.Image.Image type
img = image.load_img(img_file_path, target_size=(120, 120))
# convert PIL.Image.Image type to 3D tensor with shape (120, 120, 3)
x = image.img_to_array(img)

There are a number of other ways too: Convert an image to 2D array in python

In terms of assigning labels to images (here labels are the pixel heights), it would be as simple as creating your training set x_train (nb_images, 120, 120, 3) and labels y_train (nb_images, 120, 120, 1) and running supervised learning on these until for each image in x_train the model can predict each corresponding value in the height set y_train within a certain error.

Kai Aeberli
  • 1,189
  • 8
  • 21
  • Thanks for your reply! Do you aware of any python or matlab code for labeling the images with values rather than types. I am new in this field and I don't know how I can label an image with a matrix of scaler values. – Anahita Imanian Mar 26 '19 at 22:58
  • not completely sure i understand what you need, but guessing you have the image file and need to convert it to a numpy array. Updated the answer. For the pixel heights, i guess they are already in an array? – Kai Aeberli Mar 26 '19 at 23:27