Hi Kevin,
thanks for the example.
I will see if I can update my code. I'm still a bit
confused as to why I have to use a ROI in this
particular case though. The image maintains the same
dimensions right up to the final Crop step.
If I change the return line to return
Image (the original input image)
imagePixellated (the pixellated version)
or
imageStrip
and hover the mouse over the output port of the C I
Filter patch, I see what seem to be the correct
figures in the tooltip. In the case of the iSight
being the input, the output bounds are reported as
'{{0,0},{640,480}} pixels'.
However, the preview picture is not the same as the
one displayed on a Billboard connected to the patch.
Cheers,
Alex
--- Kevin Quennesson <[EMAIL PROTECTED]> wrote:
> Sure,
>
> The ROI is the rectangle in the source image that is
> needed by the
> kernel to process pixel in a given destination
> rectangle (dstRect)
>
> Here's a example of simple subsampling by 2 of an
> image:
>
> //KERNEL:
> kernel vec4 susbample(sampler image)
> {
> vec2 xy = destCoord();
> xy = (xy - vec2(0.5,0.5)) * 2. + vec2(0.5,0.5); //
> Pixels are
> sampled at half coordinates.
> return sample(image, samplerTransform(image, xy));
> }
>
> //JavaScript:
>
> function myROIFunction(samplerIndex, dstRect, info)
> {
> var roiRect = new Vec(dstRect.x*2., dstRect.y*2.,
> dstRect.width*2.,
> dstRect.height*2.); //ROI is twice bigger than
> dstRect
> return roiRect;
> }
>
> susbample.ROIHandler = myROIFunction;
>
> function __image main(__image image) {
> var dodRect = new Vec(image.extent.x/2.,
> image.extent.y/2.,
> image.extent.width/2., image.extent.height/2.);
> //DOD of resulting
> image is twice smaller that image.extent
> return susbample.apply(dodRect, null, image);
> }
>
> On Dec 11, 2007, at 12:48 AM, Alex Drinkwater wrote:
> >
> > On 11 Dec 2007, at 03:32, Kevin Quennesson wrote:
> >
> >> Hi,
> >>
> >> When your kernel reads pixel at a location
> different from the
> >> active pixel, make sure:
> >> 1) To use the destCoord() as destination
> coordinate and
> >> sample(image, samplerTransform(image, ...))
> >> 2) You define a region of interest (ROI) for your
> kernels. Check
> >> out examples in /Developer/Examples/Quartz
> Composer/Compositions/
> >> Core Image Filters and look at the Core Image
> documentation.
> >
> > I've read some of the Core Image documentation on
> ROI, but I'm still
> > a bit confused, I'm afraid.
> >
> > Could you possibly give a really simple example of
> setting up a ROI
> > for the Kernel, and using destCoord?
> >
> > Thanks again,
> >
> > alx
> >
>
>
___________________________________________________________
Support the World Aids Awareness campaign this month with Yahoo! For Good
http://uk.promotions.yahoo.com/forgood/
_______________________________________________
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]