LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

importing .NET DLL

Hello, i am trying to import a .NET DLL into labview, please consider me absolute beginner in doing this. i am trying to bring a DLL into labview to achieve the same 

 

i use "contructor node", i am able to see all funciton name inside(which is good).

 

in the native environment, i experimented the DLL, so i believe the DLL is in good condition:

 

source code in native environment:

$from = OpenCV_LoadImageFromFile("c:\from.jpg");
$search = OpenCV_LoadImageFromFile("c:\search.jpg");


($conf,$x,$y,$corres) = OpenCV_MatchTemplate($from,$search,"CCO",false)
printf($conf);
printf($x);
printf($y);

 

the code above will output 3 things to the screen, is number.

 

maybe this is easy to do, but i do not know how to bring that DLL into labview.

please guide me how can i do this in labview?

Thank you

 

0 Kudos
Message 1 of 7
(2,607 Views)

What OpenCV implementation is that?

 

That dll is not a .net assembly at all. It's a regular 32 bit dll. So you can't use it as a .net dll.

 

I've been using OpenCVSharp. Not too straight forward either, but it works.

0 Kudos
Message 2 of 7
(2,578 Views)

thats weird, 

if i use .NET contructor node, i can see all the function i need, as picture show.

 

but if i use call library function, then even i tried to manually write the function name in, for example "OpenCV_GetColorIntensity", it always contain error.

 

assuming it is regular 32-bit dll, how should i set it to call that dll? i wish to could replicate the sequence in labview

 

Thank you

0 Kudos
Message 3 of 7
(2,559 Views)

@jackson_thom wrote:

thats weird, 

if i use .NET contructor node, i can see all the function i need, as picture show.


That is not a .net constructor node. It's a call library function node. You didn't get it from the .net palette...

EDIT: sorry just saw the right half.

 

I did try a .net constructor node, and didn't see any names. In fact, I got an error more or less stating it's not a .net assembly.

 


@jackson_thom wrote:

but if i use call library function, then even i tried to manually write the function name in, for example "OpenCV_GetColorIntensity", it always contain error.


The image shows the call library function node...

 

If you see names in a CLFN, it's not a .net assembly, and vice versa.

 

The dll might not be compiled with other languages in mind. If you compile a C++ dll, by default you'll get c++ function names. Those names are mangled, and not usable in LabVIEW. 

 

 


@jackson_thom wrote:

assuming it is regular 32-bit dll, how should i set it to call that dll? i wish to could replicate the sequence in labview


That might not be possible without a recompile of the dll.

 

 

I think it might be a .net assembly, but one that links to a 32 bit regular dll. That's why I can't load it (or test it).

0 Kudos
Message 4 of 7
(2,544 Views)

To get the OpenCV_LoadImageFromFile function, either select it, and then select one of the constructors at the bottom.

 

If there are no constructors at the bottom, create a .net constant, select the OpenCV_LoadImageFromFile class. Then wire an invoke node (and\or a property) node to it. Then you might get a method that is static. Static methods don't need instantiation.

 

Lets try that first...

0 Kudos
Message 5 of 7
(2,540 Views)

a.png

 

when i load .NET contructor, i am able to see all list of function. OpenCV_LoadImageFromFile was listed there.

 

how to feed the file location to it?

how to get the output ref? this ref will be used by other function as reference.

something like replicating the line below:

 

$ref_file_from = OpenCV_LoadImageFromFile("c:\from.jpg");

 

I tried to printf($ref_file_from);

im getting this string below:

Emgu.CV.Image`2[Emgu.CV.Structure.Bgr,System.Byte]

 

maybe if i can store this string as ref and pass it as input to other function?

0 Kudos
Message 6 of 7
(2,501 Views)

Make a constant of those inputs.

 

Then, and this is tricky, wire the constant to the upper left to a constructor node (this is NOT an input, but wire it anyway). See if there are constructors. If not, wire it to a property and\or invoke node to see what options you have.

 

system.byte can perhaps be created by LabVIEW, by converting a byte to a .net object.

0 Kudos
Message 7 of 7
(2,484 Views)