Skip to content

Instantly share code, notes, and snippets.

@ayapi
Last active January 1, 2016 14:59
Show Gist options
  • Save ayapi/8161498 to your computer and use it in GitHub Desktop.
Save ayapi/8161498 to your computer and use it in GitHub Desktop.
opencv-nodeをっかって画像を階調反転して表示する
var cv = require('opencv-node');
var path = require('path');
var fullpath = path.resolve('./lena.png');
console.log('Opening ', fullpath);
var src = cv.imread(fullpath, -1);
if(src.empty) return console.log('Error opening file');
cv.namedWindow("Original", 1);
cv.imshow("Original", src);
cv.bitwise_not(src, src);
cv.namedWindow("RGB Invert", 1);
cv.imshow("RGB Invert", src);
cv.closeOnEsc();
cv.runMessageLoop();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment