gpt4 book ai didi

C# 解释器。用于 C++ 中的事件形状模型库

转载 作者:太空宇宙 更新时间:2023-11-04 12:22:24 24 4
gpt4 key购买 nike

Stasm (http://www.milbo.users.sonic.net/stasm/index.html) 是一个 C++ 库,用于在图像上查找特征,应用事件形状模型的概念。

我正在尝试使用 stasm DLL (stasm_dll) 上的 AsmSearchDll,如 this在 C# 项目上。在 C++ 中,原型(prototype)是

void AsmSearchDll(
int *pnlandmarks, // out: number of landmarks, 0 if can't get landmarks
int landmarks[], // out: the landmarks, caller must allocate
const char image_name[], // in: used in internal error messages, if necessary
const char image_data[], // in: image data, 3 bytes per pixel if is_color
const int width, // in: the width of the image
const int height, // in: the height of the image
const int is_color, // in: 1 if RGB image, 0 if grayscale
const char conf_file0[], // in: 1st config filename, NULL for default
const char conf_file1[]); // in: 2nd config filename, NULL for default, "" for none

我在 C# 中使用这个

[DllImport(@"..\data\stasm_dll.dll")]
public static extern void AsmSearchDll(
out int pnlandmarks, // out: number of landmarks, 0 if can't get landmarks
out int[] landmarks, // out: the landmarks, caller must allocate
[MarshalAs(UnmanagedType.LPStr)]string imagename, // in: used in internal error messages, if necessary
byte[] imagedata, // in: image data, 3 bytes per pixel if is_color
int width, // in: the width of the image
int height, // in: the height of the image
int is_color, // in: 1 if RGB image, 0 if grayscale
[MarshalAs(UnmanagedType.LPStr)]string conf_file0, // in: 1st config filename, NULL for default
[MarshalAs(UnmanagedType.LPStr)]string conf_file1 // in: 2nd config filename, NULL for default, "" for none
);

函数开始读取配置文件,但随后退出程序。我不知道发生了什么事。有什么建议吗?

最好的问候

最佳答案

我试图将相同的函数绑定(bind)到 python,但没有成功。

在将指针传递给函数之前,您必须首先分配地标数组和一个 int。

该功能需要很多配置文件在../data/,确保它在那里。

图像名称字符串实际上应该是图像的文件路径。别开玩笑了。它加载它并对其进行任何处理。顺便说一句,imagedata 必须指向分配的内存......

关于C# 解释器。用于 C++ 中的事件形状模型库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4306649/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com