All Projects → Jomes → Sand

Jomes / Sand

Using JNI to achieve Sobel operator image edge detection使用JNI实现Sobel算子图像边缘检测,支持kotlin https://github.com/Jomes/sand

Programming Languages

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

Projects that are alternatives of or similar to Sand

Webrtc apm
webrtc中apm相关代码的提取,包括AEC/NS/AGC/VAD ,另外还包括mp3/aac编码器、SoundTouch
Stars: ✭ 65 (-65.05%)
Mutual labels:  jni
Jni By Examples
🎇Fun Java JNI By Examples - with CMake and C++ (or C, of course!) ‼️ Accepting PRs
Stars: ✭ 99 (-46.77%)
Mutual labels:  jni
Xcrash
🔥 xCrash provides the Android app with the ability to capture java crash, native crash and ANR. No root permission or any system permissions are required.
Stars: ✭ 148 (-20.43%)
Mutual labels:  jni
Sbt Jni
sbt plugin to ease working with JNI
Stars: ✭ 81 (-56.45%)
Mutual labels:  jni
Stackparam
JVM agent to add method parameters to Java stack traces
Stars: ✭ 90 (-51.61%)
Mutual labels:  jni
Dlib Face Recognition Android
Android app to demo dlib face recognition
Stars: ✭ 115 (-38.17%)
Mutual labels:  jni
Jenny
JNI glue code generator
Stars: ✭ 53 (-71.51%)
Mutual labels:  jni
Jpegkit Android
Efficient JPEG operations for Android without the risk of an OutOfMemoryException.
Stars: ✭ 154 (-17.2%)
Mutual labels:  jni
Jnitrace Engine
Engine used by jnitrace to intercept JNI API calls.
Stars: ✭ 94 (-49.46%)
Mutual labels:  jni
Native Opencv Android Template
A tutorial for setting up OpenCV 4.5.0 (and other 4.x.y version) for Android in Android Studio with Native Development Kit (NDK) support.
Stars: ✭ 131 (-29.57%)
Mutual labels:  jni
Gluegen
JNI Glue Code Generator
Stars: ✭ 83 (-55.38%)
Mutual labels:  jni
Android Luajit Launcher
Android NativeActivity based launcher for LuaJIT, implementing the main loop within Lua land via FFI
Stars: ✭ 87 (-53.23%)
Mutual labels:  jni
Java.interop
Java.Interop provides open-source bindings of Java's Java Native Interface (JNI) for use with .NET managed languages such as C#
Stars: ✭ 120 (-35.48%)
Mutual labels:  jni
Ejdb
🏂 EJDB 2.0 — Embeddable JSON Database engine C library. Simple XPath like query language (JQL). Websockets / Android / iOS / React Native / Flutter / Java / Dart / Node.js bindings. Docker image.
Stars: ✭ 1,187 (+538.17%)
Mutual labels:  jni
Androidsecurity
Android安全实践
Stars: ✭ 150 (-19.35%)
Mutual labels:  jni
Pyjnius
Access Java classes from Python
Stars: ✭ 1,085 (+483.33%)
Mutual labels:  jni
Androiddevwithcpp
Android Develop With C++
Stars: ✭ 106 (-43.01%)
Mutual labels:  jni
Scapix
Scapix Language Bridge
Stars: ✭ 171 (-8.06%)
Mutual labels:  jni
Wasmer Java
☕ WebAssembly runtime for Java
Stars: ✭ 152 (-18.28%)
Mutual labels:  jni
Googleserialport
Android串口通信:抱歉,学会它真的可以为所欲为 ! ! !
Stars: ✭ 130 (-30.11%)
Mutual labels:  jni

sand

Sand is Android library that it is using JNI to achieve Sobel operator image edge detection. it's easy to build a picture like sand .

Screenshot

sand

Build

Step 1. Add the JitPack repository to your build file

add the JitPack maven to your project in root build.gradle

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

Step 2. Add module dependency build.gradle

 dependencies {
     	  compile 'com.github.Jomes:sand:v0.01'

 } 

That's it!

How to use

you can get Bitmap from SandPic class,you need to provide original Bitmap、threshold、pointNum。

Bitmap bitmap = SandPic.getInstance().tramform(originalBitmap,thre,pointNum);

there is a important tramform method in the SandPic class. it get pixels array from JNI.

public Bitmap tramform(Bitmap bitmap,int threshold,int ponitNum ){
        int width =  bitmap.getWidth();
        int height = bitmap.getHeight();
        Bitmap newImage = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(newImage);
        Paint paint = new Paint();
        paint.setAntiAlias(false);
        paint.setStyle(Paint.Style.STROKE);
        int pixels[] = new int [width*height];
        bitmap.getPixels(pixels,0,width,0,0,width,height);
        int[] generate = generate(pixels, width, height, threshold, ponitNum);
        for (int i = 0, n = generate.length; i + 1 < n; i += 2) {
                int x = generate[i]>0? generate[i]:0;
                int y = generate[i+1] >0?generate[i+1]:0 ;
                int color = bitmap.getPixel(x,y);
                paint.setColor(color);
                canvas.drawCircle(x, y, 1, paint);
            }

        return newImage;
    }

License

Copyright 2017 jomeslu [email protected]

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