Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9150273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:35:26+00:00 2026-06-17T11:35:26+00:00

‘using System; ‘using System.Collections.Generic; ‘using System.Drawing; ‘using System.Windows.Forms; ‘using Emgu.CV; ‘using Emgu.CV.Structure; ‘using Emgu.CV.CvEnum;

  • 0
'using System;
'using System.Collections.Generic;
'using System.Drawing;
'using System.Windows.Forms;
'using Emgu.CV;
'using Emgu.CV.Structure;
'using Emgu.CV.CvEnum;
'using System.IO;
'using System.Diagnostics;
'using System.Runtime.InteropServices;

'namespace FaceStat   
'{
   'class Form1 : Form
   {
      // public static extern void AsmSearchDll(out int nlmarks, out int lmarks, string imgname, byte imgdata, int width, int height, int is_color, string conf_file0, string conf_file1);
      [DllImport(@"../data/stasm_dll.dll")]
      public static extern void AsmSearchDll( 
         out int pnlandmarks, // out: number of landmarks, 0 if can't get landmark
         out int[] landmarks, // out: the landmarks, caller must allocate
         [MarshalAs(UnmanagedType.LPStr)]string image_name, // in: used in internal error messages, if necessary
         [MarshalAs(UnmanagedType.LPStr)]string image_data, // 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
     );        
     static void Main(string[] args)
     {            
         string image_name = "../data/Chupul.jpg";
         IplImage img = cvlib.cvLoadImage(image_name, cvlib.CV_LOAD_IMAGE_COLOR);

         if (img == null)
         {
            Console.Write("Error: Can't open the image. {0}\n", image_name);
            return;
         }

         int nlandmarks;
         int[] landmarks = new int[500]; // space for x,y coords of up to 250 landmarks
         AsmSearchDll(out nlandmarks, out landmarks, image_name, img.imageData, img.width, img.height, 1, null, null);
         if (nlandmarks == 0)
         {
             Console.Write("\nError: Cannot locate landmmarks in {0}\n", image_name);
             return;
         }

         int[] p = landmarks;            

         cvlib.cvPolyLine(img, p, nlandmarks, 1, true, cvlib.CV_RGB(255,0,0));

         cvlib.cvShowImage("Asm example", img);
         cvlib.cvWaitKey(0);
         cvlib.cvDestroyWindow("Asm example");
         cvlib.cvReleaseImage(img);

         return;              
      }
   }
'}

I’ve got 6 errors

  1. The best overloaded method match for ‘FaceStat.Form1.AsmSearchDll(out int, out int[], string, string, int, int, int, string, string)’ has some invalid arguments

  2. argument 4 cannot convert from ‘System.IntPtr’ to ‘string’

  3. The best overloaded method match for ‘cvlib.cvPolyLine(CvArr, CvPoint[], int[], int, int, CvScalar)’ has some invalid arguments

  4. argument 2 cannot convert from ‘int[]’ to ‘CvPoint[]’

  5. argument 3 cannot convert from ‘int’ to ‘int[]’

  6. Argument 5: cannot convert from ‘bool’ to ‘int’

Thanks

The C++ dll

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, "" if none
)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:35:27+00:00Added an answer on June 17, 2026 at 11:35 am
    [DllImport(@"../data/stasm_dll.dll")]
    internal static extern void AsmSearchDll
    ( 
        [Out] out Int32 pnlandmarks,
        [Out] out Int32[] landmarks,
        [In, MarshalAs(UnmanagedType.LPStr)] String image_name,
        [In, MarshalAs(UnmanagedType.LPStr)] String image_data,
        [In] Int32 width,
        [In] Int32 height,
        [In] Int32 is_color,
        [In, MarshalAs(UnmanagedType.LPStr)] String conf_file0,
        [In, MarshalAs(UnmanagedType.LPStr)] String conf_file1
    );
    
    IplImage img = cvlib.cvLoadImage(image_name, cvlib.CV_LOAD_IMAGE_COLOR);
    String imageData = Marshal.PtrToStringAnsi(img.imageData);
    
    AsmSearchDll(out nlandmarks, out landmarks, image_name, imageData, img.width, img.height, 1, null, null);
    

    You didn’t specified cvPolyLine… so I can’t check arguments. Anyway… you are just passing wrong value types to your method. As simple as this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm creating a web service to transfer json to an iPhone app. I'm using
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have the following tasks in my deploy.rb namespace :unicorn do desc stop unicorn
I have just tried to save a simple *.rtf file with some websites and
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I've got a string that has curly quotes in it. I'd like to replace
I am doing a simple coin flipping experiment for class that involves flipping a
I am trying to create a RegEx expression that will successfully parse the following
I would like to run a str_replace or preg_replace which looks for certain words

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.