Android Studio中使用JNI调用OpenCV本地代码Canny 边缘检测
1.add activity_canny.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/btn_ndk"
android:text="use C++ OpenCV process img"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/btn_restore"
android:text="restore"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/img"/>
</LinearLayout>
2.CannyActivity
public class CannyActivity extends Activity {
static {
System.loadLibrary("canny");
}
@Override
protected void onCreate(Bundle savedInstanceState) {