GPUImage2 | GPUImage 2 is a BSD-licensed Swift framework for GPU-accelerated video and image processing | iOS library
kandi X-RAY | GPUImage2 Summary
kandi X-RAY | GPUImage2 Summary
GPUImage 2 is the second generation of the GPUImage framework, an open source project for performing GPU-accelerated image and video processing on Mac, iOS, and now Linux. The original GPUImage framework was written in Objective-C and targeted Mac and iOS, but this latest version is written entirely in Swift and can also target Linux and future platforms that support Swift code. The objective of the framework is to make it as easy as possible to set up and perform realtime video processing or machine vision against image or video sources. By relying on the GPU to run these operations, performance improvements of 100X or more over CPU-bound code can be realized. This is particularly noticeable in mobile or embedded devices. On an iPhone 4S, this framework can easily process 1080p video at over 60 FPS. On a Raspberry Pi 3, it can perform Sobel edge detection on live 720p video at over 20 FPS.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of GPUImage2
GPUImage2 Key Features
GPUImage2 Examples and Code Snippets
Community Discussions
Trending Discussions on GPUImage2
QUESTION
I have a photo/gif app I made previously using AVFoundation as a base for the camera and taking photos, but I wanted to upgrade it to add some live filtering and post capture filtering too.
After some digging I found gpuimage/gpuimage2 and since my project is in swift 3 I started replacing my previous camera module with gpuimage.
I got the camera to work again but I have issues capturing a photo from the camera to store it as a uiimage until it is uploaded to a server.
...ANSWER
Answered 2017-Dec-08 at 14:41I found where my problem was by looking at similar issues and the comments (found one where Brad Larson commented here
Basically it has to do with the lifespan of my pictureOutput variable, since it was enclosed inside a method is didn't last long enough for the callback to be made and to save the image, by making my pictureOutput variable a class variable I solved my issues
QUESTION
This may be a more complicated issue than I am portraying, but after building an iOS app and occasionally using GIT, I am not in a challenging position; I have additional developers I am working with, and there is a need to properly use a repository (BitBucket) for further work.
My project is "complicated" for two reasons;
- I am using CocoaPods for third-party dependencies.
- I use using GPUImage2, which is a separate .xcproject embedded in my project.
Somehow, everything was working fine (I had a master branch and several branches that various developers have been working on). Things have been complicated whenever I find the need to switch branches or merge branches. Issues related to CocoaPods constantly come up, though endless efforts at the command line typically get us through our challenges.
At this point, we are now trying to merge master into a new feature branch, and have hit the end of the line.
My question: Only one actual project file has a merge conflict. Every other file is related to the .xcworkspace or something with CocoaPods. I would think it would be ideal to remove CocoaPods from GIT control altogether, leaving just the Podfile, which developers can install locally.
Does anyone have suggestions on dealing with CocoaPods and GIT with Xcode projects?
...ANSWER
Answered 2019-Apr-11 at 04:47I strongly recommend that you do not add your Pods folder to git, only commit the Podfile and Podfile.lock.
You can do the following to remove the folder:
QUESTION
I have these errors:
Cocoa.h File Not Found (in GPUImageView.h)
Unknown Type Name: **NSOpenGLContext, CVOpenGLESTextureCacheRef (GPUImageContext)
Now, I tried to fix all these errors, but ended up making things worse.
I know OpenGL ES is deprecated in iOS 12, but as I understand deprecation, it should still be working for the moment, right?
For error #1, I don't understand what's a MAC OS framework (cocoa.h) doing in here (some of the references are not surrounded with #IFDEF MAC_OS statements).
As for error #2, these types are defined within the AppKit framework (also a MAC_OS framework, not an iOS framework).
I have considered switching to GPUImage2, but it's a ton of work as it's not as easy as swapping the frameworks, I'll have a lot of code to rewrite. I also see Brad Larson (the semi-God behind this framework) has already started working on GPUImage3 which will use Metal instead of OpenGL ES but it's still work-in-progress but it won't be a simple swap from GPUImage v1 to GPUImage v3.
...ANSWER
Answered 2018-Sep-18 at 15:40I found a way to fix it. Maybe it will help someone with the same problem. The GPUImage main folder contains the iOS and the MAC projects.
Go to the framework folder, and delete the GPUImageMac.xcodeproj file.
Then go to the Source folder located within the framework folder, and delete the whole folder named Mac.
Clean your project and rebuild. Voilà!
Good luck!
QUESTION
How to rotate or switch between front and back camera in GPUImage2(Switch version) using swift (toggle with a button). Any help would be highly appreciated.Thank you in advance.
...ANSWER
Answered 2017-May-13 at 15:02I found the answer to it.
I reloaded my view controller again and later checking it by a bool value and accordingly initialised the camera i.e the render view again.
QUESTION
In cocos2d-x I need to implement fast gaussian blur and here is how it should looks like( I just found some game on the App Store with already done such blur, in unity):
So, it's nice fadeIn-fadeOut blur when user pauses the game.
GPUImage already has a fast blur I need, but I can't find solution for cocos2d-x.
v1 code when it was (GPUImage v1) Objective C
- GPUImage-x C++ version
Here is result of live camera view using GPUImage2 - tested on iPod Touch 5G, and it works fast on this slow and old device.
Blur in GPUImage works very fast even on very slow devices like iPod Touch 5G.
Looking for solution with super fast Gaussian blur for cocos2d-x.
ANSWER
Answered 2017-Oct-30 at 19:08After studying "Post-Processing Effects in Cocos2d-X" and "RENDERTEXTURE + BLUR", I came along to the following solution.
The common way to achieve post processing effects in Cocos2s-X is to implement layers. The scene is one layer, and a post process is another layer, which uses the scene layer as an input. With this technique, the post process can manipulate the rendered scene.
The blur algorithm is implemented in a shader. A common way to apply a blur effect on a scene is to blur first along he X-axis of the viewport and in an second pass along the Y-axis of the viewport (see ShaderLesson5). This is an acceptable approximations, which gives a massive gain of performance.
This means, that we need 2 post process layers in Cocos2s-X. So wee need 3 layers, one for the scene and 2 for the post processes:
QUESTION
I look at the source code of GPUImage2
...ANSWER
Answered 2018-Mar-29 at 22:44This is an operator declared to add a destination target to the source.
QUESTION
I wrote a code using GPUImage2(https://github.com/BradLarson/GPUImage2).
I confirmed that my code successfully save an image before touching a set button (Rendering a filtered image).
However, my code save a red image (same size, only red filled) after touching a set button.
My App. includes a RenderView IBOutlet and two IBActions (Set Button & Save Button).
Here is my full source code.
How can I successfully save an image after touching a set button?
...ANSWER
Answered 2018-Jan-06 at 05:35I solved this problem! I added an optional UIImage (tempImage) that is used to save temporarily on the memory. When "saveButtonDown()" is called, I check whether tempImage is nil. If it is nil, I just print an error message (No Image). If it is not nil, it must had been initialized at "setButtonDown()". Here is my full source code. Thank you.
QUESTION
UPDATE: i update my code last.
Seems like I have same issue with this site but in different case. So I tried to use shiTomasiFeatureDetector filter from GPUImage2 framework in viewController.swift and i got EXC_BAD_ACCESS with code=1/code=2 in line camera --> blendFilter --> renderView
. Here's my code:
ANSWER
Answered 2017-Oct-24 at 09:12I got the answers! All you have to do is check your identity inspector on your left (utilities bar), check whether class and module use 'RenderView' class and GPUImage modules or not.
QUESTION
I want to use only a few filters within GPUImage2 in my swift project, how can I tailor GPUImage2 to only a few filters that I need?
I am not familiar with the code base, and I don't see any documentation on this.
P.S. My concern is mostly about app size, if including everything doesn't bloat the app size, I am OK with importing GPUImage as a whole.
...ANSWER
Answered 2017-Aug-09 at 16:11This is a common question for people who want to shrink their binary size by only bringing over the operations they need, so I'll see if I can provide a canonical reference.
The easiest way to do this is to remove the dependency on GPUImage from your project and instead manually copy into your project just the files necessary to build the core components of the framework. The platform-independent core files are these:
- CameraConversion.swift
- SerialDispatch.swift
- BasicOperation.swift
- Color.swift
- FillMode.swift
- Matrix.swift
- OpenGLContext_Shared.swift
- Timestamp.swift
- OpenGLRendering.swift
- ShaderProgram.swift
- ShaderUniformSettings.swift
- Framebuffer.swift
- FramebufferCache.swift
- Position.swift
- Size.swift
- Pipeline.swift
- ImageOrientation.swift
The following files also need to come over, but they have platform-specific (Mac, iOS, or Linux) variants, so you'll either need to choose the ones for your specific platform target or selectively include them to each of your various targets:
- PictureInput.swift
- PictureOutput.swift
- MovieInput.swift
- MovieOutput.swift
- Camera.swift
- OpenGLContext.swift
- RenderView.swift
With those files, you should be able to build a project that can perform image processing in the same manner as GPUImage, but without the long list of operations. If you have one or two operations you want to bring over, you can selectively copy those files into your project. You might need to copy over one or two dependencies if they are subclassed from another operation.
QUESTION
This probably is a dumb question, but I am stuck with this for a while so going to ask it anyway.
I'm trying to implement a Hudson/Nashville
filter on a pet project. I googled a little and checkout out a few open-source projects and found some Objective-C
(which I don't understand) based projects. They do have the filters implemented using GPUImage2
, but I wasn't sure about their approach.
I have the overlay and other images that they have used and the GLSL
files.
So my question is how do I go about using this images and shader files to implement a custom filter?
Note: I tried using the LookupFilter
approach as suggested, but the result wasn't so good. It would be super helpful if you can show me some code. Thanks
Update:
What I am trying to understand this. Given a custom shader like the one below, how am I supposed to pass the input images for uniform inputImageTexture2
, inputImageTexture3
& inputImageTexture4
. Do I pass it as a PictureInput
to BasicOperation
by subclassing it? If so, how? What am I missing? I haven't been able to walk through the code much because of the lack of a proper documentation. I have read up on shaders and its different components now, but still not able to figure out a way to work with custom filters on GPUImage2
. Please help.
ANSWER
Answered 2017-Jul-06 at 02:26The GPUImage convention is that the first input texture to a shader is called inputTextureCoordinate
, the second inputTextureCoordinate2
, and so on. In the original Objective-C version of GPUImage, you can to manually subclass a filter type that matched the number of input textures in your shader.
In the Swift GPUImage 2, I've made it so that you just need to use a BasicOperation class or subclass, and it automatically attaches textures to the number of inputs needed for your shader. You do this by initializing a BasicOperation and setting the number of inputs:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install GPUImage2
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page