Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8353479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:16:21+00:00 2026-06-09T09:16:21+00:00

I am trying to call OpenCV function MinAreaRect2 from within python. I use OpenCV

  • 0

I am trying to call OpenCV function MinAreaRect2 from within python.
I use OpenCV 2.4.2 with python 2.7 and numpy 1.6.
I went this far :

import cv

def nda2ipl(arr, dtype=None):
    return cv.fromarray(np.ascontiguousarray(arr, dtype=dtype))

def min_area_rect2(points):
    storage = cv.CreateMemStorage()
    cv_points = nda2ipl(points.reshape((-1, 1, 2)))
    out = cv.MinAreaRect2(cv_points, storage)
return out

I can call this function with a ndarray of shape (N x 2). I get this kind of results :

((476.5, 604.5), (951.0, 1207.0), -0.0)

I assume that the first tuple is the center of the box, the second gives the width and the height and the last is the angle.

The problem is I could not get a clear reference stating this. Actually, the opencv documentation tells me what the functions returns in Python.

I found the official documentation about this function but this is not very helpful.

What are exactly the output of MinAreaRect2 in python ?
More generally, where do you get precise documentation about the OpenCV python wrapper ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T09:16:24+00:00Added an answer on June 9, 2026 at 9:16 am

    OpenCV Python wrapper documentation is kept along with the normal documentation in same site, http://www.docs.opencv.org

    Earlier Python module used was cv interface, which used native data types from original C++ interface like cvMat, cvSeq etc.

    Later it was shifted to more better, advanced and simpler module cv2 interface. In it, everything is returned as either Numpy arrays or native python data types.

    Here, tuple returned has the same arguments as that of cvBox2D. You can find more details the differences between different python wrappers here : What is different between all these OpenCV Python interfaces?

    Here, your assumption is correct. Those values specified exactly what you mentioned.

    If you want to draw rotated rect, you need 4 vertices of the rectangle. For that, you need a function which is never seen in documentation, ie cv2.cv.BoxPoints() (but don’t worry, it will be there in documentation when OpenCV 2.4.3 is released. )

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use the Python opencv function Moments() on a grayscale image,
Hi im trying call this function from an element, but the element id is
I'm trying to call a function present in one class from another class by
I am trying to call c# function from javascript the code i have tried
Im trying to call python functions from C code, and i followed a sample
When trying to call this function in my code i get the error in
(Step 1) I'm trying to get openCV to run from python on my mac
HI! I'm trying to install opencv and use it with python, but when I
In the following I am trying call action script function from js function. What
Am trying to call a JS script from a function library in another script.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.