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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:08:42+00:00 2026-05-13T22:08:42+00:00

Does anybody knows about post-processing algorithms to remove ghost objects from binarized image? The

  • 0

Does anybody knows about post-processing algorithms to remove ghost objects from binarized image? The problem:
When I binarize image using for example niblack method or bernsen,
it produces many noise. I red book or internet articles about binarization, and they all say that the post-processing step is needed in Niblack and other’s binarization method,
But they don’t say what is it, post-processing operation. So please, if someone knows, tel me.
EDIT:
Original image:

alt text http://i.piccy.info/i4/20/63/b970ab2ca66e997f421e969a1657.bmp

Bernsen threshold winsize 31, contrast difference 15:

alt text http://i.piccy.info/i4/32/55/2f1e0293311119986bd49529e579.bmp

Bernsen threshold winsize 31, contrast difference 31:

alt text http://i.piccy.info/i4/2a/13/774508890030b93201458986bbd2.bmp

Niblack method window size-15, k_value 0.2:

alt text http://i.piccy.info/i4/12/4f/fa6fc09bcba7a7e3245d670cbfa5.bmp

Niblack method window size-31, k_value 0.2:

alt text http://i.piccy.info/i4/c0/fd/1f190077abba2aeea89398358fc0.bmp

EDIT2:
As you see, the Niblack threshold is making many noise.
And if I make the window size less, the black squares became a little white inside.
The Bernsen is better – less noise, but even if I make the contrast difference bigger,
but there is one problem, I just can’t produce image right now, in words, the problem:
if image contains some objects with color close to white color, and the background is white,
so if there is a region (for examle line) with black color, then this method ignores the objects and result is wrong.
That is because Bernsen method use this formula:
at each pixel calculate the contrast difference
diff = maximum_grayscale_value – minimum_grayscale_value
and then the diff is used to calculate threshold value,
but in the case that I wrote above, we have maximum value of 255
and minimum value of 0.
So threshold will be 128,
But actual object color is above the 128 (near white color).

So I need to use some post-processing operations to make binarization correctly.
Any thoughts?

  • 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-13T22:08:42+00:00Added an answer on May 13, 2026 at 10:08 pm

    Complete Python program using K-means, a tool meant for finding optimal quantization intervals:

    from scipy.misc import imread, imsave
    def kmeans(file_in, file_out, maxiter):
        X = imread(file_in)
        thresh = X.mean()
        for iter in range(maxiter):
            thresh = (X[X<thresh].mean() + X[X>=thresh].mean())/2.0
        X[X<thresh] = 0
        X[X>=thresh] = 255
        imsave(file_out, X)
        return X, thresh
    

    During each iteration, K-means computes the center of each “cluster” then reassigns elements to clusters based upon the recomputed centers. In the simple case where each element (i.e., pixel) is one-dimensional, and only two clusters are required, the threshold is simply the average of the two cluster centers.

    I should add that this method works for the example image you posted, but may not for others (such as the one you posted in another question). But without further information, I think that this solution works.

    Output:

    binary.bmp http://up.stevetjoa.com/binary.bmp

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

Sidebar

Ask A Question

Stats

  • Questions 365k
  • Answers 365k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can use the data in the /proc filesystem to… May 14, 2026 at 3:57 pm
  • Editorial Team
    Editorial Team added an answer Do you still get the error when you use a… May 14, 2026 at 3:57 pm
  • Editorial Team
    Editorial Team added an answer You can use array_chunk to create a single array comprised… May 14, 2026 at 3:57 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.