2

enter image description here

I want to remove background unnecessary greyed pixels in above image. May i know how to do that.

2 Answers 2

4

Quick and dirty with ImageMagick:

convert 9AWLa.png -blur x1 -threshold 50% out.png

enter image description here

Somewhat better, still with ImageMagick:

convert 9AWLa.png -morphology thicken '1x3>:1,0,1' out.png

enter image description here

Updated Answer

It is rather harder to keep the noisy border intact while removing noise elsewhere in the image. Is it acceptable to trim 3 pixels off all the way around the edge, then add a 3 pixel wide black border back on?

convert 9AWLa.png -morphology thicken '1x3>:1,0,1' \
        -shave 3x3 -bordercolor black -border 3 out.png

enter image description here

2
  • Thanks Mark. On the above image, the left hand side line is broken. When I run the above command for my image, i find that the table lines are also broken due to it. May i know how to get unbroken lines also. Commented Nov 4, 2014 at 14:14
  • Good answer! (I love it when there are illustrations showing the output of the commands.) Commented Nov 14, 2014 at 22:03
1

Some methods that come to my mind are

  • If the backgroud is gray color rather than sparse black dots then you can convert the image in binary by thresholding it with proper value of grayscale. i.e. all values above particular values of pixel are white and all values below that are black. Something like this.

  • Another thing you can do is first smoothing the picture my some filter like mean or median filter and then converting into binary presented in previous point.

I think in this way the unnecessary background can be removed

1
  • 3
    You could improve this answer considerably by adding two things: (1) the specific command to use; (2) some illustration about the result the command produces. [After all, the OP's question includes an example picture, which is rare to see with most questions...] Commented Nov 14, 2014 at 22:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.