You are not logged in.

#1 2018-07-19 12:35:18

deepsoul
Member
From: Earth
Registered: 2012-12-23
Posts: 67
Website

Colour fringes when displaying grey-scale images

I am seeing colour fringes at the edges of black and white regions of a binary image.  Example photo: http://volkerschatz.com/tmp/colourfringe.jpg.  This effect is independent of the image viewer, graphics card, Linux distribution and version.  I would like to disable the kind of rendering that causes this.

Searching the web has turned up the following very limited information:

For fonts there is a misfeature called "subpixel rendering" implemented in the freetype library, which can be disabled in fontconfig.  I have this disabled already, and anyway it is supposed to apply to font rendering only.

xrandr --verbose outputs a line "Subpixel: horizontal rgb" (or other values, according to web rumour), which suggests xorg is aware of the order of subpixels if they are not colocated.  (My monitor has colocated colours as you can see in the photo.)  However, xrandr does not seem to allow to change this value.

So it looks like to me that xorg may be the cause, and changing its idea about subpixel order / colocation may solve my problem.  Does anyone have an idea how to do this, or any information on subpixel rendering at the level of X11 or the kernel?  Am I wrong in assuming this is an X issue, and/or could there be different points of attack for defeating this?  Thank you for your suggestions.


Officer, I had to drive home - I was way too drunk to teleport!

Offline

#2 2018-07-20 10:35:30

radiomike
Member
Registered: 2013-12-19
Posts: 73

Re: Colour fringes when displaying grey-scale images

Subpixel rendering only applies to fonts. On the basis this occurs for bitmap based things then it's unlikely to be an X issue. More likely the display itself.

Are you running at the native res for your display?

Is this an external display or a laptop? Assuming external, and looking at the image provided, you probably want to look at turning off sharpening (usually off is 0, but some displays may have off as a higher value and apply softening/blur below this). Turning off things like edge enhancement/detection and also mpeg/digital noise filters. possibly any auto dynamic range things may also help. Depending on the manufacturer there may be other options or they may be named differently.

Lastly, assuming the above don't resolve this. what kind of connection are you using? What video card is it and what display?

Offline

#3 2018-07-20 15:50:21

deepsoul
Member
From: Earth
Registered: 2012-12-23
Posts: 67
Website

Re: Colour fringes when displaying grey-scale images

Thank you for the suggestion.  I had not considered the display.

I have found the effect on all four different computers I have tried.  All have external displays made by Dell run in native resolution with VGA or DVI cables.  The graphics cards are by ATI (3) and nVidia (1).

The sharpness setting is inaccessible (greyed out) on two of the displays, and does not make a difference on the other two.  I have not found settings for the other enhancements you mention, perhaps because these are computer displays, not TVs or multimedia components.

I am going to test a non-Dell display in case this is a Dell thing.


Officer, I had to drive home - I was way too drunk to teleport!

Offline

#4 2018-07-20 19:23:43

radiomike
Member
Registered: 2013-12-19
Posts: 73

Re: Colour fringes when displaying grey-scale images

So, for vga, the issue is most likely to be a sync one. Depends on the screen, but you might just need to change refresh rate. It is sometimes possible on higher end displays to tweak sync in the settings. Some graphics drivers may allow you to tweak sync too, but not seen or attempted this on Linux. Another possibility would be try different cables - better quality or shorter lengths
If you're seeing the same thing with dvi, then you may want to check that you're not doing vga over dvi. Dvi-I and dvi-a are a thing.

Last edited by radiomike (2018-07-20 19:30:05)

Offline

#5 2018-07-22 15:19:46

deepsoul
Member
From: Earth
Registered: 2012-12-23
Posts: 67
Website

Re: Colour fringes when displaying grey-scale images

The effect is also present on a Samsung display, so it's not just Dell.

The DVI-attached display I have at home uses DVI-D, and I think the others do too - these days most small graphics cards have a VGA and a DVI-D output (with a flat plastic surface where the analog pins would be).  I'll check tomorrow.


Officer, I had to drive home - I was way too drunk to teleport!

Offline

#6 2018-07-22 16:41:06

