I am trying to create a wrapper file using SWIG for C++ code and call it in python on raspberry pi Linux platform The C++ code contains uEye IDS camera in built function. I am using QT creator and openCV.
To generate wrapper file I have used source : https://mit-crpg.github.io/OpenMOC/devguide/swig.html and it works fine for normal c++ code. Now when I try generating wrapper for IDS camera I get error: Import error:./filename.so: undefined symbol: is_InitCamera. I am not sure how I am supposed to correct it.
exam.i - Interface file-
%module exam
%{
#define SWIG_FILE_WITH_INIT
#include "exam.h"
%}
%include "exam.h"
exam.h - Header file-
#include <iostream>
#include <ueye.h>
#include <opencv2/opencv.hpp>
double cam (int a);
exam.cpp - Source file -
#include"exam.h"
using namespace std;
double cam(int a)
{
int nRet = 0;
int nMemoryId = 0;
HIDS hCam = a;
HWND hWndDisplay = 0;
nRet = is_InitCamera(&hCam, hWndDisplay);
if (nRet != IS_SUCCESS)
{
cout << "ERROR" << endl;
}
else
{
cout << "Camera initialisation was successful!" << endl << endl;
}
// Disables the hCam camera handle and releases the data structures and memory areas taken up by the uEye camera
nRet = is_ExitCamera(hCam);
if (nRet == IS_SUCCESS)
{
cout << "The camera has been successfully logged off!" << endl << endl;
}
system("pause");
return 1;
}