danlozano / filtr Goto Github PK
View Code? Open in Web Editor NEWPhoto filter effects for iOS/tvOS/macOS
License: MIT License
Photo filter effects for iOS/tvOS/macOS
License: MIT License
Filter.process()
whether using a built-in type or a custom type, takes around ~3s to execute.
Given the following code:
if let lutImage = UIImage(named: "Cantina-64.png") {
if let lutData64 = LUTConverter.cubeDataForLut64(lutImage: lutImage) {
let effectFilter = EffectFilter(customFilter: lutData64, withDimension: .sixtyFour)
effectFilter.inputIntensity = 0.7
let filterStack = FilterStack()
filterStack.effectFilter = effectFilter
if let image = preview.image {
// the following line throws
let filteredImage = Filtr.process(inputImage: image, filterStack: filterStack)
// line never reached
preview.image = filteredImage
}
}
}
It throws the following stack trace:
2019-05-27 20:10:01.548795-0300 florapp[96447:18261345] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Filtr.EffectFilter 0x60000022f200> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key inputImage.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000109c3d29b __exceptionPreprocess + 331
1 libobjc.A.dylib 0x00000001086c9735 objc_exception_throw + 48
2 CoreFoundation 0x0000000109c3ce09 -[NSException raise] + 9
3 CoreImage 0x000000010a88c78c -[CIFilter setValue:forUndefinedKey:] + 136
4 Foundation 0x00000001080f60b4 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 292
5 Filtr 0x000000010806bb44 $S5FiltrAAV7process33_1FFDDA8B5D37E087EDC205781D24F5D5LL_7filtersSo7CIImageCSgAG_SaySo8CIFilterCGtFZ + 548
6 Filtr 0x000000010806b867 $S5FiltrAAV7process10inputImage11filterStackSo7UIImageCSgAG_AA06FilterF0CtFZ + 135
7 florapp 0x0000000107d5a4ff $S7florapp14ViewControllerC5applyyyypF + 1679
8 florapp 0x0000000107d5ab5c $S7florapp14ViewControllerC5applyyyypFTo + 76
9 UIKitCore 0x0000000111e6c7c3 -[UIApplication sendAction:to:from:forEvent:] + 83
10 UIKitCore 0x0000000111edbb58 __45-[_UIButtonBarTargetAction _invoke:forEvent:]_block_invoke + 154
11 UIKitCore 0x0000000111edba91 -[_UIButtonBarTargetAction _invoke:forEvent:] + 152
12 UIKitCore 0x0000000111e6c7c3 -[UIApplication sendAction:to:from:forEvent:] + 83
13 UIKitCore 0x0000000111fa4e85 -[UIControl sendAction:to:forEvent:] + 67
14 UIKitCore 0x0000000111fa51a2 -[UIControl _sendActionsForEvents:withEvent:] + 450
15 UIKitCore 0x0000000111fa40e6 -[UIControl touchesEnded:withEvent:] + 583
16 UIKitCore 0x000000011267f334 -[UIWindow _sendTouchesForEvent:] + 2729
17 UIKitCore 0x0000000112680a30 -[UIWindow sendEvent:] + 4080
18 UIKitCore 0x0000000111e86e10 -[UIApplication sendEvent:] + 352
19 UIKitCore 0x0000000111dbf0d0 __dispatchPreprocessedEventFromEventQueue + 3024
20 UIKitCore 0x0000000111dc1cf2 __handleEventQueueInternal + 5948
21 CoreFoundation 0x0000000109ba0b31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
22 CoreFoundation 0x0000000109ba03a3 __CFRunLoopDoSources0 + 243
23 CoreFoundation 0x0000000109b9aa4f __CFRunLoopRun + 1263
24 CoreFoundation 0x0000000109b9a221 CFRunLoopRunSpecific + 625
25 GraphicsServices 0x000000010f7211dd GSEventRunModal + 62
26 UIKitCore 0x0000000111e6b115 UIApplicationMain + 140
27 florapp 0x0000000107d5d057 main + 71
28 libdyld.dylib 0x000000010c1ea551 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
There's nothing in my storyboard with inputImage
(which is the common reason why this error shows up)
After doing some digging I found sometimes you need to use dynamic var
instead of let
but all my intents fixed nothing.
Any tips?
EDIT:
It even fails using let effectFilter = EffectFilter(type: .color3)
(custom filters aren't the problem)
The data inside is stored as binary
How to generate this file from a .cube / .3dl or other lut plain text format?
Can you implement a class to load .cube files?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.