Main Content

Image Quantization with Half-Precision Data Types

This example shows the effects of quantization on images. The ex_imagequantization model, computes the two-dimensional fourier transform of an image of a checkerboard. The original image is displayed in the left-most column, and the result is displayed with fixed-point, half-precision, and single-precision data types. You can see in the resulting images that, while the fixed-point data type does not always produce an acceptable result, the half-precision data type, which uses the same number of bits as the fixed-point data type, produces a result comparable to the single-precision result.

model = 'ex_image_quantization.slx';
open_system(model);
sim(model)

Figure contains 12 axes. Axes 1 with title fixdt(1,16,4) contains an object of type image. Axes 2 with title half precision contains an object of type image. Axes 3 with title single precision contains an object of type image. Axes 4 with title original chessboard image range [0, 1024] contains an object of type image. Axes 5 with title fixdt(1,16,4) contains an object of type image. Axes 6 with title half precision contains an object of type image. Axes 7 with title single precision contains an object of type image. Axes 8 with title original chessboard image range [0, 1] contains an object of type image. Axes 9 with title fixdt(1,16,4) contains an object of type image. Axes 10 with title half precision contains an object of type image. Axes 11 with title single precision contains an object of type image. Axes 12 with title original chessboard image range [0, 1/1024] contains an object of type image.