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

  • RT @qikipedia: "Anyone who is capable of getting themselves made President should on no account be allowed to do the job." DOUGLAS ADAMS 2 days ago
  • RT @_psonice: @johnreppion Did they really put Paul Nuttal's orgasm face on the bus? That has to be photoshopped. 1 week ago
  • RT @_psonice: Also happened by Lacy's Caves. Good spot. Path was washed away further up, nearly lost a bollock to barb wire going round. Wo… 1 week ago
May 2017
M T W T F S S
« Aug    
1234567
891011121314
15161718192021
22232425262728
293031  

Links

Blog Stats

  • 470,063 hits