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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:55:41+00:00 2026-06-06T19:55:41+00:00

I have an image with some blobs. Some is one pixel dot and some

  • 0

I have an image with some blobs. Some is one pixel dot and some are not. When I use cvBlobsLibs to find the height and width of the one pixel dot, it shows the value equals to zero. Is this correct? I tried to use contours to fill the one dot pixel but seems to fail too. Any other approach that can remove the one dot pixel or even remove the height or width that is equal to zero?

  • 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-06T19:55:43+00:00Added an answer on June 6, 2026 at 7:55 pm

    I am not sure why its area of a single pixel element is zero. ( my mind says it should be one). Check out documentation for contourArea. It says, area is calculated using Green Formula, so area and number of pixels may be different.

    Secondly, to remove this noise, you can use medianFilter. I have shown it below using Python.

    Input image :

    enter image description here

    Now Code :

    >>> img2 = cv2.imread('D:\Abid_Rahman_K\work_space\mask.png',0)
    
    >>> contours,hierarchy = cv2.findContours(img,cv2.RETR_LIST,cv2.CHAIN_APPROX_SIMPLE)
    

    Number of non-zero pixels:

    >>> cv2.countNonZero(img2)
    121
    

    Now apply medianFilter and check again number of non-zero pixels:

    >>> blur = cv2.medianBlur(img2,5)
    >>> cv2.countNonZero(blur)
    0
    

    Output image :

    enter image description here

    EDIT:

    If an image has an object, it will not be affected much by the blurring.

    Input Image :

    enter image description here

    Output Image :

    enter image description here

    EDIT after second comment to this answer.

    As Mizuki commented, there is a chance where closely placed objects get connected each other after median filtering. To understand this, i give here an image from wikipedia page. Check how yellow objects which are seperated by black lines get connected after using median filter of high radius.

    enter image description here

    It is because, median filter uses a window which calculates the median of all values in that windows and replaces center element by that median. As size of window increases, more elements are used to calculate median. So narrow gaps are removed.

    Wikipedia articles is a good one : Link

    Also see this link for a simple explanation : Link

    So to avoid this, there is another method called erosion and dilation ( both implemented in OpenCV). Simply saying, erosion reduces the size of white object and dilation increases the size of white object.

    So erosion removes small white pixels, but it also reduces the size of our object. So we use dilate to get back its size. Since, all white noises are already removed due to erosion, they won’t come back in dilation.

    This is a good procedure to remove noise.

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

Sidebar

Related Questions

I have an image and some text. I want to center both of them
So I have some cool Image Processing algorithm. I have written it in OCaml.
We have an url like http://site.s3.amazonaws.com/images/some image @name.jpg inside $string What I'm trying to
I have an image and a hyperlink inside a div, but for some reason,
my problem is: I have an image and want to mark some areas over
I'm planning to try contours on some image. Lets say I have three object
I have 2 tables, where I have some rows with some image buttons. What
I have some code that downloads an image from a remote server $data =
I have some code that loads an image file off the web and puts
I have an image which consists of two arbitrarily placed black 1px blobs on

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.