(defun create-trackbar-example (&optional (camera-index 0) (width *default-width*)
(height *default-height*))
"Creates a trackbar and attaches it to the specified window.
Move the slider to adjust the brightess of the camera output"
(with-capture (capture (create-camera-capture camera-index))
(let ((window-name "CREATE-TRACKBAR Example")
(contrast (cffi:foreign-alloc :int :initial-contents '(50))))
(set-capture-property capture +cap-prop-frame-width+ width)
(set-capture-property capture +cap-prop-frame-height+ height)
(named-window
window-name)
(move-window window-name 600 175)
(do* ((frame (query-frame capture) (query-frame capture))
(dest (clone-image frame))
(scalar 0))
((plusp (wait-key *millis-per-frame*)) nil)
(format t "Trackbar level: ~a~%~%" (cffi:mem-ref contrast :int))
(create-trackbar "Brightness" window-name contrast 100 (change-contrast contrast window-name frame dest))
(setf scalar (scalar (- (cffi:mem-ref contrast :int 50))
(- (cffi:mem-ref contrast :int) 50)
(- (cffi:mem-ref contrast
:int) 50)))
(add-s frame scalar dest)
(show-image window-name dest))
(destroy-window window-name))))
(defun create-trackbar-example (&optional (camera-index 0) (width *default-width*)
(height *default-height*))
"Creates a trackbar and attaches it to the specified window.
Move the slider to adjust the brightess of the camera output"
(with-capture (capture (create-camera-capture camera-index))
(let ((window-name "CREATE-TRACKBAR Example")
(contrast (cffi:foreign-alloc :int :initial-contents '(50))))
(set-capture-property capture +cap-prop-frame-width+ width)
(set-capture-property capture +cap-prop-frame-height+
height)
(named-window window-name)
(move-window window-name 600 175)
(do* ((frame (query-frame capture) (query-frame capture))
(dest (clone-image frame))
(scalar 0))
((plusp (wait-key *millis-per-frame*)) nil)
(format t "Trackbar level: ~a~%~%" (cffi:mem-ref contrast :int))
(create-trackbar "Brightness" window-name contrast 100 (change-contrast contrast window-name frame dest))
(setf scalar (scalar (- (cffi:mem-ref contrast :int 50))
(- (cffi:mem-ref contrast :int) 50)
(- (cffi:mem-ref contrast :int) 50)))
(add-s frame scalar dest)
(show-image window-name dest))
(destroy-window window-name))))
(defun create-trackbar-example (&optional (camera-index 0) (width *default-width*)
(height *default-height*))
"Creates a trackbar and attaches it to the specified window.
Move the slider to adjust the brightess of the camera output"
(with-capture (capture (create-camera-capture camera-index))
(let ((window-name "CREATE-TRACKBAR Example")
(contrast
(cffi:foreign-alloc :int :initial-contents '(50))))
(set-capture-property capture +cap-prop-frame-width+ width)
(set-capture-property capture +cap-prop-frame-height+ height)
(named-window window-name)
(move-window window-name 600 175)
(do* ((frame (query-frame capture) (query-frame capture))
(dest (clone-image frame))
(scalar 0))
((plusp (wait-key *millis-per-frame*)) nil)
(format t "Trackbar level: ~a~%~%" (cffi:mem-ref contrast :int))
(create-trackbar "Brightness" window-name contrast 100 (change-contrast contrast window-name frame dest))
(setf scalar (scalar (- (cffi:mem-ref contrast :int 50))
(- (cffi:mem-ref contrast :int) 50)
(- (cffi:mem-ref contrast :int) 50)))
(add-s frame scalar dest)
(show-image window-name dest))
(destroy-window window-name))))
(defun create-trackbar-example (&optional (camera-index 0) (width *default-width*)
(height *default-height*))
"Creates a trackbar and attaches it to the specified window.
Move the slider to adjust the brightess of the camera output"
(with-capture (capture (create-camera-capture camera-index))
(let ((window-name "CREATE-TRACKBAR Example")
(contrast (cffi:foreign-alloc :int :initial-contents '(50))))
(set-capture-property capture +cap-prop-frame-width+ width)
(set-capture-property capture +cap-prop-frame-height+ height)
(named-window
window-name)
(move-window window-name 600 175)
(do* ((frame (query-frame capture) (query-frame capture))
(dest (clone-image frame))
(scalar 0))
((plusp (wait-key *millis-per-frame*)) nil)
(format t "Trackbar level: ~a~%~%" (cffi:mem-ref contrast :int))
(create-trackbar "Brightness" window-name contrast 100 (change-contrast contrast window-name frame dest))
(setf scalar (scalar (- (cffi:mem-ref contrast :int 50))
(- (cffi:mem-ref contrast :int) 50)
(- (cffi:mem-ref contrast
:int) 50)))
(add-s frame scalar dest)
(show-image window-name dest))
(destroy-window window-name))))