All Projects → abhriyaroy → Rxlowpoly

abhriyaroy / Rxlowpoly

A RxJava based library using native code to convert images to Lowpoly for Android

Programming Languages

java
68154 projects - #9 most used programming language
kotlin
9241 projects

Projects that are alternatives of or similar to Rxlowpoly

Grox
Grox helps to maintain the state of Java / Android apps.
Stars: ✭ 336 (+110%)
Mutual labels:  rxjava, rxjava-android
Android Kotlin Mvp Architecture
This repository contains a detailed sample app that implements MVP architecture in Kotlin using Dagger2, Room, RxJava2, FastAndroidNetworking and PlaceholderView
Stars: ✭ 615 (+284.38%)
Mutual labels:  rxjava, rxjava-android
Rxcache
简单一步,缓存搞定。这是一个专用于 RxJava,解决 Android 中对任何 Observable 发出的结果做缓存处理的框架
Stars: ✭ 377 (+135.63%)
Mutual labels:  rxjava, rxjava-android
Rxanime
Visualizer to understand RxJava operators
Stars: ✭ 261 (+63.13%)
Mutual labels:  rxjava, rxjava-android
Android Mvvm Rx3 Dagger2 Navcomponent
Implemented using MVVM, LiveData, Room, RX3, Dagger2, Coil, View Binding, Navigation Component and AndroidX
Stars: ✭ 72 (-55%)
Mutual labels:  rxjava, rxjava-android
Nybus
NYBus (RxBus) - A pub-sub library for Android and Java applications
Stars: ✭ 283 (+76.88%)
Mutual labels:  rxjava, rxjava-android
Traceur
Easier RxJava2 debugging with better stacktraces
Stars: ✭ 502 (+213.75%)
Mutual labels:  rxjava, rxjava-android
Marvel
Marvel Characters Android Application Assigned by smava GmbH
Stars: ✭ 227 (+41.88%)
Mutual labels:  rxjava, rxjava-android
Rxbluetoothkotlin
Bluetooth low energy reactive framework for Android written in Kotlin
Stars: ✭ 68 (-57.5%)
Mutual labels:  rxjava, rxjava-android
Rx.observe
Transform any method to an Rx Observable ! (VIPER)
Stars: ✭ 34 (-78.75%)
Mutual labels:  rxjava, rxjava-android
RxRetroAPICall
API call example using Retrofit and RxJava2
Stars: ✭ 16 (-90%)
Mutual labels:  rxjava, rxjava-android
Mvvm Reddit
A companion project for our blog post on better Android software development using MVVM with RxJava.
Stars: ✭ 106 (-33.75%)
Mutual labels:  rxjava, rxjava-android
RxRealm
Utilities for using RxJava with Realm
Stars: ✭ 23 (-85.62%)
Mutual labels:  rxjava, rxjava-android
Freezer
A simple & fluent Android ORM, how can it be easier ? RxJava2 compatible
Stars: ✭ 326 (+103.75%)
Mutual labels:  rxjava, rxjava-android
android-online-course
Android Online Course
Stars: ✭ 22 (-86.25%)
Mutual labels:  rxjava, rxjava-android
Android Mvp Architecture
This repository contains a detailed sample app that implements MVP architecture using Dagger2, GreenDao, RxJava2, FastAndroidNetworking and PlaceholderView
Stars: ✭ 4,360 (+2625%)
Mutual labels:  rxjava, rxjava-android
Rxjava2 Operators Magician
你用不惯 RxJava,只因缺了这把钥匙 🔑 You are not used to RxJava, just because of the lack of this key.
Stars: ✭ 868 (+442.5%)
Mutual labels:  rxjava, rxjava-android
Mvpframes
整合大量主流开源项目并且可高度配置化的 Android MVP 快速集成框架,支持 AndroidX
Stars: ✭ 100 (-37.5%)
Mutual labels:  rxjava, rxjava-android
Rxjavapriorityscheduler
RxPS - RxJavaPriorityScheduler - A RxJava Priority Scheduler library for Android and Java applications
Stars: ✭ 138 (-13.75%)
Mutual labels:  rxjava, rxjava-android
Android Mvvm
Android MVVM + Retrofit + Dagger 2 + Room
Stars: ✭ 153 (-4.37%)
Mutual labels:  rxjava

RxLowpoly

An Android library to bring your ordinary photos to life with an awesome crystallized effect.

Table of Contents

Introduction

