getting Error when wrapping cvCreateTrackbar with CFFI?
Posted: Tue Sep 03, 2013 11:46 pm
I need to understand how to get past this type of error
The value 0 is not of type SB-SYS:SYSTEM-AREA-POINTER. [Condition of type TYPE-ERROR]
I'm getting it because of the 0 in my create-trackbar call in the function below
this funtion works without the create-trackbar line
(defun display (filename)
"Open the image FILENAME and show it in a window."
(let* ((img (load-image filename 1))
(img-size (get-size img))
(dest (create-image img-size +ipl-depth-8u+ 3))
(bright 50)
(scalar (make-cv-scalar (- bright 50) (- bright 50) (- bright 50))))
(named-window "Display" 1)
(create-trackbar "brightness" "Display" bright 100 0)
(add-scalar img scalar dest)
(show-image "Display" dest)
(loop while (not (= (wait-key 0) 27)))
(release-image img)
(destroy-all-windows)))
My attempt at wrapping the fuction is below so hopefully you can see it and give me pointers I just need to know how to wrap the CvTrackbarCallback on_change=NULL part of the below definition then I can apply the knowledge you give me to future wraps....I've already added 20 new functions to cl-opencv and plan to make it complete but I can use your help
;; int cvCreateTrackbar(const char* trackbar_name, const char* window_name, int*
;; value, int count, CvTrackbarCallback on_change=NULL)
;; CvTrackbarCallback
(cffi:defctype cv-trackbar-callback :pointer)
(cffi:defcfun ("cvCreateTrackbar" %create-trackbar) :int
"Creates a trackbar and attaches it to the specified window."
(trackbar-name :string)
(window-name :string)
(value :int)
(count :int)
(on-change cv-trackbar-callback))
(defun create-trackbar (trackbar-name window-name value count &optional on-change)
;(if (= 0 on-change) (setf on-change (cffi:null-pointer)))
(%create-trackbar trackbar-name window-name value count on-change))
The value 0 is not of type SB-SYS:SYSTEM-AREA-POINTER. [Condition of type TYPE-ERROR]
I'm getting it because of the 0 in my create-trackbar call in the function below
this funtion works without the create-trackbar line
(defun display (filename)
"Open the image FILENAME and show it in a window."
(let* ((img (load-image filename 1))
(img-size (get-size img))
(dest (create-image img-size +ipl-depth-8u+ 3))
(bright 50)
(scalar (make-cv-scalar (- bright 50) (- bright 50) (- bright 50))))
(named-window "Display" 1)
(create-trackbar "brightness" "Display" bright 100 0)
(add-scalar img scalar dest)
(show-image "Display" dest)
(loop while (not (= (wait-key 0) 27)))
(release-image img)
(destroy-all-windows)))
My attempt at wrapping the fuction is below so hopefully you can see it and give me pointers I just need to know how to wrap the CvTrackbarCallback on_change=NULL part of the below definition then I can apply the knowledge you give me to future wraps....I've already added 20 new functions to cl-opencv and plan to make it complete but I can use your help
;; int cvCreateTrackbar(const char* trackbar_name, const char* window_name, int*
;; value, int count, CvTrackbarCallback on_change=NULL)
;; CvTrackbarCallback
(cffi:defctype cv-trackbar-callback :pointer)
(cffi:defcfun ("cvCreateTrackbar" %create-trackbar) :int
"Creates a trackbar and attaches it to the specified window."
(trackbar-name :string)
(window-name :string)
(value :int)
(count :int)
(on-change cv-trackbar-callback))
(defun create-trackbar (trackbar-name window-name value count &optional on-change)
;(if (= 0 on-change) (setf on-change (cffi:null-pointer)))
(%create-trackbar trackbar-name window-name value count on-change))