Removing Horizontal Lines

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
jeromerocks
Posts: 3
Joined: 2011-04-28T07:44:02-07:00
Authentication code: 8675308

Removing Horizontal Lines

Post by jeromerocks »

Hi!

I've been stumped on this problem for a while. Could anyone please tell me how to remove horizontal lines from an image? The horizontal lines could be slightly angled.

Is there any way to complete this in ImageMagick?

I tried the solution in: /viewtopic.php?f=1&t=15692 but the commands didn't seem to be recognised.

Thanks in advance!
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Removing Horizontal Lines

Post by Bonzo »

A sample image would be useful along with your Imagemagick version and how you will be runing Imagemagick.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Removing Horizontal Lines

Post by fmw42 »

I tried the solution in: /viewtopic.php?f=1&t=15692 but the commands didn't seem to be recognised.
As Bonzo had suggested above, it would be best if you could provide a link to your example image and your exact command line and your operating system. Please read viewtopic.php?f=1&t=9620 before posting questions and try to follow those instructions as it makes it much easier for others to help if they know more about your problem and environment.

Perhaps your lines are thicker than 1 pixel wide. If so then the command above in my earlier post you reference will not work and you need another convolve filter. However, I have verified that it still works on the image that I tested with the convolve filter specified. Please note that my command was for unix. If you are on Windows, then you need to use other syntax for variables or just hard code the actual values into the convolve kernel. See http://www.imagemagick.org/Usage/windows/

But now, you may be able to do what you need for broader lines with the relatively newer 1D morphology gaussian convolution (vertical direction). See http://www.imagemagick.org/Usage/convolve/#blur

PS If lines are at an angle, then the above horizontal or vertical filters will not work very well, especially the more rotated the lines.
Last edited by fmw42 on 2011-04-30T10:13:47-07:00, edited 1 time in total.
jeromerocks
Posts: 3
Joined: 2011-04-28T07:44:02-07:00
Authentication code: 8675308

Re: Removing Horizontal Lines

Post by jeromerocks »

Thanks for your replies!

I really want to post an example picture but they are not mine to post and I don't have permission. I've found the problem, to call Morphology on Windows, one needs to use:

Code: Select all

-morphology convolve
Anyway I tried the 1D vertical blurring and it worked! Thanks for your suggestion! Wouldn't have worked without applying the blurring because some of the lines intersect, causing them to be more than 1px wide.

Thanks everyone!
Post Reply