RxLowpoly serves as an improvement over XLowPoly by

  • fixing out of memory crashes by scaling down the image in a loss-less manner before processing.
  • providing better quality results by using 4000 as the point count by default which provides a good trade-off between speed and time.
  • the higher point count leads to a longer execution period, but it is significantly reduced by scaling down the image before processing.
  • provides wider choice of input sources like Bitmap, File, Uri or Drawable resource.
  • natively using RxJava for background processing thereby reducing boilerplate code on the developer's end.

Lowpoly Samples

Original Image Lowpoly Image
Original Lowpoly
Original Lowpoly
Original Lowpoly
Original Lowpoly

Installation

Download

Add the dependency in your app module's build.gradle file

dependencies {
	...
        implementation "com.zebrostudio.rxlowpoly:rxlowpoly:{latest_version}"
}

That's it!

Library Details

  • RxLowpoly uses JNI with 64 bit support to meet google specified requirement for all apps to be 64 bit enabled by August 2019.
  • Use of JNI enables much faster execution than other similar libraries.
  • Use of Sobel Operator for edge detection.
  • Use of Delaunay Triangulation on the result from the sobel operator to construct the final crystallized lowpoly effect on the image.

JNI

RxLowpoly uses the Sobel Operator and then implementing the Delaunay Triangulation algorithm.

Sobel Operator

The Delaunay Triangulation can be applied.

Delaunay Triangulation

We take a set P of discrete points on an image plane and apply Delaunay Triangulation DT(P) to produce triangles connecting 3 points at a time such that no point in **P **is inside the circum-circle of any triangle in DT(P). These separate triangles taken together in-turn provide us with the image having a crystallized effect.

Which leads to the resultant crystallized image as :-

Usage Examples

Asynchronous call

  • The most simple use case is :-

      RxLowpoly.with(context)
          .input(bitmap) 
          .generateAsync()
    

    Along with Bitmaps we can also use Drawables or Files or Uri as input.

  • When we need to downscale the image :-

     RxLowpoly.with(context)
         .input(bitmap)
         .overrideScaling(downScalingFactor)
         .generateAsync()
    
  • When we need to set a maximum width for the image :-

     RxLowpoly.with(context)
         .input(bitmap)
         .overrideScaling(maxWidth)
         .generateAsync()
    
  • We can also set a quality for the lowpoly image :-

     RxLowpoly.with(context)
         .input(inputUri)
         .overrideScaling(downScalingFactor)
         .quality(Quality.HIGH)
         .generateAsync()
    

    VERY_HIGH, MEDIUM, LOW and VERY_LOW are also available as Quality configurations

  • To save the lowpoly image to a file :-

     RxLowpoly.with(context)
         .input(inputUri)
         .overrideScaling(downScalingFactor)
         .quality(Quality.HIGH)
         .output(outputFile) // An Uri of a File is also supported as an output destination
         .generateAsync()
    

All asynchronous operation is done on the IO scheduler.

Synchronous call

Replacing generateAsync() with generate() in each of the Asynchronous call examples leads to a synchronous call with a lowpoly Bitmap as a result.

A Bitmap of the generated lowpoly image is always returned irrespective of synchronous or asynchronous calls and whether an output File or Uri is supplied using the output method.

Note : A full implementation can be found in the app module of this repository or in the open sourced WallR app.

Critical Analysis

The following tests have been performed on a Xiaomi Redmi Note 5 Pro with 6 gb Ram.

Original Image       Lowpoly Image Input Source Quality Execution Time (ms)
Bitmap Very High 15813
Drawable Very High 16275
File Very High 15987
Uri Very High 15931
Bitmap High 4547
Drawable High 5088
File High 4734
Uri High 4612
Bitmap Medium 1113
Drawable Medium 1672
File Medium 1297
Uri Medium 1152
Bitmap Low 918
Drawable Low 1496
File Low 1091
Uri Low 996
Bitmap Very Low 850
Drawable Very Low 1024
File Very Low 923
Uri Very Low 876

Thus it is evident that when quality is set to High, a good trade-off between speed and texture is obtained, hence the default value of Quality is set to HIGH.
Also, we can see that Bitmap is the input format of choice as it is processed the fastest, followed by Uri, File and Drawable respectively.

Sample App

The sample app provides an implementation of various configurations of RxLowpoly which one can experience and assess first hand before using the library.

Screenshots

       

How to Contribute

Please feel free to raise an issue in-case you come across a bug or even if you have any minor suggestion.

About the Author

Abhriya Roy

Android Developer with 2 years of experience in building apps that look and feel great. Enthusiastic towards writing clean and maintainable code. Open source contributor.

LinkedIn   Twitter   Stack Overflow   Angel List   Angel List


License

Copyright 2019 Abhriya Roy

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.
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].