A Digital Grayscale Generation Equipment for Image Display Standardization

Featured Application: This equipment enables traceable measurement of grayscale to luminance with high accuracy and can provide a standardized reference for the display of grayscale images in the ﬁelds of medicine, remote sensing, nondestructive testing, etc. Abstract: The standardization of grayscale display is essentially signiﬁcant for image signal communication, transmission, and terminal reading. The key step of this standardization is establishing a traceable equipment of grayscale. As a relative value, grayscale is transferred to two di ﬀ erent absolute values to satisfy di ﬀ erent traceability methods, including optical density for hardcopy image and luminance for softcopy. For luminance, a generation equipment is designed to build the relationship between luminance and grayscale. In this work, novel equipment is established using digital light processing (DLP) by time-frequency modulation, and the corresponding uncertainty is analyzed. The experiment result shows that this digital equipment builds the relationship between grayscale and luminance in the range of 0.16-4000 cd / m 2 . It enables traceable measurement of grayscale to luminance on this equipment with high accuracy and can provide a standardized reference for the display of grayscale images in the ﬁelds of medicine, remote sensing, non-destructive testing, etc.


Introduction
Grayscale is an important feature which characterizes the lightness and darkness of an image, and grayscale images are widely used in medical, remote sensing, and industrial inspection fields [1][2][3][4]. Color images can be converted to grayscale by weighting algorithm as required [5]. In recent years, it has been applied in the technology of image segmentation, target recognition, and machine vision based on differences and discontinuous changes in image grayscale [6][7][8]. Therefore, the standardization of grayscale display is essentially significant for image communication, transmission, and terminal reading.
The traditional grayscale standardization method is making or selecting a gray image as the display reference and comparing the obtained gray image with the reference to requantize the fixed value [9][10][11].

Method
There are three steps to realize the standardization and traceability of grayscale. Firstly, the grayscale should be transmitted to an absolute value in theory, as described in Section 2.1. Secondly, a corresponding equipment should be established to realize the measurement and traceability of the theory value, as described from Section 2.2 to Section 2.4. Finally, the traceability uncertainty needs to be analyzed to accomplish the standardization, as described in Section 3.
The grayscale of an image is a relative value. For traceability research, it should be transferred to absolute value. This step is related to the image type. Hardcopy images (usually films) are mostly described by optical density [24]. Optical density includes transmission density D T and reflection density D V , and D T is defined as shown in Equation (1), where Φ i is incident diffuse light flux and Φ ι is transmission light flux [25]. Similarly, D V is defined as shown in Equation (2), where Φ r is reflection light flux [25]. We have developed a micron-scale printed density film (transmission film and reflection film) as the standard of value transmission [16]. The changes in optical density on a plane are achieved by adjusting the spatial frequency in the ways of amplitude modulation (AM) or frequency modulation (FM). Furthermore, spatial frequency is characteristic of periodic structure in space. As shown in Figure 1, different pixels in each display unit are assigned different values, and each unit is assigned the same pixel information, so it appears visually as a certain grayscale.
D V = log 10 (φ r /φ i ), (2) processing technology is gradually maturing [26][27][28]. Consequently, digital grayscale generation equipment is established to reproduce high-resolution (bit depth) grayscale accurately, which can be regarded as grayscale-to-luminance traceability equipment, providing a measurable basis for grayscale image display standardization.

Composition and Principle
The digital grayscale generation equipment (DGGE) is shown in Figure 2. In this figure, "A" is a light source module (laser-driven light source), with characteristics of high brightness (up to 104 cd/m 2 ) and wide bandwidth. The laser excitation mode ensures its stability. The light hits DMD through "B" (a series of lens groups), using fiber-coupled output. "C" is a DLP module, including a digital micro-mirror device (DMD) with up to 16-bit precision, drive and control circuits, etc. "D" is the projection lens that projects the outgoing light onto "E" (the luminance screen). "E" is a white polyester fluoroethylene-coated board with a diameter of 100 mm. "F" is a DC power supply, and the constant current working model is used in the equipment. "G" is a laptop for DLP control and data processing. Besides, a photometer (PR655, not labeled in Figure 2 but labeled in Figure 3) is used to measure the luminance value of the terminal output. The principle of this equipment is shown in Figure 3. The high-intensity light enters the DLP module through a series of lenses and is displayed with different luminance after being adjusted by the DMD. The light is received by the luminance screen and measured with a photometer.  For softcopy images, it is not optical density, but luminance, and the change of luminance is achieved by adjusting the time frequency. The same theory is applied in DLP technology. At the same time, image display resolution and detection precision are both improving, and real-time image processing technology is gradually maturing [26][27][28]. Consequently, digital grayscale generation equipment is established to reproduce high-resolution (bit depth) grayscale accurately, which can be regarded as grayscale-to-luminance traceability equipment, providing a measurable basis for grayscale image display standardization.

