/Form-N-Fun

Primary LanguageJavaMIT LicenseMIT

Form-N-Fun

Form ‘N’ Fun is an android maze game based on real time computer vision. The uniqueness of this game is that the user can draw his own mazes on a white paper with pen/pencil and play. The game detects the maze and user can play using the accelerometer. This android app uses contours algorithms in OpenCV to detect maze that is drawn on the paper. This app uses JBox2d engine for simulating the rigid bodies.

Download APK

Apk can be found in apk folder, download and install the apk.

Modifications if needed

  1. Resolution: Resolution is fixed to 1280x960 (less than or equal). Resolution can be changed by modifing this line.

  2. Limiting the Pitch and Roll: Pitch and Roll are limited to 3.8, limiting value can be changed by modifing MIN and MAX. Here is the implementation of limiting function.

  3. Force on the ball: Force on the ball can be changed here.

  4. Color of the ball: Color of the ball can be modified here.

Download Android NDK r16b from https://developer.android.com/ndk/downloads/older_releases.html and extract the file, On Mac I extracted to /Users/Name/Documents/Android/android-ndk-r16b

Open the local.properties file and set ndk.dir to the path of Android NDK folder.

on Windows local.properties

sdk.dir = C\:\\android_sdk
ndk.dir = C\:\\android_ndk

on Mac local.properties

sdk.dir = /Users/Name/Library/Android/sdk
ndk.dir = /Users/Name/Documents/Android/android-ndk-r16b

Build Instructions with CV4:

Download OpenCV for Android (I used OpenCV 4.1.0) from http://opencv.org/releases.html and extract the file. I extracted the file to C:\Opencv\OpenCV-android-sdk-4.1.0 (On Windows) or /Users/Name/Documents/Android/OpenCV-android-sdk-4.1.0 (On Mac)

Open the Android.mk file in jni folder, modify the export OPENCV_PACKAGE_DIR to extracted OpenCV Path

on Windows.

export OPENCV_PACKAGE_DIR = C:/Opencv/OpenCV-android-sdk-4.1.0

on Mac.

export OPENCV_PACKAGE_DIR = /Users/Name/Documents/Android/OpenCV-android-sdk-4.1.0

Run the app after making the above changes.

Build Instructions with CV3:

Download OpenCV for Android (I used OpenCV 3.4.1) from http://opencv.org/releases.html and extract the file. I extracted the file to C:\Opencv\OpenCV-android-sdk-3.4.1 (On Windows) or /Users/Name/Documents/Android/OpenCV-android-sdk-3.4.1 (On Mac)

Open the Android.mk file in jni folder, modify the export OPENCV_PACKAGE_DIR to extracted OpenCV Path

on Windows.

export OPENCV_PACKAGE_DIR = C:/Opencv/OpenCV-android-sdk-3.4.1

on Mac.

export OPENCV_PACKAGE_DIR = /Users/Name/Documents/Android/OpenCV-android-sdk-3.4.1

remove LOCAL_CPPFLAGS in line 14 in Android.mk to build with CV3

LOCAL_CPPFLAGS := -DCV4

Run the app after making the above changes.

Note:

I build it on Mac for all the Devices but I tested it on Google PIXEL XL.

APP_ABI := arm64-v8a armeabi-v7a x86 x86_64

If you want to build the App for a particular device then modify APP_ABI to device ABIs in Application.mk in jni folder.

For example, to build App only for Google PIXEL XL then modify APP_ABI to APP_ABI:=arm64-v8a in Application.mk (Pixel XL has ARMv8 based CPU supports AArch64).

APP_ABI := arm64-v8a