# Extract data from rect = cv2.minAreaRect(c) structure (tuple?)

**URL:** <https://forum.opencv.org/t/extract-data-from-rect-cv2-minarearect-c-structure-tuple/24273>\
**Category:** Python\
**Tags:** programming\
**Created:** [December 21, 2025, 5:30pm UTC](https://forum.opencv.org/t/extract-data-from-rect-cv2-minarearect-c-structure-tuple/24273 "2025-12-21T17:30:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jogl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/jogl/32/410_2.png) [@jogl](https://forum.opencv.org/u/jogl)\
**Post date:** [December 21, 2025, 5:30pm UTC](https://forum.opencv.org/t/extract-data-from-rect-cv2-minarearect-c-structure-tuple/24273/1 "2025-12-21T17:30:00Z")

</div>

I have rect = cv2.minAreaRect(c) which contains the data as (centre x,y), (size l,w), angle.

How can I extract the data so I have it in simple integer form?

Ie.

x=

y=

l=

w=

angle=

I know this is simple but I’m kind of struggling with the Python terminology I think.

Thanks,

JP

P.S.:

This is what I have working now, is there a better way?

```auto
    `(rx,ry),(rl,rw),ra = rect`

```

`print (int(rx), int(ry), int(rl), int(rw), int(ra))`

[CODE]

[/CODE]

and… where are the CODE tags?

---

<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:** [December 21, 2025, 10:20pm UTC](https://forum.opencv.org/t/extract-data-from-rect-cv2-minarearect-c-structure-tuple/24273/2 "2025-12-21T22:20:26Z")

</div>

> [@jogl](#):
>
> `(rx,ry),(rl,rw),ra = rect`

That is how to do it.

The concept is called “destructuring bind”. It is not unique to Python. Other languages have this too.

This forum is a “Discourse” forum. It uses some variant of Markdown for styling. This is similar to reddit and stack overflow, which also use variants of Markdown. Right above the text box is a menu bar for styling. The text box can also be switched to a rich text editor, from that same menu bar.