seth
Member
Registered: 2012-09-03
Posts: 51,684

Re: Colour fringes when displaying grey-scale images

What color are those pixels supposed to be? (black, white or gray?)

Also let's eliminate some variables:
"startx xterm" and there run "xsetroot -mod 16 16" (to get every compositor out of the way and most DEs provide a desktop window that covers the root window, the background should turn into a nice black and white grid) => do you get the same effect?

Offline

#7 2018-07-22 18:19:43

deepsoul
Member
From: Earth
Registered: 2012-12-23
Posts: 67
Website

Re: Colour fringes when displaying grey-scale images

My test image is black and white without any intermediate grey values.

I tried your suggestion of xsetroot without a window manager, and the colour fringes also show on the grid lines.  Same when tiling with my test image using "xsetroot -bitmap".  Otherwise I had used xv to display the image, which depends only on libx11 for displaying images (next to image format decoding libraries).


Officer, I had to drive home - I was way too drunk to teleport!

Offline

#8 2018-07-22 20:00:20

seth
Member
Registered: 2012-09-03
Posts: 51,684

Re: Colour fringes when displaying grey-scale images

So it's most likely crtc, display or connection.
1st off: this is very easy to hit w/ VGA connections (monitors usually provide an auto-sync to deal with this), so ensure to use a digital connection.
2nd:

xsetroot -mod 2 2

