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

  • Home
  • SEARCH
  • 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 100045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:30:15+00:00 2026-05-11T00:30:15+00:00

Given an object on a plain white background, does anybody know if OpenCV provides

  • 0

Given an object on a plain white background, does anybody know if OpenCV provides functionality to easily detect an object from a captured frame?

I’m trying to locate the corner/center points of an object (rectangle). The way I’m currently doing it, is by brute force (scanning the image for the object) and not accurate. I’m wondering if there is functionality under the hood that i’m not aware of.

Edit Details: The size about the same as a small soda can. The camera is positioned above the object, to give it a 2D/Rectangle feel. The orientation/angle from from the camera is random, which is calculated from the corner points.

It’s just a white background, with the object on it (black). The quality of the shot is about what you’d expect to see from a Logitech webcam.

Once I get the corner points, I calculate the center. The center point is then converted to centimeters.

It’s refining just ‘how’ I get those 4 corners is what I’m trying to focus on. You can see my brute force method with this image: Image

  • 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. 2026-05-11T00:30:16+00:00Added an answer on May 11, 2026 at 12:30 am

    There’s already an example of how to do rectangle detection in OpenCV (look in samples/squares.c), and it’s quite simple, actually.

    Here’s the rough algorithm they use:

    0. rectangles <- {} 1. image <- load image 2. for every channel: 2.1  image_canny <- apply canny edge detector to this channel 2.2  for threshold in bunch_of_increasing_thresholds: 2.2.1   image_thresholds[threshold] <- apply threshold to this channel 2.3  for each contour found in {image_canny} U image_thresholds: 2.3.1   Approximate contour with polygons 2.3.2   if the approximation has four corners and the angles are close to 90 degrees. 2.3.2.1    rectangles <- rectangles U {contour} 

    Not an exact transliteration of what they are doing, but it should help you.

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

Sidebar

Related Questions

Given a String, I know Groovy provides convenience methods like String.findAll(String, Closure) Finds all
How do I check if a given object is nullable in other words how
Do you generally assume that toString() on any given object has a low cost
Given an object: let myObject = { "ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*" };
Given an object like: class M(models.Model): test = models.BooleanField() created_date = models.DateTimeField(auto_now_add=True) Given sample
What is the best way to take a given PHP object and serialize it
How would you dynamically subscribe to a C# event so that given a Object
Given a Python object of any kind, is there an easy way to get
Given an SQLConnection object how can you get a schema for a single table?
Given a FieldInfo object and an object, I need to get the actual bytes

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.