I think ImageMagick convert command has the capability of doing what I would like to do in batch, on many files, but I am apparently not up to the task of figuring it out.
Here is the story.
I have software that can create an image that not only has RGB values for each pixel, but a 3D coordinate for each pixel. I can visualize the 3D model in several ways, and that is wonderful. However, getting the 3D model projected back into a 2D image is also very useful.
What I am currently doing is using convert to read a tif file and create a text file with the RGB values - yes 16 bit values
# ImageMagick pixel enumeration: 307,145,65535,rgb
0,0: (40349,36237,32896) #9D9D8D8D8080 rgb(157,141,128)
1,0: (41634,37008,33667) #A2A290908383 rgb(162,144,131)
2,0: (39321,33410,30840) #999982827878 rgb(153,130,120)
3,0: (37522,32639,30069) #92927F7F7575 rgb(146,127,117)
4,0: (34438,30069,27499) #868675756B6B rgb(134,117,107)
5,0: (43433,39064,36494) #A9A998988E8E rgb(169,152,142)
6,0: (39321,34952,32382) #999988887E7E rgb(153,136,126)
7,0: (40349,35980,33410) #9D9D8C8C8282 rgb(157,140,130)
8,0: (41120,37008,33667) #A0A090908383 rgb(160,144,131)
9,0: (33153,28527,25443) #81816F6F6363 rgb(129,111,99)
...
I then extract just the 16 bit RGB values and paste them into a file so the xyz coordinate has a rgb value
4589.918 2602.008 -620.766 40349 36237 32896
4587.991 2601.901 -619.187 41634 37008 33667
4585.957 2601.825 -617.705 39321 33410 30840
4584.189 2601.673 -615.987 37522 32639 30069
4582.551 2601.486 -614.154 34438 30069 27499
4580.698 2601.359 -612.516 43433 39064 36494
4578.678 2601.280 -611.028 39321 34952 32382
4576.746 2601.176 -609.464 40349 35980 33410
4574.785 2601.081 -607.927 41120 37008 33667
4572.937 2600.955 -606.292 33153 28527 25443
Now the hard part.
I want to convert the text file with xyzrgb values into an image by interpolating the x and y columns as if they are pixels - get rid of the z since the result is 2D in nature - to the nearest unit or fraction of a unit, in this case say 1/10 of a unit - 0.1
I think I have to sort the file second column (y) then first column (x) and try to make an even row and column file based on the original rows and columns - somehow - but there is not a one to one match - evenly that is
I have tried a couple of things with convert and interpolate NearestNeighbor since the xy coords are not evenly space and looking at virtual-pixel to fill in the areas where there is no image but I just can't seem to get anything to work.
Sigh
Looking for ImageMagick convert experts and any ideas.
Hope this makes sense and Thanks in advance.
