This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.jason9075.myopencv; | |
| public class ImageInfo { | |
| private final int width; | |
| private final int height; | |
| public ImageInfo(int width, int height) { | |
| this.width = width; | |
| this.height = height; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| binding = ActivityMainBinding.inflate(getLayoutInflater()); | |
| setContentView(binding.getRoot()); | |
| setSupportActionBar(binding.toolbar); | |
| NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_main); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class NativeLib { | |
| static { | |
| System.loadLibrary("myopencv"); | |
| } | |
| public native String stringFromJNI(); | |
| public native void toGrey(Bitmap bitmapIn, Bitmap bitmapOut); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extern "C" JNIEXPORT void JNICALL | |
| Java_com_jason9075_myopencv_NativeLib_toGrey( | |
| JNIEnv *env, | |
| jobject, | |
| jobject bitmapIn, | |
| jobject bitmapOut) { | |
| Mat src, greyOut; | |
| bitmapToMat(env, bitmapIn, src, false); | |
| cvtColor(src, greyOut, CV_BGR2GRAY); | |
| matToBitmap(env, greyOut, bitmapOut, false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cmake_minimum_required(VERSION 3.18.1) | |
| set(OpenCV_DIR "/home/jason9075/Documents/OpenCV-android-sdk/sdk/native/jni") | |
| find_package(OpenCV REQUIRED) | |
| project("myopencv") | |
| add_library(myopencv | |
| SHARED |
NewerOlder