当前位置: 首页 > 软件库 > 手机/移动开发 > >

android-gpuimage

授权协议 Readme
开发语言 Java
所属分类 手机/移动开发
软件类型 开源软件
地区 不详
投 递 者 蒋永宁
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

GPUImage for Android

Idea from: iOS GPUImage framework

Goal is to have something as similar to GPUImage as possible. Vertex and fragment shaders are exactly the same. That way it makes it easier to port filters from GPUImage iOS to Android.

Requirements

  • Android 2.2 or higher (OpenGL ES 2.0)

Usage

Gradle dependency

repositories {
    mavenCentral()
}

dependencies {
    implementation 'jp.co.cyberagent.android:gpuimage:2.x.x'
}

Sample Code

With preview:

Java:

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity);

    Uri imageUri = ...;
    gpuImage = new GPUImage(this);
    gpuImage.setGLSurfaceView((GLSurfaceView) findViewById(R.id.surfaceView));
    gpuImage.setImage(imageUri); // this loads image on the current thread, should be run in a thread
    gpuImage.setFilter(new GPUImageSepiaFilter());

    // Later when image should be saved saved:
    gpuImage.saveToPictures("GPUImage", "ImageWithFilter.jpg", null);
}

Kotlin:

public override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_gallery)

    val imageUri: Uri = ...
    gpuImage = GPUImage(this)
    gpuImage.setGLSurfaceView(findViewById<GLSurfaceView>(R.id.surfaceView))
    gpuImage.setImage(imageUri) // this loads image on the current thread, should be run in a thread
    gpuImage.setFilter(GPUImageSepiaFilter())

    // Later when image should be saved saved:
    gpuImage.saveToPictures("GPUImage", "ImageWithFilter.jpg", null)
}

Using GPUImageView

<jp.co.cyberagent.android.gpuimage.GPUImageView
    android:id="@+id/gpuimageview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:gpuimage_show_loading="false"
    app:gpuimage_surface_type="texture_view" /> <!-- surface_view or texture_view -->

Java:

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity);

    Uri imageUri = ...;
    gpuImageView = findViewById(R.id.gpuimageview);
    gpuImageView.setImage(imageUri); // this loads image on the current thread, should be run in a thread
    gpuImageView.setFilter(new GPUImageSepiaFilter());

    // Later when image should be saved saved:
    gpuImageView.saveToPictures("GPUImage", "ImageWithFilter.jpg", null);
}

Kotlin:

public override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_gallery)

    val imageUri: Uri = ...
    gpuImageView = findViewById<GPUImageView>(R.id.gpuimageview)
    gpuImageView.setImage(imageUri) // this loads image on the current thread, should be run in a thread
    gpuImageView.setFilter(GPUImageSepiaFilter())

    // Later when image should be saved saved:
    gpuImageView.saveToPictures("GPUImage", "ImageWithFilter.jpg", null)
}

Without preview:

Java:

public void onCreate(final Bundle savedInstanceState) {
    public void onCreate(final Bundle savedInstanceState) {
    Uri imageUri = ...;
    gpuImage = new GPUImage(context);
    gpuImage.setFilter(new GPUImageSobelEdgeDetection());
    gpuImage.setImage(imageUri);
    gpuImage.saveToPictures("GPUImage", "ImageWithFilter.jpg", null);
}

Kotlin:

public override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_gallery)
    val imageUri: Uri = ...
    gpuImage = GPUImage(this)
    gpuImage.setFilter(GPUImageSepiaFilter())
    gpuImage.setImage(imageUri)
    gpuImage.saveToPictures("GPUImage", "ImageWithFilter.jpg", null)
}

