Skip to content

Instantly share code, notes, and snippets.

@W-Net-AI
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save W-Net-AI/11205892 to your computer and use it in GitHub Desktop.
Save W-Net-AI/11205892 to your computer and use it in GitHub Desktop.
///////////////////////////////////////Lisp///////////////////////////////////
;;All these Lisp wrappers for the C++ code are thoroughly tested and work correctly except
,,detectMultiScale(detect-multi-scale in Lisp) Everything is run in the same order as in C/C++ above at the REPL
;;I can supply the wrappers if neccessary.
LCV> (defparameter face-cascade-name "/home/w/Desktop/opencv-master/data/haarcascades/haarcascade_frontalface_alt.xml")
(defparameter faces (%vector-rect))
(defparameter face-cascade (cascade-classifier face-cascade-name))
(defparameter frame (imread "/home/w/Desktop/opencv-master/samples/cpp/lena.jpg" 1))
(cvt-color frame frame +bgr2gray+)
(equalize-hist frame frame)
(detect-multi-scale face-cascade frame faces 1.1d0 2 (logior 0 +cascade-scale-image+) (size 30 30))
LCV> (dotimes (ic (vector-rect-size faces))
(setf n (%vector-rect-to-c-array faces))
(rect-x (mem-aref n :pointer ic))) ;<---this is where it fails, rect-x, my Lisp wrapper for C wrapper for the c++ Rect class member x in this statement isn't getting a Rect* so it outputs error: Unhandled ;memory fault at #xC9000000D5. The %vector-rect-to-c-array function is a wrapper for the c function in the posted c/c++ code. It works as expected on everything else but the vector<Rect> output of detectMultiScale.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment