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
Point2f* Point2f_mul_Assign(Point2f* self, Point2f* other) { | |
*self *= *other; | |
return self; | |
} | |
Point2f* Point2f_mul_Assign(Point2f* self, Point2f* other) { | |
return &(*self *= *other); | |
} |
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 @1 (ptr &optional arg1 arg2 arg3) | |
(if (symbolp arg1) | |
(case arg1 | |
(:char (mem-aref (resolve-pointer ptr) :char 0)) | |
(:uchar (mem-aref (resolve-pointer ptr) :uchar arg2)) | |
(:unsigned-char (mem-aref (resolve-pointer ptr) :unsigned-char arg2)) | |
(:short (mem-aref (resolve-pointer ptr) :short arg2)) | |
(:ushort (mem-aref (resolve-pointer ptr) :ushort arg2)) | |
(:unsigned-short (mem-aref (resolve-pointer ptr) :unsigned-short arg2)) | |
(:int (mem-aref (resolve-pointer ptr) :int arg2)) |
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
typedef vector<Mat> vector_Mat; | |
void cv_drawContours(Mat* image, vector_Mat* contours, int contourIdx, Scalar* color, int thickness, int lineType, | |
Mat* hierarchy, int maxLevel, Point* offset) { | |
cout << *contours[0] << endl; | |
cv::drawContours(*image, *contours, contourIdx, *color, thickness, lineType, *hierarchy, maxLevel, *offset); | |
} |
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 have a setf version of the @@@ method in this macro. How would I go about calling it inside the macro. | |
The way I call it is (setf (@@@ object index) val). | |
(defmacro @ (object &optional i j) | |
"CFFI:MEM-AREF macro with C-POINTER reader." | |
(if (keywordp i) | |
`(mem-aref (resolve-pointer ,object) ,i (or ,j 0)) | |
`(@@@ ,object ,i ,j))) |
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
;; DMATCH | |
(define-foreign-type dmatch () | |
((garbage-collect :reader garbage-collect :initform nil :initarg | |
:garbage-collect)) | |
(:actual-type :pointer) | |
(:simple-parser dmatch)) | |
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 set-br (self val) | |
(let ((a (cons self nil)) | |
(rect-x (@ self :int)) | |
(rect-y (@ self :int 1)) | |
(rect-width (@ self :int 2)) | |
(rect-height (@ self :int 3)) | |
(point-x (@ val :int)) | |
(point-y (@ val :int 1)) | |
(new-x) |
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
Point* cv_Rect_set_tl(Rect* self, Point* val) { | |
&self = new Rect(val->x, val->y, self->width, self->height); | |
return val; | |
} |
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 set-br (self val) | |
(let ((rect-x (@ self :int)) | |
(rect-y (@ self :int 1)) | |
(rect-width (@ self :int 2)) | |
(rect-height (@ self :int 3)) | |
(point-x (@ val :int)) | |
(point-y (@ val :int 1)) | |
(new-x) | |
(new-y)) |
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 j (self point) | |
(defun h (x) (funcall x '= point)) | |
(h (lambda (op &optional val) | |
(if (eq '= op) | |
(setf self val) | |
self))) | |
(assert (= self point)) (princ self)) |
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
(defparameter *b* 0) | |
(defun s (self val) | |
(funcall (lambda (a) (setf self a)) val)) | |
NewerOlder