# Number of keypoints does not match number of descriptors

**URL:** <https://forum.opencv.org/t/number-of-keypoints-does-not-match-number-of-descriptors/17866>\
**Category:** C++\
**Tags:** features2d, feature-detection, orb\
**Created:** [June 7, 2024, 4:12am UTC](https://forum.opencv.org/t/number-of-keypoints-does-not-match-number-of-descriptors/17866 "2024-06-07T04:12:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![farhadbat](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/farhadbat/32/10136_2.png) [@farhadbat](https://forum.opencv.org/u/farhadbat)\
**Post date:** [June 7, 2024, 4:12am UTC](https://forum.opencv.org/t/number-of-keypoints-does-not-match-number-of-descriptors/17866/1 "2024-06-07T04:12:06Z")

</div>

Hi everyone,

I have a set of keypoints extracted with an aribirary keypoint detector (orb, random pixel, GFTT, etc).

Now, I want to extract ORB descriptor to each keypoint. I used the following code for it; however, number of keypoints is not equal to number of rows of descriptor matrix (cv::Mat).

Thank you,

```auto
// Compute the descriptors
        orb_descriptor_->compute(frame->left_img_, keypoints, frame->desctriptor_);

```

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [June 7, 2024, 5:16am UTC](https://forum.opencv.org/t/number-of-keypoints-does-not-match-number-of-descriptors/17866/2 "2024-06-07T05:16:03Z")

</div>

ORB::compute() may remove “bad” keypoints from the list, this is expected behaviour (same for SIFT & SURF)

that said, please use `ORB::detectAndCompute()` if possible, (not seperate functions) for effectivity.
