not sure of the wording on this so pls bear with me
in OpenCV when you want to create an image you do this
IplImage* img=cvCreateImage(cvGetSize(imgHSV),IPL_DEPTH_8U, 1);
or you can do this
img=cvCreateImage(cvGetSize(imgHSV),IPL_DEPTH_8U, 1);
if you've already called the below first
IplImage* img;
my question is...since i already wrapped cvCreateImage
with this successfully
;; IplImage* cvCreateImage(CvSize size, int depth, int channels)
(cffi:defcfun ("cvCreateImage" %create-image) (:pointer (:struct ipl-image))
(size :int64)
(depth :int)
(channels :int))
(defun create-image (size depth channels)
"Create an image with dimensions given by SIZE, DEPTH bits per
channel, and
CHANNELS number of channels."
(let ((nsize (size->int64 size)))
(%create-image nsize depth channels)))
and i use
it all the time successfully, converting c opencv code into lisp in many programs...and have never once did this
IplImage* img;
I always call it in a let like this
(img (create-image sz +ipl-depth-8u+ 3))
but if i wanted to expose this kind of functionality in lisp where i would call i/e
(ipl-image img) first before calling (img (create-image sz +ipl-depth-8u+ 3)) how would i do that
I tried writing a glue wrapper in c
IplImage* IplImage_glue(int img)
{
return (IplImage *) img;
}
here is my repl history after that was compiled into a .so(ubuntu raring)
CL-OPENCV> ;; IplImage*
IplImage_glue(IplImage* img);
(cffi:defcfun ("IplImage_glue" ipl-image) (:pointer (:struct ipl-image))
(img (:pointer (:struct ipl-image))))
IPL-IMAGE
CL-OPENCV> (dp img (cffi:null-pointer))
IMG
CL-OPENCV> (ipl-image img)
#.(SB-SYS:INT-SAP #X00000000)
CL-OPENCV> (cffi:with-foreign-slots ((n-size)
img (:struct ipl-image))
(format t
"n-size = ~a~%"
n-size))
every thing runs up until the with-foreign-slots then..
Unhandled memory fault at #x0.
[Condition of type SB-SYS:MEMORY-FAULT-ERROR]
..i assume because im not accessing a ipl-image struct pointer but maybe i am.....any help is appreciated