What I failed to mention of course, is that the lookup
table has to be a strip with a width of 256 pixels. It
only needs to be 1 pixel high.

alx



--- Alex Drinkwater <[EMAIL PROTECTED]> wrote:

> The code would be a little different in CIKernel
> Slang, as texture coordinates are handled
> differently.
> 
> This code does a similar thing, in CIKernel slang:
> 
> 
> kernel vec4 lut(sampler image, sampler LUT)
> {
>       // Input pixel
>       vec4 inPix = unpremultiply(sample(image,
> samplerCoord(image)));
>       // Output pixel
>       vec4 outPix;
>       outPix.r = unpremultiply(sample(LUT, vec2(inPix.r *
> 255.0,0.0))).r;
>       outPix.g = unpremultiply(sample(LUT, vec2(inPix.g *
> 255.0,0.0))).g;
>       outPix.b = unpremultiply(sample(LUT, vec2(inPix.b *
> 255.0,0.0))).b;
>       outPix.a = unpremultiply(sample(LUT, vec2(inPix.a *
> 255.0,0.0))).a;
>       
>       // Output
>       return premultiply(outPix);
> }
> 
> alx
> 
> 
> --- vade <[EMAIL PROTECTED]> wrote:
> 
> > I would suggest creating a look up table as a
> > texture, feed that in to  
> > a CIKernel, and have it map the r/g/b vales to the
> > r/g/b values of the  
> > original image, something in GLSL like:
> > 
> > // define our rectangular texture samplers
> > uniform sampler2DRect tex0;
> > uniform sampler1D tex1;
> > 
> > // define our varying texture coordinates
> > varying vec2 texcoord0;
> > varying vec2 texcoord1;
> > 
> > void main (void)
> > {
> >     vec4 inputColor = texture2DRect(tex0, texcoord0);
> >             
> >     vec4 colorout;
> >     
> >     colorout.r = texture1D(tex1, inputColor.r).r;
> >     colorout.g = texture1D(tex1, inputColor.g).g;
> >     colorout.b = texture1D(tex1, inputColor.b).b;
> >     colorout.a = inputColor.a;
> >     
> >     gl_FragColor = colorout;
> > }
> > 
> > 
> > On Jan 15, 2008, at 10:10 PM, David Giovannini
> > wrote:
> > 
> > > Hello,
> > >
> > > Let me describe what I am trying to do a little
> > better than before.  
> > > Every avenue I try comes up short.
> > >
> > > My daughter got a LEGO Mosaic set for Christmas.
> I
> > am working on a  
> > > pattern maker application using QC. I have the
> > pixellating and LEGO  
> > > impressions all working. The mosaic set comes
> with
> > 12 colors where  
> > > three are black, dark gray, and white. I need to
> > have the colors in  
> > > the resulting image limited to the 12.
> > >
> > > I keep trying to solve this problem using core
> > image kernels and not  
> > > getting the results I am looking for. I keep
> > looking for "grayish"  
> > > and attempting to find either the correct color
> or
> > the correct gray.  
> > > There is nothing linear about the LEGO colors
> and
> > "grayish" is very  
> > > subjective
> > >
> > > Given a set of 12 arbitrary colors, with fixed
> > HBS, how would I  
> > > color match an image?
> > >
> > > Any thoughts would be appreciated.
> > >
> > > Cheers,
> > > Dave
> > >
> > > On Jan 13, 2008, at 12:40 PM, Stephanie
> Giovannini
> > wrote:
> > >
> > >> Hello,
> > >>
> > >> I am nearly done with a composition but I am
> > stuck solving a color  
> > >> matching problem. I want to apply a palette of
> 12
> > fixed colors  
> > >> (intensity, luminosity, saturation, etc all
> > predetermined) to an  
> > >> image. The palette includes 3 greys. ColorMap
> > seems to  be close  
> > >> but not quite.
> > >>
> > >> What should I be using?
> > >>
> > >> Cheers,
> > >> Dave
> > >>
> > >>
> > >> _______________________________________________
> > >> Do not post admin requests to the list. They
> will
> > be ignored.
> > >> Quartzcomposer-dev mailing list     
> > ([email protected] 
> > >> )
> > >> Help/Unsubscribe/Update your Subscription:
> > >>
> >
>
http://lists.apple.com/mailman/options/quartzcomposer-dev/dsjove%40mac.com
> > >>
> > >> This email sent to [EMAIL PROTECTED]
> > >
> > > _______________________________________________
> > > Do not post admin requests to the list. They
> will
> > be ignored.
> > > Quartzcomposer-dev mailing list     
> > ([email protected] 
> > > )
> > > Help/Unsubscribe/Update your Subscription:
> > >
> >
>
http://lists.apple.com/mailman/options/quartzcomposer-dev/doktorp%40mac.com
> > >
> > > This email sent to [EMAIL PROTECTED]
> > 
> >  _______________________________________________
> > Do not post admin requests to the list. They will
> be
> > ignored.
> > Quartzcomposer-dev mailing list     
> > ([email protected])
> > Help/Unsubscribe/Update your Subscription:
> >
>
http://lists.apple.com/mailman/options/quartzcomposer-dev/the_voder%40yahoo.co.uk
> > 
> > This email sent to [EMAIL PROTECTED]
> > 
> 
> 
> 
>      
>
__________________________________________________________
> Sent from Yahoo! Mail - a smarter inbox
> http://uk.mail.yahoo.com
> 
>  _______________________________________________
> Do not post admin requests to the list. They will be
> ignored.
> Quartzcomposer-dev mailing list     
> ([email protected])
> Help/Unsubscribe/Update your Subscription:
>
http://lists.apple.com/mailman/options/quartzcomposer-dev/the_voder%40yahoo.co.uk
> 
> This email sent to [EMAIL PROTECTED]
> 



      __________________________________________________________
Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to