Composition and Principle
The digital grayscale generation equipment (DGGE) is shown in Figure 2. In this figure, "A" is a light source module (laser-driven light source), with characteristics of high brightness (up to 104 cd/m 2 ) and wide bandwidth. The laser excitation mode ensures its stability. The light hits DMD through "B" (a series of lens groups), using fiber-coupled output. "C" is a DLP module, including a digital micro-mirror device (DMD) with up to 16-bit precision, drive and control circuits, etc. "D" is the projection lens that projects the outgoing light onto "E" (the luminance screen). "E" is a white polyester fluoroethylene-coated board with a diameter of 100 mm. "F" is a DC power supply, and the constant current working model is used in the equipment. "G" is a laptop for DLP control and data processing. Besides, a photometer (PR655, not labeled in Figure 2 but labeled in Figure 3) is used to measure the luminance value of the terminal output. The principle of this equipment is shown in Figure 3. The high-intensity light enters the DLP module through a series of lenses and is displayed with different luminance after being adjusted by the DMD. The light is received by the luminance screen and measured with a photometer.
Appl. Sci. 2020, 10, x FOR PEER REVIEW 3 of 10 processing technology is gradually maturing [26][27][28]. Consequently, digital grayscale generation equipment is established to reproduce high-resolution (bit depth) grayscale accurately, which can be regarded as grayscale-to-luminance traceability equipment, providing a measurable basis for grayscale image display standardization.

Composition and Principle
The digital grayscale generation equipment (DGGE) is shown in Figure 2. In this figure, "A" is a light source module (laser-driven light source), with characteristics of high brightness (up to 104 cd/m 2 ) and wide bandwidth. The laser excitation mode ensures its stability. The light hits DMD through "B" (a series of lens groups), using fiber-coupled output. "C" is a DLP module, including a digital micro-mirror device (DMD) with up to 16-bit precision, drive and control circuits, etc. "D" is the projection lens that projects the outgoing light onto "E" (the luminance screen). "E" is a white polyester fluoroethylene-coated board with a diameter of 100 mm. "F" is a DC power supply, and the constant current working model is used in the equipment. "G" is a laptop for DLP control and data processing. Besides, a photometer (PR655, not labeled in Figure 2 but labeled in Figure 3) is used to measure the luminance value of the terminal output. The principle of this equipment is shown in Figure 3. The high-intensity light enters the DLP module through a series of lenses and is displayed with different luminance after being adjusted by the DMD. The light is received by the luminance screen and measured with a photometer.

Grayscale Standard Generation Algorithm
The core device of the DLP module is the DMD, which has the on and off states at a certain time. That is, it corresponds well to 1 and 0 of a binary image matrix. The issue of standardizing grayscale information of softcopy image can be translated into precise control of the DMD. Similar to the spatial frequency that determines the optical density of a hardcopy image, the grayscale information of softcopy image is determined by controlling the time frequency. Therefore, we conducted secondary development based on the DMD, and transformed the spatial frequency characteristics of hardcopy images to the time-frequency characteristics of softcopy images.
Specifically, the grayscale standard image generation algorithm consists of the following steps. Firstly, grayscale is quantized into numerical matrices with different bit precision, and the value is expressed in binary. Secondly, the image is layered on a corresponding bit plane, and different planes represent the information on different bit positions. Different hierarchical planes are displayed at different times during display, corresponding to the weights at different bit positions (higher bits correspond to higher weights). Lastly, the binary value is read from high to low in unit integration time, and displayed according to time-weight distribution. Thus, grayscale is achieved through the control of time frequency, and the flow chart of the grayscale generation algorithm is shown in Figure  4.
Taking an 8-bit grayscale image with a value of 82 as example (shown in Figure 5), it is considered to be decomposed into eight binary images. The specific implementation method is to express the grayscale in eight binary numbers and then read them from high to low. Reading one bit at a time as the value of the corresponding binary image of the pixel, the 8-bit grayscale image can be decomposed into eight binary images.

