本文介绍了将C ++ opencv项目在计算机上转换为opencv android的步骤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的计算机上写了一个c ++项目,用于使用 OpenCV 稳定视频。但我想使用Opencv4Android写这个项目到android。为了做到这一点,我应该让新的项目或任何方式来转换该项目为android通过使用NDK?如果我可以使用项目的mycompter,需要对该c ++代码的许多更改?

I wrote a c++ project on my computer for stabilizing a video using OpenCV. But I want to write this project to android using Opencv4Android. For doing this, should I make new project or Is any way to convert that project for android by using NDK? If I can use project of mycompter, Did need many changes on that c++ codes? What steps need to convert or porting a computer opencv project to android opencv project?

推荐答案

这是一个真正一般的问题,所以我需要将计算机opencv项目转换或移植到android opencv项目?将尝试将其分解。

This is a really general question, so I will try to break it down a bit.

首先,让我们忘记openCV一秒钟。

First, lets forget about the openCV for a second.

您要为Android创建一个c ++项目。当为Android构建一个c ++代码,你通过NDK构建它。我建议您从这个开始,首先尝试构建一个非常简单的C ++项目与NDK,编译,并看到,你可以在Android设备上运行。

You want to create a c++ project for Android. When building a c++ code for Android, you build it by means of NDK. I suggest you start with this tutorial, and first try to build a very simple C++ project with NDK, that compiles, and see that you're able to run on an Android device.Things will get much clearer for you then.

在你掌握了这一点之后,我建议你开始将你的代码小部分移动到那个项目,同时替换OpenCV函数与存根,并让这些代码在Android上编译和运行(不做任何事情)。

After you mastered that, I suggest you start moving your code in small bits to that project, meanwhile replacing the OpenCV functions with stubs, and have that code compile and run (doing nothing) on Android.

之后,阅读关于将OpenCV依赖项集成到NDK项目,这不是(至少不是我的情况)。

After that, read about integrating OpenCV dependancy into an NDK project, this is not that hard (at least it wasn't in my case).

这对我来说是非常有用的。

This step-by-step was pretty usefull for me.

至于你是否可以自动翻译你的(可能是视觉工作室)项目文件到一个Android NDK make文件 - 答案通常是没有。有工具,声称能够做到这一点,但我从来没有成功与任何他们。

As to the question whether you can "automagically" translate your (probably visual studio) project files into an Android NDK make files -- the answer is usually no. There are tools that'll claim to be able to do just that, but I was never successful with any of them.

这篇关于将C ++ opencv项目在计算机上转换为opencv android的步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 04:34