Giter Site home page Giter Site logo

zhangdexin / gpupixel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pixpark/gpupixel

0.0 0.0 0.0 109.42 MB

Cross-Platform AI Beauty Effects Library, Achieving Commercial-Grade Beauty Effects. Written in C++11, Based on OpenGL/ES and VNN.

Home Page: https://open.pixpark.net/gpupixel

License: MIT License

C++ 69.61% C 0.64% Objective-C 11.00% Java 7.28% Objective-C++ 10.29% CMake 1.18%

gpupixel's Introduction

GPUPixel Stars GPUPixel Release GPUPixel Stars GPUPixel Stars


English | 简体中文

GPUPixel @ PixPark

Introduction

⛰️ GPUPixel is a high-performance image and video AI beauty effect library written in C++11, Extremely easy to compile and integrate, with a very small library size.

🔑 It is GPU-based and comes with built-in beauty effects filters that can achieve commercial-grade results.

🔌 It supports platforms including iOS, Mac, Android, and it can theoretically be ported to any platform that supports OpenGL/ES.

💡 The face key points detection currently utilizes the Face++ library, but it will be replaced with either VNN in the future.

Effects Preview

👉 Video: YouTube | BiliBili

Origin Smooth White ThinFace
origin smooth white thinface
BigEye Lipstick Blusher **On
bigeye lipstick blusher on-off

Architecture

Features Compared

This table compares the features supported by GPUPixel and GPUImage:

✅: Supported | ❌: Not supported | ✏️: Planning

GPUPixel GPUImage
🍎Filters:
Skin Smoothing Filter
Skin Whitening Filter
Face Slimming Filter
Big Eyes Filter
Lipstick Filter
Blush Filter
More Build in Filter
🍓Input Formats:
YUV420P(I420)
RGBA
JPEG
PNG
NV21(for Android) ✏️
🍉Output Formats:
RGBA
YUV420P(I420) ✏️
🥑Platform:
iOS
Mac
Android
Win ✏️
Linux ✏️

System Requirements

OS iOS OSX Android Windows Linux
Min Support OS Version 10.0 10.13 5.0 (API 21) - -

Performance

iPhone

- iPhone 6P iPhone 8 iPhone X iPhone 11 iPhone 14 pro
CPU 5% 5% 3% 3% 3%
Time Taken 10ms 4ms 3ms 3ms 3ms

Android

- Xiaomi 10 Huawei Meta30 Vivo SAMSUNG Google Pixel
CPU 3% 5% - - -
Time Taken 6ms 5ms - - -

Compilation

iOS

  1. Open objc/gpupixel.xcodeproj or objc/demo/PixDemo.xcodeproj Xcode project ;

  2. Select the corresponding platform for compilation;

Android

  1. Open the directory ./android in Android Studio

  2. Configure NDK r21+

Library Size

iOS(.framework) MacOS(.framework) Android(.aar)
Size 2.4 MB 2.6 MB 2.1 MB

Usage

Refer to ./objc/demo or ./android demo

.h file

// video data input
std::shared_ptr<SourceRawDataInput> source_raw_input_;
// beauty filter
std::shared_ptr<FaceBeautyFilter> face_beauty_filter_;
// video data output 
std::shared_ptr<TargetRawDataOutput> target_raw_output_;

Create Filter, .cpp file

 GPUPixel::GPUPixelContext::getInstance()->runSync([&] {
    // Create filter
    source_raw_input_ = SourceRawDataInput::create();
    target_raw_output_ = TargetRawDataOutput::create();
    // Face Beauty Filter
    face_beauty_filter_ = FaceBeautyFilter::create();
    
    // Add filter
    source_raw_input_->addTarget(face_beauty_filter_)->addTarget(target_raw_output_);
 }

Input Image Data I420 or RGBA

// ...
// YUVI420
 source_raw_input_->uploadBytes(width,
                                height, 
                                bufferY,
                                strideY, 
                                bufferU, 
                                strideU,
                                bufferV, 
                                strideV);
// ...
// bytes: RGBA data
 source_raw_input_->uploadBytes(bytes,
                                width, 
                                height, 
                                stride);

Output Data Callback

// I420 callback
target_raw_output_->setI420Callbck([=](const uint8_t *data, 
                                        int width, 
                                        int height, 
                                        int64_t ts) {
    size_t y_size = width * height;
    const uint8_t *uData = data + y_size;
    const uint8_t *vData = data + y_size + y_size / 4;
    // Do something you want
});

// RGBA callback->
target_raw_output_->setPixelsCallbck([=](const uint8_t *data, 
                                        int width, 
                                        int height, 
                                        int64_t ts) {
    size_t rgba_size = width * height*4;
    // Do something you want
});

// Output data callbck

Star History

Star History Chart

Acknowledgement

Reference Project

  1. GPUImage
  2. CainCamera
  3. AwemeLike
  4. VNN

gpupixel's People

Contributors

gezhaoyou avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.