Skip to content

Commit

Permalink
Merge branch 'peterbraden-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
AVVS committed Apr 1, 2015
2 parents 4131385 + 3ae1ccb commit d2a918b
Show file tree
Hide file tree
Showing 38 changed files with 1,921 additions and 184 deletions.
70 changes: 65 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,70 @@
language: node_js

node_js:
- "0.10"
- "0.11"
- '0.10'
- '0.11'
- '0.12'

compiler: clang

env:
global:
- secure: "kCAwXdfcMv4l4ok5lO89ANbKXXwWQpn5/3qupSbhmX2NDIGUxyXze/cs90u9gF5hcT7ebq27ZJPEtu7pRov8MadfQM9BAd4ZZrHcMHWSkA0Iz+nM+m0Urwach6jkp2Iuwx15L2NHSis7f5PUKJcEv4Gnqs8jrCJzHHS7m7dO0Xo="
- secure: "lBIk4BhdIkSmJtFUNp93UjDm445i9eF7nKA+oSiLRu+b9i/WeRLiKFI89tehexWeXBlyNhziBN16LrHmx3I86yZfEok9dBMA1JuzYBjrvpjRAflGcqaCFLV3axyyyNQRIh7Q+ziAlg0xg8HL752BpnfXO91g3jfDPjGxcvBb5xQ="


