• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Writing a custom core image filter part 2
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Writing a custom core image filter part 2


  • Subject: Writing a custom core image filter part 2
  • From: Kevin Meaney <email@hidden>
  • Date: Sun, 23 Feb 2014 22:10:03 +0000

In the CoreImage Programming guide on the discussion about writing a custom filter one of the steps described it to write a custom attributes method called "customAttributes". I used as a template of what I needed to do the customAttributes method implemented in Apple's sample code for AVGreenScreenPlayer and so I have implemented my customAttributes method as follows:

- (NSDictionary *)customAttributes
{
   NSDictionary *inputColorProps;
   inputColorProps = @{ kCIAttributeClass : [CIColor class],
                      kCIAttributeDefault : YVSChromaKeyFilterDefaultInputColor,
                         kCIAttributeType : kCIAttributeTypeOpaqueColor };

   NSDictionary *inputDistanceProps;
   inputDistanceProps = @{
                    kCIAttributeClass : [NSNumber class],
                  kCIAttributeDefault : YVSChromaKeyFilterDefaultInputDistance,
                     kCIAttributeType : kCIAttributeTypeDistance };

   NSDictionary *inputSlopeWidthProps = @{
                   kCIAttributeClass : [NSNumber class],
                 kCIAttributeDefault : YVSChromaKeyFilterDefaultInputSlopeWidth,
                    kCIAttributeType : kCIAttributeTypeDistance };

   return @{ kCIInputColorKey : inputColor,
             @"inputDistance" : inputDistanceProps,
           @"inputSlopeWidth" : inputSlopeWidthProps };
}

Nothing else is described as being needed in relation to attributes in the CoreImage Programming guide. But when I call where filter is a YVSChromaKeyFilter object:

NSDictionary *attribs = [filter attributes];

I get an exception thrown:

2014-02-23 16:19:00.623 chromakey[19946:303] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSMutableDictionary addEntriesFromDictionary:]: dictionary argument is not an NSDictionary'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff8608e41c __exceptionPreprocess + 172
	1   libobjc.A.dylib                     0x00007fff808d1e75 objc_exception_throw + 43
	2   CoreFoundation                      0x00007fff85faabfc -[NSMutableDictionary addEntriesFromDictionary:] + 492
	3   CoreImage                           0x00007fff8492d4a9 -[CIFilter attributes] + 458
	4   chromakey                           0x000000010000365d -[YVSChromaKeyImageProcessor run] + 1517
	5   chromakey                           0x0000000100004115 main + 149
	6   libdyld.dylib                       0x00007fff839af5fd start + 1
	7   ???                                 0x000000000000000f 0x0 + 15
)
libc++abi.dylib: terminating with uncaught exception of type NSException

So once again, I feel like I'm missing something. Is there something else I need to be doing?

Kevin

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Writing a custom core image filter part 2
      • From: Sandy McGuffog <email@hidden>
  • Prev by Date: Writing a core image custom filter
  • Next by Date: Custom migration on iCloud Core Data
  • Previous by thread: Writing a core image custom filter
  • Next by thread: Re: Writing a custom core image filter part 2
  • Index(es):
    • Date
    • Thread