C#Interp。对于C++;
斯塔姆(http://www.milbo.users.sonic.net/stasm/index.html是一个C++的库,用于查找图像上的特征,应用主动形状模型的概念。 我正在尝试使用AsmSearchDll,它位于statsm DLL(statsm#u DLL)上,就像在C#项目上一样。在C++中,原型是C#Interp。对于C++;,c#,c++,interop,dllimport,C#,C++,Interop,Dllimport,斯塔姆(http://www.milbo.users.sonic.net/stasm/index.html是一个C++的库,用于查找图像上的特征,应用主动形状模型的概念。 我正在尝试使用AsmSearchDll,它位于statsm DLL(statsm#u DLL)上,就像在C#项目上一样。在C++中,原型是 void AsmSearchDll( int *pnlandmarks, // out: number of landmarks, 0 if can't get landmarks int
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
);
函数开始读取配置文件,但随后退出程序。我不知道发生了什么事。有什么建议吗
致以最诚挚的问候我试图将同一个函数绑定到python,但没有成功 在将指针传递给函数之前,必须首先分配landmarks数组和int 函数需要../data/中的大量配置文件,请确保它在那里
imagename字符串实际上应该是图像的文件路径。别开玩笑了。它加载并处理它。顺便说一句,imagedata必须指向分配给 我试图将同一个函数绑定到python,但没有成功 在将指针传递给函数之前,必须首先分配landmarks数组和int 函数需要../data/中的大量配置文件,请确保它在那里
imagename字符串实际上应该是图像的文件路径。别开玩笑了。它加载并处理它。顺便说一句,imagedata必须指向分配给 你能解决这个问题吗?如果是,你是如何解决的?我面临着同样的问题,这让我发疯。对不起,我不记得了。但是试着先分配地标和地标…你能解决这个问题吗?如果是,你是如何解决的?我面临着同样的问题,这让我发疯。对不起,我不记得了。但是试着先分配地标和地标。。。