Filter to improve some tif images
-
- Posts: 41
- Joined: 2016-10-04T02:08:22-07:00
- Authentication code: 1151
- Location: Nice, France
Filter to improve some tif images
I have a tif image with many horizontal and vertical lines. When I zoom a horizontal line I often see irregular borders between the black and white areas. Translating this in .pbm this gives several full of zeroes, a line like 000001010010110011111 and several lines full of ones.
If I could transform the complicated line into 00000000001111111111 this would not affect the resolution of useful details but this would significally reduce the size ot the tif. Same request for a vertical line.
Of course a Gaussian-blur with sigma = 3 or 4 will do the job but it will blur useful details at other areas. Is there the right filter for me?
If I could transform the complicated line into 00000000001111111111 this would not affect the resolution of useful details but this would significally reduce the size ot the tif. Same request for a vertical line.
Of course a Gaussian-blur with sigma = 3 or 4 will do the job but it will blur useful details at other areas. Is there the right filter for me?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Filter to improve some tif images
A sample image would help us understand the problem.
snibgo's IM pages: im.snibgo.com
-
- Posts: 41
- Joined: 2016-10-04T02:08:22-07:00
- Authentication code: 1151
- Location: Nice, France
Re: Filter to improve some tif images
How can I attach a sample that is not on the web?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Filter to improve some tif images
This forum does not allow uploads. So you need to post the image to some free image hosting service and then put the URL here. If your image is proprietary, can you create or find one that is not, which shows the same issue?
Also please always provide your ImageMagick version and platform? Perhaps you are using an old version and it needs upgrading or your delegate for the input or output format needs updating.
Also please always provide your ImageMagick version and platform? Perhaps you are using an old version and it needs upgrading or your delegate for the input or output format needs updating.
-
- Posts: 41
- Joined: 2016-10-04T02:08:22-07:00
- Authentication code: 1151
- Location: Nice, France
Re: Filter to improve some tif images
I hope an inline pbm does'nt spam this forum
P1
50 15
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1
0 0 1 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
How can I cause Imagemagick to provide its version? It is not that I am obtaining an error message I don't understand.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Filter to improve some tif images
Code: Select all
convert -version
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Filter to improve some tif images
So, your image has noise. You want to remove the noise while not removing detail. From such a small sample I can't tell what is noise and what is detail.
However, the median filter cleans this image:
However, the median filter cleans this image:
Code: Select all
magick lines.pbm -statistic median 11x1 out.png
snibgo's IM pages: im.snibgo.com
-
- Posts: 41
- Joined: 2016-10-04T02:08:22-07:00
- Authentication code: 1151
- Location: Nice, France
Re: Filter to improve some tif images
hey, there is an old version in your brains Here it works only with magick -version and it says 7.0.5-0 Q8 x86fmw42 wrote: ↑2018-06-22T22:31:50-07:00will give you the ImageMagick version.Code: Select all
convert -version
Last edited by Jean-Pierre Coulon on 2018-06-23T05:13:57-07:00, edited 1 time in total.
-
- Posts: 41
- Joined: 2016-10-04T02:08:22-07:00
- Authentication code: 1151
- Location: Nice, France
Re: Filter to improve some tif images
I would be happy if my 6th line was transformed into
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Perfect for horizontal lines like my example, but does nothing for vertical lines and whitens some horizontal portions of vertical lines.However, the median filter cleans this image:Code: Select all
magick lines.pbm -statistic median 11x1 out.png
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Filter to improve some tif images
The median filter I show acts horizontally. If you want it to act vertically, interchange the dimensions: "-statistic median 1x11".
I suggest you post a link to entire images, not small portions.
I suggest you post a link to entire images, not small portions.
snibgo's IM pages: im.snibgo.com
-
- Posts: 41
- Joined: 2016-10-04T02:08:22-07:00
- Authentication code: 1151
- Location: Nice, France
Re: Filter to improve some tif images
You can obtain a test page like this: 1: scan 1 page of sheet music at 600 dpi, tif format, with an intentional skew of about 1 degree. Should be about 100 kB big. 2: say magick thispage.tif -deskew 50% newpage.tif. Should give an about 200 KB big page.
Magnify a portion of a staff line a lot and you will understand what I want to filter.
Magnify a portion of a staff line a lot and you will understand what I want to filter.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Filter to improve some tif images
It would be better if you provide an example. This forum does not allow uploads. So you need to post the image to some free image hosting service and then put the URL here.
-
- Posts: 41
- Joined: 2016-10-04T02:08:22-07:00
- Authentication code: 1151
- Location: Nice, France
Re: Filter to improve some tif images
Then goto http://imslp.org/wiki/Clarinet_Quintet_ ... g_Amadeus) Search the viola part in the Scanned by Coulonnus section. Extract p.2 with pdftk. Say magick p2.pdf -quality 100% -density 600 p2.jpg and magick p2.jpg -threshold 50% -compress group4 p2.tif (for some reason a direct pdf to tif conversion gives a result with a very low density). p2.tif should be 123 577 B big. But all it will contain will be a big number of cases like line 6 of my brief pbm example.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Filter to improve some tif images
Scanning makes continuous-tone images (grayscale or colour). But your image is black and white only. Why?Jean-Pierre Coulon wrote:... scan 1 page of sheet music ...
If you must make it black and white only, I suggest you do that after denoising, not before.
snibgo's IM pages: im.snibgo.com
-
- Posts: 41
- Joined: 2016-10-04T02:08:22-07:00
- Authentication code: 1151
- Location: Nice, France
Re: Filter to improve some tif images
Simply because a grayscale page would be about 10 times bigger than a monochrome. And the original document was monochrome.
Then is there the right filter for me in grayscale?If you must make it black and white only, I suggest you do that after denoising, not before.
I succeeded in reducing the tif size by 75 % with my home made Fortran process.