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
_______________________________________________
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]