• Stars
    star
    239
  • Rank 168,763 (Top 4 %)
  • Language
    C++
  • License
    MIT License
  • Created about 9 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

GPU accelerated image filters for iOS, based on OpenGL.

iOS-GPUImage-Plus

GPU accelerated filters for iOS based on OpenGL.

New feature: Face effects will be created with the ios11's VNSequenceRequestHandler & VNDetectFaceLandmarksRequest.

Android version: https://github.com/wysaid/android-gpuimage-plus

Abstract

  • This repo is open source now. You can use cge.framework in your project.

    1. You can add the cge.framework to your project, then add the code

    #import <cge/cge.h> //Everything is done.

    1. If you're using CocoaPods, add this to your Podfile:

    pod 'cge', :git => 'https://github.com/wysaid/ios-gpuimage-plus.git'

    or with the latest static library:

    pod 'cge', :git => 'https://github.com/wysaid/ios-gpuimage-plus-pod.git', :tag => '2.5.1'

    Dependencies: libc++, ImageIO.framework, MobileCoreServices.framework

    Note: The filters are written in C++, so you should change your source file extensions to "mm" if you want use all features. But it is not necessary when you're using the interface-headers just like the demo.

  • Hundreds of built-in filters are available in the demo. 😋If you'd like to add your own filter, please take a look at the manual page. Or you can follow the demo code. The new custom filters should be written in C++.

  • To build the source code, you can use the xcode project in the 'library' folder.

Manual

1. Usage

Sample Code for doing a filter with UIImage

//Simply apply a filter to an UIImage.
- (void)viewDidLoad
{
    UIImage* srcImage = [UIImage imageNamed:@"test.jpg"];
    //HSL Adjust (hue: 0.02, saturation: -0.31, luminance: -0.17)
    //Please see the manual for more details.
    const char* ruleString = @"@adjust hsl 0.02 -0.31 -0.17";
    UIImage* resultImage = cgeFilterUIImage_MultipleEffects(srcImage, ruleString, 1.0f, nil);

    //Then the dstImage is applied with the filter.
    //It's so convenient, isn't it?
}

2. Custom Shader Filter

2.1 Write your own filter

Your filter must inherit CGEImageFilterInterfaceAbstract or its child class. Most of the filters are inherited from CGEImageFilterInterface because it has many useful functions.

// A simple customized filter to do a color reversal.
class MyCustomFilter : public CGE::CGEImageFilterInterface
{
public:
    
    bool init()
    {
        CGEConstString fragmentShaderString = CGE_SHADER_STRING_PRECISION_H
        (
        varying vec2 textureCoordinate;  //defined in 'g_vshDefaultWithoutTexCoord'
        uniform sampler2D inputImageTexture; // the same to above.

        void main()
        {
            vec4 src = texture2D(inputImageTexture, textureCoordinate);
            src.rgb = 1.0 - src.rgb;  //Simply reverse all channels.
            gl_FragColor = src;
        }
        );

        //m_program is defined in 'CGEImageFilterInterface'
        return m_program.initWithShaderStrings(g_vshDefaultWithoutTexCoord, s_fsh);
    }

    //void render2Texture(CGE::CGEImageHandlerInterface* handler, GLuint srcTexture, GLuint vertexBufferID)
    //{
    //  //Your own render functions here.
    //  //Do not override this function to use the CGEImageFilterInterface's.
    //}
};

Note: To add your own shader filter with c++. Please see the demo for further details.

2.2 Run your own filter

Please see this: https://github.com/wysaid/ios-gpuimage-plus/blob/master/library/filterLib/cgeCustomFilters.h#L34

3. Filter Rule String

En: https://github.com/wysaid/android-gpuimage-plus/wiki/Parsing-String-Rule-En

Ch: https://github.com/wysaid/android-gpuimage-plus/wiki/Parsing-String-Rule

Tool

Some utils are available for creating filters: https://github.com/wysaid/cge-tools

Tool

License

MIT License

Donate

Alipay:

Alipay

Paypal:

Paypal

More Repositories

1

android-gpuimage-plus

Android Image & Camera Filters Based on OpenGL.
C
1,726
star
2

Android-ffmpeg-CameraRecord

使用JavaCV提供的支持, 使用OpenGL实时处理+显示摄像头采集的图像, 并使用FFMPEG实时录制音视频
Java
352
star
3

cge-tools

tools for cge
88
star
4

NDKOpenGLOffscreenRendering

简单demo, Android下使用NDK(C++)+GLES2.0进行后台绘图,保存到bitmap并交给java层处理. 在安卓下使用PBuffer创建context并实现在ndk下后台处理
C
55
star
5

WebGL-Lessons

A simple introduction to WebGL
JavaScript
35
star
6

SOFT_3D

使用普通C++代码实现了OpenGL矩阵、向量运算。部分代码参考自OpenGL.org,使用EGE图形库做了几个CPU渲染的小demo,欢迎感兴趣的同学参考,希望对你有所帮助
Objective-C
19
star
7

wge

WGE (Web Graphics Engine) 是一个web平台下的图形引擎。主要使用webgl实现,同时编写html5-2d兼容版本
JavaScript
15
star
8

WebImage

GPU accelerated Image processing using WebGL
JavaScript
11
star
9

android-gpuimage-plus-libs

9
star
10

ios-vision-face-detection-demo

A quick demo project exploring the face detection feature in Vision.framework
Objective-C++
8
star
11

MineSweep

Minesweep, a simple game for pc.
C++
7
star
12

ege-opencv

一个demo告诉你如何在ege(https://github.com/misakamm/xege) 里面使用OpenCV.
C++
6
star
13

ege-openal

A simple demo that shows how to record&play audio (via OpenAL) with EGE.
C
6
star
14

OGLPaint

This program achieves basic graphics functions with OpenGL. Hoping it would have something helpful for you.
C++
5
star
15

simple-arithmetic

A simple class for arithmetic parsing & calculating.
C++
5
star
16

SpriteGenerator

A Free Image Merger, supporting images with alpha channel, and configurations
C++
4
star
17

faceTrackerLib

A wrapper lib for Jason Saragih's FaceTracker
C++
4
star
18

MathAndProgramming

A simple demo about programming with Elementary Mathematics
C++
4
star
19

MazeLock

MazeLock of the auto generated maze!
C++
3
star
20

open-xege

Another EGE with GPU acceleration based on OpenGL.
C++
2
star
21

xege.org

xege website
C++
1
star
22

WordWar

A fully implemented 2D game
C++
1
star
23

android-gpuimage-plus-maven

maven repo for https://github.com/wysaid/android-gpuimage-plus
HTML
1
star
24

ios-gpuimage-plus-pod

pod repo for ios-gpuimage-plus
C++
1
star
25

soft_mesh_mapping

A soft uv mesh mapping demo with EGE
C++
1
star
26

MagicWings

A 2D game with map editor.
C++
1
star
27

EGE_Net

网格变形, 算法,思路较原版的清晰多了,但是实现方式大不同。作者依据其原理原创
C++
1
star