Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
;;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