如何从 Xamarin(Android 和 iOS)使用 OpenCV? [英] How to use OpenCV from Xamarin (Android and iOS)?

查看:55
本文介绍了如何从 Xamarin(Android 和 iOS)使用 OpenCV?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 Xamarin 为 iOS 和 Android 创建一个移动应用程序,我想调用一些 OpenCV 函数(例如,轮廓检测和透视变换).

I would like to create a mobile app using Xamarin for both iOS and Android, and I would like to call a few OpenCV functions (for example, contour detection and perspective transform).

我大致了解从C#调用C++函数的过程,但不知道如何从OpenCV 二进制文件适用于 iOS 和 Android.有一个 OpenCvSharp 的分支 支持 Xamarin.Android,但不支持 Xamarin.iOS.

I generally understand the process of calling C++ functions from C#, but I don't know how to do this from the OpenCV binaries provided for iOS and Android. There's a fork of OpenCvSharp that supports Xamarin.Android, but it doesn't support Xamarin.iOS.

我不打算将整个 OpenCV 库移植到 Xamarin(目前).我只是想调用一个非常小的函数子集.

I'm not looking to port the entire OpenCV library to Xamarin (yet). I'm just looking to call a very small subset of functions.

推荐答案

对于 iOS,您应该自己为 Objective-C 提供绑定.这是一个如何做的例子,代码不是我的.

For iOS you should provide binding for Objective-C yourself. Here is an example of how to do, code is NOT mine.

https://github.com/trinnguyen/xamarin.ios-opencv

这是一篇描述步骤的文章:https://chamoda.com/how-to-use-opencv-with-xamarin-ios/

Here is an article describing the steps: https://chamoda.com/how-to-use-opencv-with-xamarin-ios/

[BaseType(typeof(NSObject))]
interface OpenCV
{

    [Export("version:")]
    NSString Version();

}

private OpenCV OpenCV = new OpenCV();

Console.WriteLine(OpenCV.Version());

这篇关于如何从 Xamarin(Android 和 iOS)使用 OpenCV?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