Posts Tagged ‘Core Image Kernel

09
Mar
10

Apply Core Image Kernel To Area Of Image

I always knew this was possible. Never got an answer from anyone ‘in the know’ on how to do it though, so eventually worked it out on my own.

/*
	Apply effect to area of image.
	
	toneburst 2010
*/

function __image main(__image image) {
	
	// Define rect (x-pos, y-pos, width, height)
	var rect = new Vec(100,100,100,200);
	
	// Apply effect to area of image defined by rect
	var inverted = fx.apply(rect, null, image);
	
	// Composite processed area on top of original image and return result
	return Filter.CISourceOverCompositing(inverted, image);
}

This snipped of JavaScript in a Core Image Filter (with ‘Edit filter function’ turned on) will apply the kernel function ‘fx’ in the top panel to the area of the image defined by the variable ‘rect’. Then I return the result of compositing the processed area on top of the original image.

I have a use for this, actually. Not sure anyone else out there will, mind you…

UPDATE:
Added demo QTZ to the Box.net widget
‘tb_CIFilter_wipe_demo.qtz’




Twitter

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

February 2017
M T W T F S S
« Aug    
 12345
6789101112
13141516171819
20212223242526
2728  

Links

Blog Stats

  • 465,901 hits