<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:12pt"><pre style="" class="default prettyprint prettyprinted"><code><span class="pln"> CL</span><span class="pun">-</span><span class="pln">OPENCV</span><span class="pun">></span><span class="pln"> 
 </span><span class="pun">;;</span><span class="pln"> </span><span class="pun">(</span><span class="pln">cffi</span><span class="pun">:</span><span class="pln">foreign</span><span class="pun">-</span><span class="pln">type</span><span class="pun">-</span><span class="pln">size </span><span class="str">'(:struct cv-size)) = 8
 (cffi:defcstruct (cv-size :class cv-size-type)
   (width :int)
   (height :int))



 (defmethod cffi:translate-from-foreign (p (type cv-size-type))
   (let ((plist (call-next-method)))
     (make-size :width (getf plist '</span><span class="pln">width</span><span class="pun">)</span><span class="pln">
                </span><span class="pun">:</span><span class="pln">height </span><span class="pun">(</span><span class="pln">getf plist </span><span class="str">'height))))

 (defmethod cffi:translate-to-foreign (value (type cv-size-type))
   (let ((plist ()))
     (setf (getf plist '</span><span class="pln">width</span><span class="pun">)</span><span class="pln"> </span><span class="pun">(</span><span class="pln">size</span><span class="pun">-</span><span class="pln">width value</span><span class="pun">)</span><span class="pln">
           </span><span class="pun">(</span><span class="pln">getf plist </span><span class="str">'height) (size-height value))
     (call-next-method plist type)))



 ;; CvSize cvGetSize(const CvArr* arr)
 (cffi:defcfun ("cvGetSize" get-size) (:struct cv-size)
   (arr (:pointer cv-arr)))


 ;; IplImage* cvCreateImage(CvSize size, int depth, int channels)
 (cffi:defcfun ("cvCreateImage" create-image) (:pointer (:struct  ipl-image))
   (size (:struct cv-size))
   (depth :int)
   (channels :int))


 STYLE-WARNING: redefining CL-OPENCV:GET-SIZE in DEFUN
 STYLE-WARNING: redefining CL-OPENCV:CREATE-IMAGE in DEFUN
 CREATE-IMAGE
 CL-OPENCV> (defparameter capture (create-camera-capture 0))
 (defparameter frame (query-frame capture))
 (defparameter img-size (get-size frame))
 (defparameter img (create-image img-size +ipl-depth-8u+ 3))</span></code></pre></div></body></html>