# Origin of blurring and colour distortion in monochrome diagrams

I am analysing a large number of PDF files from scientific articles, all of which contain images which (I think) were originally monochrome ( black/white). The images have been extracted with Apache PDFBox and I am doing image processing on *.png. The images have severe colour distortion, and blurring which I do not think is due to the extraction process or to subpixel antialising (see https://stackoverflow.com/questions/16242731/reconstructing-line-diagrams-from-subpixel-rendering). Note that the effect is present on both lines and text.

The effect is present in all PNG files though in different amounts. I suspect it comes from the tool/s used to create the PDFs from the original images which apply some softening process (antialising). I have analysed this visually and it consists of a narrow plane in HSV with only two colours mixed with a lot of white/grey/black.

I'd like to know what the algorithm is that creates this blurring and colour so that I can reverse it. Traditional sharpening is only partially successful. I'd be delighted if anyone has code that does this (any language will do).

NOTE: I do not have originals.

UPDATE. Here are some analyses of the colors with ImageJ ColorInspector3D plugin in YCbCr space

= YCbCr frequencies = Note the very sharp plane in which the colors lie

and a histogram to show the distribution more clearly. (The red/pink is there on the RH sides - not very clear in this screen shot)

I intend to ask another question on how to sharpen this. (This Q is *where" does the effect arise; the next will be how to correct it even if we don't know the origin)

• This looks like JPEG artefacts so I guess the image went through a JPEG compression step at one stage and that permanently introduced noise into the image. The red channel is blurred stronger because JPEG applies chroma subsampling. – PaulHK Jun 28 '19 at 6:16
• That's really useful and sounds like a very possible cause. If you add it as an answer I'll upvote it . Is there any way to deconvolute this? I know JPEGs are lossy but we know a lot about the original image. – peter.murray.rust Jun 28 '19 at 9:15
• You can mostly clean it up. You can "despeckle" it in photoshop to get rid of the high frequency / random dots. The chroma subsampling is a bit trickier as some parts of the colour space are at lower resolution. As your image is monochrome we could cheat, and just capture the highest resolution colour channel (Green) and reconstruct the monochrome image from that. An even better way would be to convert RGB back to YCrCb space, and then keep only the Y/Luminance channel as these are usually encoded at 1:1 scale unlike the Cr/Cb colour channels. – PaulHK Jun 28 '19 at 9:28
• Great suggestions. BTW I am doing this automatically (using boofcv.org - a great Java library similar to OpenCV.) Maybe I should open a new question for this? – peter.murray.rust Jun 28 '19 at 9:43
• Go for it, would be interesting to see other ideas. – PaulHK Jun 28 '19 at 9:51