I am using machine vision for industry task with opencv. I have images from a camera monitoring the process. The detailed look at the small part of the image follows: enter image description here

Enlarged: enter image description here

In the detail, it is possible to see pixel chessboard-like pixel structure. I can get rid of it in many ways (any kind of blur or averaging will do the trick). However, I would like to know where this structure origins. My ideas:

  1. camera use colors by default - can the grayscale setting use the RGB sensors in the way that cause this?

  2. could this be produced by compression or storing of the images? I have no information about how it is done - but the images are in PNG format when I get them.

As I said, I can homogenize the image, but I wonder, maybe there is something fundamentally wrong what we do and that should be fixed.

  • $\begingroup$ Is there somewhere a FFT-based filter involved? If a 2D FFT is done and some fftshift is introduced, but not properly reversed, the resulting images do sometimes have a checkerboard overlay. $\endgroup$
    – M529
    Jul 7, 2019 at 15:38
  • $\begingroup$ @M529 Thanks for suggestion. As far as I know, there is no FFT processing included (I guess it is not commy part of the camera firmware, correct me If I am wrong). $\endgroup$
    – matousc
    Jul 7, 2019 at 19:53

2 Answers 2


It looks like that is a color camera with the Bayer pattern, and the color camera data is directly used as grayscale data, as if it was coming from a grayscale camera. If it is a color camera, the color camera data should be de-Bayerized first (and smoothed etc processing) to get color RGB data pixels as usual, and then the RGB data can be converted to grayscale if grayscale is needed.


If it is a color camera, then typically there is a Bayer filter mosaic in front of the sensor:

enter image description here
Figure 1. Bayer filter (with cutout) in front of a sensor. Image credit: Colin M.L. Burnett.

Perhaps the grayscale mode pixels are simply the sensor element outputs, giving the repeating pattern for a solid color area. You can first debayer the image into a color image, or let the color mode of the camera do that for you, and then convert to greyscale.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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