【问题标题】:How to make Android application from from C++ program using OpenCV如何使用 OpenCV 从 C++ 程序制作 Android 应用程序
【发布时间】:2014-08-09 23:16:49
【问题描述】:

我有一个这样开始的 C++ 程序:

#include "opencv2/highgui/highgui.hpp"
#include <opencv2/objdetect/objdetect.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
#include <vector>
#include <stdio.h>
#include "linefinder.h"

#define PI 3.1415926

using namespace cv;

int main(int argc, char* argv[]) {
    int houghVote = 200;
    string arg = argv[1];
    bool showSteps = argv[2];

    string window_name = "Processed Video";
    namedWindow(window_name, CV_WINDOW_KEEPRATIO); //resizable window;
    VideoCapture capture(arg);

我想用它制作一个 Android 应用。 我已经安装了 NDK,但我不知道我现在要做什么。

我是否必须更改 C++ 主程序中的任何内容才能在 Android 上运行,或者我可以不加改动地编译和运行它吗?

【问题讨论】:

标签: android c++ opencv android-ndk


【解决方案1】:

Introduction to Android

Android 提供了丰富的应用程序框架,允许您在 Java 语言环境 中为移动设备构建创新的应用程序和游戏。 ... Android 应用程序构建为可以单独调用的不同组件的组合。

您需要使用 Java 构建您的应用,然后通过 JNI 调用您的 C++ 代码。

另外,Android NDK 有话要说

您应该只在对您的应用程序必不可少的情况下使用 NDK——绝不是因为您只是更喜欢用 C/C++ 编程

特别是,阅读Using the NDK 以了解为什么您无法在不更改任何内容的情况下运行您的 C++ 主程序

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-07-15
    • 1970-01-01
    • 1970-01-01
    • 2018-02-28
    • 2021-09-16
    • 1970-01-01
    • 2014-08-28
    相关资源
    最近更新 更多