拍完一张照片后,我的相机卡住了。我只是尝试使用exec命令,因为这似乎是最简单的方法。我使用佳能EOS 400d,树莓派B型和node.js版本0.10.28。谢谢你的帮助!
var Camera = function(){
}
Camera.prototype = {
sys: require('sys'),
exec: require('child_process').exec
}
Camera.prototype.takePicture = function(imageCount, nextImagePosition, callback){
this.exec("gphoto2 --capture-image-and-download --filename '%Y%m%d%H%M%S.jpg' ",
function(error, stdout, stderr){
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
});
};
万一有人遇到相同的问题,解决方案是使用以下脚本更新gphoto2:https : //github.com/gonzalo/gphoto2-updater
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句