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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:27:32+00:00 2026-05-27T15:27:32+00:00

Imagine a plain rectangular bitmap of, say, 1024×768 pixels filled with white. There are

  • 0

Imagine a plain rectangular bitmap of, say, 1024×768 pixels filled with white. There are a few (non-overlapping) sprites drawn onto the bitmap: circles, squares and triangles.

Is there an algorithm (possibly even a C++ implementation) which, given the bitmap and the color which is the background color (white, in the above example), yields a list containing the smallest bounding rectangles for each of the sprites?

Here’s some sample: On the left side you can see a sample bitmap which my code is given (together with the information that the ‘background’ is white). On the right side you can see the same image together with the bounding rectangles of the four shapes (in red); the algorithm I’m looking for computes the geometry of these rectangles.

Input picture
Output picture

Some painting programs have a similiar feature for selecting shapes: they can even compute seemingly arbitrary bounding polygons. Instead of dragging a selection rectangle manually, you can click the ‘background’ (what’s background and what’s not is determined by some threshold) and then the tool automatically computes the shape of the object drawn onto the background. I need something like this, except that I’m perfectly fine if I just have the rectangular bounding areas for objects.

I became aware of OpenCV; it appears to be relevant (it seems to be a library which includes every graphics algorithm I can think of – and then some) but in the fast amount of information I couldn’t find the way to the algorithm I’m thinking of. I would be surprised if OpenCV couldn’t do this, but I fear you’ve got to have a PhD to use it. 🙂

  • 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-05-27T15:27:33+00:00Added an answer on May 27, 2026 at 3:27 pm

    Here is the great article on the subject:

    http://softsurfer.com/Archive/algorithm_0107/algorithm_0107.htm

    I think that PhD is not required here 🙂

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

Sidebar

Related Questions

Hey, imagine a plain webapp with a log4j.properties which is under version control. I
Possible Duplicate: Plain english explanation of Big O I'd imagine this is probably something
Imagine there's a project in Bamboo with two build plans: Staging Deployment (SD) and
Let's say in some abstract ViewModel base-class I have a plain-old property as follows:
Imagine you homebrew a custom gui framework that doesn't use windows handles (compact framework,
Imagine we have a program trying to write to a particular file, but failing.
Imagine you want to animate some object on a WinForm. You setup a timer
Imagine an object you are working with has a collection of other objects associated
Imagine the scene, you're updating some legacy Sybase code and come across a cursor.
Imagine I have an function which goes through one million/billion strings and checks smth

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.