All Projects → wysaid → Android Gpuimage Plus

wysaid / Android Gpuimage Plus

Licence: mit
Android Image & Camera Filters Based on OpenGL.

Programming Languages

C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language
java
68154 projects - #9 most used programming language
objective c
16641 projects - #2 most used programming language
Makefile
30231 projects
CMake
9771 projects

Projects that are alternatives of or similar to Android Gpuimage Plus

Ezfilter
A lightweight (<180KB), easy-to-extend Android filter and dynamic sticker framework for adding filters and stickers for camera, video, bitmap and view.(一个轻量级(<180KB)、易扩展的Android滤镜和动态贴纸框架,支持摄像头、视频、图片和视图添加滤镜和贴纸。)
Stars: ✭ 155 (-90.03%)
Mutual labels:  opengl, filter
Pesdk Android Demo
A fully customizable photo editor for your app.
Stars: ✭ 464 (-70.14%)
Mutual labels:  opengl, filter
Ios Gpuimage Plus
GPU accelerated image filters for iOS, based on OpenGL.
Stars: ✭ 217 (-86.04%)
Mutual labels:  opengl, filter
Metalpetal
A GPU accelerated image and video processing framework built on Metal.
Stars: ✭ 907 (-41.63%)
Mutual labels:  opengl, filter
Android Ffmpeg Camerarecord
使用JavaCV提供的支持, 使用OpenGL实时处理+显示摄像头采集的图像, 并使用FFMPEG实时录制音视频
Stars: ✭ 334 (-78.51%)
Mutual labels:  opengl, filter
React Native Gpuimage
GPUImage Component in React Native
Stars: ✭ 45 (-97.1%)
Mutual labels:  opengl, filter
Muuri
Infinite responsive, sortable, filterable and draggable layouts
Stars: ✭ 9,797 (+530.44%)
Mutual labels:  filter
Glutin
A low-level library for OpenGL context creation, written in pure Rust.
Stars: ✭ 1,520 (-2.19%)
Mutual labels:  opengl
Engo
Engo is an open-source 2D game engine written in Go.
Stars: ✭ 1,356 (-12.74%)
Mutual labels:  opengl
Envisaged
Envisaged - Effortless Gource Visualizations with Docker
Stars: ✭ 98 (-93.69%)
Mutual labels:  opengl
Revogrid
Powerful virtual data grid smartsheet with advanced customization. Best features from excel plus incredible performance 🔋
Stars: ✭ 1,870 (+20.33%)
Mutual labels:  filter
Xrtl
Cross-platform Real-Time Rendering Library
Stars: ✭ 108 (-93.05%)
Mutual labels:  opengl
Gdx Vfx
LibGDX post-processing visual effects
Stars: ✭ 105 (-93.24%)
Mutual labels:  opengl
Engine
Go 3D Game Engine
Stars: ✭ 1,362 (-12.36%)
Mutual labels:  opengl
Sh3redux
SILENT HILL 3 Engine Remake in OpenGL and C++
Stars: ✭ 105 (-93.24%)
Mutual labels:  opengl
Openrct2
An open source re-implementation of RollerCoaster Tycoon 2 🎢
Stars: ✭ 10,115 (+550.9%)
Mutual labels:  opengl
Awesome Opengl
A curated list of awesome OpenGL libraries, debuggers and resources.
Stars: ✭ 1,577 (+1.48%)
Mutual labels:  opengl
Alfred Workflow
Alfred Workflow教程与实例; CDto: 打开Terminal并转到任意文件夹或文件所在目录; Effective IP:查询本机和外网IP地址,解析任意URL和域名的IP地址,以及进行归属地和运营商查询; UpdateAllNPM: 更新所有Node.js全局模块; UpdateAllPIP: 更新所有Python模块
Stars: ✭ 98 (-93.69%)
Mutual labels:  filter
Clapper
A GNOME media player built using GJS with GTK4 toolkit and powered by GStreamer with OpenGL rendering.
Stars: ✭ 103 (-93.37%)
Mutual labels:  opengl
Orb Slam2 Based Ar On Android
This is a Android Augmented Reality APP based on ORB-SLAM2 and OpenGL,which can work well on both outdoor and indoor environments
Stars: ✭ 107 (-93.11%)
Mutual labels:  opengl

