Code: Select all
CV_INLINE CvSize cvSize( int width, int height )
i created a cl-opencv-glue.c file and adding this
Code: Select all
CvSize cvSize_glue(int width, int height)
{
return cvSize(width, height);
}
Code: Select all
/* CvSize cvSize(int width, int height) */
CvSize cvSize_glue(int width, int height);
Code: Select all
/usr/local/lib/libcl-opencv-glue.so
then created a wrapper for the glue function like this:
Code: Select all
;; CvSize cvSize(int width, int height)
(cffi:defcfun ("cvSize_glue" size) (:pointer (:struct cv-size))
"Constructs CvSize structure."
(width :int)
(height :int))
Code: Select all
(defun init-image-header-example (&optional (width *default-width*)
(height *default-height*))
"Initializes an image header that was previously allocated."
(let* ((img-size (size width height))
(image (create-image img-size +ipl-depth-8u+ 3))
(image-re-init (init-image-header image img-size
+ipl-depth-8u+ 3
+ipl-origin-tl+ 4))
(window-name "INIT-IMAGE-HEADER Example"))
(named-window window-name +window-normal+)
(move-window window-name 702 285)
(create-data image-re-init)
(show-image window-name image-re-init)
(loop while (not (= (wait-key 0) 27)))
(release-image image-re-init)
(destroy-window window-name)))
Code: Select all
(img-size (size width height))
Code: Select all
(create-image img-size +ipl-depth-8u+ 3)
Code: Select all
;; IplImage* cvCreateImage(CvSize size, int depth, int channels)
(cffi:defcfun ("cvCreateImage" create-image) (:pointer (:struct ipl-image))
(size (:pointer (:struct cv-size)))
(depth :int)
(channels :int))
Code: Select all
CL-OPENCV> (defparameter size (size 1280 1024))
SIZE
CL-OPENCV> size
#.(SB-SYS:INT-SAP #X40000000500)
CL-OPENCV>
so i attempt to get at the slots by running at the repl(w/ output)
Code: Select all
CL-OPENCV> (cffi:with-foreign-object (size '(:struct cv-size))
;; Initialize the slots
;; Return a list with the coordinates
(cffi:with-foreign-slots ((width height) size (:struct cv-size))
(list width height)))
Output > (754484 0)
Code: Select all
(754484 0)
Code: Select all
(cffi:defcstruct cv-size
(width :int)
(height :int))
here is how they are defined in /home/w/Downloads/opencv-2.4.6.1/modules/core/include/opencv2/core/types_c.h:
Code: Select all
typedef struct CvSize
{
int width;
int height;
}
CvSize;
CV_INLINE CvSize cvSize( int width, int height )
{
CvSize s;
s.width = width;
s.height = height;
return s;
}
Code: Select all
CvSize cvSize_glue(int width, int height)
{
cvSize(width, height);
}
Code: Select all
(cffi:with-foreign-object (size '(:struct cv-size))
;; Initialize the slots
;; Return a list with the coordinates
(cffi:with-foreign-slots ((width height) size (:struct cv-size))
(list width height)))
Output > (338509 0)
Code: Select all
(754484 0)
Code: Select all
(cffi:defcstruct cv-size
(width :int)
(height :int))
Code: Select all
:struct cv-size, (:struct cv-size), (:pointer (:struct cv-size)), :struct cv-size
Code: Select all
CL-OPENCV> (defparameter size (size 1280 1024))
SIZE
CL-OPENCV> size
#.(SB-SYS:INT-SAP #X40000000500)
CL-OPENCV> (cffi:with-foreign-slots ((width height)
size (:struct cv-size))
(format t "width = ~a~%height = ~a~%"
width height ))
Code: Select all
[Condition of type SB-SYS:MEMORY-FAULT-ERROR]
Any help on this would be much appreciated...