title: C# Interp. for Active Shape Models library in C++
body: <p>Stasm (http://www.milbo.users.sonic.net/stasm/index.html) is a C++ library for finding features on image, applying the concept of active shape models. </p>
  
  <p>I am trying to use AsmSearchDll which is on stasm DLL (stasm_dll) like <a href="http://www.milbo.users.sonic.net/stasm/opencv.html" rel="nofollow">this</a> on a C# project. In C++ the prototype is </p>
  
  <pre><code>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
  </code></pre>
  
  <p>I am using this in C# with this</p>
  
  <pre><code>[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
      );
  </code></pre>
  
  <p>The function starts to read the config files, but then it quits the program. I can't figure out what is going on. Any suggestions?</p>
  
  <p>Best regards</p>