Skip to content

Commit 9ff60e3

Browse files
committed
Add CV\getTickCount and CV\getTickFrequency function
1 parent c874053 commit 9ff60e3

File tree

4 files changed

+77
-0
lines changed

4 files changed

+77
-0
lines changed

config.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ if test "$PHP_OPENCV" != "no"; then
3434

3535
opencv_source_file="opencv.cc \
3636
source/opencv2/core/opencv_mat.cc \
37+
source/opencv2/core/opencv_utility.cc \
3738
source/opencv2/opencv_imgcodecs.cc \
3839
opencv_exception.cc \
3940
source/opencv2/core/hal/opencv_interface.cc \

opencv.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ extern "C" {
4040
#include "source/opencv2/opencv_objdetect.h"
4141
#include "source/opencv2/opencv_videoio.h"
4242
#include "source/opencv2/opencv_face.h"
43+
#include "source/opencv2/core/opencv_utility.h"
4344

4445
/* If you declare any globals in php_opencv.h uncomment this:
4546
ZEND_DECLARE_MODULE_GLOBALS(opencv)
@@ -231,6 +232,8 @@ const zend_function_entry opencv_functions[] = {
231232
ZEND_NS_NAMED_FE(OPENCV_NS, threshold, ZEND_FN(opencv_threshold), opencv_threshold_arginfo)
232233
ZEND_NS_NAMED_FE(OPENCV_NS, morphologyEx, ZEND_FN(opencv_morphology_ex), opencv_morphology_ex_arginfo)
233234
ZEND_NS_NAMED_FE(OPENCV_NS, LUT, ZEND_FN(opencv_lut), opencv_lut_arginfo)
235+
ZEND_NS_NAMED_FE(OPENCV_NS, getTickCount, ZEND_FN(opencv_get_tick_count), NULL)
236+
ZEND_NS_NAMED_FE(OPENCV_NS, getTickFrequency, ZEND_FN(opencv_get_tick_frequency), NULL)
234237
PHP_FE_END /* Must be the last line in opencv_functions[] */
235238
};
236239
/* }}} */
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
+----------------------------------------------------------------------+
3+
| PHP-OpenCV |
4+
+----------------------------------------------------------------------+
5+
| This source file is subject to version 2.0 of the Apache license, |
6+
| that is bundled with this package in the file LICENSE, and is |
7+
| available through the world-wide-web at the following url: |
8+
| http://www.apache.org/licenses/LICENSE-2.0.html |
9+
| If you did not receive a copy of the Apache2.0 license and are unable|
10+
| to obtain it through the world-wide-web, please send a note to |
11+
| hihozhou@gmail.com so we can mail you a copy immediately. |
12+
+----------------------------------------------------------------------+
13+
| Author: HaiHao Zhou <hihozhou@gmail.com> |
14+
+----------------------------------------------------------------------+
15+
*/
16+
17+
18+
#ifdef HAVE_CONFIG_H
19+
#include "config.h"
20+
#endif
21+
22+
#include "../../../php_opencv.h"
23+
#include "opencv_utility.h"
24+
25+
void opencv_utility_init(int module_number){
26+
27+
}
28+
29+
/**
30+
* CV\getTickCount
31+
* @param execute_data
32+
* @param return_value
33+
*/
34+
PHP_FUNCTION(opencv_get_tick_count){
35+
long tick_count = getTickCount();
36+
RETURN_LONG(tick_count);
37+
}
38+
39+
40+
/**
41+
* getTickFrequency
42+
* @param execute_data
43+
* @param return_value
44+
*/
45+
PHP_FUNCTION(opencv_get_tick_frequency){
46+
double tick_frequency = getTickFrequency();
47+
RETURN_DOUBLE(tick_frequency);
48+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
+----------------------------------------------------------------------+
3+
| PHP-OpenCV |
4+
+----------------------------------------------------------------------+
5+
| This source file is subject to version 2.0 of the Apache license, |
6+
| that is bundled with this package in the file LICENSE, and is |
7+
| available through the world-wide-web at the following url: |
8+
| http://www.apache.org/licenses/LICENSE-2.0.html |
9+
| If you did not receive a copy of the Apache2.0 license and are unable|
10+
| to obtain it through the world-wide-web, please send a note to |
11+
| hihozhou@gmail.com so we can mail you a copy immediately. |
12+
+----------------------------------------------------------------------+
13+
| Author: HaiHao Zhou <hihozhou@gmail.com> |
14+
+----------------------------------------------------------------------+
15+
*/
16+
17+
#ifndef PHP_OPENCV_UTILITY_H
18+
#define PHP_OPENCV_UTILITY_H
19+
20+
#endif //PHP_OPENCV_UTILITY_H
21+
22+
void opencv_utility_init(int module_number);
23+
24+
PHP_FUNCTION(opencv_get_tick_count);
25+
PHP_FUNCTION(opencv_get_tick_frequency);

0 commit comments

Comments
 (0)