Downsampling Theory

Introduction

This article explains the theory on how to downsample a Zivid point cloud. If you are interested in the SDK implementation, go to Downsample article.

Why Not Keep Every Nth Pixel?

When downsampling an image, the goal is to reduce the size of the image while preserving as much of the quality as possible.

A common approach to downsampling is to keep every second, third, fourth, etc., pixel and discard the rest. However, this is not necessary ideal because of colors filters on the sensor. Take the Bayer filter mosaic as an example. The Bayer filter mosaic grid for a 4x4 image is shown below.

The Bayer arrangement of color filters on the pixel array of an image sensor.

Note

Zivid point clouds coordinate system start with (0,0).

With this filter, each pixel on the camera corresponds to one color filter on the mosaic.

Consider a downsampling algorithm that keeps every other pixel. All kept pixels would correspond to the same color filter:

  • (1,1) (1,3) (3,1) (3,3) → Blue

  • (2,1) (2,3) (4,1) (4,3) → Green

  • (1,2) (1,4) (3,2) (3,4) → Green

  • (2,2) (2,4) (4,2) (4,4) → Red