This sample demonstrate how to use js-aruco2 in a NodeJS application to detect markers on a video stream generated with FFMPEG.
- FFMPEG installed or
ffmpeg
executable available in this folder - NodeJS + NPM
-
Configure your camera input editing the
config.camera
,config.cameraWidth
andconfig.cameraHeight
parameters in thepackage.json
(instructions for setting the camera on different OS are available in thepackage.json
). -
Optionally configure the server port (default
8081
) editing theconfig.port
attribute. -
Optionally change the endpoint secret editing the
config.secret
attribute, in order to avoid stream hijacking if deployed on centralized server. -
Optionally change the ArUco markers dictionary used editing the
config.dictionaryName
attribute (defaultARUCO_MIP_36h12
). Available values areARUCO_MIP_36h12
andARUCO
. -
Optionally change the default hamming distance of the selected dictionary editing the
config.maxHammingDistance
attribute.
- Initialize the project:
npm run init
- Start the server:
npm run server
- Start the FFMPEG stream of your camera:
- For Window based OS:
npm run stream_win
- For Linux based OS:
npm run stream_unix
- For MacOS based OS:
npm run stream_osx
- For Window based OS:
- The recognized markers are visualized in the console. Additionally (mainly for testing purposes) the last processed image will be continously saved as JPEG in this folder with name
camera_out.jpg
- In order to avoid frames dropping and not overload the system,
ffmpeg
will send 1 frame per second to the server.