should generate a 2x2  grid. Does that "flicker"? (Be careful if you're sensitive to such, it might make you slightly nauseous)

Do you use custom modelines to drive the output(s)?

xrandr -q --verbose

Offline

#9 2018-07-22 20:31:38

deepsoul
Member
From: Earth
Registered: 2012-12-23
Posts: 67
Website

Re: Colour fringes when displaying grey-scale images

This is still the same system I reported about earlier today, so a DVI-D interface.

With regard to the 2x2 grid, I do not really trust myself to answer that.  Depending how closely I look at it, I feel it is static or maybe can see slight crawling colour patterns at a 45 degree angle.  I tend towards the view that that is just subjective.  The colour fringes can be recorded with a camera, by contrast.

I set up this system a long time ago, but I do not remember setting any special video mode.  I just let X choose the native resolution automagically.  The output of xrandr is here: http://volkerschatz.com/tmp/xrandr-home


Officer, I had to drive home - I was way too drunk to teleport!

Offline

#10 2018-07-23 06:12:19

seth
Member
Registered: 2012-09-03
Posts: 51,684

Re: Colour fringes when displaying grey-scale images

I wasn't entirely sure about the output because of the mentioned VGA ones.
Reg. the "subjectiveness" of the flicker - you would notice that effect, don't worry ;-)
(It's not the general human problem w/ high contrast grids)

The xrandr output doesn't hint any pitfall (digital connection, physical resolution, low frequency, no rotation or scaling - even the RGB subpixel indication fits)
What's somehow suspicious is the gray line on the bottom - it seems as if there's a "halo" around the entire bar (leading to the aberration on the sides)

Are you running a 30bpp server?
Can you try to feed the monitor(s) w/ a different source?
Do you get the same effect on linux consoles?
What for white on black in general?

can be recorded with a camera

Just to be sure: you can also see this with your eyes and you're not wearing glasses (because aberration w/ a single lens is inevitable)?
(Sorry to ask, but I start running out of explanations)

Offline

#11 2018-07-23 09:38:37

deepsoul
Member
From: Earth
Registered: 2012-12-23
Posts: 67
Website

Re: Colour fringes when displaying grey-scale images

One can see the effect with the bare eye too, though one has to look closely.  I am implementing image processing methods, so I am probably used to looking more closely than most people.  No glasses.

The white text on black on the text consoles also shows the effect (I'll upload a photo when I'm home).  Same for an inverted test image.  Also the same with two more displays attached with DisplayPort.  Not sure about your question regarding the server, but xwininfo on the root window reports Depth as 24 bits.

The photo I uploaded and linked to above is a bit blurred.  I think that is the cause of the halo.

I am pretty convinced now that this is a general feature of all TFT displays.  I have tested 7 different ones by now and always found the same.  (Try taking a close-up photo of a black-white edge on yours.)  I do not know how TFT displays work in detail, but at a guess black pixels sink less current than bright ones, and adjacent sub-pixels receive a somewhat higher current as a side effect.  That said, the effect is small enough that most people would never notice.


Officer, I had to drive home - I was way too drunk to teleport!

Offline

#12 2018-07-23 14:33:07

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,804

Re: Colour fringes when displaying grey-scale images

deepsoul wrote:

I do not know how TFT displays work in detail, but at a guess black pixels sink less current than bright ones, and adjacent sub-pixels receive a somewhat higher current as a side effect.  That said, the effect is small enough that most people would never notice.

Not really.

I do want to state what may be the obvious.  A color LCD has no "Grey" or "White" pixels.  Each "Pixel" is (generally) a triad of three sub-pixels; red, green and blue.  Most of the luminescence information for the human eye is carried by the green signal.  Green is usually the center sub-pixel in the triad.  Red and blue sub-pixels, with longer and shorter wavelengths respectively compared to green are placed to either side of the green sub-pixel.  Some monitors actually have four sub-pixels, with green being every other sub-pixel (reg-green-blue-green).  Others have experimented with a yellow pixel, but I have never worked with one.  The eye integrates the color spatially allow us to perceive blends of these colors magenta, cyan, purple, orange, 

To display monochrome (black, grey, white), the only thing the monitor can do is to set the red level equal to the green level equal to the blue level.  This work great -- right up to where you have a discontinuity -- in the case of your photo a step from black, or a step to black.  Notice that the last thing you see as you step down to black is that last blue sub-pixel hanging of to the right.  As as you step from black, you see the red sub-pixel on the left.   

The way a monitor usually mitigates this is to identify where those discontinuities occur, and crank down the values of the sub-pixels at the edge of the discontinuity.  In other words, as you step down from grey to black, set the value of the blue pixel to half what the "grey" value should be.  Same thing for where you step from black back up to grey -- those red pixels could also be softened.   This is exactly what the "sharpness" setting does on displays with analog interfaces.  It also makes text look fuzzy.   Most times, "sharpness" settings on monitors are not provided when the data arrive over a digital interface.   (Note: sharper settings cause more color fringing as they try to create a "sharp" edge, turning down "sharpness"  applies a low pass filter to the edge to smooth it out. It minimizes the color fringing by creating a "soft" [fuzzy] edge)

I do not believe this has anything to do with the clock phase as suggested by radiomike.   Another issue that happens on VGA/EGA/SVGA/XGA is ringing caused by impedance mismatch and poor cable equalization; that being "ringing" seen after a step in value seen as errors caused in pixels to right of the discontinuity as reflections damped out. Again, that is not what is happening here.

Last edited by ewaller (2018-07-23 14:37:06)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#13 2018-07-23 16:50:55

deepsoul
Member
From: Earth
Registered: 2012-12-23
Posts: 67
Website

Re: Colour fringes when displaying grey-scale images

First, more image links: The reason for the "halo" noted by seth is that the first linked image was out of focus.  Here is a sharp one of the same display.  (So contrary to what I stated, the sub-pixels are not co-located on this display.  I drew the wrong conclusion from the blurred photo.)

The second new image is of a text console, where I find the fringes harder to notice with the bare eye.  If you want to have a look at your own display, a test image is here.  With the bare eye, the fringes are easiest to spot if you compare the hue of opposite edges of a black rectangle.

The colour fringes are the opposite colour compared to what would result from subpixel anti-aliasing: With that, edges to the left of a black region would be reddish, and to the right bluish (assuming RGB subpixel order).  The photos show the opposite, which was a major clue that this was not caused by some kind of subpixel rendering, I just did not realise it until now.

This also leads to your remarks, ewaller.  If I understand correctly, you suggest that a kind of subpixel blurring might be overcompensated by the display.  That would cause the right fringe colouring.  But in that case I would expect an intermediate setting to exist where there are no fringes, and I tried out the full range on two monitors and found fringes (in the same colour) for all of them.  If you are saying that equally bright red, green and blue subpixels do not average out to white next to a black region, I do not understand why that would be.  In the sharp photo I just linked to, the column of the red subpixel becomes noticeably brighter where the black rectangle comes up beside it, so there is an actual local excess of red colour there.


Officer, I had to drive home - I was way too drunk to teleport!

Offline

#14 2018-07-23 16:56:16

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,804

Re: Colour fringes when displaying grey-scale images

Is that a progressive scan, or is it interlaced?  I am interested in the row "Hanging" below the bottoms of the characters.  See the red-green-blue subpixels at a reduced brightness?  Sometimes de-interlacing algorithms average field one and field 2 in interlaced displays.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#15 2018-07-23 18:00:18

deepsoul
Member
From: Earth
Registered: 2012-12-23
Posts: 67
Website

Re: Colour fringes when displaying grey-scale images

You are right, that is quite strange.  The only idea I have on that is that I took the picture at an angle to avoid glare, so maybe this is pixels extending behind the screen surface?  Unlikely really, but all I can come up with.  Maybe I can take a better photo tomorrow.

I had thought interlacing was dead and buried.  I am also not sure how it might be visible in a static image.  If a display of a major brand had interlace-style updating of every other row, I expect gamers and people viewing videos would be complaining loudly.


Officer, I had to drive home - I was way too drunk to teleport!

Offline

#16 2018-07-23 18:14:37

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,804

Re: Colour fringes when displaying grey-scale images

LCD displays are inherently progressive.  If your system is outputting an interlaced format, the display must convert it to progressive. It is that conversion that can create the de-interlace artifacts I point out.  But, this is will not impact the parts of the displays where you have several identical horizontal scans in a row -- as in your test pattern.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#17 2018-07-23 18:41:52

deepsoul
Member
From: Earth
Registered: 2012-12-23
Posts: 67
Website

Re: Colour fringes when displaying grey-scale images

Thank you for explaining again.  The display in question was attached via DVI-D (a cable with the analog contacts missing, I checked because seth asked earlier).  Does DVI-D allow interlacing? 

From a quick web search I see that X mode lines may contain the word "Interlace".  This system is at work, so I can check tomorrow if the active mode line from "xrandr --verbose" contains it (shudder).


Officer, I had to drive home - I was way too drunk to teleport!

Offline

#18 2018-07-23 19:49:33

seth
Member
Registered: 2012-09-03
Posts: 51,684

Re: Colour fringes when displaying grey-scale images

Not in the randr dump you pasted previously.

Google suggests that at least dell monitors should have a sharpness setting? Does it have impact on this effect?

Offline

#19 2018-07-24 10:06:30

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: Colour fringes when displaying grey-scale images

deepsoul wrote:

First, more image links: The reason for the "halo" noted by seth is that the first linked image was out of focus.  Here is a sharp one of the same display.  (So contrary to what I stated, the sub-pixels are not co-located on this display.  I drew the wrong conclusion from the blurred photo.)

The second new image is of a text console, where I find the fringes harder to notice with the bare eye.  If you want to have a look at your own display, a test image is here.  With the bare eye, the fringes are easiest to spot if you compare the hue of opposite edges of a black rectangle.

The colour fringes are the opposite colour compared to what would result from subpixel anti-aliasing: With that, edges to the left of a black region would be reddish, and to the right bluish (assuming RGB subpixel order).  The photos show the opposite, which was a major clue that this was not caused by some kind of subpixel rendering, I just did not realise it until now.

This also leads to your remarks, ewaller.  If I understand correctly, you suggest that a kind of subpixel blurring might be overcompensated by the display.  That would cause the right fringe colouring.  But in that case I would expect an intermediate setting to exist where there are no fringes, and I tried out the full range on two monitors and found fringes (in the same colour) for all of them.  If you are saying that equally bright red, green and blue subpixels do not average out to white next to a black region, I do not understand why that would be.  In the sharp photo I just linked to, the column of the red subpixel becomes noticeably brighter where the black rectangle comes up beside it, so there is an actual local excess of red colour there.

About those close-up photos of your monitor you made, those look to me as if everything is working correctly for you. You can see that the panel's subpixels are arranged in a red-green-blue order. Every white pixel in your test image and text console photo seems to correctly be built out of those three sub-pixels getting lit fully.

Viewing that test image you linked, I can't perceive any color fringes here on my monitor. My monitor is a 24 inch 1920x1200 resolution monitor, and with the way I'm sitting I can stretch out my arms fully in front of me without touching the monitor.

I don't quite understand why you can perceive the color of the subpixels on the edges between black and "white" areas. Is your monitor very large with low resolution, for example 32" 1080p, and you are sitting close to it?

I tried to take photos of my monitor using my phone, but it didn't turn out well, see here:

https://i.imgur.com/5LqDsvt.png

Offline

#20 2018-07-24 15:07:09

seth
Member
Registered: 2012-09-03
Posts: 51,684

Re: Colour fringes when displaying grey-scale images

If you look at the "colored" lines, it seems as if they're brighter than regular ("white") subpixels, what could  be an effort to raise the (local) contrast for better sharpness (though it's oc hard to say what is the monitor and what is the camera)
Playing w/ brightness, contrast and sharpness setting in your monitor OSD would then impact the effect?

Offline

#21 2018-07-24 19:23:34

deepsoul
Member
From: Earth
Registered: 2012-12-23
Posts: 67
Website

Re: Colour fringes when displaying grey-scale images

@ewaller: I am relieved to report that my office system doesn't do any interlacing either.  I took a slightly better picture of a text console, and the subpixel colours in the bottom row of the white characters are less pronounced, but still there.  I do not have an explanation.

@seth: The xrandr dump I uploaded is from my home system, while the console photo is from my office system.  The sharpness setting of the Dell monitors was greyed out in most systems I tested, and ewaller explained that: apparently, it is only accessible when an analog (VGA) interface is in use.

@Ropid: I am implementing image processing methods in my job, so I look very closely at processed test images at less than the usual reading distance.  While doing so I noticed this effect.  I posted this topic only because I thought it might be due to a software setting like subpixel rendering for fonts.


Officer, I had to drive home - I was way too drunk to teleport!

Offline

#22 2018-07-24 19:54:49

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,804

Re: Colour fringes when displaying grey-scale images

deepsoul wrote:

I am implementing image processing methods in my job, so I look very closely at processed test images at less than the usual reading distance.

Be sure and look into the algorithms developed by Faroudja (Later part of Genesis Microchip, now part of STMicroelectronics)

Nothing looked better than their stuff when it came to professional video.  Period.

https://www.st.com/content/st_com/en/se … ces-page=1
https://en.wikipedia.org/wiki/Faroudja

Last edited by ewaller (2018-07-24 19:57:39)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#23 2018-07-24 20:32:19

radiomike
Member
Registered: 2013-12-19
Posts: 73

Re: Colour fringes when displaying grey-scale images

So, looking at the focused image and double checking things in gimp, there doesn't seem to be any issue with your display. Using the dropper tool, the blue and red fringes are pretty much the same intensity as the blue and red pixels in the middle of the white area.

This means  that what you're/we're seeing/perceiving as fringing is the closest sub pixel to the black area due to the high contrast and exaggerated by a lowish pixel density. At even lower density like your screen shot, the effect is more pronounced and disappears at high pixel densities i.e. retina display. Pretty much an optical illusion.

Last edited by radiomike (2018-07-24 20:33:57)

Offline

#24 2018-07-24 20:39:50

seth
Member
Registered: 2012-09-03
Posts: 51,684

Re: Colour fringes when displaying grey-scale images

They're much more saturated, though - what might be an optical effect picked up by the camera but if "real", would add to the aberration effect.

I guess this is at maximum contrast + brightness?

Offline

#25 2018-07-24 20:44:57

radiomike
Member
Registered: 2013-12-19
Posts: 73

Re: Colour fringes when displaying grey-scale images

I'm not sure they are more saturated, I think that's just perception plus the fact that while better focused/steadied, the updated images are still not critically "sharp" in the photography sense.

Offline

Board footer

Powered by FluxBB