Page 1 of 1

visualizing data arrays

Posted: 2012-05-28T22:22:05-07:00
by egor7
I have some 2D arrays of type integer and want to visualize it.
I dump it to file:

Code: Select all

fileHandle = fopen( "2dplot.raw", "wb" );
fwrite(myArray, WIDTH*HEIGHT, sizeof(int), fileHandle);
The next code displays black-white data only (without bw gradients):

Code: Select all

display -depth 32 -size ${WIDTH}x${HEIGHT} gray:2dplot.raw
How to visualize it properly?

Re: visualizing data arrays

Posted: 2012-05-29T09:23:32-07:00
by fmw42
convert your 2D array into a 1D array, specify the number of rows and columns and max graylevel value while putting the string of values into pgm format from NetPBM. You can display the pgm image or convert it to some other more easily viewed format.

see
http://www.imagemagick.org/Usage/formats/#pbmplus

Re: visualizing data arrays

Posted: 2012-05-30T01:08:55-07:00
by anthony
Their are many ways to visuallize a 'height field' as these images are called.

You can '-shade' the image to generate shadow effects caused by the height.
http://www.imagemagick.org/Usage/transform/#shade

You can psuedo-color the image by height, using either a gradient, or 'iso-colors' to show various levels.
See Color Lookup Tables
http://www.imagemagick.org/Usage/color_mods/#clut
Also see Ordered Dither which has a 'threshold map' that can be used to add a power of two levels
http://www.imagemagick.org/Usage/quanti ... red-dither

Also see DIY ordered dither to tile patterns based on level
http://www.imagemagick.org/Usage/quantize/#diy_symbols

Finally someone wrote a PHP script than generates a 3-D view of the heigh field in a very rough way.
I know I have that link, but can't seem to find it!

If you are serious and what to generate actual graphs of the 3-D data. Perhaps Gunplot is a better option. It has facilities to deal with raw data as well, but can also be a steep learning curve.

Re: visualizing data arrays

Posted: 2012-05-30T01:51:04-07:00
by Jessica1
normally you have the data in a two-dimensional array.

i tried it with GL_QUADS and GL_TRIANGLE_STRIPS but the outcome is a little strange as you can see in this screenshot:

http://www.embege.com/misc/bad_hf.jpg

the problem is that there is a certain orientation of the polygons which shouldnt be there.

Re: visualizing data arrays

Posted: 2012-05-30T04:20:02-07:00
by anthony
Example JPG has a "404 Not Found Error"

Also those symbols is for OpenGL 3D display library, which is unrelated to ImageMagick.

Additional, you can also look at Ray tracing the heigh field, using something like PovRay.
ImageMagick is good for preparing inputs into such programs.