enthought / enthought/mayavi

Wrapped Image Over DEM Appears Blank

Open
#852 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
316
Avg merge
7h 44m
Merged PRs (30d)
5

Description

I am trying to wrap an image (already read as an array and then converted with the code below) over a digital elevation model with the texture generated from the following piece of code,

def texture_from_np(image):
"""
Creates a tvtk.Texture object from a numpy image array
"""
scalars = tvtk.UnsignedCharArray(name='RGB',
number_of_components=3)
# vtk uses column-major order (Fortan order), whereas
# numpy array is in row-major order (C order) by default
scalars.from_array(image.reshape(-1, 3, order='F'))
tvtk_img = tvtk.ImageData()
tvtk_img.dimensions = [image.shape[0], image.shape[1], 1]
tvtk_img.point_data.scalars = scalars
texture = tvtk.Texture()
texture.set_input_data(tvtk_img)
return texture

However, the DEM appears to be blank. I tried to see if this is a contrast stretching issue by generating a random matrix of zeros and ones and wrap it over the DEM but it appears to be not as the scene is still blank.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.