beartung / tclip-android

Bitmap smart clipping using OpenCV

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#Bitmap Smart Clipping using OpenCV

#Demo Screenshots

demo screenshots

#Features

  • using OpenCV to detect faces firstly, if have faces, won't cut faces off
  • using OpenCV to detect other characters secondly, if found significant zone, won't cut it off
  • using FAST feature detector instead of SURF, thanks for @yanunon

#Usage

  • copy config file to app dir

    String configPath = TClip.copyConfig(context, TClip.CONFIG, R.raw.haarcascade_frontalface_alt);
    
  • get cropped bitmap

    //config: /data/data/com.demo.tclip.debug/haarcascade_frontalface_alt.xml
    Bitmap ret = TClip.crop(configPath, sourceBitmap, width, height);
    

#Build

  • download OpenCV & unzip to /home/user/opencv-android-sdk
  • export OPENCV_PACKAGE_DIR="/home/user/opencv-android-sdk"
  • libnonfree.so & libopencv_java.so from beartung/nonfree-opencv-android
  • using FAST feature detector without libnonfree
  • cd jni && ndk-build

About

Bitmap smart clipping using OpenCV


Languages

Language:C++ 65.6%Language:Java 27.9%Language:Groovy 4.7%Language:C 1.3%Language:Shell 0.6%