Grayscale Standard Generation Algorithm
The core device of the DLP module is the DMD, which has the on and off states at a certain time. That is, it corresponds well to 1 and 0 of a binary image matrix. The issue of standardizing grayscale information of softcopy image can be translated into precise control of the DMD. Similar to the spatial frequency that determines the optical density of a hardcopy image, the grayscale information of softcopy image is determined by controlling the time frequency. Therefore, we conducted secondary development based on the DMD, and transformed the spatial frequency characteristics of hardcopy images to the time-frequency characteristics of softcopy images.
Specifically, the grayscale standard image generation algorithm consists of the following steps. Firstly, grayscale is quantized into numerical matrices with different bit precision, and the value is expressed in binary. Secondly, the image is layered on a corresponding bit plane, and different planes represent the information on different bit positions. Different hierarchical planes are displayed at different times during display, corresponding to the weights at different bit positions (higher bits correspond to higher weights). Lastly, the binary value is read from high to low in unit integration time, and displayed according to time-weight distribution. Thus, grayscale is achieved through the control of time frequency, and the flow chart of the grayscale generation algorithm is shown in Figure 4.

Grayscale Standard Generation Algorithm
The core device of the DLP module is the DMD, which has the on and off states at a certain time. That is, it corresponds well to 1 and 0 of a binary image matrix. The issue of standardizing grayscale information of softcopy image can be translated into precise control of the DMD. Similar to the spatial frequency that determines the optical density of a hardcopy image, the grayscale information of softcopy image is determined by controlling the time frequency. Therefore, we conducted secondary development based on the DMD, and transformed the spatial frequency characteristics of hardcopy images to the time-frequency characteristics of softcopy images.
Specifically, the grayscale standard image generation algorithm consists of the following steps. Firstly, grayscale is quantized into numerical matrices with different bit precision, and the value is expressed in binary. Secondly, the image is layered on a corresponding bit plane, and different planes represent the information on different bit positions. Different hierarchical planes are displayed at different times during display, corresponding to the weights at different bit positions (higher bits correspond to higher weights). Lastly, the binary value is read from high to low in unit integration time, and displayed according to time-weight distribution. Thus, grayscale is achieved through the control of time frequency, and the flow chart of the grayscale generation algorithm is shown in Figure  4.
Taking an 8-bit grayscale image with a value of 82 as example (shown in Figure 5), it is considered to be decomposed into eight binary images. The specific implementation method is to express the grayscale in eight binary numbers and then read them from high to low. Reading one bit at a time as the value of the corresponding binary image of the pixel, the 8-bit grayscale image can be decomposed into eight binary images.  Taking an 8-bit grayscale image with a value of 82 as example (shown in Figure 5), it is considered to be decomposed into eight binary images. The specific implementation method is to express the grayscale in eight binary numbers and then read them from high to low. Reading one bit at a time as the value of the corresponding binary image of the pixel, the 8-bit grayscale image can be decomposed into eight binary images. Appl. Sci. 2020, 10, x FOR PEER REVIEW 5 of 10 The relevant parameters of DMD we used are shown in Table 1 (refer to the product manual provided by the manufacturer). According to the DLP characteristics used in this equipment, the integration time t is 3800 μs, so eight binary images are displayed cyclically by weight of 128t/256, 64t/256, 32t/256, 16t/256, 8t/256, 4t/256, 2t/256, 1t/256. Thus, we achieved an accurate display of the grayscale of the image. All relevant information of the DGGE is shown in Table 2.

Operation and Control Mechanism
The Xinlin V5 series FPGA is used in DGGE, and it communicates with the host computer via USB. The display control process is mainly managed by the host computer program, which can realize a 1~16 bit gray level display. The control process includes initialization, adjusting grayscale image, displaying grayscale image, and stopping display. We connected the DLP after power-on to the PC of the host computer, and the main interface is shown in Figure 6(a). The interface is mainly composed of the grayscale preview area, control button area, and device information district. The image to be displayed is divided into six blocks, and each block can display different gray levels according to user settings. Firstly, the equipment needs to be initialized. The host computer modifies the control register on the DLP through the USB interface, so that the DLP development board enters the display preparation state. Secondly, users define the precision and content of the grayscale image to be displayed. If 8-bit is selected, the grayscale image has 256 gray levels, and users can then set the gray value of the six subareas in the preview area separately. Lastly, the approximate distribution of The relevant parameters of DMD we used are shown in Table 1 (refer to the product manual provided by the manufacturer). According to the DLP characteristics used in this equipment, the integration time t is 3800 µs, so eight binary images are displayed cyclically by weight of 128t/256, 64t/256, 32t/256, 16t/256, 8t/256, 4t/256, 2t/256, 1t/256. Thus, we achieved an accurate display of the grayscale of the image. All relevant information of the DGGE is shown in Table 2.

Operation and Control Mechanism
The Xinlin V5 series FPGA is used in DGGE, and it communicates with the host computer via USB. The display control process is mainly managed by the host computer program, which can realize a 1~16 bit gray level display. The control process includes initialization, adjusting grayscale image, displaying grayscale image, and stopping display. We connected the DLP after power-on to the PC of the host computer, and the main interface is shown in Figure 6a. The interface is mainly composed of the grayscale preview area, control button area, and device information district. The image to be displayed is divided into six blocks, and each block can display different gray levels according to user settings. Firstly, the equipment needs to be initialized. The host computer modifies the control register on the DLP through the USB interface, so that the DLP development board enters the display preparation state. Secondly, users define the precision and content of the grayscale image to be displayed. If 8-bit is selected, the grayscale image has 256 gray levels, and users can then set the gray value of the six subareas in the preview area separately. Lastly, the approximate distribution of the generated grayscale image can be observed through the preview window, as shown in Figure 6(b). We downloaded this image to the onboard memory of the DLP, and after the data transfer was complete, the DLP displayed the grayscale image according to the preset display mode. In this way, we achieved accurate control and output of each gray level, and the luminance of the output image is measured through a photometer.
Appl. Sci. 2020, 10, x FOR PEER REVIEW 6 of 10 the generated grayscale image can be observed through the preview window, as shown in Figure  6(b). We downloaded this image to the onboard memory of the DLP, and after the data transfer was complete, the DLP displayed the grayscale image according to the preset display mode. In this way, we achieved accurate control and output of each gray level, and the luminance of the output image is measured through a photometer.

Uncertainty Analysis
We analyzed the measurement uncertainty u(Lm) on the DGGE. Different grayscales are generated from the unique light source by DLP in the sequence algorithm as described in Section 2.3; the uncertainty of grayscale (relative luminance) generation of DGGE is related to the stability of the light source ΔLr and the uniformity of the luminance screen ΔLu. Furthermore, the grayscale must be traced to luminance by photometer, so the uncertainty of the photometer measurement result ΔLP should be considered. Thus, the uncertainty model of grayscale (No., n) ΔLn from DGGE can be described by: where N means the maximum grayscale number (corresponding to bit depth).
This means there are three main sources of uncertainty; u(Sr) is the uncertainty from the stability of the light source ΔLr, u(Su) is the uncertainty from the uniformity of the luminance screen ΔLu, and u(Lp) is the uncertainty from the photometer measurement result ΔLP.
(1) u(Sr)-The uncertainty from the stability of the light source ΔLr According to the digital control mode of the equipment, the light source works at a fixed working current, and its emission degree is also determined. We set all control bits of the DMD to "1", that is, the luminance of the light source projected onto the whiteboard is the maximum, and the grayscale corresponds to 255 (8-bit precision). The amount of change in the luminance of the projection whiteboard at 1 h was measured as the stability of the light source. The measurement interval is 5 min, and the measurement results are shown in Table 3.

Uncertainty Analysis
We analyzed the measurement uncertainty u(L m ) on the DGGE. Different grayscales are generated from the unique light source by DLP in the sequence algorithm as described in Section 2.3; the uncertainty of grayscale (relative luminance) generation of DGGE is related to the stability of the light source ∆L r and the uniformity of the luminance screen ∆L u . Furthermore, the grayscale must be traced to luminance by photometer, so the uncertainty of the photometer measurement result ∆L P should be considered. Thus, the uncertainty model of grayscale (No., n) ∆L n from DGGE can be described by: where N means the maximum grayscale number (corresponding to bit depth). This means there are three main sources of uncertainty; u(S r ) is the uncertainty from the stability of the light source ∆L r , u(S u ) is the uncertainty from the uniformity of the luminance screen ∆L u, and u(L p ) is the uncertainty from the photometer measurement result ∆L P .
(1) u(S r )-The uncertainty from the stability of the light source ∆L r According to the digital control mode of the equipment, the light source works at a fixed working current, and its emission degree is also determined. We set all control bits of the DMD to "1", that is, the luminance of the light source projected onto the whiteboard is the maximum, and the grayscale corresponds to 255 (8-bit precision). The amount of change in the luminance of the projection whiteboard at 1 h was measured as the stability of the light source. The measurement interval is 5 min, and the measurement results are shown in Table 3. The stability of the light source calculated according to Bessel's formula is: where L i represents each luminance measurement result, L represents the average of the results, and n is the number of measurements (which is 13).
(2) u(S u )-The uniformity of the luminance screen ∆L u According to the field of view and distance of the calibrated photometer, the size of the luminance area can be estimated. The whiteboard on the projection surface is a circular area with a diameter of 100 mm. Considering the influence of aberrations, an area with a diameter of 30 mm is selected as the calibration plane. As shown in Table 4, the uncertainty of the luminance uniformity of the screen of Φ30 mm when measuring the 255th gray level was taken as the result. The position mark on the luminance screen is shown in Figure 7. The stability of the light source calculated according to Bessel's formula is: where Li represents each luminance measurement result, L represents the average of the results, and n is the number of measurements (which is 13).
(2) u(Su)-The uniformity of the luminance screen ΔLu According to the field of view and distance of the calibrated photometer, the size of the luminance area can be estimated. The whiteboard on the projection surface is a circular area with a diameter of 100 mm. Considering the influence of aberrations, an area with a diameter of 30 mm is selected as the calibration plane. As shown in Table 4, the uncertainty of the luminance uniformity of the screen of Φ30 mm when measuring the 255th gray level was taken as the result. The position mark on the luminance screen is shown in Figure 7.  The uniformity calculation formula can be expressed as: where Li represents the luminance of the i-th position (position 2 is selected here), and L0 represents the luminance at the center of the measurement area (corresponding to position 9). It can be calculated as: (3) u(Lp)-The uncertainty from the photometer measurement result ΔLP Both the output of the digital grayscale generation equipment and the display curve of the calibrated image are characterized by luminance. The calibration process is also determined by the luminance range, so the luminance measurement uncertainty of the photometer is the main source of uncertainty, and its value is given by the calibration of the photometer. According to the calibration certificate of photometer given by the National Institute of Metrology (NIM), its extended uncertainty is 2% (k = 2). The traceability is achieved at maximum luminance Lmax (4000 cd/m 2 ), so u(Lp) should be: The uniformity calculation formula can be expressed as: where L i represents the luminance of the i-th position (position 2 is selected here), and L 0 represents the luminance at the center of the measurement area (corresponding to position 9). It can be calculated as: (3) u(L p )-The uncertainty from the photometer measurement result ∆L P Both the output of the digital grayscale generation equipment and the display curve of the calibrated image are characterized by luminance. The calibration process is also determined by the luminance range, so the luminance measurement uncertainty of the photometer is the main source of uncertainty, and its value is given by the calibration of the photometer. According to the calibration certificate of photometer given by the National Institute of Metrology (NIM), its extended uncertainty is 2% (k = 2). The traceability is achieved at maximum luminance L max (4000 cd/m 2 ), so u(L p ) should be: Appl. Sci. 2020, 10, 2297 8 of 10 It should be noted that DLP uses digital technology, so it can be considered to have no uncertainty. The above uncertainty compositions are summarized as shown in Table 5. The combined standard uncertainty is: u(L n ) = n N u(S r ) + n N u(S u ) + n N u(L P ) = 3.55 n N + 22 n N + 40 n N = 65.55 n N (8)

Analysis of Luminance Measurement Result
Based on the high-brightness light source and attenuator, we control the output luminance range from 0.16~4000 cd/m 2 . That is, theoretically, the output luminance corresponding to 0 gray level is 0.16 cd/m 2 , while 255 gray level corresponds to 4000 cd/m 2 . Then, some typical gray levels are set, and the luminance is measured by the photometer PR655. As shown in Table 6, the corresponding uncertainty is calculated, and experimental data show that all measurements meet expectations.

Discussion
From the measurement result and corresponding analysis of the property of the DGGE, it is determined to have desirable luminance output in the range of 0.16~4000 cd/m 2 . Furthermore, the standard uncertainty of the measurement by DGGE has a range of 0.26~65.55 cd/m 2 at the luminance range. From this result, it is found that the methods of equipment building and the corresponding measurement are key to the standardization and traceability of grayscale. These methods influence the uncertainty of grayscale, which is equal to the standardization. Furthermore, the calibration and processing methods of luminance data are also needed for the traceability of grayscale, which we elaborate in another published paper [29].

Conclusions
The digital standard grayscale generation equipment is firstly established in the National Institute of Metrology, China. It can provide a traceable grayscale value for the standardization of the terminal image of imaging equipment. Images are represented in grayscale, which is traceable to national luminance benchmarks. Thus, the images are consistent in different instruments, and they can be transmitted consistently and identified in one mode. Notably, the characteristics of human vision and