Support status of GPUImage for iOS shaders

  • Saturation
  • Contrast
  • Brightness
  • Levels
  • Exposure
  • RGB
  • RGB Diation
  • Hue
  • White Balance
  • Monochrome
  • False Color
  • Sharpen
  • Unsharp Mask
  • Transform Operation
  • Crop
  • Gamma
  • Highlights and Shadows
  • Haze
  • Sepia Tone
  • Amatorka
  • Miss Etikate
  • Soft Elegance
  • Color Inversion
  • Solarize
  • Vibrance
  • Highlight and Shadow Tint
  • Luminance
  • Luminance Threshold
  • Average Color
  • Average Luminance
  • Average Luminance Threshold
  • Adaptive Threshold
  • Polar Pixellate
  • Pixellate
  • Polka Dot
  • Halftone
  • Crosshatch
  • Sobel Edge Detection
  • Prewitt Edge Detection
  • Canny Edge Detection
  • Threshold Sobel EdgeDetection
  • Harris Corner Detector
  • Noble Corner Detector
  • Shi Tomasi Feature Detector
  • Colour FAST Feature Detector
  • Low Pass Filter
  • High Pass Filter
  • Sketch Filter
  • Threshold Sketch Filter
  • Toon Filter
  • SmoothToon Filter
  • Tilt Shift
  • CGA Colorspace Filter
  • Posterize
  • Convolution 3x3
  • Emboss Filter
  • Laplacian
  • Chroma Keying
  • Kuwahara Filter
  • Kuwahara Radius3 Filter
  • Vignette
  • Gaussian Blur
  • Box Blur
  • Bilateral Blur
  • Motion Blur
  • Zoom Blur
  • iOS Blur
  • Median Filter
  • Swirl Distortion
  • Bulge Distortion
  • Pinch Distortion
  • Sphere Refraction
  • Glass Sphere Refraction
  • Stretch Distortion
  • Dilation
  • Erosion
  • Opening Filter
  • Closing Filter
  • Local Binary Pattern
  • Color Local Binary Pattern
  • Dissolve Blend
  • Chroma Key Blend
  • Add Blend
  • Divide Blend
  • Multiply Blend
  • Overlay Blend
  • Lighten Blend
  • Darken Blend
  • Color Burn Blend
  • Color Dodge Blend
  • Linear Burn Blend
  • Screen Blend
  • Difference Blend
  • Subtract Blend
  • Exclusion Blend
  • HardLight Blend
  • SoftLight Blend
  • Color Blend
  • Hue Blend
  • Saturation Blend
  • Luminosity Blend
  • Normal Blend
  • Source Over Blend
  • Alpha Blend
  • Non Maximum Suppression
  • Thresholded Non Maximum Suppression
  • Directional Non Maximum Suppression
  • Opacity
  • Weak Pixel Inclusion Filter
  • Color Matrix
  • Directional Sobel Edge Detection
  • Lookup
  • Tone Curve (*.acv files)

Others

  • Texture 3x3
  • Gray Scale

Gradle

Make sure that you run the clean target when using maven.

gradle clean assemble

License

Copyright 2018 CyberAgent, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
 相关资料
  • JNI绑定 Android上的Java资源 WebView代码组织

  • Native.js for Android封装一条通过JS语法直接调用Native Java接口通道,通过plus.android可调用几乎所有的系统API。 方法: currentWebview: 获取当前Webview窗口对象的native层实例对象 newObject: 创建实例对象 getAttribute: 获取对象(类对象/实例对象)的属性值 setAttribute: 设置对象(类对

  • Android++ 是一个免费的 Visual Studio 扩展,用于支持在 Visual Studio 上开发和调试原生的 Android 应用,主要基于 NDK 的 C/C++ 应用。同时包括可订制的发布、资源管理以及集成了 Java 源码编译。

  • Android(安卓)是一种基于Linux内核的自由及开放源代码的操作系统,主要使用于移动设备,如智能手机和平板电脑,由美国谷歌公司和开放手机联盟领导及开发。Android操作系统最初由Andy Rubin开发,主要支持手机。2005年8月由谷歌收购注资。2007年11月,谷歌与84家硬件制造商、软件开发商及电信营运商组建开放手机联盟共同研发改良Android系统。随后谷歌以Apache许可证的授

  • Android(安卓)是一种基于Linux内核的自由及开放源代码的操作系统,主要使用于移动设备,如智能手机和平板电脑,由美国谷歌公司和开放手机联盟领导及开发。Android操作系统最初由Andy Rubin开发,主要支持手机。2005年8月由谷歌收购注资。2007年11月,谷歌与84家硬件制造商、软件开发商及电信营运商组建开放手机联盟共同研发改良Android系统。随后谷歌以Apache许可证的授

  • 简介 该库提供J2SE的Swing、AWT等类的安卓实现,引用该库便能在Android上运行J2SE应用程序。 该库实现大多数必需功能,但不是全部的J2SE。 成功示例HomeCenter服务器,该服务器基于J2SE,同时完全运行于Android之上。 使用指引 该库依赖于开源工程HomeCenter。 它不含Activity,需另建Android工程,并引用本库。 Activity和res需作为