Skip to content

Edge detection with OpenCV.js

Updated

OpenCV.js, imported from a CDN, finds the edges in a picture drawn on a script canvas with Canny edge detection, and two planes show the picture and its edges side by side.

OpenCV.js is an 11 MB download (2.8 MB compressed): wait a few seconds for the edges to appear. Then click the scene and press Space to try other thresholds. Drag to orbit the camera, scroll to zoom.

Edge detection with OpenCV.js

The script is explained step by step in Edge detection with OpenCV.js.

Download the project file below, then import it in XR Hub with Projects › New › Import, as described in Projects and templates. It opens in XR Creator with the same scene you see running above, each script already attached to its Behavior entity. From there you can edit the scripts, adjust components and their props, preview your changes, and deploy the result as a world of your own.

OpencvEdges.xrproj