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

Thread Subject:
remove noise

Subject: remove noise

From: Toan Cao

Date: 10 Nov, 2010 13:49:04

Message: 1 of 3

hi everybody,

I have a binary image with horizontal lines and vertical lines (value of pixels =1). However, there also exist some white dots (its pixel value=1) that do not lie on horizontal and vertical lines. In order to remain only lines, i would like to remove these white dots. How can i do that ?!!
Looking forward to your reply.
Thanks in advance !

Subject: remove noise

From: Sean

Date: 10 Nov, 2010 14:48:04

Message: 2 of 3

"Toan Cao" <toancv3010@gmail.com> wrote in message <ibe7sg$k8m$1@fred.mathworks.com>...
> hi everybody,
>
> I have a binary image with horizontal lines and vertical lines (value of pixels =1). However, there also exist some white dots (its pixel value=1) that do not lie on horizontal and vertical lines. In order to remain only lines, i would like to remove these white dots. How can i do that ?!!
> Looking forward to your reply.
> Thanks in advance !

It's really hard to provide advice without seeing the images, but here are a few ideas:

Assuming you have the image processing toolbox:

-If the dots are small and not connected, use bwareaopen.
doc bwareaopen

-If the dots are larger by area than the lines, one way is this:
Do a connected components analysis (bwconncomp) and get the regionprops
doc bwconncomp
doc regionprops

Call for the 'Image' option in bwconncomp and then get the size of this. Since round things' dimensions are about equal and lines' dimensions are much different (length close to width v. length >> width) divide the minimum dimension by the maximum dimension, set a threshold, and remove all things below it.

-You could also look at imopen and with an appropriate structuring element you might be able to get it to work. This would be your best bet if the dots are connected to the lines.

Subject: remove noise

From: ImageAnalyst

Date: 10 Nov, 2010 15:02:13

Message: 3 of 3

And one more option, if the dots are truly just one single isolated
pixel: you can use the 'clean' option of bwmorph().

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us