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 8658145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:41:36+00:00 2026-06-12T15:41:36+00:00

I have drawn a rectangle using cv.rectangle and have a contours shape (from FindContours)

  • 0

I have drawn a rectangle using cv.rectangle and have a contours shape (from FindContours) which the rectangle is drawn over .

The rectangle intersects the the complete contour at two points. How can I find these points of intersection between the rectangle and the contour outline.

I could add the two images together and look for maxima but I do know how the rectangle vertices are stored , as I would need a line type vector filled with a set of points

Thanks

  • 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-12T15:41:38+00:00Added an answer on June 12, 2026 at 3:41 pm

    If you are sure that your rectangle cross the shape at only 2 points, you can iterate through your contour point, and check if these points are in your rectangle border.

    std::vector<cv::Point> shape; // computed with FindContours
    cv::Rect myRect; //whatever
    
    const int NUMPOINTS = 2;
    int found = 0;
    for(std::vector<cv::Point>::iterator it = shape.begin(); it != shapes.end() && found < NUMPOINTS; ++it) {
      if (it->y == myRect.y && it->x >= myRect.x && it->x < myRect.x + width)
        // that point cross the top line of the rectangle
        found++; // you might want to store the point
      else if (// ... add the other checks here)
    
    }  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Flex application in which I draw a rectangle using: <s:Rect height=20
I have a custom UIView which is drawn using its -[drawRect:] method. The problem
I have drawn something like this: How to remove the paths and points?
I have drawn a checkbox in devexpress grid group row using the code below.
Hi I have tried to draw an rubberband rectangle on a form using the
I have created a custom control which derives from Panel. I use it to
I was a problem with drawing rectangle using mouse. I have solve my problem
I have drawn a rectangle. I know its (x1,y1) Top Left and (x2,y2) Bottom
I have drawn an image on a Composite using the following code imageCanvas =
Hi there I have a image with a black rectangle drawn on it, and

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.