{"_id":"@amdglobal/ptz","_rev":"8-9c98b32c110ef3b979a930e2123b49b8","name":"@amdglobal/ptz","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@amdglobal/ptz","version":"0.1.0","keywords":["ptz","pan","tilt","zoom","fecc","camera","uvc","visca"],"author":{"url":"https://github.com/ghafran","name":"Ghafran Abbas"},"license":"ISC","_id":"@amdglobal/ptz@0.1.0","maintainers":[{"name":"fauxsoup","email":"fauxsoup@gmail.com"}],"homepage":"https://github.com/ghafran/ptz#readme","bugs":{"url":"https://github.com/ghafran/ptz/issues"},"dist":{"shasum":"8c5b657c2178efe1ec64b484fb087ff119f23b6d","tarball":"https://registry.npmjs.org/@amdglobal/ptz/-/ptz-0.1.0.tgz","fileCount":14,"integrity":"sha512-Igrbj5MMWKZvt30T+WC3Rk8ljzd0FbbL2fIiFxGexPBdldFlU/5yFGij9wXoKrM1YdlftVQ+cOerYbfeoQglPQ==","signatures":[{"sig":"MEUCIQDnu3eYzGyEEpCGMiGisy25NJM32wXLufXN/Z6JvuoPqwIgS7Hpo/FoLARmc6gDYfYOvuM9zK5H14QhaC0zdfToeQI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80009,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJipFqBACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqf1g//f30RnFnWr47GZrO/HzTXRfKwEmrs0ZwS2XjPO3c+JetnkCJd\r\nyleYvpCRLsSPJB4AD0Piq4MR7+tjw/Gwg0nCFb0t8xN6dtHbkIvD8ZGoHVi/\r\nZiHfrNlcjU/JF1473CGmhzcg1HyI5o2CnNHbWuqAmlrmehshKm01+aPCf3gt\r\n2304QTYxEgA/mHdshXtnV8qG7j+3pKMWuaBny0/Ly78XE43B2BXqO94gN18w\r\nfOuh6l1N8nyQarIdnNI3EJUNyG/ugMulN1TxFgjIotIcJdnO2FKd94y4eM5s\r\nXzFm80bnSLef7cVDGZWEMCN7qXxbzcsAlLiR+H0QkqMVWmfxGnQAaKGfGyUn\r\nNDySVIiqevwhXJkPGBubyUrrjZmfp6miJDP2furu6pa3V+N1FBND8uzLt34d\r\n/+42aDgKOKj3d9NFdVzApEKxtSd7kK4/rDtpot7woeeMKmwW8xJ5QOJHrugJ\r\nBDMi2vETPGNCIp6GMNi3ig8x0wToFQQqNB5cnAqKt/4D/xHHvnlcbLzqBHWJ\r\npOS/ssZESaQSdABiznZN3p/zZWLRwKE5O+FHW1V1Wknev2Zp97ZwTQbYidD9\r\nWLdMyt4E6btl+LHh6W8ZLl3SlgLsu+lk0nflZXb/q2Uz/zr9rPHq/TtDEVE+\r\nyahuqH11nd9iZs7Rth7SAdIRu5NJA2CgyWU=\r\n=tmRB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/ptz.js","gitHead":"d6567ffc1fade791d95b5a4e9379956bd413d698","gypfile":true,"scripts":{"test":"gulp test","install":"node-gyp rebuild"},"_npmUser":{"name":"fauxsoup","email":"fauxsoup@gmail.com"},"repository":{"url":"git+https://github.com/ghafran/ptz.git","type":"git"},"_npmVersion":"8.3.1","description":"ptz","directories":{"doc":"docs","test":"test"},"_nodeVersion":"16.14.0","dependencies":{"lodash":"^4.17.4","bluebird":"^3.5.0"},"_hasShrinkwrap":false,"devDependencies":{"nan":"^2.16.0","chai":"^4.1.2","gulp":"^3.9.1","chalk":"^2.1.0","chance":"^1.0.6","jshint":"^2.9.4","gulp-mocha":"^4.3.1","gulp-shell":"^0.6.3","gulp-jshint":"^2.0.4","run-sequence":"^2.1.0","jshint-stylish":"^2.2.1","gulp-load-plugins":"^1.5.0"},"_npmOperationalInternal":{"tmp":"tmp/ptz_0.1.0_1654938241204_0.3473871938350077","host":"s3://npm-registry-packages"}},"0.1.1":{"name":"@amdglobal/ptz","version":"0.1.1","keywords":["ptz","pan","tilt","zoom","fecc","camera","uvc","visca"],"author":{"url":"https://github.com/ghafran","name":"Ghafran Abbas"},"license":"ISC","_id":"@amdglobal/ptz@0.1.1","maintainers":[{"name":"fauxsoup","email":"fauxsoup@gmail.com"}],"homepage":"https://github.com/ghafran/ptz#readme","bugs":{"url":"https://github.com/ghafran/ptz/issues"},"dist":{"shasum":"6cb42bd38f08ea108b05270ffddf031d29ef61c3","tarball":"https://registry.npmjs.org/@amdglobal/ptz/-/ptz-0.1.1.tgz","fileCount":14,"integrity":"sha512-TJNuKny87HWg8YaY/CygFwoYCqPyCH3TSoO5DgaxLiEImbCHLQt/0kC3H5KdqQ53g9C6gFWbnM5h5Sh2ZVFr0Q==","signatures":[{"sig":"MEUCIQDRkqs+cMD2HB6yeG+n9wAxs99l+fKrrMp9fOB3wXPofQIgUsPZiihhvd4glqhiuzo8opONWzNJmyac4+JLBh44ac0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80009,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJipFrdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrUgw//XYFnr1pHMixjZSKRBbwQ06w442ayFIUyS1Wr3h1RxmTBEWBR\r\nj0NeuDmbzG+52FbXhRHpgEW1o/AASNKVtR3AmypaQwlFi17/GBm0zWXrcNog\r\nFzxFCwhzzLzdQdPOfc0rtEmKFDGo87PRjvdZJBS7J5yIFAbO3epC1mURvf2J\r\nddgmqRA97+M5J2LLOx9P/JkDtLNAL9SyPvxttfiY4GHc1lw9/XAFg4mvQt4Y\r\nc8I+lwyWlKh6Xc4yOgjGMTRSIa53TwTmVD2OsiLPaoIsfxQHIytXJZXQe3o6\r\nEZXr4sIQEeq6nrTItr6bF8Li5KG7BKeSCmSYo05/XN5fBNrbd8iB4mB0PG/9\r\nGcUgf2LulMKntJNLvX82OErdowS4OE9ysZ4r7bLjHiOSDFTOHkqnFv3DQnpR\r\nlvf981j8jzxTLE3FL97kfHBo2DrKYYE7PrEZamc6tX3H00s7JSxjcj94YHPD\r\n+M9nuPTYX2XFDwzrst+oRqdX8FW9hZiCkNMYclNlg3W1cDC+JPxdIg92oih9\r\niP6H1ZytVGb1Jx2ewzJbeD/3jNBMCjthz1nckN/0RA18yvD9svQ5bG2HYZhz\r\nM2oxedn4aJ/M1h1Ue6NU6/0a8z9jUx3K56QeNNVv0c00oQheR2JbKX5E4Igk\r\noEKLMJA20PKp7dSTmWGd99pA9U6vYKm2e/4=\r\n=yc7a\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/ptz.js","gitHead":"fb91f91e69dfe995ff89addec0ba6ea061f9b026","gypfile":true,"scripts":{"test":"gulp test","install":"node-gyp rebuild"},"_npmUser":{"name":"fauxsoup","email":"fauxsoup@gmail.com"},"repository":{"url":"git+https://github.com/ghafran/ptz.git","type":"git"},"_npmVersion":"8.3.1","description":"ptz","directories":{"doc":"docs","test":"test"},"_nodeVersion":"16.14.0","dependencies":{"nan":"^2.16.0","lodash":"^4.17.4","bluebird":"^3.5.0"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.1.2","gulp":"^3.9.1","chalk":"^2.1.0","chance":"^1.0.6","jshint":"^2.9.4","gulp-mocha":"^4.3.1","gulp-shell":"^0.6.3","gulp-jshint":"^2.0.4","run-sequence":"^2.1.0","jshint-stylish":"^2.2.1","gulp-load-plugins":"^1.5.0"},"_npmOperationalInternal":{"tmp":"tmp/ptz_0.1.1_1654938333313_0.5779177028825533","host":"s3://npm-registry-packages"}},"0.1.2":{"name":"@amdglobal/ptz","version":"0.1.2","keywords":["ptz","pan","tilt","zoom","fecc","camera","uvc","visca"],"author":{"url":"https://github.com/ghafran","name":"Ghafran Abbas"},"license":"ISC","_id":"@amdglobal/ptz@0.1.2","maintainers":[{"name":"fauxsoup","email":"fauxsoup@gmail.com"}],"homepage":"https://github.com/ghafran/ptz#readme","bugs":{"url":"https://github.com/ghafran/ptz/issues"},"dist":{"shasum":"a57201ae04f316e52681ccf2e63359378c99088b","tarball":"https://registry.npmjs.org/@amdglobal/ptz/-/ptz-0.1.2.tgz","fileCount":11,"integrity":"sha512-f9w19dER7zGlxXOxMOVMYDPiJQyOSNvykpkjQtnqesSBCQXQwkDAMqR061zS2qAuyzatR/r6urnvNg2lFDpmjQ==","signatures":[{"sig":"MEUCIByQGMG707dH2fHSZtAgdTqVJOi7m/ZMaEeSNick4zpHAiEAsEpWX1cMIH1y5Uwbg5NALYf3JLHLTF4v9SlpyLZJPmA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":67443,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJipN5KACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpPZhAAjgZP2kTwFwvwLaF1yAugm8scAfDHCdIuyZ3bwsqryuZRTdk7\r\n79++/HqhbYi9rdqokdmE5t5EGmOk1AR9NER5gOwoLqM8mvLTUtPX19dC0wgE\r\n1Wg1iMKatJKGsAUw3WVvrLY9v0DvMXclabFC6ME5i3vUQgYBazw0NBMhMmq3\r\nCOfbQWqJvSm85recE68+doPM9UrAT6SdegjA8krWJJbuwTHNTi4AwJ2nXQo/\r\n1RhhRVuTyFIGvhAIjRELR8COyGZxXTge94KSWVA2a85rZ0HAXjrV8FgO7v8J\r\nJmUq0AUq3lfOjRqySC8OJYMcMAUyqSYEvg1Y+1dfGESP8Lq+b0oIrvPxnS9A\r\nvzCwlZndDRCG+x2t9+jbME54uq7iN4cRwjUyMo32BfrviVUgAtlSejUQaLhS\r\no6DlNtud/E9GZ18YRpcMaihkQKFZ8J2kpPZc6BSdiOwm7MCI8ymHoi5tvvFf\r\nJBAXliQEX+1FBhzNZzCgy6YY2hDWHAx4uTr+Xd097M1Hj/mm7bQvbKDD4rGt\r\nyD+lpg47EFjtp3e5rHM/G9KAZ78AUdPzlNHYcc+X/zq3Cw2f4HykBeSbBMql\r\nBOF0NuiiQ0BcZk+HFwZaGJ809FQAwsCTeCXBkoSV/yWW/VO2Xbx7knHPgDy3\r\nCoZ9aLLnFYo50Dvftb/cKw0i05oFysdkN7o=\r\n=b8Ex\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/ptz.js","gitHead":"be6c9b7b86feb76408d759747e519d6f6fb996b9","gypfile":true,"scripts":{"test":"gulp test","install":"node-gyp rebuild"},"_npmUser":{"name":"fauxsoup","email":"fauxsoup@gmail.com"},"repository":{"url":"git+https://github.com/ghafran/ptz.git","type":"git"},"_npmVersion":"8.3.1","description":"ptz","directories":{"doc":"docs","test":"test"},"_nodeVersion":"16.14.0","dependencies":{"nan":"^2.16.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/ptz_0.1.2_1654971978291_0.20807807589696425","host":"s3://npm-registry-packages"}}},"time":{"created":"2022-06-11T09:04:01.147Z","modified":"2026-06-16T18:11:31.275Z","0.1.0":"2022-06-11T09:04:01.384Z","0.1.1":"2022-06-11T09:05:33.551Z","0.1.2":"2022-06-11T18:26:18.431Z"},"bugs":{"url":"https://github.com/ghafran/ptz/issues"},"author":{"url":"https://github.com/ghafran","name":"Ghafran Abbas"},"license":"ISC","homepage":"https://github.com/ghafran/ptz#readme","keywords":["ptz","pan","tilt","zoom","fecc","camera","uvc","visca"],"repository":{"url":"git+https://github.com/ghafran/ptz.git","type":"git"},"description":"ptz","maintainers":[{"email":"ganesh.r@excelglobalsolution.com","name":"ganeshr"},{"email":"muhammadyounus.shaik@excelglobalsolution.com","name":"younus183"},{"email":"fauxsoup@gmail.com","name":"fauxsoup"},{"email":"rohitkumar.padala@excelglobalsolution.com","name":"rohitkumarpadala"},{"email":"sean@amdtelemedicine.com","name":"dayburner"},{"email":"chip@amdtelemedicine.com","name":"chipmcintosh"}],"readme":"[![Build Status](https://secure.travis-ci.org/ghafran/ptz.png)](http://travis-ci.org/ghafran/ptz)\n\n# PTZ\n\nA camera control module for pan/tilt/zoom operations. Oh yea, in nodejs.\n\n## Installing\n\nInstall dependencies first (see below).\n```\nnpm install ptz\n```\n\n# Goals\n\nWorks with any plug & play UVC camera to perform pan/tilt/zoom operations.\n\n# Reference\n\n```\nvar ptz = require('ptz');\n```\n\n# List Devices\n\n```\nptz.listDevices(function(err, devices){\n    devices.forEach(function(device){\n        console.log(device.type, device.vendorId, device.productId, device.description);\n    });\n});\n```\n\nOr, using promises. Generally, all operations can be done via callback or promises, whatever floats your boat :)\n\n```\nptz.listDevices().then(function(devices){\n    devices.forEach(function(device){\n        console.log(device.type, device.vendorId, device.productId, device.description);\n    });\n});\n```\n\n# Get Camera Instance\n\nBefore any operations can be performed, get a camera instance using the code below. The camera details can be retrieved from **listDevices()**. Then you can call **getCapabilities()** to see what operations are supported by the camera.\n\n```\nvar camera = ptz.getCamera({\n    vendorId: 0, // use 0 to get the first camera\n    productId: 0 // use 0 to get the first camera\n});\n\n// perform ptz operations here, or get camera ptz capabilities\ncamera.getCapabilities().then(function(capabilities){\n    console.log(capabilities);\n});\n```\n\n# Pan/Tilt/Zoom Operations\n\nLet's get to the fun part.\n\n## Zoom\n\nThere are two methods of performing zoom operations, **absolute** and **relative**.\n\nAbsolute allows you to specify the exact zoom level to go to and the camera goes there regardless of current zoom level.\n\nRelative lets you send a zoom-in or zoom-out commands, then the camera will beginning changing its zoom level towards that direction. Once its where you want it to be, send a stop command.\n\n### Absolute Zoom\n\n```\n// Get the camera's zoom info so you know the min, max, and resolution values for zoom level.\ncamera.getAbsoluteZoom().then(function(zoom){\n    console.log(zoom);\n\n    var zoomLevel = 10; // must be between min and max and divisible by resolution, without remainder.\n    camera.absoluteZoom(zoomLevel).then(function(){\n        console.log('absolute zoom command sent!');\n    });\n});\n```\n\n### Relative Zoom\n\n```\n// Get the camera's zoom info so you know the min, max, and resolution values for speed.\ncamera.getRelativeZoom().then(function(zoom){\n    console.log(zoom);\n\n    var speed = 10; // must be between min and max and divisible by resolution, without remainder.\n    camera.relativeZoomIn(speed).then(function(){\n        console.log('relative zoom-in command sent!');\n        camera.relativeZoomStop().then(function(){ // usually we would wait for a bit before stopping\n            console.log('relative zoom stop command sent!');\n            camera.relativeZoomOut(speed).then(function(){\n                console.log('relative zoom-out command sent!');\n                camera.relativeZoomStop().then(function(){\n                    console.log('relative zoom stop command sent!');\n                });\n            });\n        });\n    });\n});\n\n```\n\n## Pan/Tilt\n\nThere are two methods of performing pan/tilt operations, **absolute** and **relative**. For some reason both pan and tilt go hand-in-hand in the UVC standards specification. We cannot change these two independently. We must provide both values together when sending commands to the device. They are like stuck together, like, well, glue.\n\nAbsolute allows you to specify the exact pan and tilt location to go to and the camera goes there regardless of current location.\n\nRelative lets you send up, down, left, right commands, then the camera will beginning changing its location towards those directions. Once its where you want it to be, send a stop command.\n\nAlso, pan and tilt settings are in arc second units. 1 arc second is 1/3600 of a degree. Values range from **–180*3600** arc second to **+180*3600** arc second. Positive values are clockwise from the origin (the camera rotates clockwise when viewed from above), and negative values are counterclockwise from the origin. For tilt, positive values point the imaging plane up, and negative values point the imaging plane down.\n\n\n### Absolute Pan/Tilt\n\n```\n// Get the camera's pan and tilt info so you know the min, max, and resolution values for both.\ncamera.getAbsolutePanTilt().then(function(panTilt){\n    console.log(panTilt);\n\n    var pan = 90 * 3600;\n    var tilt = 90 * 3600;\n    camera.absolutePanTilt(pan, tilt).then(function(){\n        console.log('absolute pan/tilt command sent!');\n    });\n});\n```\n\n### Relative Pan/Tilt\n\n```\n// Get the camera's pan and tilt info so you know the min, max, and resolution values for both speeds.\ncamera.getRelativePanTilt().then(function(panTilt){\n    console.log(panTilt);\n\n    var pan_speed = 10; // must be between min and max and divisible by resolution, without remainder.\n    var tilt_speed = 10; // must be between min and max and divisible by resolution, without remainder.\n    var pan_direction = 1; // 1 right, -1 left, 0 no change\n    var tilt_direction = 1; // 1 up, -1 down, 0 no change\n    camera.relativePanTilt(pan_direction, pan_speed, tilt_direction, tilt_speed).then(function(){\n        console.log('relative pan/tilt command sent!');\n        camera.relativeZoomStop().then(function(){ // usually we would wait for a bit before stopping\n            console.log('relative pan/tilt stop command sent!');\n        });\n    });\n});\n```\n\n# Install dependencies\nNeed to install `libuvc` on the machine first.\n\n## Mac\n```\n# install libusb\nbrew install libtool automake\nmkdir -p ~/git\ncd ~/git\ngit clone https://github.com/libusb/libusb\ncd libusb\nautoreconf --install\nmkdir build\ncd build\n../configure\nmake && sudo make install\n\n# install libuvc\nbrew install cmake\nmkdir -p ~/git\ncd ~/git\ngit clone https://github.com/ktossell/libuvc\ncd libuvc\nmkdir build\ncd build\ncmake -D LIBUSB_INCLUDE_DIRS=/usr/local/Cellar/libusb/1.0.21/include/libusb-1.0 ..\nmake && sudo make install\n```\n\n## Linux\n```\nsudo apt-get -qq update\nsudo apt-get install -y libusb-1.0-0-dev\nsudo apt-get install -y build-essential libudev-dev libtool cmake git\nmkdir -p ~/git\ncd ~/git\ngit clone https://github.com/ktossell/libuvc\ncd libuvc\nmkdir build\ncd build\ncmake -D LIBUSB_INCLUDE_DIRS=/usr/include/libusb-1.0 ..\nmake && sudo make install\n```\n\n## Windows\nNot supported\n\n\n# As A Side Note\n\nJust as a side node, on every operation sent to the camera, a USB connection is opened and immediately closed. This is to minimize conflicts with the USB device and keep things easy to manage. We don't need to figure out how to keep USB connections open and maintain them.\n\nDon't always trust the min max values from the cameras. For pan/tilt the min should always be (-180 * 3600) and max should be (180 * 3600). If these values are different, test the values before trusting them.\n","readmeFilename":"README.md"}