28
\$\begingroup\$

When I take pictures of a screen at school or at my house, they turn out really weirdly. When blown up to 100%, they look fine, but when they get sized down, they look really weird, here is a screenshot of my phone to show what I mean

\$\endgroup\$
4
  • 2
    \$\begingroup\$ Might be some relevant info here: photo.stackexchange.com/questions/21294/… \$\endgroup\$
    – MikeW
    Aug 28, 2014 at 6:01
  • \$\begingroup\$ Out of curiosity, what on earth is going on in the background of your image? \$\endgroup\$ Aug 29, 2014 at 3:49
  • 1
    \$\begingroup\$ @GeorgesOatesLarsen Its a screenshot of the Photos app on iOS, in which I was pinching the picture to show the effect. I just blurred out my private images. \$\endgroup\$
    – Milo
    Aug 29, 2014 at 4:18
  • \$\begingroup\$ If this one is closed as a duplicate of the indicated question, surely those who voted to close this one should write an answer to the other that includes the specific use case of moire caused by screen interaction with a camera sensor's grid? There's not a single mention of this phenomenon in the entire question and answers of the so-called duplicate! \$\endgroup\$
    – Michael C
    Jun 20, 2023 at 9:31

6 Answers 6

41
\$\begingroup\$

This is moiré. It occurs because a screen is actually a grid of squares that are being used to make the image. When it ends up trying to be mapped to another grid of pixels (either by being captured by a sensor or by scaling) points of light or pixel data don't line up exactly. Some pixels get 2 pixels of information, some get the border between pixels. The Wikipedia article I linked to has far more detail available on it. It can happen any time that two grids interact (such as taking a picture of a skyscraper from a distance.

