Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Help using CISpotlight
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help using CISpotlight



In case anybody has this issue in the future, I finally found the answer at Krugle.org. A search of CISpotlight there takes you to the Seashore project which has code using CISpotlight. The key apparently is using a CIConstantColorGenerator to generate a black image and combinig that with the spotlight output. That then gives me the effect I see in QuartzComposer. Interestingly enough, I didn't have to use either of these explicitly in either QuartzComposer or Core Image Fun House. Do these applications add these filters implicitly?

CIFilter * filter = [CIFilter filterWithName:@"CIConstantColorGenerator"];
[filter setDefaults];
CIColor* backColor = [CIColor colorWithRed:0 green:0 blue:0];
[filter setValue:backColor forKey:@"inputColor"];
CIImage* background = [filter valueForKey: @"outputImage"];
filter = [CIFilter filterWithName:@"CISourceOverCompositing"];
[filter setDefaults];
[filter setValue:background forKey:@"inputBackgroundImage"];
[filter setValue:spotlightOutput forKey:@"inputImage"];
CIImage* output = [filter valueForKey:@"outputImage"];



George On Jul 11, 2008, at 10:03 PM, Malayil Philip George wrote:

Playing around with the values I seem to get a spotlight effect by placing the light position at a y point greater than the height of the image rect and pointing it at some point in the image. However, this spotlight seems to be in reverse. While a regular spotlight would be like having a black stage with a beam of light, lighting a portion of it, this one is more like a cloud effect. The image is bathed in white and there is a portion of it visible. Maybe I'm using the color param incorrectly? But, I'm using white in Quartz Composer, Core Image Fun House and in my code (1,1,1,1). I've uploaded a screenshot of the effect as I have it at
http://img519.imageshack.us/my.php?i...icture1na4.png
if you'd like to take a look.
Taking brightness up to 3 gives the following look
http://img205.imageshack.us/my.php?i...icture2nh7.png


This is wierd as the same brightness values in Quartz Composer looks nothing like this.

Thanks
George


On Jul 11, 2008, at 7:57 PM, Malayil Philip George wrote:

After playing around with the values for a bit and reducing brightness to 0.3 I kind of get a spotlight effect. But, instead of a typical spotlight effect where I would have a bright center surrounded by dark regions, in the displayed effect the surroundings seems to be covered with white. Not sure why...any ideas? Thanks


George

On Jul 10, 2008, at 10:42 PM, Malayil Philip George wrote:

Hi,
Does anybody know if there is any sample code to using the CIFilter CISpotlight. When I use the filter in Quartz Composer, I get a nice spotlight effect. But, setting the same values in code results in a totally washed out image with some patches of bright yellow, blue etc. It's a very strange effect.


[spotlightFilter setDefaults];
CIVector* inputLightPointsAt = [CIVector vectorWithX:200. Y:200. Z:0.];
NSNumber* inputBrightness = [NSNumber numberWithFloat:1.893];
NSNumber* inputConcentration = [NSNumber numberWithFloat:0.6694];
CIColor* inputColor = [CIColor colorWithRed:1. green:1. blue:1.];

[spotlightFilter setValue: ciImage forKey:@"inputImage"];
[spotlightFilter setValue: lightPosition forKey:@"inputLightPosition"];
[spotlightFilter setValue: inputLightPointsAt forKey:@"inputLightPointsAt"];
[spotlightFilter setValue: inputBrightness forKey:@"inputBrightness"];
[spotlightFilter setValue: inputConcentration forKey:@"inputConcentration"];
[spotlightFilter setValue: inputColor forKey:@"inputColor"];

CIImage *spotlightOutput = [spotlightFilter valueForKey:@"outputImage"];

I guess I am not passing the parameters correctly, but, I'm not sure what's wrong. In CIFilter documentation for CISpotlight I see
inputBrightness
An NSNumber class whose attribute type is CIAttributeTypeDistance and whose display name is Brightness.


Default value: 3.00 Minimum: 0.00 Maximum: 0.00 Slider minimum: 0.00 Slider maximum: 10.00 Identity: 1.00

Why is minimum and maximum both 0.0? Does slider values refer to the slider in QuartzComposer? And what does identity mean? Do I multiply/divide slider value I set in Quartz Composer with the Identity to arrive at the value I should set in code. It probably doesn't matter for inputBrightness but inputConcentration has identity 20 and others null. I have tried various combinations of number, multiplying and dividing values in QuartzComposer, to no avail.

I'm a little confused with how to use these params and would appreciate any help/pointers. Thanks



Regards

George M.P.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Quartz-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Quartz-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Quartz-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Help using CISpotlight (From: Malayil Philip George <email@hidden>)
 >Re: Help using CISpotlight (From: Malayil Philip George <email@hidden>)
 >Re: Help using CISpotlight (From: Malayil Philip George <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.