Stasm (http://www.milbo.users.sonic.net/stasm/index.html) est une bibliothèque C++ permettant de rechercher des entités sur une image, en appliquant le concept de modèles de formes actifs.C# Interp. pour la bibliothèque Active Shape Models en C++
J'essaie d'utiliser AsmSearchDll qui se trouve sur stasm DLL (stasm_dll) comme this sur un projet C#. En C++ le prototype est
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
J'utilise cela en C# avec ce
[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
);
La fonction commence à lire les fichiers de configuration, mais il quitte le programme. Je ne peux pas comprendre ce qui se passe. Aucune suggestion?
Meilleures salutations
Avez-vous pu résoudre ce problème? Si oui, comment l'avez-vous résolu? Je fais face au même problème, et ça me rend fou. – Syma
je ne me souviens pas, désolé. Mais essayez d'allouer des pnlandmarks et des repères en premier ... – jose