Skip to content

use proper memory allocation for objects #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 5 additions & 79 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,84 +1,10 @@
language: php
sudo: required

compiler:
- gcc
- clang

os:
- linux
# - osx

php:
- 7.0
- 7.1

notifications:
email: [email protected]
services:
- docker

before_install:
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
- sudo apt-get -qq update
- sudo apt-get install gcc-4.8 -y -qq
- sudo apt-get install g++-4.8 -y -qq

install:
# OpenCV dependencies - Details available at: http://docs.opencv.org/trunk/doc/tutorials/introduction/linux_install/linux_install.html
- sudo apt-get install -y build-essential
# Install Cmake
- wget https://cmake.org/files/v3.8/cmake-3.8.2.tar.gz
- tar -zxf cmake-3.8.2.tar.gz
- cd cmake-3.8.2
- ./configure
- make
- sudo make install
- cd ..

- sudo apt-get install -y git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev -qq
- sudo apt-get install -y python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev -qq

# Download OpenCV-contrib v3.3.0-rc
#- git clone https://github.com/opencv/opencv_contrib.git
#- cd opencv_contrib
#- git checkout 3.3.0-rc
#- cd ..

# Download OpenCV v3.3.0-rc
- git clone https://github.com/opencv/opencv.git
- cd opencv
- git checkout 3.3.0-rc

# Create a new 'build' folder.
- mkdir build
- cd build

# Set build instructions for Ubuntu distro.
#- cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules ..
- cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
# Run 'make' with four threads.
- make -j6

# Install to OS.
- sudo make install
# Add configuration to OpenCV to tell it where the library files are located on the file system (/usr/local/lib)
- sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'

- sudo ldconfig
- echo "OpenCV installed."

# We need to return to the repo "root" folder, so we can then 'cd' into the C++ project folder.
- cd ../../

#addons:
# apt:
# sources:
# - george-edison55-precise-backports
# packages:
# - cmake-data
# - cmake

#Compile
before_script:
- ./travis/compile.sh
- docker pull ubuntu:18.04

script:
- exit 0
- docker build .
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM ubuntu:18.04

RUN apt update && export DEBIAN_FRONTEND=noninteractive && apt install -y wget pkg-config cmake git php-cli php-dev

RUN wget https://raw.githubusercontent.com/php-opencv/php-opencv-packages/master/opencv_3.4_amd64.deb && dpkg -i opencv_3.4_amd64.deb && rm opencv_3.4_amd64.deb

RUN git clone https://github.com/php-opencv/php-opencv.git

RUN cd php-opencv && phpize && ./configure --with-php-config=/usr/bin/php-config && make && make install
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

## Requirements

- OpenCV 3.3.0+
- OpenCV 3.4+
- PHP7.0+


Expand Down
4 changes: 3 additions & 1 deletion config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ if test "$PHP_OPENCV" != "no"; then
source/opencv2/opencv_videoio.cc \
source/opencv2/opencv_face.cc \
source/opencv2/face/opencv_facerec.cc \
source/opencv2/face/opencv_facemarkLBF.cc \
source/opencv2/core/opencv_cvdef.cc \
source/opencv2/dnn/opencv_dnn.cc \
source/opencv2/opencv_ml.cc"


Expand Down Expand Up @@ -88,4 +90,4 @@ if test "$PHP_OPENCV" != "no"; then
fi


fi
fi
7 changes: 7 additions & 0 deletions opencv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ extern "C" {
#include "source/opencv2/core/opencv_utility.h"
#include "source/opencv2/opencv_ml.h"
#include "source/opencv2/core/opencv_cvdef.h"
#include "source/opencv2/dnn/opencv_dnn.h"

/* If you declare any globals in php_opencv.h uncomment this:
ZEND_DECLARE_MODULE_GLOBALS(opencv)
Expand Down Expand Up @@ -124,6 +125,7 @@ PHP_MINIT_FUNCTION(opencv)
opencv_objdetect_init(module_number);
opencv_videoio_init(module_number);
opencv_face_init(module_number);
opencv_dnn_init(module_number);
opencv_ml_init(module_number);
opencv_cvdef_init(module_number);

Expand Down Expand Up @@ -244,6 +246,11 @@ const zend_function_entry opencv_functions[] = {
ZEND_NS_NAMED_FE(OPENCV_NS, findContoursWithoutHierarchy, ZEND_FN(opencv_find_contours_without_hierarchy), opencv_find_contours_without_hierarchy_arginfo)
ZEND_NS_NAMED_FE(OPENCV_NS, drawContours, ZEND_FN(opencv_draw_contours), opencv_draw_contours_arginfo)
ZEND_NS_NAMED_FE(OPENCV_NS, boundingRect, ZEND_FN(opencv_bounding_rect), NULL)
ZEND_NS_NAMED_FE(OPENCV_DNN_NS, blobFromImage, ZEND_FN(opencv_dnn_blob_from_image), NULL)
ZEND_NS_NAMED_FE(OPENCV_DNN_NS, readNetFromCaffe, ZEND_FN(opencv_dnn_read_net_from_caffe), NULL)
ZEND_NS_NAMED_FE(OPENCV_DNN_NS, readNetFromTorch, ZEND_FN(opencv_dnn_read_net_from_torch), NULL)
ZEND_NS_NAMED_FE(OPENCV_DNN_NS, readNetFromTensorflow, ZEND_FN(opencv_dnn_read_net_from_tensorflow), NULL)
ZEND_NS_NAMED_FE(OPENCV_NS, imdecode, ZEND_FN(opencv_imdecode), NULL)
PHP_FE_END /* Must be the last line in opencv_functions[] */
};
/* }}} */
Expand Down
1 change: 1 addition & 0 deletions php_opencv.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ using namespace cv;
#define OPENCV_NS "CV"
#define OPENCV_FACE_NS ZEND_NS_NAME(OPENCV_NS,"Face")
#define OPENCV_ML_NS ZEND_NS_NAME(OPENCV_NS,"ML")
#define OPENCV_DNN_NS ZEND_NS_NAME(OPENCV_NS,"DNN")

#define OPENCV_CONNECT(text1,text2) text1##text2

Expand Down
Loading