09-29-2014 05:15 PM
Hi all,
I am trying to create a DLL to do some image processing using OpenCV. So in the first place, I am trying to create a DLL that can read an image and display it. But I have encountered a problem when I call this DLL in LabVIEW.
The error in LabVIEW says:"Error 1097 occurred at Call Library Function Node in DLL Read Image (Play).vi
Possible reason(s):
LabVIEW: An exception occurred within the external code called by a Call Library Function Node. The exception might have corrupted the LabVIEW memory. Save any work to a new location and restart LabVIEW."
These are the steps that I have followed:
1. Download OpenCV2.4.9 and extract the files. Make proper changes to Environment Variables to include OpenCV.
2. Start a new Microsoft Visual Studio 2010 Project to create a DLL.
3. Add a property sheet to the property manager to include OpenCV Library.
4. Edit the Read Image DLL(Play).cpp code as it is in the attached file.
5. Compile to create the Read Image DLL(Play).dll file.
6. Create a VI in LabVIEW to call the DLL.
Attached are the related files: 1. Read Image DLL(Play).cpp 2. Read Image DLL(Play).dll 3. Read Image DLL(Play).vi
Would anyone kindly help me with this? I suppose it might be the problem with the Read Image DLL(Play).cpp code.
Thanks very much.
1. Attached Read Image DLL(Play).cpp code:
///include necessary image processing opencv libraries
#include "stdafx.h"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <stdio.h>
using namespace std;
using namespace cv;
///function declaration
extern "C" {
_declspec (dllexport) int main( int argc, char** argv );
}
/// Global Variables
Mat img;
_declspec (dllexport) int main( int argc, char** argv )
{
/// Load image
img = imread( argv[1], 1 );
return 0;
}
Solved! Go to Solution.
09-30-2014 12:09 AM
Hello,
if it helps, here are some examples on Labview/OpenCV image processing:
https://decibel.ni.com/content/blogs/kl3m3n
Best regards,
K
10-02-2014 11:51 AM
Hi Klemen,
This is really helpful. And I will look deeper into the details! Thanks a lot!
01-11-2019 08:03 AM
can i detect the face in video stream using open cv in labview without creating dll files??
01-14-2019 10:14 AM - edited 01-14-2019 10:15 AM
Hi soomro,
This thread is over 4 years old. I would recommend creating a new thread with details on your question. If this forum post is part of the problem/solution feel free to link it in your new post.