Hi all,
I came across a script used to generate height-map,
this script use the fx function "v.p{0,u*v.h}".
If v.p{x,y} is the absolute position of a pixel in the second image,
I dont understand the "u*v.h" part.
I assume that u*v.h will multiply all the colors of the current pixel (taken form u) times the
"height of v", but how does that fit into the {x,y} coordinates ?
Isn't u*v.h a triplet of values RGB scaled from 0 to v.h ?
thanks for your help!
b.
Using FX, a question about u, v and pixel position
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Using FX, a question about u, v and pixel position
This type of syntax is typically used as a look-up table to modify the graylevels of an image according to the color in a 1D gradient lut image. (It can also be used to warp an image).
See http://www.imagemagick.org/Usage/color/#color_lut
It is getting the value of u at pixel i,j in the first (main) image, finding the color at coordinate 0,u*(width of second 1D lut image) in the second image and replacing the i,j pixel in the first image with the color it found in the second image at that column position.
But this use of -fx is outdated and has been superseded by -clut
Anthony can explain much better. Hopefully when his weekend is over he will reply.
See http://www.imagemagick.org/Usage/color/#color_lut
It is getting the value of u at pixel i,j in the first (main) image, finding the color at coordinate 0,u*(width of second 1D lut image) in the second image and replacing the i,j pixel in the first image with the color it found in the second image at that column position.
But this use of -fx is outdated and has been superseded by -clut
Anthony can explain much better. Hopefully when his weekend is over he will reply.
Re: Using FX, a question about u, v and pixel position
Thanks for that fmw42! I'm starting to understand. So it replaces
the color of the first image, better said ALL the channel in the first image,
with those in the second image.
I have tried the -clut operator and it works faster.
My original gray image has mainly transparent pixels, is there
any way to speed up the process considering that those
pixels don't need to be changed ?
If I should write and ad-hoc program in C, which library
should I use for it ?
thanks again,
b.
the color of the first image, better said ALL the channel in the first image,
with those in the second image.
I have tried the -clut operator and it works faster.
My original gray image has mainly transparent pixels, is there
any way to speed up the process considering that those
pixels don't need to be changed ?
If I should write and ad-hoc program in C, which library
should I use for it ?
thanks again,
b.
Re: Using FX, a question about u, v and pixel position
Well, I thought I understood, but I didnt!!:(fmw42 wrote: It is getting the value of u at pixel i,j in the first (main) image, finding the color at coordinate 0,u*(width of second 1D lut image) in the second image and replacing the i,j pixel in the first image with the color it found in the second image at that column position.
When you say u*(width of the second 1D lut image) what exactly it's multiplying the width of the LUT?
Because u has got R,G,B, and A values (all ranged in 0.0-1.0)
cheers,
b.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Using FX, a question about u, v and pixel position
each channel is processed separately with its own u (u.r, u.g., u.b), each ranging from 0 to 1. but the input image is gray, so they are all the same value. thus for each graylevel in the first image, it will find a location along the 1D second image and get its color at that location and replace the current i,j pixel in the first image.
Re: Using FX, a question about u, v and pixel position
I see. it makes sense now. Thanks a lot!
b.
b.