# SIFT algorithm in opencvjs is undefined

**URL:** <https://forum.opencv.org/t/sift-algorithm-in-opencvjs-is-undefined/23973>\
**Category:** Uncategorized\
**Tags:** opencvjs, features2d, build\
**Created:** [September 10, 2025, 6:54am UTC](https://forum.opencv.org/t/sift-algorithm-in-opencvjs-is-undefined/23973 "2025-09-10T06:54:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![2297098619pcz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/2297098619pcz/32/13706_2.png) [@2297098619pcz](https://forum.opencv.org/u/2297098619pcz)\
**Post date:** [September 10, 2025, 6:54am UTC](https://forum.opencv.org/t/sift-algorithm-in-opencvjs-is-undefined/23973/1 "2025-09-10T06:54:33Z")

</div>

OpenCV version: 4.12.0  
I added “‘SIFT’: [‘create’],” to features2d in opencv\_js.config.py. However, after building, references to cv.SIFT are still undefined. I also added the opencv\_contrib add-on module and enabled --cmake\_option=“-DOPENCV\_ENABLE\_NONFREE=ON”, but this did not resolve the issue.

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [September 10, 2025, 9:53am UTC](https://forum.opencv.org/t/sift-algorithm-in-opencvjs-is-undefined/23973/2 "2025-09-10T09:53:03Z")

</div>

here is a previous thread on getting SIFT and the FLANN-based matcher to build for javascript:

- [[OpenCV.js] Getting SIFT and FLANN to work](https://forum.opencv.org/t/opencv-js-getting-sift-and-flann-to-work/9987)

It links to this issue, where someone explains what’s needed to make FLANN available. To me it sounds as if the procedure needs little adaptation to work for SIFT:

- [FLANN feature matching in opencv.js · Issue #16607 · opencv/opencv · GitHub](https://github.com/opencv/opencv/issues/16607)

Perhaps try to include more than just the `create` method.

When in doubt, you could add a post to the other thread, directly pinging the relevant user by typing an `@` and then their name. After typing the `@`, autocompletion should pop up.

---

<div class="post-metadata">

**Author:** ![2297098619pcz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/2297098619pcz/32/13706_2.png) [@2297098619pcz](https://forum.opencv.org/u/2297098619pcz)\
**Post date:** [September 11, 2025, 2:01am UTC](https://forum.opencv.org/t/sift-algorithm-in-opencvjs-is-undefined/23973/3 "2025-09-11T02:01:13Z")

</div>

I have read these two posts, but the problem does not seem to be solved. I tried to add the SITF whitelist to be consistent with ORB, but I can only use the ORB algorithm and cannot use the SIFT algorithm. I understand that since the patent expires in 2020, SIFT should have been included in the main library, but I still can’t use it. Perhaps you can provide me with an opencv.js file

---

<div class="post-metadata">

**Author:** ![2297098619pcz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/2297098619pcz/32/13706_2.png) [@2297098619pcz](https://forum.opencv.org/u/2297098619pcz)\
**Post date:** [September 11, 2025, 2:07am UTC](https://forum.opencv.org/t/sift-algorithm-in-opencvjs-is-undefined/23973/4 "2025-09-11T02:07:42Z")

</div>

I didn’t use FLANN, but BFMatcher. Now I use it after ORB. My feature points are around 500, and I think BFMatcher is better than it.

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [September 11, 2025, 9:36am UTC](https://forum.opencv.org/t/sift-algorithm-in-opencvjs-is-undefined/23973/5 "2025-09-11T09:36:25Z")

</div>

you could open an issue, asking for inclusion of SIFT in opencv.js. to my knowledge, no such issue exists yet.

> **[opencv/opencv](https://github.com/opencv/opencv/issues)**
>
> Open Source Computer Vision Library. Contribute to opencv/opencv development by creating an account on GitHub.

SIFT is in `features2d`, i.e. the main repo. it used to be in `xfeatures2d` (contrib repo) when it was still under patent protection.

newer feature descriptors are faster and at least as good as SIFT. I’ve been using AKAZE for a long time. even better ones might have been developed since. some of those are ML/DNN-based, so if you browse the `dnn` module or its examples, you might find some.

---

<div class="post-metadata">

**Author:** ![2297098619pcz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/2297098619pcz/32/13706_2.png) [@2297098619pcz](https://forum.opencv.org/u/2297098619pcz)\
**Post date:** [September 11, 2025, 10:03am UTC](https://forum.opencv.org/t/sift-algorithm-in-opencvjs-is-undefined/23973/6 "2025-09-11T10:03:50Z")

</div>

OK, thank you for your answer. I will suggest SIFT to be included in the whitelist on GitHub. My original intention was to extract complex graphic features composed of lines, but it seems that many algorithms are not ideal, combined with the Lowe ratio test.
