This repository has only educational and teaching purposes.
This repository contains an example of an Android Studio app (for Android) showing how to use OpenCV 4.5 to perform a simple binarization in HSV Color Space.
- Download Android Studio Bumblebee (2021.1.1) Stable and uncompress in any location
- Download OpenCV 4.5 for Android and uncompress in any location
- Download this repository
- Update references to OpenCV 4.5. for Android libraries, according to your local paths
- Import the project into Android Studio and Run
- Add your own function according to your needs, following this format:
extern "C" JNIEXPORT void JNICALL
Java_giiata_vision_opencvhelade_MainActivity_filters(
JNIEnv* env,
jobject /* this */,
jobject bitmapIn,
jobject bitmapOut,
jint hMin,
jint sMin,
jint vMin,
jint hMax,
jint sMax,
jint vMax) {
cv::Mat src;
bitmapToMat(env, bitmapIn, src, false);
//cv::flip(src, src, 0);
cv::Mat tmp;
cv::cvtColor(src, tmp, cv::COLOR_BGR2HSV);
cv::inRange(tmp, cv::Scalar(hMin, sMin, vMin), cv::Scalar(hMax, sMax, vMax), tmp);
matToBitmap(env, tmp, bitmapOut, false);
}
Video-Sample-OpenCV-4.2-Android-Studio-Bumblebee.webm
Contributors names and contact info
Vladimir Robles-Bykbaev @vlarobbyk
- 0.1
- Initial Release
This project is licensed under The GNU General Public License v3.0 License - see the LICENSE.md file for details
Inspiration: