Forums - How to reference FastCV in C# WP8 Project

6 posts / 0 new
Last post
How to reference FastCV in C# WP8 Project
Franva
Join Date: 3 Mar 14
Posts: 9
Posted: Wed, 2014-03-05 08:22
Update 1:
 
I am wondering whether I can reference to a .lib file, but it seems that I cannot. If this is true, and I have no source code of the C++ project, How can I use its methods? Btw, I'm using FastCV library.
 
I come across a situation that I need to call C++ methods from C# code. The C++ generated files structure:
 
 lib
 --libfastcv.lib
 --vc120.pdb inc
 --fastcv.h
 --fastcv.inl
 --stdint.h
I know how to call C++ methods from C# :
 
[DllImport("libfastcv.lib",CallingConvention=CallingConvention.Cdecl)]
public static extern <ReturnType> <MethodName>(<Parameters>);
But I think the .h and .inl files need to be included in my C# project as well. So how to include them?
 
Thank you very much.
  • Up0
  • Down0
krishanu6690
Join Date: 24 Nov 13
Posts: 10
Posted: Mon, 2014-03-10 00:52

1.  Create a  C++ header file:   fastcv_c#.h
    This file contents will look something like this:
    #include "fastcv\fastcv.h"
    //<fastcv headers>
   
    namespace fastcv_c#
    {
            puclic ref class FASTCV_c#
            {
                 public :
                 <constructor declarations>;
                 <API declarations>;
            }
    }
    Please include the proper path to <fastcv headers > and <fastcv lib> in the properties option of Visual Studio
2.  Create a C++ source file containing the API definitions.
3.  Refer this C# project :For instance:
     using fastcv_c#;
         

  • Up0
  • Down0
Franva
Join Date: 3 Mar 14
Posts: 9
Posted: Mon, 2014-03-10 04:11

Hi Krishanu,

 

Thank you very much for your help.

 

I will follow your instruction and give a try, and keep you posted.

 

Btw, I just wonder why QualComm doesn't provide C# Dlls directly to save our time and efforts. I will gradful if they could do so.

 

Cheers,

Winston

  • Up0
  • Down0
Franva
Join Date: 3 Mar 14
Posts: 9
Posted: Sat, 2014-03-15 06:37

Hi krishanu6690,

 

Thank you very much for your reply.

 

Now, I just back to my home and found that I do not know how to write the constructor declarations and API declarations.

I want to detect faces. So I am gratefull if you could give an example of the header file?

I am looking forward to your reply.

 

Best regards,

 

Franva

  • Up0
  • Down0
Franva
Join Date: 3 Mar 14
Posts: 9
Posted: Sat, 2014-03-15 06:58

Hi 

Sorry for asking so many questions, but here is another one.

 

The 2nd step you mentioned : Create a C++ source file containing the API definitions.

What does the C++ source file containing the API definitions look like?

 

  • Up0
  • Down0
Franva
Join Date: 3 Mar 14
Posts: 9
Posted: Sat, 2014-03-15 07:09

Hi krishanu6690,

 

After seeking face detection methods in the fastcv.h for several minutes, I just cannot find any.

I highly appreciate that if you could write me a small but completely example which contains the .h file, C++ file and C# files in a C# Windows Phone 8 project.

 

Thank you again.

 

Best regards,

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.