I was also wondering about the possibility of wrapping OpenCV's C++ interface in C and then wrapping that in Lisp so I could add all the C++ functionality as well to my cl-opencv wrapper because I would like to make it complete.... Also wondered if I do that, can I use the C++ wrapper with the C wrapper in lisp ....if it is possible if you could show me a quick example program, like an open window and show a picture function, only in c and c++ together ....like using cv::namedWindow instead of cvNamedWindow and all the other parts being c .....here is my attempt the program below runs when i use cv::namedWindow only but fails with
shape.cpp:37:32: error: invalid initialization of
reference of type ‘cv::InputArray {aka const cv::_InputArray&}’
from expression of type ‘IplImage* {aka _IplImage*}’In file included from
/usr/local/include/opencv/highgui.h:48:0,
from shape.cpp:4:
/usr/local/include/opencv2/highgui/highgui.hpp:78:19: error:
in passing argument 2 of ‘void cv::imshow(const string&, cv::InputArray)’
Compilation exited abnormally with code 1 at Thu Sep 26 21:18:00
when i add cv::imshow
#include <cv.h>
#include <highgui.h>
using namespace std;
int main(){
CvCapture* capture =0;
capture = cvCaptureFromCAM(0);
if(!capture){
printf("Capture failure\n");
return -1;
}
IplImage* frame=0;
cv::namedWindow("Video");
// cout << "colorModel = " << endl << " " << size << endl << endl;
while(true){
frame = cvQueryFrame(capture);
if(!frame) break;
frame=cvCloneImage(frame);
cv::imshow("Video", frame );
cvReleaseImage(&frame);
//Wait 50mS
int c = cvWaitKey(10);
//If 'ESC' is pressed, break the loop
if((char)c==27 ) break;
}
cvDestroyAllWindows() ;
cvReleaseCapture(&capture);
return 0;
}
I'd like to know if it would be doable...like be 100% sure before i start, that i could at least wrap every c++ function in c and wrap that with lisp..or if u think id run into snags in some places or even impossibilities.....and also would wrapping it twice make it slow? and id the c interface better/worse than the c++..or can i accomlish everything in the c interface that i can in c++
i ask this because in the swig and cffi documentation it says the c++ support is not complete.
oh yeah and i also tried running the above code with all these headers
#include <cv.h>
#include <highgui.h>
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
and still get above error
extern "C" ...
declarations and maybe work from there, although this is really just the gut feeling.