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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:12:35+00:00 2026-06-08T20:12:35+00:00

I have recently come across a problem that I cannot seem to solve. I

  • 0

I have recently come across a problem that I cannot seem to solve. I have a processed image that contains a number of pixels spread out across the entire image in small ‘local’ groups. I would like to find the ‘centre’ as it were of each group and place a single pixel in the output image as a representative of each group. The groupings can either be a closely knit group with no pixel zero spacing between them or a smaller spread out group with only a few (less than 4~5 pixels) between them. My first thought was to use something along the lines of morphological erosion but this doesn’t account for the case of slightly more spread out groups of pixels. I would just like to know if someone can point me in the right direction. The following is an example of what I would like to do:
Local Group
The left hand side image shows the input (the big black dot represents a group of pixels with no zeroes between them) and the right hand side image is an example of the type of output or processed image I would like to have. Finally I am using MATLAB and it can be assumed that the input image is a binary image (either with black being 1 or 0 either way the logic should be the same).

Thanks so much for your help!

EDIT: Thanks everyone for their input – I will be trying out the different solutions over the next day or so and I will try to reply to everyone whence I’m done. Thank you all so much for your insightful inputs – it is greatly appreciated.

  • 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-08T20:12:36+00:00Added an answer on June 8, 2026 at 8:12 pm

    I’d recommend an approach involving morphological closing followed by connected component analysis. Note that I’ve inverted the problem so the “good dots” are high-valued and the “bad background” is black. This fits more closely with the expected definition of the morphological operations.

    path = 'yourimage.png'
    space = 5; % you can change this to make it accept bigger spacings
    
    input = imcomplement(rgb2gray(imread(path))) > 0;
    input = imclose(input, strel('disk', space));
    [labels, num] = bwlabel(input, 8);
    output = logical(zeros(size(input)));
    for i = 1:num
       [r, c] = find(labels==i); 
       x = round(mean(c))
       y = round(mean(r))
       output(y,x) = 1;
    end
    
    imshow(output)
    

    The results look like this:

    Results

    Seems to me to be what you’re looking for!

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

Sidebar

Related Questions

I have never come across this issue but most recently I noticed that a
I have recently come across a number of projects where developers have been leaving
Ive come across a nice problem recently, I have a Map LinkedHashMap<String, List<MyCustomObject>> I
Recently I have come across a curious pattern in some code. We know that
I'm teaching myself VB.Net. Here is a problem I have recently come across. Say
This is a problem I have come across a number of times and I'm
I recently have come across with a need for some type of translation-type that
I have recently come across the term Instance Deactivation . a) What is that?
I have a Magento 1.5.0.1 site and have recently come across a problem which
I've been working on website recently and have come across a major problem :http://jimbob.webatu.com/index.html(you'll

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.