howto create a color-coded perspective image from heightmap (heightfield) BMP or PNG?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
robotreto
Posts: 1
Joined: 2020-03-25T03:40:08-07:00
Authentication code: 1152

howto create a color-coded perspective image from heightmap (heightfield) BMP or PNG?

Post by robotreto »

Sorry I am a noob using IM, but I think it is a powerfull tool and it could certainly do what I am looking for. I just found nothing yet.....

I have this 2.5D Image : (Height is coded in grayscale values from 0 to 255, image comes from a 3D-camera)
Image

And I want to convert it to a color-coded perspective view like this : (and save it again as a BMP or PNG)
Image

I probabely need to specify the camera position and viewing angles, zoom, and color-range.

How can this be done in IM ?

At first using the command line, in a later stage from your .NET wrapper.

Any detailled help (exact cli commands) would be greatly appreciated.

User avatar
fmw42
Posts: 26261
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: howto create a color-coded perspective image from heightmap (heightfield) BMP or PNG?

Post by fmw42 »

Sorry, ImageMagick does not have a 3D perspective transformation at this time. However, you can color code the grayscale image.

snibgo
Posts: 12894
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: howto create a color-coded perspective image from heightmap (heightfield) BMP or PNG?

Post by snibgo »

The two images do not seem to correspond. (1) They are different sizes. (2) Objects seem to overlap in the second image but not the first.

I suspect the first image is not a true heightmap, where lighter pixels represent closeness to the camera. For example, the middle object of the column of three objects is lighter than the others.

If the first image is a true heightmap, and the goal is to simulate a photo taken from a different position, then a 3D tool such as Blender or PovRay would seem the obvious choice.
snibgo's IM pages: im.snibgo.com

User avatar
fmw42
Posts: 26261
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: howto create a color-coded perspective image from heightmap (heightfield) BMP or PNG?

Post by fmw42 »

Snibgo, I believe the second image is the perspective transformation result he wants. The input would be the color coded height image and the height image. The two can be used to create a 3D perspective. I did that years ago, but not with ImageMagick. (See http://www.fmwconcepts.com/fmw/ipt.html)

You did something much simpler at http://im.snibgo.com/curve3d.htm

Post Reply