Android-GPUImage-Plus

Image, Camera And Video Filters Based On OpenGL

To get pure lib without ffmpeg(No feature of video recording), please checkout the branch min. The whole jni module will be less than 600KB.

New Feature

See the image deform demo.

Gradle dependency

repositories {
    jcenter()
}

//Choose only one of them
dependencies {
    //All arch: armeabi, armeabi-v7a, arm64-v8a, x86
    compile 'org.wysaid:gpuimage-plus:2.6.3'

    //Pure graphics lib without ffmpeg. (all arch for branch 'min')
    compile 'org.wysaid:gpuimage-plus:2.6.3-min'
}

Use other ffmpeg-library, see: https://github.com/wysaid/FFmpeg-Android.git

Abstract

  • This repo is an Android Studio Project, comprising "cgeDemo", "library" two sub-modules. 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 filter should be written in C++.

  • Demo and Library will be updated as needed. Welcome for your questions or PR.

  • To build with the jni part, pleasae try:

export NDK=path/of/your/ndk
cd folder/of/jni (android-gpuimage-plus/library/src/main/jni)

#This will make all arch: armeabi, armeabi-v7a arm64-v8a, x86, mips
./buildJNI
#Or use "sh buildJNI"

#Try this if you failed to run the shell above
export CGE_USE_VIDEO_MODULE=1
$NDK/ndk-build

#If you don't want anything except the image filter,
#Do as below to build with only cge module
#No ffmpeg, opencv or faceTracker.
#And remove the loading part of ffmpeg&facetracker
$NDK/ndk-build

#For Window user, you should include the `.cmd` extension to `ndk-build` like this:
cd your_path_to\android-gpuimage-plus-master\library\src\main\jni
your_path_to_ndk\ndk-bundle\ndk-build.cmd

#Also remember to comment out these line in NativeLibraryLoader
//System.loadLibrary("ffmpeg");
//CGEFFmpegNativeLibrary.avRegisterAll();

You can find precompiled libs here: android-gpuimage-plus-libs (The precompiled '.so' files are generated with NDK-r16b)

Note that the generated file "libFaceTracker.so" is not necessary. So just remove this file if you don't want any feature of it.

Manual

1. Usage

Sample Code for doing a filter with Bitmap

//Simply apply a filter to a Bitmap.
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Bitmap srcImage = ...;

    //HSL Adjust (hue: 0.02, saturation: -0.31, luminance: -0.17)
    //Please see the manual for more details.
    String ruleString = "@adjust hsl 0.02 -0.31 -0.17";

    Bitmap dstImage = CGENativeLibrary.filterImage_MultipleEffects(src, ruleString, 1.0f);

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

    //Save the result image to /sdcard/libCGE/rec_???.jpg.
    ImageUtil.saveBitmap(dstImage);
}

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

In C++, you can use a CGEImageHandler to do that:

//Assume the gl context already exists:
//JNIEnv* env = ...;
//jobject bitmap = ...;
CGEImageHandlerAndroid handler;
CustomFilterType* customFilter = new CustomFilterType();

//You should handle the return value (false is returned when failed.)
customFilter->init();
handler.initWithBitmap(env, bitmap);

//The customFilter will be released when the handler' destructor is called.
//So you don't have to call 'delete customFilter' if you add it into the handler.
handler.addImageFilter(customFilter);

handler.processingFilters(); //Run the filters.

jobject resultBitmap = handler.getResultBitmap(env);

If no gl context exists, the class CGESharedGLContext may be helpful.

In Java, you can simply follow the sample:

See: CGENativeLibrary.cgeFilterImageWithCustomFilter

Or to do with a CGEImageHandler

3. Filter Rule String

Doc: https://github.com/wysaid/android-gpuimage-plus/wiki

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-(ZH)

Tool

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

Tool

License

MIT License

Donate

Alipay:

Alipay

Paypal:

Paypal

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].