From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI Vision OpenCV Utilities package: FindContours wrapper

Hi,

we are using NI Vision OpenCV Utilities package to write a wrapper for OpenCV.

Do you have some idea on how to pass the contours generated by the FindContours function back to LabView?

Contours data type is the following:

 

vector<vector<Point> >

 

Thanks in advance for your help

 

 

0 Kudos
Message 1 of 7
(4,217 Views)

Hi MarcoMauri,

can you explain better what do you mean?

You are developing a wrapper in labVIEW, but I don't understand your phrase: "Do you have some idea on how to pass the contours generated by the FindContours function back to LabView?"

If you are developing in LabVIEW, why do you need to pass back a value in LabVIEW? You should already have it...

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

Hi!

I was not clear in my first post: we are developing a wrapper for LabView and not with LabView.

It's not easy to call the FindContour function of OpenCv directly in LabView,

so we are developing a wrapper in Visual C compiled as a DLL.

The function FindContour is called in our wrapper and then the result needs to be passed back to LabView.

Since it is not a simple data type but an array of arrays of points, this is quite tricky.

 

 

0 Kudos
Message 3 of 7
(4,081 Views)

Hi MarcoMauri,

as you know, with the "CallLibraryFunction" node you can get only simple data types and pointers. I suggest you to share out  the memory location's pointer of your function result. In LabVIEW you can access the data using the MoveBlock function.

 

Have a look on these links:

http://www.ni.com/example/27242/en/

http://forums.ni.com/t5/Developer-Center-Resources/Dereferencing-Pointers-from-C-C-DLLs-in-LabVIEW/t...

 

You will find some explenations and examples!

 

Good luck!

 

Stefano Fois

0 Kudos
Message 4 of 7
(4,063 Views)

I have the same question. Do you find a way to solve the problem?

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

Here attached I've put some sample code, I hope this helps.

You'll need to include some libreries to compile it, for instance:

#include <C:\Program Files (x86)\National Instruments\NIVision OpenCV Utilities\nivisionextlib\include\NIVisionExtLib.h>
#include "C:\Program Files (x86)\National Instruments\NIVision OpenCV Utilities\nivisionextlib\include\lv_prolog.h"

 

Hope this helps,

Marco

Message 6 of 7
(2,229 Views)

Hi Marco,

 

I am currently trying to tackle exactly the same problem. There are still some undefined types in your code like 'LVArrayOfArray' and 'LV_Array_XYPoint_Int'. Would you mind sharing your .h file?

0 Kudos
Message 7 of 7
(1,335 Views)