diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..dde1fec
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,10 @@
+root = true
+
+[*]
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+indent_style = tab
+indent_size = tab
+tab_width = 4
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..884c40b
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2016 - Antoine Eddi
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/README.md b/README.md
index 28e2dbf..1fcd9b2 100644
--- a/README.md
+++ b/README.md
@@ -1,32 +1,38 @@
# Python OpenCV module for AWS Lambda
-This is a simple script that build a deployement package including OpenCV compatible with the AWS Lambda Python runtime. The dynamic library is compiled with all extended instruction sets supported by Lambda CPU and binaries are stripped to save space. You simply need to add your code inside *lambda_funcion.py* and possibly your haar cascades files or additional Python modules. You can download directly a [pre-built archive](https://github.com/Plastic-1/aws-lambda-python-opencv/archive/prebuilt.zip).
+
+ 
+ Simple Mustache Service is an AWS Lambda demo that uses this module
+
+
+## Description
+This is a simple script that builds a deployment package including OpenCV compatible with the AWS Lambda Python runtime. The dynamic library is compiled with all extended instruction sets supported by Lambda CPU and binaries are stripped to save space. You simply need to add your code inside *lambda_function.py* and possibly your haar cascades files or additional Python modules. You can directly download a [pre-built archive](https://github.com/aeddi/aws-lambda-python-opencv/releases/download/Prebuilt/aws-lambda-python-opencv-prebuilt.zip).
- Build duration: ~20 min on T2.micro / ~15 min on C4.2xlarge
- Package size without haar cascades included: 26MB
-- OpenCV 3.1 by default but may works with newer
+- OpenCV 3.2 by default but may work with newer
-**Need to be built on an Amazon Linux instance.**
+**Needs to be built on an Amazon Linux instance.**
## Module building
### Option 1: with an existing instance
-- Download the repo `wget https://github.com/Plastic-1/aws-lambda-python-opencv/archive/master.zip`
+- Download the repo `wget https://github.com/aeddi/aws-lambda-python-opencv/archive/master.zip`
- Unzip the archive `unzip master.zip`
- Launch the script `cd aws-lambda-python-opencv-master && ./build.sh`
### Option 2: without an existing instance
-On the EC2 console, launch a new instance with:
+In the EC2 console, launch a new instance with:
- Amazon Linux AMI
- Role with S3 write permission
- Shutdown behavior: *Terminate*
- Paste the script below in the user data text field
-```sh
+```bash
#!/bin/bash
yum update -y
yum install -y git cmake gcc-c++ gcc python-devel chrpath
cd /tmp
-wget https://github.com/Plastic-1/aws-lambda-python-opencv/archive/master.zip
+wget https://github.com/aeddi/aws-lambda-python-opencv/archive/master.zip
unzip master.zip
chmod 777 aws-lambda-python-opencv-master
cd aws-lambda-python-opencv-master
diff --git a/build.sh b/build.sh
index e6f95dd..33d15d4 100755
--- a/build.sh
+++ b/build.sh
@@ -3,37 +3,39 @@
# Setting up build env
sudo yum update -y
sudo yum install -y git cmake gcc-c++ gcc python-devel chrpath
-mkdir lambda-package lambda-package/cv2 build build/numpy
+mkdir -p lambda-package/cv2 build/numpy
# Build numpy
pip install --install-option="--prefix=$PWD/build/numpy" numpy
cp -rf build/numpy/lib64/python2.7/site-packages/numpy lambda-package
-# Build OpenCV 3.1
+# Build OpenCV 3.2
(
NUMPY=$PWD/lambda-package/numpy/core/include
cd build
git clone https://github.com/Itseez/opencv.git
cd opencv
- git checkout 3.1.0
- cmake \
- -D CMAKE_BUILD_TYPE=RELEASE \
- -D WITH_TBB=ON \
- -D WITH_IPP=ON \
- -D WITH_V4L=ON \
- -D ENABLE_AVX=ON \
- -D ENABLE_SSSE3=ON \
- -D ENABLE_SSE41=ON \
- -D ENABLE_SSE42=ON \
- -D ENABLE_POPCNT=ON \
- -D ENABLE_FAST_MATH=ON \
- -D BUILD_EXAMPLES=OFF \
+ git checkout 3.2.0
+ cmake \
+ -D CMAKE_BUILD_TYPE=RELEASE \
+ -D WITH_TBB=ON \
+ -D WITH_IPP=ON \
+ -D WITH_V4L=ON \
+ -D ENABLE_AVX=ON \
+ -D ENABLE_SSSE3=ON \
+ -D ENABLE_SSE41=ON \
+ -D ENABLE_SSE42=ON \
+ -D ENABLE_POPCNT=ON \
+ -D ENABLE_FAST_MATH=ON \
+ -D BUILD_EXAMPLES=OFF \
+ -D BUILD_TESTS=OFF \
+ -D BUILD_PERF_TESTS=OFF \
-D PYTHON2_NUMPY_INCLUDE_DIRS="$NUMPY" \
.
- make
+ make -j`cat /proc/cpuinfo | grep MHz | wc -l`
)
cp build/opencv/lib/cv2.so lambda-package/cv2/__init__.so
-cp -L build/opencv/lib/*.so.3.1 lambda-package/cv2
+cp -L build/opencv/lib/*.so.3.2 lambda-package/cv2
strip --strip-all lambda-package/cv2/*
chrpath -r '$ORIGIN' lambda-package/cv2/__init__.so
touch lambda-package/cv2/__init__.py
diff --git a/template.py b/template.py
index c3d7d38..3244ffe 100644
--- a/template.py
+++ b/template.py
@@ -1,8 +1,8 @@
import cv2
def lambda_handler(event, context):
- print "OpenCV installed version:", cv2.__version__
- return "It works!"
+ print "OpenCV installed version:", cv2.__version__
+ return "It works!"
if __name__ == "__main__":
- lambda_handler(42, 42)
+ lambda_handler(42, 42)