-
Notifications
You must be signed in to change notification settings - Fork 93
/
Copy pathphp_opencv.h
131 lines (104 loc) · 3.96 KB
/
php_opencv.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Michael Maclean <[email protected]> |
+----------------------------------------------------------------------+
*/
/* $Id: header 297205 2010-03-30 21:09:07Z johannes $ */
#ifndef PHP_OPENCV_H
#define PHP_OPENCV_H
extern "C" {
#include "php.h"
#include "zend_exceptions.h"
#ifdef ZTS
#include "TSRM.h"
#endif
}
extern zend_error_handling opencv_original_error_handling;
extern zend_module_entry opencv_module_entry;
#define phpext_opencv_ptr &opencv_module_entry
#ifdef PHP_WIN32
# define PHP_OPENCV_API __declspec(dllexport)
#elif defined(__GNUC__) && __GNUC__ >= 4
# define PHP_OPENCV_API __attribute__ ((visibility("default")))
#else
# define PHP_OPENCV_API
#endif
/* Constants for open_basedir checks */
#define OPENCV_READ_WRITE_NO_ERROR 0
#define OPENCV_READ_WRITE_SAFE_MODE_ERROR 1
#define OPENCV_READ_WRITE_OPEN_BASEDIR_ERROR 2
/* turn error handling to exception mode and restore */
#define PHP_OPENCV_ERROR_HANDLING() do { \
zend_replace_error_handling(EH_THROW, opencv_ce_cvexception, &opencv_original_error_handling TSRMLS_CC); \
} while(0)
#define PHP_OPENCV_RESTORE_ERRORS() do { \
zend_restore_error_handling(&opencv_original_error_handling TSRMLS_CC); \
} while(0)
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
PHP_MINIT_FUNCTION(opencv);
PHP_MINIT_FUNCTION(opencv_error);
PHP_MINIT_FUNCTION(opencv_mat);
PHP_MINIT_FUNCTION(opencv_image);
PHP_MINIT_FUNCTION(opencv_histogram);
PHP_MINIT_FUNCTION(opencv_capture);
PHP_MSHUTDOWN_FUNCTION(opencv);
PHP_MINFO_FUNCTION(opencv);
PHP_RINIT_FUNCTION(opencv);
extern zend_object_handlers opencv_std_object_handlers;
extern zend_class_entry *opencv_ce_cvexception;
extern zend_class_entry *opencv_ce_cvmat;
extern zend_class_entry *opencv_ce_image;
extern zend_class_entry *opencv_ce_histogram;
typedef struct _opencv_mat_object {
zend_object std;
zend_bool constructed;
Mat *cvptr;
} opencv_mat_object;
typedef struct _opencv_image_object {
zend_object std;
zend_bool constructed;
IplImage *cvptr;
} opencv_image_object;
typedef struct _opencv_histogram_object {
zend_object std;
zend_bool constructed;
CvHistogram *cvptr;
} opencv_histogram_object;
typedef struct _opencv_capture_object {
zend_object std;
zend_bool constructed;
CvCapture* cvptr;
} opencv_capture_object;
PHP_OPENCV_API extern void php_opencv_throw_exception(TSRMLS_D);
PHP_OPENCV_API void php_opencv_basedir_check(const char *filename TSRMLS_DC);
PHP_OPENCV_API extern opencv_image_object* opencv_image_object_get(zval *zobj TSRMLS_DC);
PHP_OPENCV_API extern opencv_histogram_object* opencv_histogram_object_get(zval *zobj TSRMLS_DC);
PHP_OPENCV_API zval *php_opencv_make_image_zval(IplImage *image, zval *image_zval TSRMLS_DC);
#ifdef ZTS
#define OPENCV_G(v) TSRMG(opencv_globals_id, zend_opencv_globals *, v)
#else
#define OPENCV_G(v) (opencv_globals.v)
#endif
#endif /* PHP_OPENCV_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/