🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

salient-image

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

salient-image

Image signature: highlighting sparse salient regions

1.0.2
latest
Source
npm
Version published
Weekly downloads
6
500%
Maintainers
1
Weekly downloads
 
Created
Source

salient-image

Simple salient processing on top of node-opencv

H. Xiaodi, H. Jonathan, C. Koch, Image signature: highlighting sparse salient regions, IEEE Transactions on Pattern Analysis and Machine Intelligence 34 (1) (2012) 194–200.

pre-requisites

  • opencv

installation

npm install salient-image

examples

Examples

Images

assets/input.jpgassets/output.pngassets/output_with_options.png

Code

var salient = require("salient-image");
var cv = require("opencv");

// Without any options
salient("assets/mona.png", function(err, saliency){
  // saliency is an node-opencv floating-point Matrix
  // maximum is 1, minium is 1
  var width = saliency.width(), height =  saliency.height();
  var imgOutput = new cv.Matrix(width, height, cv.Constants.CV_8U);

  // convert floating point to grey scale Matrix
  saliency.convertTo(imgOutput, cv.Constants.CV_8U, 255);
  imgOutput.save("assets/output.png");
  console.log('Image saved to ./assets/output.png');
});

Example with options

var cv = require("node-opencv");

// With options
salient("assets/mona.png", {
    resize : [200, 200], // the resize size
    sigma : 0.045, // the sigma of the gaussian kernel
    gaussianKernel : [11, 11] // the size of the gaussian kernel
  }, function(err, saliency){
    // saliency is an node-opencv floating-point Matrix
    // maximum is 1, minium is 1
    var width = saliency.width(), height =  saliency.height();
    var imgOutput = new cv.Matrix(width, height, cv.Constants.CV_8U);

    // convert floating point to grey scale Matrix
    saliency.convertTo(imgOutput, cv.Constants.CV_8U, 255);
    imgOutput.save("assets/output_with_options.png");
    console.log('Image saved to ./assets/output_with_options.png');
});

With existing opencv image as input

var img = new cv.Matrix(<...>);

salient({
    image : img,
    resize : [200, 200], // the resize size
    sigma : 0.045, // the sigma of the gaussian kernel
    gaussianKernel : [11, 11] // the size of the gaussian kernel
  }, function(err, saliency){ ... });

Keywords

salient

FAQs

Package last updated on 05 Sep 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts