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 objects. Hidden axes object 1 with title fixdt(1,16,4) contains an object of type image. Hidden axes object 2 with title half precision contains an object of type image. Hidden axes object 3 with title single precision contains an object of type image. Hidden axes object 4 with title original chessboard image range [0, 1024] contains an object of type image. Hidden axes object 5 with title fixdt(1,16,4) contains an object of type image. Hidden axes object 6 with title half precision contains an object of type image. Hidden axes object 7 with title single precision contains an object of type image. Hidden axes object 8 with title original chessboard image range [0, 1] contains an object of type image. Hidden axes object 9 with title fixdt(1,16,4) contains an object of type image. Hidden axes object 10 with title half precision contains an object of type image. Hidden axes object 11 with title single precision contains an object of type image. Hidden axes object 12 with title original chessboard image range [0, 1/1024] contains an object of type image.