Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 9, 2025

Adds TypeScript type definitions for SIFT (Scale-Invariant Feature Transform) feature detector. SIFT patent expired in 2020 but requires OpenCV built with OPENCV_ENABLE_NONFREE=ON.

Changes

Type Definitions (src/types/opencv/SIFT.ts)

  • SIFT class extending Feature2D with 5 optional constructor parameters matching OpenCV 4.12 API
  • Exported via _types.ts

Build Configuration (.github/workflows/build-opencv.yml)

  • Added --cmake_option="-DOPENCV_ENABLE_NONFREE=ON" to enable SIFT in future opencv.js builds

Documentation (README.md)

  • Feature detection section with SIFT usage example and memory management patterns

Tests (test/SIFT.test.ts)

  • Type definition validation (runs now)
  • Runtime functionality tests (skipped until opencv.js rebuilt with NONFREE enabled)

Usage

const sift = new cv.SIFT(
  500,   // nfeatures
  3,     // nOctaveLayers  
  0.04,  // contrastThreshold
  10,    // edgeThreshold
  1.6    // sigma
);

const keypoints = new cv.KeyPointVector();
const descriptors = new cv.Mat();
sift.detectAndCompute(gray, new cv.Mat(), keypoints, descriptors);

console.log(`Found ${keypoints.size()} keypoints with ${descriptors.cols}-dim descriptors`);

// Cleanup
keypoints.delete();
descriptors.delete();
sift.delete();

Note: Full SIFT functionality requires rebuilding opencv.js binary with updated workflow. TypeScript definitions work immediately.

Original prompt

This section details on the original issue you should resolve

<issue_title>could including SIFT function</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)


💡 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.

Co-authored-by: ttt43ttt <132509+ttt43ttt@users.noreply.github.com>
Copilot AI changed the title [WIP] Add SIFT function implementation Add SIFT feature detector TypeScript definitions and enable NONFREE build flag Nov 9, 2025
Copilot AI requested a review from ttt43ttt November 9, 2025 13:52
Copilot finished work on behalf of ttt43ttt November 9, 2025 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

could including SIFT function

2 participants