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