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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:57:09+00:00 2026-06-17T14:57:09+00:00

This is part of image processing algorithm where more optimization is expected. We have

  • 0

This is part of image processing algorithm where more optimization is expected.
We have a large sparse matrix consisting of 0’s and 1’s. In this sparse matrix there are one or more dense region of 1’s. Lets say the whole matrix represents an image and 0 represent non-video areas and 1 represents video areas. Basically All nearby 1’s should be grouped together to find out the more approximate video region. So drawing a boundary around all 1’s will give exact video areas in a image.

enter image description here

As shown in the above matrix of 0’s and 1’s. There are 4 dense areas of 1’s. We have tried a naive approach which is of more time complexity and further improvements expected.

The approach we tried is converting all 0’s in a block size of 3*3 or 2*2 if the number of 1’s in the block are above a certain threshold value. But even this approach doesnt give us the exact boundary of video blocks.

So looking for a better algorithm which is good in both time and space complexity. Actually this calculation need to be done in real time so algorithm must have a very less time complexity. It would be great if we can achieve in O(n) linear time.

  • 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-17T14:57:10+00:00Added an answer on June 17, 2026 at 2:57 pm

    The usual approach here is to apply a sweep line algorithm.

    Basically, it works as follows: Look at each column. If it consists of all zeros, move on to the next column. If it contains 1’s, save the smallest and largest vertical positions (they are likely candidates for rectangle coordinates). As you move the sweep line further, adjust your candidates accordingly. If you have found candidates and reach a line consisting of all zeros, your coordinate candidates are the actual coordinates of the rectangle.

    You may as well (or additionally) sweep vertically and examine rows instead of columns.

    Depending on the properties of your matrix (or your task), there are a lot of different possible solutions. Consider the following matrix:

    1 1 1
    1 1 1
    1 1 1
    

    How many rectangles does it contain? 1? 9? 4?

    In your example, the two touching rectangles may as well be regarded as part of one larger rectangle.

    Some advice: state your problem more clearly.

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

Sidebar

Related Questions

I have an app that uploads an image to Facebook. this is the part
I have an image processing algorithm which makes of matrices, I have my own
I have written an image processing application with the GUI part written in Java
This part of an app that I am working on, I have the following
I have this part of script from my GAE application which uses webapp2, which
I have this problem on my payroll processing system. Below the area where the
We have a Mono application under Linux that does image processing on a bunch
So, this is my problem: I have this very big image, and I want
I have made an image processing module that defines a Pixel type as a
I study convolution in image processing as it is a part of the curriculum,

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.