Skip to content

Instantly share code, notes, and snippets.

@w4ilun
Last active May 22, 2016 02:43
Show Gist options
  • Select an option

  • Save w4ilun/fba741839e3d1c744e60ab8d0396b0ed to your computer and use it in GitHub Desktop.

Select an option

Save w4ilun/fba741839e3d1c744e60ab8d0396b0ed to your computer and use it in GitHub Desktop.
var childProcess = require('child_process');
//take a snapshot using the webcam with ffmpeg
childProcess.exec('/home/root/bin/ffmpeg/ffmpeg -loglevel panic -y -s 320x240 -f video4linux2 -i /dev/video0 -vframes 1 ./capture.jpeg');
/***********************************************************
ffmpeg flags:
* -loglevel - set the logging level used by the library
* -y - overwrite output files without asking
* -s - set frame size WxH
* -f - force format
* -i - input filename
* -vframes - set the number of video frames to output
* ./capture.jpeg - output name
***********************************************************/
var gcloud = require('gcloud')({
projectId: 'YOUR_PROJECT_ID',
keyFilename: 'YOUR_KEY_LOCATION'
});
var vision = gcloud.vision();
vision.detectLabels('./capture.jpeg', { verbose : true }, function(err, labels){
if(err){
console.log(err);
}else{
console.log(labels);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment