LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help to make opencv's dll and LabVIEW's Call Library function node understanding each others

Hi, i have a little problem trying to use a C++ opencv's dll in labview. I wrote a really simple and stupid dll just to try to understand how it works the call library function node. Here the header code:

#ifdef GENERICDLL_EXPORTS
#define GENERICDLL_API __declspec(dllexport)
#else
#define GENERICDLL_API __declspec(dllimport)
#endif

#include "stdafx.h"

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <opencv/cv.h>
#include <opencv/highgui.h>

// Questa classe è esportata da Generic DLL.dll
class GENERICDLL_API CGenericDLL {
public:
	int Summ(int a, int b);
	int Sott(int a, int b);
	int opencv(int a);
	// TODO: aggiungere qui i metodi.
};

 and here the .cpp:

// Generic DLL.cpp: definisce le funzioni esportate per l'applicazione DLL.
//

#include "stdafx.h"
#include "Generic DLL.h"

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <opencv/cv.h>
#include <opencv/highgui.h>

using namespace cv;
using namespace std;


// Esempio di variabile esportata
GENERICDLL_API int nGenericDLL=0;

// Funzioni esportate.
GENERICDLL_API int Summ(int a, int b)
{
	return a+b;
}

GENERICDLL_API int Sott(int a, int b)
{
	return a - b;
}

GENERICDLL_API int opencv(int a)
{
	const string ind = "C:\\Users\\sviluppo\\Desktop\\Tuli.bmp";
	const string ind_2 = "C:\\Users\\sviluppo\\Desktop\\Tuli_Gray.bmp";

	//Mat image;
	

	return 5;
}

 

i can call all the three simple functions in labview with this easy code. No problem at all. If i uncomment the line "Mat image;" the call library function node doesn't work and i receive the error:

 

"The library specified for this node cannot be found or cannot be loaded. Right-click the Call Library Function node and select Configure, then choose the correct library name or path."

 

I think that is a problem of dependencies between opencv libraries but i dont know how to manage this. Any ideas?

 

Thank you for yours time,

Francesco.

0 Kudos
Message 1 of 4
(3,876 Views)

Hi Francesco,

 

maybe you could take a look at this post

 

http://forums.ni.com/t5/Machine-Vision/Using-OpenCV-library-in-LabVIEW/td-p/648429

 

It could be useful.

 

Clara

0 Kudos
Message 2 of 4
(3,819 Views)

Thank you Loura, it was only a stupid dependence error that brought me a little trouble. Now it work. Thank you anyway.

 

Francesco.

0 Kudos
Message 3 of 4
(3,816 Views)

Hello Francesco,

 

I'm having exactly the same problem as you. I created a DLL that I can easily access from LabView. If I add one line and include "imgproc.hpp" (the only one I need), then LV gives me the same error you had. I read the thread Loura linked to, but I don't see how people actually take care of the dependecies (Klemen's examples did not work for me for the same reason, even though I recompiled the .cpp). Could you explain in detail what you did to make it work?

 

Thanks

0 Kudos
Message 4 of 4
(3,561 Views)