before_install:
# Fix a problem with apt-get failing later, see http://docs.travis-ci.com/user/installing-dependencies/#Installing-Ubuntu-packages
- sudo apt-get update -qq
- sudo add-apt-repository -y ppa:kubuntu-ppa/backports
- sudo apt-get update
- sudo apt-get install libcv-dev
- sudo apt-get install libopencv-dev
- sudo apt-get install libhighgui-dev
- sudo apt-get install --force-yes libcv-dev libcvaux-dev libhighgui-dev libopencv-dev
# get commit message
- COMMIT_MESSAGE=$(git show -s --format=%B $TRAVIS_COMMIT | tr -d '\n')
# put local node-pre-gyp on PATH
- export PATH=./node_modules/.bin/:$PATH
# install node-pre-gyp so it is available for packaging and publishing
- npm install node-gyp -g
# install node-pre-gyp so it is available for packaging and publishing
- npm install node-pre-gyp
# install aws-sdk so it is available for publishing to AS3
- npm install aws-sdk
# figure out if we should publish
- PUBLISH_BINARY=false
# if we are building a tag then publish
- if [[ $TRAVIS_BRANCH == `git describe --tags --always HEAD` ]]; then PUBLISH_BINARY=true; fi;
# or if we put [publish binary] in the commit message
- if test "${COMMIT_MESSAGE#*'[publish binary]'}" != "$COMMIT_MESSAGE"; then PUBLISH_BINARY=true; fi;
- platform=$(uname -s | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/")

install:
# ensure source install works
- npm install --build-from-source
# test our module
- npm test
- node lib/opencv.js

before_script:
- echo "Publishing native platform Binary Package? ->" $PUBLISH_BINARY
# if publishing, do it
- if [[ $PUBLISH_BINARY == true ]]; then node-pre-gyp package publish || true; fi;
# cleanup
- node-pre-gyp clean
- node-gyp clean
- sudo apt-get purge libcv-dev
- sudo apt-get purge libopencv-dev
- sudo apt-get purge libhighgui-dev

script:
# if publishing, test installing from remote
- INSTALL_RESULT=0
- if [[ $PUBLISH_BINARY == true ]]; then INSTALL_RESULT=$(npm install --fallback-to-build=false > /dev/null)$? || true; fi;
# if install returned non zero (errored) then we first unpublish and then call false so travis will bail at this line
- if [[ $INSTALL_RESULT != 0 ]]; then echo "returned $INSTALL_RESULT";node-pre-gyp unpublish;false; fi
# If success then we arrive here so lets clean up
- node-pre-gyp clean
# Can't compile opencv 32bit in 64 bit env.

after_success:
# if success then query and display all published binaries
- node-pre-gyp info
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@

# Changelog

### 3.0.0

You wait ages for a release, and 2 come along at once...

This one is awesome. It adds prebuilt binaries, so you don't need
to build opencv for the common platforms.

Many many thanks to @edgarsilva for awesome work here, and
http://hybridgroup.com/ for hosting the binaries


### 2.0.0

- Support for node 0.12
- Camera Calibration Functions from @queuecumber
- Fix for Nan 1.5.1 from @IMGNRY
- More build fixes from @scanlime
- Matrix crop prototype from @dbpieter
- Many fixes from @madshall

Thanks to everyone that contributed!


### 1.0.0

Ok, let's do a proper semver release :)
Expand Down
34 changes: 34 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
VERSION := $(shell node -e "console.log(require('./package.json').version)")

.PHONY: default release smoke

test:
npm test

smoke:
npm install --build-from-source
node smoke/smoketest.js
npm test


release:
@echo "Tagging release $(VERSION)"
@git tag -m "$(VERSION)" v$(VERSION)

@echo "Pushing tags to GitHub"
@git push --tags

@echo "Switching to osx-binaries branch"
@git checkout osx-binaries

@echo "Merging master into osx-binaries"
@git merge --no-ff --commit -m "Merge master into osx-binaries [publish binary]" master

@echo "Pushing osx-binaries"
@git push

@echo "Switching to master branch"
@git checkout master

@echo "Publishing to NPM"
@npm publish
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ $ npm install opencv
```

## Examples
Run the examples from the parent directory.

### Face Detection

Expand Down Expand Up @@ -172,29 +173,29 @@ See [relevant source code](src/Contours.cc) and [examples](examples/)
```javascript
var contours = im.findContours;

# Count of contours in the Contours object
// Count of contours in the Contours object
contours.size();

# Count of corners(verticies) of contour `index`
// Count of corners(verticies) of contour `index`
contours.cornerCount(index);

# Access vertex data of contours
// Access vertex data of contours
for(var c = 0; c < contours.size(); ++c) {
console.log("Contour " + c);
for(var i = 0; i < contours.cornerCount(c); ++i) {
var point = contours.point(c, i);
console.log("(" + point.x + "," + point.y + ")");"
console.log("(" + point.x + "," + point.y + ")");
}
}

# Computations of contour `index`
// Computations of contour `index`
contours.area(index);
contours.arcLength(index, isClosed);
contours.boundingRect(index);
contours.minAreaRect(index);
contours.isConvex(index);

# Destructively alter contour `index`
// Destructively alter contour `index`
contours.approxPolyDP(index, epsilon, isClosed);
contours.convexHull(index, clockwise);
```
Expand Down
105 changes: 105 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# environment variables
environment:
node_pre_gyp_accessKeyId:
secure: 3GHZvq0y83PQ8Qi7FOc5rKoULRQvd2OohhtGqRQLZB4=
node_pre_gyp_secretAccessKey:
secure: AiX8Bx+U8LKu5JZHb5CMth5xOHuWawkQW3il0OFWfV4kodPZnC8dLYIqb4XZeF7f

# try on unstable version of the server to build node-opencv
os: unstable

# to add several platforms to build matrix:
platform:
- x64

install:
- cmd: ECHO "INSTALL OPENCV:"
- cmd: choco install OpenCV
- cmd: ECHO "APPVEYOR_REPO_COMMIT_MESSAGE ->"
- cmd: ECHO %APPVEYOR_REPO_COMMIT_MESSAGE%
- cmd: SET COMMIT_MSG="%APPVEYOR_REPO_COMMIT_MESSAGE%"
- cmd: SET PUBLISH_BINARY=false
# Check to verify the branch is the same than latest tag, if so
# then we publish the binaries if everything else is successful.
- cmd: git describe --tags --always HEAD > _git_tag.tmp
- cmd: SET /p GIT_TAG=<_git_tag.tmp
- cmd: ECHO "LATEST LOCAL TAG:"
- cmd: ECHO %GIT_TAG%
- cmd: ECHO "APPVEYOR REPO BRANCH/TAG:"
- cmd: ECHO %APPVEYOR_REPO_BRANCH%
- cmd: DEL _git_tag.tmp
- cmd: IF x%APPVEYOR_REPO_BRANCH%==x%GIT_TAG% SET PUBLISH_BINARY=true
# Or look for commit message containing `[publish binary]`
- cmd: IF not x%COMMIT_MSG:[publish binary]=%==x%COMMIT_MSG% SET PUBLISH_BINARY=true
- cmd: ECHO "Env Var PUBLISH_BINARY:"
- cmd: ECHO %PUBLISH_BINARY%
- cmd: git clone https://github.com/marcelklehr/nodist.git c:\nodist 2>&1
- cmd: SET PATH=C:\nodist\bin;%PATH%
- cmd: SET NODIST_PREFIX=C:\nodist

before_build:
- cmd: SET ARCH=x64
- cmd: SET NODIST_X64=1
- cmd: call nodist update
- cmd: call nodist stable
- cmd: npm install -g node-gyp
- cmd: SET APP_PATH=%CD%
- cmd: IF EXIST C:\OpenCV* CD C:\OpenCV*
- cmd: SET OPENCV_ROOT_PATH=%CD%\opencv
- cmd: CD %APP_PATH%
- cmd: SET OPENCV_DIR=%OPENCV_ROOT_PATH%\build\%ARCH%\vc12\bin
- cmd: SET PATH=%cd%\node_modules\.bin\;C:\MinGW\bin;C:\GTK\bin;C:\msys\1.0\bin;%OPENCV_DIR%;%PATH%
- cmd: SET PKG_CONFIG_PATH=C:\GTK\lib\pkgconfig
- cmd: DIR %OPENCV_ROOT_PATH%\build\%ARCH%\vc12\bin
- cmd: DIR %OPENCV_ROOT_PATH%\build\%ARCH%\vc12\lib
# Here we need to copy the opencv.pc file from the repo into PKG_CONFIG_PATH
# trick part is to check for the vc12 folder and use that one
- cmd: copy .\utils\opencv_x64.pc C:\GTK\lib\pkgconfig\opencv.pc

# to run your custom scripts instead of automatic MSBuild
build_script:
- cmd: ECHO "BUILDING x64 binary package:"
- cmd: npm install --build-from-source --msvs_version=2013
- cmd: npm test
- cmd: node lib/opencv.js
- cmd: ECHO "PUBLISH x64 binary package:"
- cmd: npm install aws-sdk
- cmd: IF %PUBLISH_BINARY%==true (node-pre-gyp package publish 2>&1)
- cmd: node-pre-gyp clean
- cmd: node-gyp clean
- cmd: npm uninstall -g node-gyp
- cmd: rmdir /q /s node_modules
- cmd: DEL C:\GTK\lib\pkgconfig\opencv.pc

after_build:
- cmd: SET ARCH=x86
- cmd: SET OPENCV_DIR=%OPENCV_ROOT_PATH%\build\%ARCH%\vc12\bin
- cmd: SET PATH=%OPENCV_DIR%;%PATH%
- cmd: SET NODIST_X64=0
- cmd: call nodist update
- cmd: call nodist stable
- cmd: npm install -g node-gyp
- cmd: copy .\utils\opencv_x86.pc C:\GTK\lib\pkgconfig\opencv.pc
- cmd: ECHO "BUILDING x86 binary package:"
- cmd: npm install --build-from-source --msvs_version=2013
- cmd: npm test
- cmd: node lib/opencv.js
- cmd: ECHO "PUBLISH x86 binary package:"
- cmd: npm install aws-sdk
- cmd: IF %PUBLISH_BINARY%==true (node-pre-gyp package publish 2>&1)
- cmd: node-pre-gyp clean
- cmd: node-gyp clean
- cmd: rmdir /q /s node_modules

on_success:
# test installing from binary package works
- cmd: ECHO "ON SUCCESS:"
- cmd: ECHO "Try installing from binary:"
#- cmd: IF %PUBLISH_BINARY%==true npm install --fallback-to-build=false
- cmd: npm install --fallback-to-build=false
# Print Available Binaries
- cmd: node-pre-gyp info

test: OFF

deploy: OFF
Loading

0 comments on commit d2a918b

Please sign in to comment.