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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:09:49+00:00 2026-06-05T18:09:49+00:00

I have a binary image that represents a number in MATLAB: I’d like to

  • 0

I have a binary image that represents a number in MATLAB:

image description

I’d like to fill all the digits. The desired result is:

enter image description here

The only thing I found was the imfill function, but that wasn’t really helpfull since I’ve lost my inner data (the 9’s inner circle for example).

  • 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-05T18:09:52+00:00Added an answer on June 5, 2026 at 6:09 pm

    The problem is how to distinguish the holes from the digits. A possible ad hoc solution is filtering them by the area of the pixels inside.

    function SolveSoProblem()
    
        I = imread('https://i.stack.imgur.com/SUvif.png');
    
        %Fill all the holes 
        F = imfill(I,'holes');
    
        %Find all the small ones,and mark their edges in the image
        bw = bwlabel(I);
        rp = regionprops(bw,'FilledArea','PixelIdxList');
        indexesOfHoles = [rp.FilledArea]<150;   
        pixelsNotToFill = vertcat(rp(indexesOfHoles).PixelIdxList); 
        F(pixelsNotToFill) = 0;
        figure;imshow(F);
    
        %Remove the inner area
        bw1 = bwlabel(F,4);
        rp = regionprops(bw1,'FilledArea','PixelIdxList');
        indexesOfHoles1 = [rp.FilledArea]<150;
        pixelListToRemove = vertcat(rp(indexesOfHoles1).PixelIdxList);
        F(pixelListToRemove) = 0;
    
        figure;imshow(F);
    end
    

    After step(1):

    enter image description here

    After step(2):

    enter image description here

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

Sidebar

Related Questions

I have an image that belongs_to a user and to a binary (physical file
I have an object that has a property: [Column] public Binary Image { get;
I have a large binary file that represents the alpha channel for each pixel
I have an image that is being fed to my PHP script as binary
I have an image that named 'binary3.tiff'. I am asked: In the following function
I have a binary image (a dll) which I wish to view the assembly
I have a binary image with contour lines and need to purify each contour
I have binary data in my database that I'll have to convert to bitmap
I have a binary tree, that I am searching: TreeNode<Vessel*>* node = this->tree_->search(PotatoFace); string
One can mark the boundary of a binary image by bwboundaries function of MATLAB.

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.