In the case of scaling particularly, if you have multiple pixels per screen display pixel, the actual effective resolution of your image is limited to whatever you were taking a photo of (there isn't more than about 2MP of information on most computer displays). What happens with the extra pixels on your camera is that they actually take an image of what the screen looks like, so you get multiple pixels for each screen pixel and some that overlap borders.

When you scale that down, particularly depending on the algorithm used, you can end up with moiré emerging because pixels that were on the border between pixels get too much weight, resulting in darker areas. This actually happens a little bit with any kind of remap, but if it isn't two grids of evenly spaced points, you don't get enough of a pattern for it to be super noticeable like it is in your sample image.

\$\endgroup\$
0
10
\$\begingroup\$

As your existing (+1) answer says, it's a Moiré pattern. But you see it particularly when the image is scaled. You don't say what does the scaling, but I'm guessing you're just zooming the display, or pasting into Word/Powerpoint/etc., in which case you may benefit from scaling the image using a different method in the GIMP (free), Photoshop (expensive) or ImageMagick (free, commandline), all of which allow you to scale images using different techniques.

This seems to be more of an issue with high pixel-count sensors as well.

As in the linked question you're generally better off taking a screenshot on the computer, phone (or even TV) if possible (for example in windows the PrintScreen or similar) key puts the contents of the current screen on the clipboard) if it's for a proper document. If it's for your own notes, I'd live with the Moiré pattern and not waste time.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ I know I can just take a screenshot, but that wasn't the question. I was simply asking why that happens, I don't care and it doesn't bother me. I take screenshots all the time, but at my school, print screen is disabled so taking a picture is the only option. \$\endgroup\$
    – Milo
    Aug 28, 2014 at 9:09
  • 3
    \$\begingroup\$ @Milo - for the explanation, your other answer beats mine, and the linked article is worth a read. In the general case people will often want to get round the problem, so I could contribute by mentioning a couple of techniques -- though they may not help you they may help the next person searching. \$\endgroup\$
    – Chris H
    Aug 28, 2014 at 9:12
5
\$\begingroup\$

If the problem only happens when scaling, then that means the scaling is bad. A simple/low quality algorithm was used and therefore the scaled image looks differently than the original. With a quality scaling this does not happen.

It would help if you would make the original image available.

What software did you use to scale the image?

For a quick check you can try opening the original image in Chrome (Googles web browser) and scale it there (just click it if it is larger than the browser window and it will be scaled down to fit the window, or hold the CTRL key and turn the scroll wheel on the mouse to resize). (Chrome has a decent image scaler, also newer versions of Firefox, IE too). You can also try other software, for example many image viewers have an option to resize the image (just while displaying it and also permanently, to save a differently sized version of the image), like IrfanView. And off-course "big" image manipulation programs, like PhotoShop, Gimp, etc.

Here is a nice and quick demonstration (works with Firefox, on Windows, did not test other browsers):

While moving the mouse, Firefox will use a simple resizing algorithm that produces strong Moire effects. When you release the button, it will take a moment to calculate a higher quality resized image with practically no moire effect.

\$\endgroup\$
3
\$\begingroup\$

As other answers state, the effect is called Moire. But why does it happen when you downscale or zoom-out? As prevoiusly stated Moire happens when two patterns interact, specially if the two patterns have a "frequency" (read size of the repeating characteristic) close enough to each other.

What happens next is a mathematic relationship between the patterns, or more precisely the sizes of the patterns: Most likely your phone or camera has higher resolution than the screen you are caturing, so the lens projects the image of the screen's grid into the sensor's grid, but each pixel from the screen is projected much larger than each of the sensor's. This means that the pattern from the screen is much larger than the sensor's grid. Think of it as laying a grid fence panel over mosquitoe screen. You would not notice moire so much in this case.

But then you downscale the image, or zoom out. This is actually reducing the size of the pattern originally captured from the screen and bringing it to a scale much closer to the second screen (the one you are watching in). It would be like shrinking the fence grid from the prevois example until it is almost the same pitch as the mosquitoe screen. Now that the two patterns are very close in size the moire is much more noticeable.

Regarding how to remove it: I think that there may be a way of getting (almost) rid of this moire. And it may be applying a certain amount of gaussian blur and then downscaling the image. The idea is that the blur will fuse toghether the image from the original screen's pixels, practically blurring the line between pixels. This will also blur the border of letters and graphs in the image, that's when the downscaling comes in. Downscaling tends to hide blurriness. Hopefully it wil produce clearly legible letters and graphs but hide the pattern from even areas of the original image. By removing the original pattern, there wont be two patterns interacting and the image should be more legible.

I want to perform an experiment for this, to add it to this answer later. Please remind me if I forget. (give three days).

\$\endgroup\$
2
\$\begingroup\$

To clarify what the people above said, the pattern you are seeing probably comes from photographing the gaps between pixels. For various reasons (e.g. camera tilt) they won't be perfectly aligned with the pixels on your sensor and in the resulting image. When downscaling, the algorithm has to decide what color will be a resulting pixel based on colors of several neighboring pixels - and based on how much of the black gap there is, the resulting color would be lighter or darker.

You will have a similar problem if you scan a color picture from magazine - interference of the printed pattern, scanner grid and downscaling algorithm will create ugly artifacts.

BTW, this principle is (I believe) used in astronomy, where the interference pattern allows to measure parallax of stars.

To reduce the moire, you can try the Selective Gaussian blur in GIMP (or it's equivalent in your graphical program) - it will blur big featureless areas more than edges and fine details.

\$\endgroup\$
1
\$\begingroup\$

While there are application-specific names for what's going on (e.g. "moire") the fundamental cause is undersampling/aliasing. The original image has high-frequency content in it (tiny pixel boundaries) and, by using a wrong downscaling algorithm, you're point-sampling it with a lot fewer samples than what are necessary to reproduce the signal you're sampling.

Most naive image resizing uses bilinear or bicubic scaling, which are reasonable for upscaling or downscaling by a factor of at most 1/2, but which do not work for more severe downscaling unless you apply them in multiple iterations, each downscaling by a factor no smaller than 1/2. For severe downscaling, you should be using area-averaging or a gaussian resampling filter with radius (in the original image size) at least as large as the distance between adjacent pixels in the output (mapped back to the original image size).

If you lack software that can properly perform area-averaging or gaussian resampling, a really good approximation is to repeatedly downscale by a much smaller factor (e.g. just downscale to 1/2, 2/3, or 3/4 size) until you get within a factor of 2 of the final desired size, then scale to your final destination size, using whatever low-quality algorithm your software is using. This should work decently unless the software uses nearest-neighbor scaling, in which case you're totally out of luck.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ I think you can just do a small blur before downsizing. Can't remember where I read that. \$\endgroup\$
    – JenSCDC
    Aug 30, 2014 at 10:02
  • 1
    \$\begingroup\$ @JenSCDC that is correct, if you do a blur with the proper radius you can even get away with nearest-neighbor scaling. It's not the highest quality approach though. \$\endgroup\$ Sep 21, 2016 at 23:02

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