Add OpenCV contrib module support with ximgproc.thinning TypeScript definitions #90
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds comprehensive support for OpenCV contrib modules, specifically addressing the missing
cv.ximgproc.thinning()
function that users need for image skeletonization.What's Added
TypeScript Definitions
ximgproc
module including:cv.ximgproc.thinning(src, dst, thinningType)
function with proper parameter typescv.ximgproc.THINNING_ZHANGSUEN
andcv.ximgproc.THINNING_GUOHALL
constantsBuild Infrastructure
scripts/build-contrib.sh
for local contrib buildsnpm run build:contrib
command for easy buildingDeveloper Tools
src/contrib-utils.ts
with functions to detect contrib module availabilityexamples/ximgproc-thinning.ts
Usage Example
With this PR, developers now get full TypeScript support for contrib modules:
Building with Contrib Modules
To use the contrib functions, users need to build OpenCV.js with contrib modules:
The build script automatically:
-DOPENCV_EXTRA_MODULES_PATH
and-DBUILD_opencv_ximgproc=ON
Documentation
Added comprehensive documentation in README.md explaining:
cv.ximgproc.thinning()
The TypeScript definitions provide immediate developer value with autocomplete and type safety, while the build infrastructure ensures users can easily create contrib-enabled builds when needed.
Fixes #84.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
build.opencv.org
curl -s REDACTED
(dns block)docs.opencv.org
curl -s REDACTED
(dns block)curl -I REDACTED
(dns block)https://api.github.com/search/code
curl -s REDACTED
(http block)https://api.github.com/search/repositories
curl -s REDACTED
(http block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.