can i wrap OpenCV's c++ interface with c and then wrap that with Lisp's CFFI?
I was also wondering about the possibility of wrapping 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++
No comments:
Post a Comment