Skip to content

Commit

Permalink
Use C++ Mat object
Browse files Browse the repository at this point in the history
  • Loading branch information
mgdm committed Jan 2, 2013
1 parent 6a34b3f commit 8847e8f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions opencv_mat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static inline opencv_mat_object* opencv_mat_object_get(zval *zobj TSRMLS_DC) {
void opencv_mat_object_destroy(void *object TSRMLS_DC)
{
opencv_mat_object *mat = (opencv_mat_object *)object;

delete mat->cvptr;
zend_hash_destroy(mat->std.properties);
FREE_HASHTABLE(mat->std.properties);

Expand Down Expand Up @@ -85,7 +85,7 @@ PHP_METHOD(OpenCV_Mat, __construct)
PHP_OPENCV_RESTORE_ERRORS();

object = (opencv_mat_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
object->cvptr = cvCreateMat(rows, cols, type);
object->cvptr = new Mat(rows, cols, type);
php_opencv_throw_exception();
}
/* }}} */
Expand Down
3 changes: 2 additions & 1 deletion php_opencv.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ extern zend_module_entry opencv_module_entry;
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>

using namespace cv;

PHP_MINIT_FUNCTION(opencv);
PHP_MINIT_FUNCTION(opencv_error);
Expand Down Expand Up @@ -90,7 +91,7 @@ typedef struct _opencv_arr_object {
typedef struct _opencv_mat_object {
zend_object std;
zend_bool constructed;
CvMat *cvptr;
Mat *cvptr;
} opencv_mat_object;

typedef struct _opencv_image_object {
Expand Down

0 comments on commit 8847e8f

Please sign in to comment.