CL-OPENCV>;;(cffi:foreign-type-size '(: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 'width):height (getf plist 'height)))) (defmethod cffi:translate-to-foreign (value (type cv-size-type)) (let ((plist ())) (setf (getf plist 'width)(size-width value)(getf plist '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))