Note that there are some explanatory texts on larger screens.

plurals
  1. POTrouble generating a mask image; CISourceOverCompositing not working as expected
    primarykey
    data
    text
    <p>I'm basically trying to get the <a href="http://developer.apple.com/library/IOs/#documentation/GraphicsImaging/Conceptual/CoreImaging/ci_filer_recipes/ci_filter_recipes.html#//apple_ref/doc/uid/TP30001185-CH4-SW22" rel="nofollow">"Anonymous Faces Filter Recipe" example</a> to work in the iOS simulator.</p> <p>There are no errors or warnings, but it appears as though "CISourceOverCompositing" filter is not working as expected. The circles are being drawn on the maskImage destructively as opposed to additively. For example, if 5 faces are found, 5 circles are drawn but only the last is shown on the maskImage.</p> <p><strong>How can I make it so that each circle is drawn to the maskImage in an additive fashion?</strong></p> <p>Here is the code I'm using to build the mask:</p> <pre><code>// Create a green circle to cover the rects that are returned. CIImage *maskImage = nil; for (CIFeature *f in faces){ CIVector *circleCenter = [CIVector vectorWithX:f.bounds.origin.x+f.bounds.size.width/2.0 Y:f.bounds.origin.y+f.bounds.size.height/2.0]; CGFloat circleRadius = MIN([f bounds].size.width, [f bounds].size.height)/1.5; CIFilter *radialGradient = [CIFilter filterWithName:@"CIRadialGradient" keysAndValues: @"inputRadius0", [NSNumber numberWithFloat:circleRadius], @"inputRadius1", [NSNumber numberWithFloat:circleRadius+1.0f], @"inputColor0", [CIColor colorWithRed:0.0 green:1.0 blue:0.0 alpha:1.0], @"inputColor1", [CIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0], @"inputCenter", circleCenter, nil]; CIImage *circleImage = [radialGradient valueForKey:@"outputImage"]; if (maskImage == nil) { maskImage = circleImage; } else { maskImage = [[CIFilter filterWithName:@"CISourceOverCompositing" keysAndValues:@"inputImage", circleImage, @"inputBackgroundImage",maskImage, nil] valueForKey:@"outputImage"]; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload