Advertisement
Guest User

Untitled

a guest
Feb 18th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. socket.on('pose_detection', (msg) => {
  2. try {
  3. console.log('ho ricevuto il comando pose_detection '+msg.mode)
  4. if(msg.mode=="frontal"){
  5. Jimp.read('./img/foto.png').then(image => {
  6. image.crop(426, 0, 426, 720);
  7. image.write('./img/foto.png');
  8. }).catch(err => {
  9. console.log(err)
  10. });
  11. calcolaDistanza()
  12.  
  13. }
  14. else{
  15. imageStream.write(msg.bytes)
  16. exec('ffmpeg -y -i ./imageStream ./img/foto.png', (error, stdout, stderr) => {
  17. imageStream = fs.createWriteStream('./imageStream', {flags: 'w'})
  18. if(msg.mode=="section"){
  19. Jimp.read('./img/foto.png').then(image => {
  20. image.crop(426, 0, 426, 720);
  21. image.write('./img/foto.png');
  22. }).catch(err => {
  23. console.log(err)
  24. });
  25. }
  26. calcolaDistanza()
  27. //findUser()
  28. })
  29. }
  30.  
  31. } catch (error) {
  32. console.log("Error: write after end")
  33. }
  34. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement