Machine Vision

Showing results for 
Search instead for 
Did you mean: 

Using OpenCV library in LabVIEW

Hello all!

I'd like to know how can I use some code I wrote in C/C++, using the OpenCV libraries, in LabVIEW.

Do I have to create a .DLL and load it in LabVIEW? If so, how does LabVIEW handles the different data types, pointers, etc.?

The script nodes (which I'm not very familiar with) of LabVIEW run C code?

Any help would be greatly appreciated.

Thanks in advance!

Message 1 of 49
Hi, Goju-Ryu,
Its not extremely complicated. All what you needed is to calling OpenCV functions. Theoretically you can call these functions directly from LabVIEW, but then you should figure out how to transfer structures from call to call. I prefer usually to create DLL wrapper, which will be called from LabVIEW, and inside of the wrapper you have to place OpenCV calls.
For example how to use Convolution (5x5 fixed kernel - gradient) from OpenCV:
We need to call cvFilter2D in this case.
I will create following code:
In the code above we will send to DLL the pointers of the Src/Dst, LineWidth of each image and Width/Height.
This DLL will be called from LabVIEW like this:
In the attachment you can found complete source code of the example.
Best regards,
Message 2 of 49

Excelent answer Andrey, thank you very much.

I haven't tested it yet... Just one clarification, the code you wrote should then be created in a .dll, that will then be called in LabVIEW, right?

Thanks in advance.

Best regards!

0 Kudos
Message 3 of 49
Exactly. This is call by following chain: LabVIEW>Convolution Test.DLL.dll>CV100.dll (cvFilter2D)
0 Kudos
Message 4 of 49
Dear Sir,
I tested Convolution tester.
In then, I find error message as follows In the attachment
Please check
Sincerely yours,
Bongchan Park
Download All
0 Kudos
Message 5 of 49
Hi, Bongchan,
Just downloaded and checked it. It works without problem.
But you should have OpenCV library already installed, otherwise you can't use it. Provided DLL is the only wrapper to OpenCV.
best regards,
Message 6 of 49

Dear Andrey

Thank you for your response.

Best regards,

Bongchan Park



0 Kudos
Message 7 of 49

Hey everyone, could somebody be as kind as to save this example in a LabView 8.2 Version?

Would be much appreciated!
0 Kudos
Message 8 of 49
Do you have any examples of using Open CV with regular LV to detect a face in a picture?
Tim C.
1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
0 Kudos
Message 9 of 49

Hi Andrey

It is good(ConvolutionTester).

By the Way, How use it in color image?

Best regards,

Bongchan Park


0 Kudos
Message 10 of 49