OpenCV On Android最佳环境配置指南(Eclipse篇),实战篇

布局内容:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/show"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1" 
            android:text="show"/>

        <Button
            android:id="@+id/process"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1" 
            android:text="process"/>
    </LinearLayout>
</RelativeLayout> 

代码编写完毕,但此时还不能运行,因为手机还未安装OpenCV Manager.apk

2.3、安装OpenCV Manager

位于OpenCV-android-sdk\apk目录下,选择合适的apk程序安装(一般选择OpenCV_3.2.0_Manager_3.20_armeabi.apk)。

2.4、运行Demo

将项目编译打包成apk,安装到手机,运行,点击按钮show后,对图像进行灰度处理,效果如下图所示:

5.png

注意:

  1. 如果出现OpenCV was not initialised correctly.Application will be shut down,可能是你的OpenCV Manager程序与你的cpu架构不同,选择合适的apk即可。
  2. 如果手机版本较高,可能会出现调用不到OpenCV Manager的情况,这是因为手机厂商做了限制,防止恶意软件相互唤醒(如百度全家桶),解决方法请自行百度(因为没有统一的方法)。
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值