Skip to content

Commit

Permalink
Merge pull request #46 from the-grid/fix-small-gif
Browse files Browse the repository at this point in the history
Fix small GIF issue
  • Loading branch information
automata committed Apr 11, 2016
2 parents 56f13d2 + 68291de commit e5cd41b
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 6 deletions.
14 changes: 11 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
language: node_js
node_js:
- '0.12'
- 4.2
sudo: false
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libpng-dev
- libopencv-dev
- libcairo2-dev
- libjpeg8-dev
- libpango1.0-dev
- libgif-dev
- build-essential
- g++
- g++-4.8
env:
matrix:
- CXX=g++-4.8
before_install:
- npm cache clean
before_script:
- npm install -g grunt-cli node-gyp
- npm install -g grunt-cli node-gyp
deploy:
provider: npm
email: [email protected]
Expand Down
9 changes: 8 additions & 1 deletion components/GetSaliency-node.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,14 @@ exports.getComponent = ->
async: true
, (canvas, groups, out, callback) ->
writeCanvasTempFile canvas, (err, tmpFile) ->
return callback err if err
if err
if err.code is 'ENOMEM'
console.log 'GetSaliency ERROR, sending empty saliency', err
out.send
saliency: null
do callback
return
return callback err
runSaliency tmpFile, (err, val) ->
return callback err if err
out.send val
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"grunt-contrib-symlink": "^0.3.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-mocha-test": "^0.12.7",
"grunt-node-gyp": "^0.5.0",
"grunt-node-gyp": "^3.0.0",
"grunt-noflo-manifest": "^0.1.11",
"mocha": "^2.4.4",
"noflo-canvas": "^0.2.0"
Expand Down
2 changes: 1 addition & 1 deletion saliency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// #define DEBUG
#undef DEBUG

#define MINSIZE 50
#define MINSIZE 100

using namespace std;

Expand Down
14 changes: 14 additions & 0 deletions spec/GetSaliency.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,17 @@ describe 'GetSaliency component', ->
inImage.beginGroup 3
inImage.send canvas
inImage.endGroup()
describe 'when passed a small gif', ->
input = 'small.gif'

it 'should extract the salient region in a reasonable time', (done) ->
@timeout 30000
error.once 'data', (err) ->
console.log 'err', err
out.once 'data', (res) ->
chai.expect(res).to.be.an 'object'
done()
testutils.getCanvasWithImageNoShift input, (canvas) ->
inImage.beginGroup 4
inImage.send canvas
inImage.endGroup()
Binary file added spec/fixtures/small.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e5cd41b

Please sign in to comment.