# 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
没有合适的资源?快使用搜索试试~ 我知道了~
一个相机项目,学习GPUImage及图形图像学方面的知识+源代码+文档说明
共886个文件
h:565个
m:199个
png:50个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 99 浏览量
2024-01-03
12:54:25
上传
评论
收藏 2.02MB ZIP 举报
温馨提示
一个相机项目,学习GPUImage及图形图像学方面的知识+源代码+文档说明 - 小白不懂运行,下载完可以私聊问,可远程教学 该资源内项目源码是个人的课程设计,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! ## 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。 --------
资源推荐
资源详情
资源评论
收起资源包目录
一个相机项目,学习GPUImage及图形图像学方面的知识+源代码+文档说明 (886个子文件)
.gitattributes 66B
MBProgressHUD.h 17KB
MASConstraint.h 8KB
GPUImageFramework.h 8KB
MASUtilities.h 6KB
GPUImage.h 6KB
MASConstraintMaker.h 6KB
GPUImageFilter.h 5KB
GPUImageVideoCamera.h 5KB
View+MASAdditions.h 5KB
GPUImageOutput.h 5KB
View+MASShorthandAdditions.h 5KB
GPUImageHoughTransformLineDetector.h 3KB
NSArray+MASAdditions.h 3KB
GPUImageCannyEdgeDetectionFilter.h 3KB
GPUImageMovieWriter.h 3KB
GPUImageContext.h 2KB
GPUImageHarrisCornerDetectionFilter.h 2KB
GPUImageMovie.h 2KB
GPUImageStillCamera.h 2KB
GPUImageGaussianBlurFilter.h 2KB
MASConstraint+Private.h 2KB
GPUImageLevelsFilter.h 2KB
GPUImageView.h 2KB
GPUImageRawDataInput.h 1KB
GLProgram.h 1KB
GPUImageLookupFilter.h 1KB
GPUImageFramebuffer.h 1KB
GPUImageFASTCornerDetectionFilter.h 1KB
MASViewConstraint.h 1KB
GPUImageFilterPipeline.h 1KB
MASViewAttribute.h 1KB
GPUImageGaussianSelectiveBlurFilter.h 1KB
GPUImageSmoothToonFilter.h 1KB
GPUImageToneCurveFilter.h 1KB
GPUImagePicture.h 1KB
GPUImageRawDataOutput.h 1KB
GPUImageChromaKeyBlendFilter.h 1KB
GPUImageiOSBlurFilter.h 1KB
NSArray+MASShorthandAdditions.h 1016B
GPUImageChromaKeyFilter.h 987B
GPUImageTwoPassFilter.h 974B
GPUImageMosaicFilter.h 973B
GPUImageTiltShiftFilter.h 927B
ViewController+MASAdditions.h 891B
GPUImageHSBFilter.h 886B
GPUImageDilationFilter.h 845B
GPUImageParallelCoordinateLineTransformFilter.h 822B
GPUImageDirectionalNonMaximumSuppressionFilter.h 817B
GPUImageHistogramFilter.h 810B
Masonry.h 802B
GPUImageTransformFilter.h 801B
GPUImageVignetteFilter.h 799B
GPUImageMotionDetector.h 768B
GPUImageCrosshairGenerator.h 734B
GPUImageFramebufferCache.h 718B
GPUImageHistogramEqualizationFilter.h 707B
GPUImageSolidColorGenerator.h 703B
GPUImageSobelEdgeDetectionFilter.h 680B
MBProgressHUD+MJ.h 675B
GPUImageLineGenerator.h 674B
GPUImageTwoPassTextureSamplingFilter.h 671B
GPUImageKuwaharaFilter.h 664B
GPUImage3x3ConvolutionFilter.h 653B
GPUImagePixellatePositionFilter.h 650B
UIView+Frame.h 648B
GPUImageToonFilter.h 644B
GPUImageLuminosity.h 641B
GPUImageFalseColorFilter.h 632B
GPUImageHazeFilter.h 630B
GPUImageTwoInputFilter.h 628B
GPUImageFilterGroup.h 625B
GPUImagePoissonBlendFilter.h 621B
GPUImagePinchDistortionFilter.h 615B
GPUImageAverageColor.h 615B
GPUImageGaussianBlurPositionFilter.h 607B
GPUImageBulgeDistortionFilter.h 600B
NNCameraViewController.h 594B
GPUImage3x3TextureSamplingFilter.h 593B
GPUImageSwirlFilter.h 576B
GPUImageSphereRefractionFilter.h 565B
GPUImageErosionFilter.h 560B
GPUImageThreeInputFilter.h 559B
GPUImageRGBDilationFilter.h 553B
NNPictureEditView.h 551B
GPUImageTextureOutput.h 549B
GPUImageOpeningFilter.h 548B
GPUImageRGBErosionFilter.h 548B
GPUImageClosingFilter.h 546B
GPUImageTwoInputCrossTextureSamplingFilter.h 544B
GPUImageMovieComposition.h 527B
GPUImageSoftEleganceFilter.h 527B
GPUImageWhiteBalanceFilter.h 525B
GPUImagePicture+TextureSubimage.h 524B
NNHeaderImageCollectionView.h 521B
GPUImageHighPassFilter.h 507B
MASLayoutConstraint.h 505B
GPUImageShiTomasiFeatureDetectionFilter.h 501B
MASCompositeConstraint.h 494B
GPUImageColorMatrixFilter.h 491B
共 886 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
机智的程序员zero
- 粉丝: 1571
- 资源: 4136
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功