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). enter image description here

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

enter image description here enter image description here and a histogram to show the distribution more clearly. enter image description here (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)

  • 1
    $\begingroup$ 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. $\endgroup$ – PaulHK Jun 28 '19 at 6:16
  • $\begingroup$ 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. $\endgroup$ – peter.murray.rust Jun 28 '19 at 9:15
  • 1
    $\begingroup$ 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. $\endgroup$ – PaulHK Jun 28 '19 at 9:28
  • $\begingroup$ 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? $\endgroup$ – peter.murray.rust Jun 28 '19 at 9:43
  • $\begingroup$ Go for it, would be interesting to see other ideas. $\endgroup$ – PaulHK Jun 28 '19 at 9:51

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 additionally applies chroma subsampling.

I suspect the original image was subpixel rendered as you shouldn't really have anything in the chroma channels for a monochrome input image.

  • $\begingroup$ I don't think it has been clipped from a screen as it's common to many publishers and (I assume) subpixel rendering is device specific. It seems more likely that it't been automatically rendered to JPEG by a PDF production company (there are only ca 3 main ones) and they probably all use similar JPEG conversions. $\endgroup$ – peter.murray.rust Jun 28 '19 at 11:26
  • $\begingroup$ I was wondering where the red halo was coming from. For a monochrome input this image would only exist in the Y plane so there should be nothing in the chroma channels to cause that artefact. It's possible the image came from a scanner source and there was some chromatic aberration added in from that. $\endgroup$ – PaulHK Jul 2 '19 at 3:11
  • $\begingroup$ It would be very useful to know the source so I'll include an ImageJ ColoInspector3D output which might give some cludes $\endgroup$ – peter.murray.rust Jul 3 '19 at 8:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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