This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun put-text-example () | |
(let* ((window-name "PUT-TEXT Example") | |
(window-width 900) | |
(window-height 600) | |
;; Initialize random number generator | |
(rng (rng #xFFFFFFFF)) | |
;; Create a black background | |
(image (mat-zeros window-width window-height +8uc3+)) | |
(mat (mat-zeros window-width window-height +8uc3+)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; I think we decided on 2 of these Mat* and this | |
void cv_inRangeS(Mat* src, Scalar* lowerb, Scalar* upperb, Mat* dst) { | |
cv::inRange(*src, *lowerb, *upperb, *dst); | |
} | |
;;Usually called as int or scalar | |
void cv_randu2(Mat* dst, Scalar* low, Scalar* high) { | |
cv::randu(*dst, *low, *high); | |
} | |
;;Needs to be able to interface w/ cv_circle | |
void cv_goodFeaturesToTrack2(Mat* image, vector_Point2f* corners, int maxCorners, double qualityLevel, double minDistance, Mat* mask, int blockSize, bool useHarrisDetector, double k) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
My lisp code.. | |
defparameter face-cascade-name "/home/w/Desktop/opencv-master/data/haarcascades/haarcascade_frontalface_alt.xml") | |
(defparameter faces (%vector-rect)) | |
(defparameter window-name-1 "Original - CASCADE-CLASSIFIER Example") | |
(defparameter window-name-2 "Detected - CASCADE-CLASSIFIER Example") | |
(defparameter face-cascade (cascade-classifier face-cascade-name)) | |
(defparameter filenumber 0) ;; Number of file to be saved | |
(defparameter filename 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pls bear with me this goes somewhere:) | |
in Lisp when I create a vector_Rect I do it like this: | |
(defparameter a (%c-arr-to-vector-rect (foreign-alloc :pointer :initial-contents | |
(LIST (rect 1 2 3 4) (rect 5 6 7 8))) 2)) | |
then when I want to access the first rect in the vector-rect A I use the CFFI function MEM-AREF like this: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "opencv2/objdetect/objdetect.hpp" | |
#include "opencv2/highgui/highgui.hpp" | |
#include "opencv2/imgproc/imgproc.hpp" | |
#include "opencv2/highgui/highgui_c.h" | |
#include "opencv2/imgproc/imgproc_c.h" | |
#include <iostream> | |
#include <stdio.h> | |
using namespace std; | |
using namespace cv; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///////////////////////////////////////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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///////////////////////////////C++/////////////////////////////////////////// | |
This is the main part, a snippet of a face detection program, runable if you have OpenCV installed | |
#include "opencv2/objdetect/objdetect.hpp" | |
#include "opencv2/highgui/highgui.hpp" | |
#include "opencv2/imgproc/imgproc.hpp" | |
#include "opencv2/highgui/highgui_c.h" | |
#include "opencv2/imgproc/imgproc_c.h" | |
#include <iostream> | |
#include <stdio.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <vector> | |
//#include <opencv2/c/opencv_generated.hpp> | |
using namespace std; | |
#define ADD_VECTOR_HEADERS(t, tn) \ | |
typedef vector< t > vector_##t; \ | |
vector_##t * create_std_vector##tn(); \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <opencv2/c/interop.hpp> | |
typedef string stdstring; | |
extern "C" { | |
stdstring* create_std_string() { | |
return new string; | |
} | |
stdstring* cstring_to_std_string(char* s, size_t len) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In file included from interop.cpp:1:0: | |
/usr/local/include/opencv2/c/interop.hpp:51:1: error: ‘KeyPoint’ was not declared in this scope | |
ADD_VECTOR_HEADERS(KeyPoint, kp); | |
^ | |
/usr/local/include/opencv2/c/interop.hpp:51:1: error: template argument 1 is invalid | |
ADD_VECTOR_HEADERS(KeyPoint, kp); | |
^ | |
/usr/local/include/opencv2/c/interop.hpp:51:1: error: template argument 2 is invalid | |
/usr/local/include/opencv2/c/interop.hpp:51:1: error: invalid type in declaration before ‘;’ token | |
ADD_VECTOR_HEADERS(KeyPoint, kp); |
OlderNewer