# GPUImage #
<div style="float: right"><img src="http://sunsetlakesoftware.com/sites/default/files/GPUImageLogo.png" /></div>
<a href="https://zenodo.org/record/10416#.U5YGaF773Md"><img src="https://zenodo.org/badge/doi/10.5281/zenodo.10416.png" /></a>
Brad Larson
http://www.sunsetlakesoftware.com
[@bradlarson](http://twitter.com/bradlarson)
contact@sunsetlakesoftware.com
## Overview ##
The GPUImage framework is a BSD-licensed iOS library that lets you apply GPU-accelerated filters and other effects to images, live camera video, and movies. In comparison to Core Image (part of iOS 5.0), GPUImage allows you to write your own custom filters, supports deployment to iOS 4.0, and has a simpler interface. However, it currently lacks some of the more advanced features of Core Image, such as facial detection.
For massively parallel operations like processing images or live video frames, GPUs have some significant performance advantages over CPUs. On an iPhone 4, a simple image filter can be over 100 times faster to perform on the GPU than an equivalent CPU-based filter.
However, running custom filters on the GPU requires a lot of code to set up and maintain an OpenGL ES 2.0 rendering target for these filters. I created a sample project to do this:
http://www.sunsetlakesoftware.com/2010/10/22/gpu-accelerated-video-processing-mac-and-ios
and found that there was a lot of boilerplate code I had to write in its creation. Therefore, I put together this framework that encapsulates a lot of the common tasks you'll encounter when processing images and video and made it so that you don't need to care about the OpenGL ES 2.0 underpinnings.
This framework compares favorably to Core Image when handling video, taking only 2.5 ms on an iPhone 4 to upload a frame from the camera, apply a gamma filter, and display, versus 106 ms for the same operation using Core Image. CPU-based processing takes 460 ms, making GPUImage 40X faster than Core Image for this operation on this hardware, and 184X faster than CPU-bound processing. On an iPhone 4S, GPUImage is only 4X faster than Core Image for this case, and 102X faster than CPU-bound processing. However, for more complex operations like Gaussian blurs at larger radii, Core Image currently outpaces GPUImage.
## License ##
BSD-style, with the full license available with the framework in License.txt.
## Technical requirements ##
- OpenGL ES 2.0: Applications using this will not run on the original iPhone, iPhone 3G, and 1st and 2nd generation iPod touches
- iOS 4.1 as a deployment target (4.0 didn't have some extensions needed for movie reading). iOS 4.3 is needed as a deployment target if you wish to show live video previews when taking a still photo.
- iOS 5.0 SDK to build
- Devices must have a camera to use camera-related functionality (obviously)
- The framework uses automatic reference counting (ARC), but should support projects using both ARC and manual reference counting if added as a subproject as explained below. For manual reference counting applications targeting iOS 4.x, you'll need add -fobjc-arc to the Other Linker Flags for your application project.
## General architecture ##
GPUImage uses OpenGL ES 2.0 shaders to perform image and video manipulation much faster than could be done in CPU-bound routines. However, it hides the complexity of interacting with the OpenGL ES API in a simplified Objective-C interface. This interface lets you define input sources for images and video, attach filters in a chain, and send the resulting processed image or video to the screen, to a UIImage, or to a movie on disk.
Images or frames of video are uploaded from source objects, which are subclasses of GPUImageOutput. These include GPUImageVideoCamera (for live video from an iOS camera), GPUImageStillCamera (for taking photos with the camera), GPUImagePicture (for still images), and GPUImageMovie (for movies). Source objects upload still image frames to OpenGL ES as textures, then hand those textures off to the next objects in the processing chain.
Filters and other subsequent elements in the chain conform to the GPUImageInput protocol, which lets them take in the supplied or processed texture from the previous link in the chain and do something with it. Objects one step further down the chain are considered targets, and processing can be branched by adding multiple targets to a single output or filter.
For example, an application that takes in live video from the camera, converts that video to a sepia tone, then displays the video onscreen would set up a chain looking something like the following:
GPUImageVideoCamera -> GPUImageSepiaFilter -> GPUImageView
## Adding the static library to your iOS project ##
Note: if you want to use this in a Swift project, you need to use the steps in the "Adding this as a framework" section instead of the following. Swift needs modules for third-party code.
Once you have the latest source code for the framework, it's fairly straightforward to add it to your application. Start by dragging the GPUImage.xcodeproj file into your application's Xcode project to embed the framework in your project. Next, go to your application's target and add GPUImage as a Target Dependency. Finally, you'll want to drag the libGPUImage.a library from the GPUImage framework's Products folder to the Link Binary With Libraries build phase in your application's target.
GPUImage needs a few other frameworks to be linked into your application, so you'll need to add the following as linked libraries in your application target:
- CoreMedia
- CoreVideo
- OpenGLES
- AVFoundation
- QuartzCore
You'll also need to find the framework headers, so within your project's build settings set the Header Search Paths to the relative path from your application to the framework/ subdirectory within the GPUImage source directory. Make this header search path recursive.
To use the GPUImage classes within your application, simply include the core framework header using the following:
#import "GPUImage.h"
As a note: if you run into the error "Unknown class GPUImageView in Interface Builder" or the like when trying to build an interface with Interface Builder, you may need to add -ObjC to your Other Linker Flags in your project's build settings.
Also, if you need to deploy this to iOS 4.x, it appears that the current version of Xcode (4.3) requires that you weak-link the Core Video framework in your final application or you see crashes with the message "Symbol not found: _CVOpenGLESTextureCacheCreate" when you create an archive for upload to the App Store or for ad hoc distribution. To do this, go to your project's Build Phases tab, expand the Link Binary With Libraries group, and find CoreVideo.framework in the list. Change the setting for it in the far right of the list from Required to Optional.
Additionally, this is an ARC-enabled framework, so if you want to use this within a manual reference counted application targeting iOS 4.x, you'll need to add -fobjc-arc to your Other Linker Flags as well.
### Building a static library at the command line ###
If you don't want to include the project as a dependency in your application's Xcode project, you can build a universal static library for the iOS Simulator or device. To do this, run `build.sh` at the command line. The resulting library and header files will be located at `build/Release-iphone`. You may also change the version of the iOS SDK by changing the `IOSSDK_VER` variable in `build.sh` (all available versions can be found using `xcodebuild -showsdks`).
## Adding this as a framework (module) to your Mac or iOS project ##
Xcode 6 and iOS 8 support the use of full frameworks, as does the Mac, which simplifies the process of adding this to your application. To add this to your application, I recommend dragging the .xcodeproj project file into your application's project (as you would in the static library target).
For your application, go to its target b
没有合适的资源?快使用搜索试试~ 我知道了~
一款小而美的工具应用!图片-高斯模糊朋友圈-九宫格手电筒扫一扫二维码竖式计算器私密照片图片-马赛克.zip
共2000个文件
h:1470个
m:249个
hpp:195个
需积分: 5 0 下载量 96 浏览量
2023-10-23
10:32:44
上传
评论
收藏 65.71MB ZIP 举报
温馨提示
matlab算法,毕设、课设程序,全部源码均已进行严格测试,可以直接运行! matlab算法,毕设、课设程序,全部源码均已进行严格测试,可以直接运行! matlab算法,毕设、课设程序,全部源码均已进行严格测试,可以直接运行! matlab算法,毕设、课设程序,全部源码均已进行严格测试,可以直接运行! matlab算法,毕设、课设程序,全部源码均已进行严格测试,可以直接运行! matlab算法,毕设、课设程序,全部源码均已进行严格测试,可以直接运行! matlab算法,毕设、课设程序,全部源码均已进行严格测试,可以直接运行! matlab算法,毕设、课设程序,全部源码均已进行严格测试,可以直接运行! matlab算法,毕设、课设程序,全部源码均已进行严格测试,可以直接运行!
资源推荐
资源详情
资源评论
收起资源包目录
一款小而美的工具应用!图片-高斯模糊朋友圈-九宫格手电筒扫一扫二维码竖式计算器私密照片图片-马赛克.zip (2000个子文件)
object_store.cpp 31KB
collection_change_builder.cpp 31KB
realm_coordinator.cpp 28KB
shared_realm.cpp 27KB
sync_session.cpp 27KB
transact_log_handler.cpp 26KB
index_set.cpp 20KB
results.cpp 19KB
sync_manager.cpp 18KB
collection_notifier.cpp 15KB
sync_file.cpp 13KB
sync_metadata.cpp 12KB
object_schema.cpp 9KB
external_commit_helper.cpp 8KB
results_notifier.cpp 8KB
schema.cpp 7KB
sync_user.cpp 6KB
list.cpp 6KB
thread_safe_reference.cpp 5KB
keychain_helper.cpp 4KB
list_notifier.cpp 3KB
object_notifier.cpp 3KB
format.cpp 2KB
collection_notifications.cpp 2KB
object.cpp 2KB
weak_realm_notifier.cpp 1KB
placeholder.cpp 42B
mtl_moa_metamacros.h 30KB
AMapSearchObj.h 24KB
AMapCommonObj.h 24KB
RLMRealm.h 24KB
WXApiObject.h 20KB
RLMObject.h 17KB
UIColor+Colours.h 14KB
RLMArray.h 13KB
JSQMessagesViewController.h 13KB
RLMResults.h 13KB
RLMCollection.h 12KB
MobClick.h 12KB
AMapSearchAPI.h 11KB
MTLManagedObjectAdapter.h 11KB
UMessage.h 10KB
TSMessage.h 9KB
JSQMessagesCollectionViewFlowLayout.h 9KB
RLMConstants.h 8KB
features.h 8KB
Macros.h 7KB
JSQMessagesCollectionViewCell.h 7KB
JSQMessagesCollectionViewDataSource.h 7KB
AMapLocationManager.h 7KB
RLMSyncSession.h 6KB
TOWebViewController.h 6KB
AMapGeoFenceManager.h 6KB
realm_nmmintrin.h 6KB
iVersion.h 6KB
JSQMessage.h 6KB
RLMSyncUtil.h 6KB
JSQMessagesCollectionViewDelegateFlowLayout.h 5KB
AMapLocationCommonObj.h 5KB
JSQMessagesKeyboardController.h 5KB
MobClickGameAnalytics.h 5KB
RLMMigration.h 5KB
WXApi.h 5KB
JSQMessagesAvatarImageFactory.h 5KB
RLMSyncUser.h 5KB
UIView+Borders.h 5KB
RLMRealm_Dynamic.h 5KB
UIDevice+DeviceInfo.h 5KB
UMFeedback.h 4KB
MZTimerLabel.h 4KB
JSQMessagesToolbarContentView.h 4KB
YIMacroDefine.h 4KB
RLMProperty_Private.h 4KB
RLMSyncCredentials.h 4KB
MobClickSocialAnalytics.h 4KB
RLMThreadSafeReference.h 4KB
RLMSyncManager.h 4KB
JSQAudioMediaViewAttributes.h 4KB
JSQAudioMediaItem.h 4KB
RLMSyncUtil_Private.h 4KB
RLMSyncPermissionChange.h 4KB
RLMRealmConfiguration.h 4KB
AMapSearchError.h 4KB
NSDate+Additional.h 4KB
JSQMessagesCollectionView.h 4KB
SevenSwitch.h 4KB
JSQMessagesMediaPlaceholderView.h 4KB
PNBarChart.h 4KB
JSQMessagesInputToolbar.h 4KB
JSQMessagesCollectionViewLayoutAttributes.h 4KB
mtl_moa_EXTScope.h 3KB
PNColor.h 3KB
RLMObjectBase_Dynamic.h 3KB
BKPasscodeViewController.h 3KB
JSQLocationMediaItem.h 3KB
RLMObject_Private.h 3KB
JSQMessagesTimestampFormatter.h 3KB
JSQMessagesBubbleImageFactory.h 3KB
RLMSyncPermissionOffer.h 3KB
SVSegmentedControl.h 3KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
天天501
- 粉丝: 568
- 资源: 4666
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功