Comments (8)
@0x6368
Hi, your question is same as #85.
Somewhere in your getCurrentFilter()
method, you should have smth like: previousFilter.removeAllTargets()
.
Cheers 😄
from gpuimage2.
@0x6368 - Before attaching a new filter to previewView
, you have to make sure the old one has been removed from it. Otherwise, it will remain the only input to that view, and trying to add any additional inputs will be rejected. A view can only have one input at a time.
from gpuimage2.
func removeAllTargets(rootTarget: ImageSource) {
//Only this type of iterator is supported for TargetContainer
for (target, _) in rootTarget.targets {
//Can this target also have targets of its own?
if let target = target as? ImageSource {
self.removeAllTargets(rootTarget: target)
}
}
rootTarget.removeAllTargets()
}
Thanks @0x6368. Here is the recursive solution if you have more than one item in your pipeline. Pass in your camera as the rootTarget.
from gpuimage2.
Yes, that should be the same between the two.
from gpuimage2.
Once I perform .removeAllTargets the camera completely freezes. What am I missing?
This is what I have:
let sat1 = ToonFilter()
camera?.removeAllTargets()
camera! --> sat1 --> renderView
Thank you!
from gpuimage2.
Is your camera going directly to the renderView, or is there another operation between there and the view? If so, you'll need to remove the targets of the thing that is currently targeted at the view. The view can only take one input at a time.
The old framework let you do this, which lead to bizarre image corruption and flickering if you weren't careful. You should be seeing warnings on the console about trying to add too many inputs to the view, if that's the case.
from gpuimage2.
Hi Brad,
I have the same problem. I initialize the view with
camera = try Camera(sessionPreset:AVCaptureSessionPreset1280x720)
camera --> getCurrentFilter() --> previewView
camera.logFPS = true
camera.startCapture()
Once I call the function to get a new filter, the previewView freezes.
camera.removeAllTargets()
camera --> getCurrentFilter() --> previewView
As you noted in the previous comment, I have to
remove the targets of the thing that is currently targeted at the view
which is in my case the targets of camera, right? But I removed them by calling camera.removeAllTargets()
. I don't get any warnings in the console either.
Any idea on what the problem could be?
from gpuimage2.
@zubco @BradLarson Thank you guys, fixed it by adding this in front of the removal of the targets from the camera:
for (target, _) in camera.targets {
if (target is BasicOperation) {
(target as! BasicOperation).removeAllTargets()
}
}
I think this issue can be closed.
from gpuimage2.
Related Issues (20)
- photography in white LED container
- Crack when build on real iphone (Xs Max ios 13.3.1) from xcode 11.3.1
- Posterize with user defined color palette
- exc_bad_access occurs when build with xcode11.4 in release mode HOT 5
- "Problem appending pixel buffer at time" with the SimpleVideoRecorder example
- Framebuffer method cannot render the texture image. HOT 1
- pointer being freed was not allocated
- SimpleMovieFilter when run demo crash how to do HOT 3
- Value of type 'AVCaptureVideoDataOutput' has no member 'availableVideoPixelFormatTypes' after update Xcode12 HOT 5
- Value of type 'AVCaptureVideoDataOutput' has no member 'availableVideoPixelFormatTypes' HOT 1
- Crashing when PictureInput(imageName: "lookup2") is called . HOT 2
- Video Brightness issue on iPhone 12 pro max HOT 1
- Crash while compile shaders for GaussianBlur
- Improving mask edges
- Memory Leak
- Normal Blend black outs base image
- Focus Stacking
- GPUImage framework always crashes on release iOS app
- Thread Performance Checker: -[AVCaptureSession startRunning] should be called from background thread. Calling it on the main thread can lead to UI unresponsiveness PID: 26281, TID: 578576
- Running on Simulator
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gpuimage2.