So I have an .hpp
file that I'm planning to use in swig, but said file has a template (Mat_<float>
to be exact), but whenever I run swig
I end up getting:
example.hpp::30: Error: Syntax error in input(1).
With line 30 being:
Mat_<float> measurement(8,1);
I'm not very familiar with c++ (and using cv2
for this one particular project isn't really possible), and from what I've found I need to define the template in my .i file, but looking through the examples, I wasn't quite sure how I should go about doing that. Any help?
My .i file:
%module example
%include <opencv.i>
%cv_instantiate_all_defaults
%{
#include "example.hpp"
%}
%include "example.hpp"
(I'm using opencv-swig for the OpenCV part)
Commands for compiling/building:
swig -I/home/me/Documents/.../opencv-swig/lib/ -I/usr/include -python -c++ example.i
g++ -shared -std=c++1z -fpic example_wrap.cxx $(pkg-config --cflags --libs python3) $(pkg-config --libs opencv) -o _example.so