<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:12pt"><div>in my library ive already written wrappers for these opencv functions <br>create-camera-capture<br>query-frame<br>img-size<br>create-image<br><br>the struct related to create-image is IplImage and i have it defined like this</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: Courier New,courier,monaco,monospace,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: Courier New,courier,monaco,monospace,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: Courier New,courier,monaco,monospace,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: Courier
 New,courier,monaco,monospace,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: Courier New,courier,monaco,monospace,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: Courier New,courier,monaco,monospace,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: Courier New,courier,monaco,monospace,sans-serif; background-color: transparent; font-style: normal;">;; ;(cffi:foreign-type-size '(:struct ipl-image)) = 144<br>(cffi:defcstruct ipl-image<br>    (n-size :int)<br>    (id :int)<br>    (n-channels :int)<br>    (alpha-channel :int)<br>    (depth :int)<br>    (color-model :int) ;;Ignored by OpenCV - was :pointer,
 changed to :int so the struct values would match OpenCV's<br>    (channel-seq :int) ;;Ignored by OpenCV - was :pointer, changed to :int so the struct values would match OpenCV's<br>    (data-order :int)<br>    (origin :int)<br>    (align :int)<br>    (width :int)<br>    (height :int)<br>    (roi (:pointer (:struct ipl-roi)))<br>    (mask-roi :pointer)<br>    (image-id :pointer)<br>    (tile-info :pointer)<br>    (image-size :int)<br>    (image-data :string)<br>    (width-step :int)<br>    (border-mode :pointer)<br>    (border-const :pointer)<br>    (image-data-origin :string))<br><br><br><br><br><br><br>so when i call the above functions and then print the struct values with the below<br>code it looks like
 this<br><br><br><br><br><br><br>CL-OPENCV> (defparameter capture (create-camera-capture 0))<br>(defparameter frame (query-frame capture))<br>(defparameter img-size (get-size frame))<br>(defparameter img (create-image img-size +ipl-depth-8u+ 3))<br>IMG<br>CL-OPENCV> (cffi:with-foreign-slots ((n-size id n-channels <br>                          alpha-channel depth color-model <br>                          channel-seq data-order origin  <br>                          align width height roi
 <br>                          mask-roi image-id tile-info <br>                          image-size image-data width-step <br>                          border-mode border-const image-data-origin) <br><br>                          img (:struct ipl-image))<br>                          (format t "n-size = ~a~%id = ~a~%n-channels =
 ~a~%alpha-channel = ~a~%depth = ~a~%color-model = ~a~%channel-seq = ~a~%data-order = ~a~%origin = ~a~%align = ~a~%width = ~a~%height = ~a~%roi = ~a~%mask-roi = ~a~%image-id = ~a~%tile-info = ~a~%image-size = ~a~%image-data = ~a~%width-step = ~a~%border-mode = ~a~%border-const = ~a~%image-data-origin = ~a~%" <br>                          n-size id n-channels <br>                          alpha-channel depth color-model <br>                          channel-seq data-order origin 
 <br>                          align width height roi <br>                          mask-rOI image-id tile-info <br>                          image-size image-data width-step <br>                          border-mode border-const image-data-origin))<br>n-size = 144<br>id = 0<br>n-channels = 3<br>alpha-channel = 0<br>depth = 8<br>color-model = 4343634<br>channel-seq = 5392194<br>data-order = 0<br>origin = 0<br>align = 4<br>width = 640<br>height = 480<br>roi =
 #.(SB-SYS:INT-SAP #X00000000)<br>mask-roi = #.(SB-SYS:INT-SAP #X00000000)<br>image-id = #.(SB-SYS:INT-SAP #X00000000)<br>tile-info = #.(SB-SYS:INT-SAP #X00000000)<br>image-size = 921600<br>image-data = <br>width-step = 1920<br>border-mode = #.(SB-SYS:INT-SAP #X00000000)<br>border-const = #.(SB-SYS:INT-SAP #X00000000)<br>image-data-origin = NIL<br>NIL<br><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: Courier New,courier,monaco,monospace,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: Courier New,courier,monaco,monospace,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: Courier New,courier,monaco,monospace,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: Courier
 New,courier,monaco,monospace,sans-serif; background-color: transparent; font-style: normal;">I'd rather not have to call  the with-foreign-slots function with all that code every time id like  to access slot values id rather do exactly like in c and call img->depth for example to access the IplImage  struct member depth....Is there a way i can have this exact functionality in lisp with the above struct or any other....if i did have to call (img depth) i guess that would be ok but id rather create  some sort of dereferencing  operator equivelant to do this as easy as in c....either way can someone show me how to dereference pointers in the tiniest way possible like in c<br><br><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: Courier New,courier,monaco,monospace,sans-serif; background-color: transparent; font-style: normal;"><br></div></div></body></html>