Use of open source framework gpuimage in iOS build libgpuimage.a file and create project (i)

Source: Internet
Author: User

First, download gpuimage

(1): Https://github.com/BradLarson/GPUImage

(2) After downloading, open the Gpuimage.xcodeproj project, select the real machine to run the project (generate LIB file for the real machine)

(3) Click Libgpuimage.a under Products to select the show in Finder.

(4) Add all the header files contained in the GPUImage.h file to the include. In a similar way, folder names can be customized.

(5) Add all the header files contained in the GPUImage.h file to the include. In a similar way, folder names can be customized.

Ii. Creation of the project

(1) Import "include" and "Libgpuimage.a" into the project, the structure is as follows:

(2) Create a ". pch", named Custom, here as follows:

(3) Select the ". pch" file and you can see the contents as follows:

(4) Find Project > Build Settings > Search "Prefix Header";

(5) "Apple LLVM 7.0-language″ column you will see the Prefix Header keyword;

(6) Enter "/users/mac/desktop/gpuiimagetest/gpuiimagetest/gpuiimagetest-prefix.pch" (Select the ". pch" file you created, show in The Finder copies the file address, or simply drags the file into the code area to get the address.

(7) Precompile Prefix header is yes, pre-compiled PCH file will be cached, can improve the speed of compilation.

(8) Make the following changes in "GPUIIMAGETEST-PREFIX.PCH":

(9) Clean and build your project

Third, write the test code

@interface Viewcontroller ()

{

UIImage * inputimage;

}

@property (Weak, nonatomic) Iboutlet Uiimageview *changeimageview;

@end

@implementation Viewcontroller

-(void) Viewdidload {

[Super Viewdidload];

Inputimage = [UIImage imagenamed:@ "Face.png"];

Using the black and white sketch filter

Gpuimagesketchfilter *disfilter = [[Gpuimagesketchfilter alloc] init];

Set line weight default value is 1.0

Disfilter.edgestrength = 1;

Set the area to render

[Disfilter forceProcessingAtSize:inputImage.size];

[Disfilter Usenextframeforimagecapture];

Get Data source

Gpuimagepicture *stillimagesource = [[Gpuimagepicture alloc]initwithimage:inputimage];

Add on Filter

[Stillimagesource Addtarget:disfilter];

Start rendering

[Stillimagesource Processimage];

Get a picture after rendering

UIImage *newimage = [Disfilter imagefromcurrentframebuffer];

Load it out

Self.changeImageView.image = NewImage;

}

Original:

After processing the diagram:

Iv. key words in Gpuimage

? Output as Source

? Intput as input source

? Filter as Filter

Use of open source framework gpuimage in iOS build libgpuimage.a file and create project (i)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.