# Format of detect corners for detectAndDecode api

**URL:** <https://forum.opencv.org/t/format-of-detect-corners-for-detectanddecode-api/5388>\
**Category:** Uncategorized\
**Tags:** qrcode\
**Created:** [September 28, 2021, 7:58am UTC](https://forum.opencv.org/t/format-of-detect-corners-for-detectanddecode-api/5388 "2021-09-28T07:58:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhargavah](https://avatars.discourse-cdn.com/v4/letter/b/bc79bd/32.png) [@bhargavah](https://forum.opencv.org/u/bhargavah)\
**Post date:** [September 28, 2021, 7:58am UTC](https://forum.opencv.org/t/format-of-detect-corners-for-detectanddecode-api/5388/1 "2021-09-28T07:58:03Z")

</div>

Hi Guys,

We could not get a clear answer on the format of the corners returned by detectAndDecode function. We are writing:

`std::vector<cv::Point> corners; std::string data = detectAndDecode(sourceImage, corners);`

We believe the size of corners would be 4 for valid cases. Now, we would like to know the format of the corners here like 1st index is for top left, 2nd index is for bottom left etc etc.

Thanks in advance for it. Could not get anything related to it online as well.

---

<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:** [September 28, 2021, 8:28am UTC](https://forum.opencv.org/t/format-of-detect-corners-for-detectanddecode-api/5388/2 "2021-09-28T08:28:26Z")

</div>

> [@bhargavah](#):
>
> detectAndDecode

which function do you mean, exactly ?  
(there are a few, but they are all “class members”, so your code is already wrong, missing an “object instance”)

> [@bhargavah](#):
>
> Could not get anything related to it online as well.

cant find [docs](https://docs.opencv.org/master), huh ?  
(there’s even a search box)

---

<div class="post-metadata">

**Author:** ![bhargavah](https://avatars.discourse-cdn.com/v4/letter/b/bc79bd/32.png) [@bhargavah](https://forum.opencv.org/u/bhargavah)\
**Post date:** [September 28, 2021, 10:57am UTC](https://forum.opencv.org/t/format-of-detect-corners-for-detectanddecode-api/5388/3 "2021-09-28T10:57:16Z")

</div>

> [@](#):
>
> which function do you mean, exactly ?  
> (there are a few, but they are all “class members”, so your code is already wrong, missing an “object instance”)

Well, that’s fine. I do not think that you are supposed to paste all code here. This is just a snapshot and I believe serves the purpose of the question.

> [@](#):
>
> cant find [docs](https://docs.opencv.org/master), huh ?  
> (there’s even a search box)

If you search, this is what you will see: [OpenCV: cv::QRCodeDetector Class Reference](https://docs.opencv.org/master/de/dc3/classcv_1_1QRCodeDetector.html#a7290bd6a5d59b14a37979c3a14fbf394)

And this does not tell you that in which order corners are given.

---

<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:** [September 28, 2021, 12:14pm UTC](https://forum.opencv.org/t/format-of-detect-corners-for-detectanddecode-api/5388/4 "2021-09-28T12:14:18Z")

</div>

order seems to be : [bl, tl, tr, br]

> <https://github.com/opencv/opencv/blob/982745fb839ee27dc0e3b9ab45b9b3e9111593bf/modules/objdetect/src/qrcode.cpp#L3488-L3493>
