MATLAB Answers


Removing black patches from an image

Asked by Soumyadip
on 30 Mar 2013


I have the following image

I want to remove the black noisy regions on the right hand side, so as to keep only the digits in black and the rest in white. How to proceed?


Wouldn't it be easier to have thresholded on a different color channel?

how to do that? I am a rookie to image processing in matlab. It would be kind if you specify further.

That threshold was a disaster. It's just an example for you to learn where global thresholds don't work when you have large global gradients. There really is no point at all in trying to fix this image or doing what you ask. It's much better to avoid the problem in the first place. I solved it in your duplicate question using color segmentation - take a look back at your original question.

1 Answer

Answer by Walter Roberson
on 30 Mar 2013

blueimage = originalimage(:,:,3);
bwimage = blueimage >= threshold;


I tried that but still it is having some black regions(although lesser than the previous). Can you suggest any method to remove such noise?? What exactly is such noise called??

For example, if the original image is "I", have a look at

T = I;T(T(:,:,[3 3 3])<64 | T(:,:,[1 1 1])>80) = 255;image(T)

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!