An improved image processing algorithm for automatic defect inspection in TFT-LCD TCON

: The demand to improve image display in TFT-LCD, implementation of design for image processing is important. In order to meet the specific requirements of low-end Thin Film Transistor-Liquid-Crystal-Display (TFT-LCD) image display. This paper adopts a novel algorithm to conduct subsequent processing of the medical image after SCALER scaling, including contrast adjustment, gamma correction and dithering. Dithering algorithm is the focus of our research. After the study of some classical video image processing algorithms, and considering the real-time requirements, an intelligent algorithm is implemented for hardware implementation and improvement. For each part, MATLAB language is firstly used for advanced simulation to verify its feasibility, and then Right-To-Left(RTL)hardwarelanguagedescriptioniscarriedout. The characteristics extraction from images is performed implementing RGB standard and grayscale images. The pixel intensity is analyzed for each RGB component and the variance is calculated. When a panel displays a variation of 6% related with their reference values, the panel is rejected. The results obtained from classification shows a 95.24% accuracy rate in the detection of defects. The re-sults of the two simulations show that the design achieves the expected goal, and the processing time is shorter.


Introduction
Thin Film Transistor-Liquid-Crystal-Display (TFT-LCD) is the rst to enter the display market with its characteristics of low working voltage, low power consumption, good display e ect, easy integration, good light, and portable. The internal circuit of TFT-LCD is mainly composed of two parts. One is the "LCD control chip module", which includes SCALER, Analog-to-Digital Converter (ADC), On-Screen Display (OSD), and Micro Controller Unit (MCU). The other part mainly includes the driver IC and timing control IC, which are the circuits attached to the panel to form the so-called LCD panel module. As the timing controller Timer Control Register (TCON) connecting SCALER, SOURCE, and GATE driver chip, it is mainly responsible for receiving and processing medical image data after SCALER scaling and providing correct timing control and display data for downstream driver chip. At present, the existing nished TCON chips on the market mainly include 1004C and 1004D of PVI; AU's UPS015, UPS017, etc.
In daily life, medical images cannot be ignored play a vital role. Medical image processing refers to the external processing and processing of relevant medical images through electronic devices such as computers. Since 1920, digital medical image processing technology began to appear, the initial processing technology for digital compression technology, its application is more and more widely, such as the medical eld, aerospace, communication technology, and military and other elds. In the eld of medicine, common X-ray is an important expression of medical image processing technology, the scientists through medical image processing technique, the original medical image clarity and resolution to improve, make doctors can observe patients more clearly through scienti c instruments of illness, doctors can fast and convenient to the preliminary diagnosis of the patient; In the eld of aerospace, the normal operation of space vehicles has been inseparable from medical image processing technology.
Medical image processing technology can help the aircraft correctly judge the direction during ight and play a role in navigation, as well as help it safely avoid risks. Similarly, in the military eld, medical image processing technology can help weapons accurately judge the target of attack and improve the accuracy and success rate of combat [1]. In addition, medical image processing technology can also help the police to solve cases and identify and deal with the traces of the crime scene. In recent years, with the development of science and technology, the application elds of medical image processing technology have gradually increased, which will make great contributions to the progress and development of society. After the 1960s, medical image processing technology developed rapidly. After about a decade, medical image processing technology began to form a relatively complete discipline system. In recent years, medical image processing technology is developing at an unprecedented speed along with the increasing demand for medical image processing technology in related elds.
For a long time, visual information is the most important information that people feel in nature. The results show that the visual system accounts for more than 70 percent of all information received by humans. Images have been widely used in daily life because of their large amount of information, intuitionistic, accurate, and higher e ciency. In the information age, images are acquired and sampled, quanti ed, and compressed. Image processing has become an e ective tool for the study of visual perception, which is widely used in medicine, engineering, remote sensing, military, meteorology, space, transportation, and many other elds. However, in our daily life, due to external factors such as insu cient light, we often nd that the brightness of the obtained image is not enough; resulting in the scene cannot be seen clearly.
To study and analyze the image, it is necessary to process the obtained image. The common processing method for digital images is to use image contrast enhancement technology to improve image quality. Image contrast enhancement refers to the processing method that highlights some information of an image according to speci c needs and weakens or removes some unnecessary information at the same time. Its main purpose is to make the processed image more suitable than the original image for some speci c applications, and the results after processing make the image more suitable for human visual characteristics or machine recognition systems. This paper mainly studies and processes the medical image after SCALER scaling, mainly including contrast adjustment, gamma correction, and dithering, and realizes the improved medical image processing algorithm in TFT-LCD TCON. In this paper, the Floyd-Steinberg error di usion theory is applied to dejitter medical image processing of TCON, and the problem of medical image blur caused by shortening the length of pixel word is solved.
In order to meet the distinct demand for improving image display in TFT-LCD, this work demonstrates a synthesis design and its employment for image processing in time controlling of TFT-LCD. This article implements a novel algorithm to conduct subsequent processing of the medical image. The steps involved scaling, contrast adjustment, gamma correction and dithering. An intelligent algorithm is implemented for hardware implementation and improvement after the study of some classical video image processing algorithms, and considering the real-time requirements. The simulation is carried out in MATLAB to verify its feasibility, and then Right-To-Left (RTL) hardware language description is analyzed. The characteristics extraction from images is performed implementing RGB standard and grayscale images and at last pixel intensity is analyzed for each RGB component and the variance is calculated.

Literature review
With the rapid development of computer medical image processing algorithms, the detection of Mura defects by machine vision has become the focus of people's attention. In recent years, researchers at home and abroad have conducted many studies on machine detection of Mura defects. TFT-LCD manufacturers' mainstream detection methods for Mura defects are to train a group of inspectors to judge Mura defects, and these inspectors make visual judgments and ratings based on experience. On the one hand, human eye detection is subjective, so di erent detection personnel cannot guarantee the complete consistency of detection standards.
On the other hand, this detection method is low in ine ciency and high in cost. Generally, it takes even 40 seconds to detect a 2.4-inch LCD medical image. After a long time of detection, the detection personnel will su er from visual fatigue and even harm to the eyes. Therefore, people began to pursue more e cient and more standardized detection methods [2]. Tiwari et al. proposed an effective method to enhance the contrast of medical images. Image contrast enhancement is a pre-processing step that improves the e ciency of other image processing applications, such as pattern recognition and computer vision. The method USES natural gamma correction and holomorphic ltering to enhance image contrast and maintains image brightness. Experimental results show that the method can enhance the contrast of medical images without a ecting brightness. This makes the algorithm a exible medical image enhancement tool [3].
Gupta and Tiwari proposed an e ective way to enhance the contrast of digital images. Image contrast enhancement is a preprocessing step to improve the eciency of image processing such as computer vision and pattern recognition. The method USES the weighted probability distribution of brightness pixels and gamma correction to enhance the contrast and brightness of the image. Experimental results show that this method can enhance the contrast of various color images without affecting the visual and color information of the image [4]. Gracheva and Kopylov believe that under the framework of the Bayesian method, the general problem of image processing can be expressed as the estimation problem of the hidden component of the two-component random eld [5].
Jin believes that model-based image processing technology is the system framework to solve the inverse problem of an imaging system [6]. Ladkat et al. believed that every pixel must be operated for image processing. If this is done sequentially, it will take too much time. To reduce time, all pixels need to be processed in parallel. Therefore, instead of working on each pixel one at a time, all pixels are worked on in parallel [7]. Maggio and Iocchi proposed a system to automatically optimize the image target classi cation algorithm and parameters simultaneously. More speci cally, the system can process a tagged image data set and return the best-con gured image processing and classi cation algorithm and its parameters in terms of classication accuracy [8].
The computer devices usually o ers display data of 8 bit width. Therefore this pixel width of 8 bit should be converted to width of 6 bit for the advanced operation. Dithering matrix provides one easy solution to solve such problem in comparison with bayer matrix [9]. However there still exists some issues that brings e ect of adjacent squares in an image present on edge of matrix. In this proposed work an e cient solution based on di usion algorithm is implemented instead of bayer [10,11]. Based on Rajinikanth et al., [12] and Kim et al., [13] the histogram for each component is computed for the RGB scale. Elguebaly et al., [14] use Bayes theory, allied to previous knowledge to estimate the absence of pixels, with a statistical and modeling or residual approach to images such as a Gaussian distribution of Laplace. Oliveira et al., [15] used a calculation technique for the average intensity of the images. The result of which is acquired and in uenced by diversied environmental factors. Huang et al., [16] presented a program of quali cation of 14 steps and presents zero for the organization, within the all, is found to be necessary for the identi cation of anomalies before the acquisition of the product of the last client.

Design of image processing system in TFT-LCD TCON
The stages of the proposed algorithm consist of the acquisition of images by cameras, the de nition of the region of interest, extraction of characteristics, analysis of images for decision making. The operational stages are presented in Figure 1 and the detailed algorithm is presented in Algorithm 1.
The captured image is digitized through ADC and then assembled in a bu er for the transmission as packets to PC. A region of interest belongs to that area of an image that we want to focus on for analysis. A region of interest can be de ned on an interactive basis, through programming, or with an image mask. The area of interest is segmented from the input image and in the next step, the characteristics are extracted from patterns. It attributes the quality associated with the pattern that allows characterization. In the fourth step, the images are analyzed for the perception and understanding of image features. In the last step based on the analysis of image, the decision is made for approval.

. Medical image enhancement
In the process of medical image generation and transmission, inevitably a ected by the external environment and generate some noise, a ects the nal medical image effect, so to guarantee the e ect of the medical image, the e ects of reducing noise, medical image enhancement algorithm arises at the historic moment, medical image enhancement algorithm, not only can e ectively reduce the in uence of the noise, and can also enhance medical image clarity, achieve the visual e ect. On medical image enhancement algorithms, there are many di erent ways, some of these methods in medical image denoising, some in gray medical image enhancement and color medical image enhancement has prominent e ect in di erent aspects, such as, according to the relevant data contrast found Jourlin and Pinoli study algorithm is more general, on the one hand, can e ectively abate the noise, on the other hand, can improve medical image clarity, sound processing medical image detail, and also can enhance the medical image grayscale and color, at the same time the medical image is not so and distortion, is now a better calculation method in the eld of medical image processing [17].

. Edge detection
Medical image processing, edge of mishandling would happen often lead to a medical image, medical image edge is due to the uneven distribution of medical image grayscale, texture or caused by improper handling, at this time to detect the edges of the medical image, the edge method also has many, but this among them, the Canny method is the most ideal e ect, but this kind of algorithm for noise treatment e ect is bad, therefore, the improved Robert comes edge detection algorithm, the improved Robert algorithm overcomes the problem of improper handling Canny method for noise. At the same time, it overcomes the disadvantage of the traditional Robert algorithm in rough medical image edge processing and can make the processed medical image have a clear viewing e ect.
. TFT-LCD system structure TCON timing signal is generated based on the needs of the TFT-LCD Panel. To understand the principle of TCON, one should rst understand the display principle of the LCD Panel. The internal structure of a typical TFT-LCD panel is shown in Figure 2. Liquid crystal has light transmittance controllability, change the voltage applied on both ends of liquid crystal; liquid crystal transmittance will change accordingly.
A liquid crystal unit displays a sample point, so a medical image can be displayed if it is arranged in a matrix according to the data structure of the binary medical image into a crystal array. In general, LCD arrays can be arranged in two ways: Strip and Delta. Di erent arrangements determine di erent Red Green Blue (RGB) sampling orders, and a pixel consists of three liquid crystal units (RGB). Therefore, the number of liquid crystal elements in the liquid crystal array determines the display resolution. TFT-LCD is formed by separating display pixels and scanning electrodes through TFT transistor on the basis of superdistorted STN, which is characterized by overcoming the crossover e ect of STN-LC9 [18]. TFT-LCD system consists of two parts: LCD control module TCON and LCD panel module. The LCD display adopts the active matrix driving mode according to the row and column. The row lines are connected to the gate of the pixel NMOS tube, and the column lines are connected to the Source of the NMOS tube. In the LCD module, the line and column line are driven separately. The circuit that drives the column line is called the Source Driver. The source driver and the gate driver together control the charging and discharging process of the liquid crystal unit. When the scan signal is valid, all TFT cells on this line are turned on at the same time, and the RGB voltage charges the memory capacitor through TFT. Therefore, the voltage di erence between RGB and Vcom determines the voltage of the liquid crystal column. When the scanning signal is invalid, the TFT unit on this line is disconnected, and the charge of the storage capacitor can remain basically unchanged in one frame time, thus achieving the static display e ect of the duty cycle approaching 100%. The main function of TCON is to provide the necessary timing control signals for the source and gate drivers in TFT-LCD panels. According to the requirements of the Panel, the most basic output signals of TCON are STV, OEV, CPV, STH, CPH, OEH, PLC, etc. In addition, in order to achieve di erent display modes, there are L/R, U/D, MOD, Q2H, and other control signals [19].

. TCON module design of timing controller
TCON module of timing controller includes PLL, I2C interface, DIV of the frequency divider, HSB of line synchronization module, VSB of eld synchronization module, and CSB of control signal output module. The eld synchronization module VSB generates the control signal needed by the gate driver. Line synchronization module HSB generates the control signal required by the source driver. The control signal output module CSB generates the scanning direction control signal.I2C interface is introduced in the design of this system. The control signal can be controlled through the internal register, and the change of display mode can be realized by changing the software, thus greatly reducing the number of pins of the external hardware circuit. PLL can provide system clocks with 1920, 1440, 1200, and 1152 resolutions, while 960, the corresponding clocks of 480, 400, and 320 resolutions are obtained by frequency division of the DIV module [20].
Since output control signals required by di erent LCD resolutions and working modes are di erent, TCON should rst make a judgment and choose the correct working mode to generate appropriate control signals. These options include LCD resolution, external/PLL clock mode, split/composite mode, NTSC/PAL mode. LCD resolution selection: in the actual display system, TFT-LCD has different sizes and resolutions. The resolution of general medium and small size TFT-LCD is 480×234 (2.5", 3.5"), 960×234 (3.6", 5", 6.4"), 1200×234 (6.5"), 1400×234 (6.2", 7"), 1920×234 (9"), etc. For di erent resolutions of LCD, the need for some control signals will be di erent. External /PLL clock mode selection: the working clock source is provided in two ways, PLL mode, and external clock mode.
In the PLL working mode, the VCO circuit generates oscillations, which are transferred to TCON by a phase-locked loop circuit a working clock for stability; in external working mode, the working clock is provided externally. Separate/compound mode selection: the input synchronization signal can be divided into compound synchronization signal and separate synchronization signal. The synchronization pulse ag bit of these two kinds of synchronization signals is di erent. NTSC/PAL options: NTSC and PAL options have completely di erent lines per frame and sync pulse ags, so a decision should be made before the input signal is processed and the control signal is generated. Display mode selection under high resolution: there are 8 di erent display modes under high resolution, including FULL, Center, Wide, Zoom1, Zoom2, Left, Right, and Zoom3. Under di erent display modes, the display area, output control performance, and pulse width will be di erent.

Adjust technology and hardware design . Contrast adjustment
The contrast of the display is de ned as: in a dark room, the brightness under the white screen is divided by the brightness under the black screen so the brighter the white and the darker the black, the higher the ratio. Contrast enhancement adjustment tries to increase the contrast between di erent colors, making bright pixels brighter and dark pixels darker. Contrast reduction reduces the contrast between colors, darkening bright pixels and brightening dark ones. There are two ways to change the contrast in an LCD display: 1. The contrast of an LCD panel. High contrast means a relatively high level of brightness and color. In fact, it is determined by the optical properties of LCD backlight and LCD panel. Once determined, it cannot be adjusted. 2. The contrast of the image itself re ects the distribution of the image from light color to dark color, and re ects the transition characteristics of the image in the gray level. This article discusses the contrast of the image itself. There are two methods of image contrast enhancement: spatial domain method and frequency domain method. After dividing the image into target area, background area and transition area through min value segmentation, the piecewise linear transformation method based on double min value segmentation can adjust the image contrast by adjusting the weight value W. The method is not only simple to adjust, but also considers the information characteristics of the image itself.
In the implementation of the circuit, since every frame of image in the continuous video stream always enters the contrast processing module one pixel at a time according to the order of horizontal and vertical scanning, to calculate the current frame's min value, it is necessary to store one frame of image. However, due to the continuity of the image, there is no need or need to increase the frame memory. We can use the value of the previous frame to adjust the contrast value of the current frame, which will not affect the adjustment e ect.
Contrast adjustment refers to Figure 2. Contrast adjustment mode is shown in Figure 2. Here mainly involves the design of a multiplier, in view of the requirement of realtime, we adopt a pulsating array, due to the combination of the multiplier delay is bigger, can't meet the requirements of our high speed, so we skillfully to pulse array of joined the level 4 trigger to form the structure of the assembly line, to reduce the delay time of each level. The L1, L2 and L3 in the gure are limited in scope,L L ∈ { / / / / / / }, the precision of L2 is relatively high, because it involves the connection problem of curves where L1 and L3 are located. We use 8 bits, L ∈ { .

. . Principle of Gamma correction
Gamma correction is a parameter value used to express the nonlinearity of the display, but in fact, Gamma correction exists even if the display is linear. The reason is that the perception of brightness, or RGB, in the human visual system is more of a pair-to-number relationship than a linear one. Gamma correction is a transfer function introduced to overcome this non-linearity and is widely used in video streaming, computer graphics and other imaging systems. In general, due to di erences in visual environment and display device characteristics, the Gamma value is between 2.2 and 2.5.Generally, when the value used for Gamma correction is greater than 1, the highlight part of the image is compressed and the dark part is expanded. When the value used for Gamma correction is less than 1, the highlight part of the image is expanded and the dark part is compressed. Gamma correction is generally used to smooth out the dark details. Without Gamma correction equipment will a ect the color of the nal output image brightness, such as a kind of color is composed of red and green, the brightness of the red 50%, green 25% brightness, if one is not after Gamma correction of the monitor Gamma value is 2. 5, so the brightness of the output will be 18% and 3%, respectively, the intensity is greatly reduced.
To compensate for this de ciency, we need to use the counter-e ect compensation curve to make the display as much as possible to output the same image as the input image, so as to get a better output on the display. This process of using the inverse compensation curve to make the input and output images consistent is called Gamma correction. The principle of correction is described as follows: the ideal display system is linear; in other words, the intensity of the light output of the display system should be proportional to the amplitude of the video signal input. Let the output light intensity of the display system is L out and the input value L Gamma in . For a linear display system, the two are equal. In reality, however, video displays are nonlinear. In other words, the output value of the display is not proportional to the input value. Due to the existence of hardware characteristic index Gamma, the output value of the display and the input value present a functional relationship with Gamma as the index: L out = L in Gamma .It is this nonlinearity that causes the output of the display to be distorted from its original image, depending on the Gamma of the speci c system. Di erent systems have different Gamma coe cients. For example, NTSC system has a Gamma coe cient of 2.2, PAL system has a Gamma of 2.8, and CRT has a Gamma coe cient of 2.4. Gamma correction involves pre-compensating the image data before it is sent to the monitor for display. Pre-compensation arti cially makes the input value of the display compare to the original image to produce Gamma distortion, which is o set by the hardware Gamma distortion of the display, so that the output value of the display and the original data of the image establish a linear relationship, thus realizing the Gamma correction of the display. The input voltage (v) of the LCD display drive circuit and the light intensity (L) of the LCD display usually have a non-linear relationship L = vc (index c is between 1 and 2.5, which is set by the display manufacturer according to di erent environmental needs and constraints). This feature makes the SOURCE driver chip have a special set of resistors to solve the nonlinear problem. Simulation to solve the non-linear is not accurate to digital technology, in order to solve this problem, the LCD display system to add digital gamma correction, the display of the light intensity and drive circuit input voltage into a linear relationship, e ectively reduce the medical image distortion, also make the SOURCE drive design simple. The core algorithm of gamma correction is the lookup table. We con gured the pre-calculated corresponding output data into ROM to realize a linearization process. In the initial debugging stage, E2PROM could be used to facilitate chip debugging.

. . Sub-channel LCD Gamma correction
Compared with the traditional CRT display, the photoelectric characteristics of LCD display are very di erent. The transfer function between the output light intensity and the input signal of the liquid crystal display system without Gamma correction is irregular "S" shape, and the corresponding transmittance is basically unchanged for the step signals of 50% lower and 20% higher. The intermediate step signal range of 30% corresponds to the transmittance range of about 90%, which seriously a ects the gray level and color reproduction e ect of the output image. The purpose of Gamma correction is to compensate for this nonlinearity; so that the liquid crystal display has the power response characteristics of the ordinary Cathode-Ray Tube (CRT) display system.
The Gamma curves of LCD are Red, Green and Blue, which are inherent to LCD, not random. The X-axis repre-sents the gray level of the input image, which ranges from 0 to 255 and is divided into 16 equal parts, each representing 16 gray levels. The Y-axis is the normalized light intensity. The three Gamma curves of Red, Green and Blue are quite di erent from the curve with a Gamma coecient of 2.2 commonly used in China. Therefore, the normal compensation curves with a Gamma coe cient of 2.2 cannot be used to correct the LCD display. Moreover, the Gamma curves of the three channels of RGB are also di erent, which makes it more di cult to correct LCD Gamma. In addition, since the current video and computer graphics generation systems still use the previous Gamma precreation method with a Gamma coe cient of 2.2, the color cannot be accurately restored when the LCD is connected to these systems. Therefore, in the LCD image engine, the linear RGB must be again specially Gamma corrected according to the LCD's Gamma curve to calibrate the LCD display image color.
Based on the above reasons, the LCD Gamma correction method proposed in this paper is as follows: 1. Sub-channel Gamma correction; since the Gamma curves of the three channels of RGB are di erent, compensation is made for the Gamma curves of the three channels of R, G and B.
2. Consider the modi cation of the pre-compensation method with a Gamma coe cient of 2.2 Since the current video and computer graphics generation system still follows the previous pre-correction method with a Gamma coe cient of 2.2, it is not possible to directly use the Gamma curves of R, G and B channels to perform Gamma correction, so the pre-correction method with a Gamma coe cient of 2.2 needs to be considered. The speci c Gamma correction method is as follows (take any point P in the gure as an example):

Make a horizontal line through point P and cross the
Red channel curve at point N; 2. The input value of pixel gray value at point P is 122; 3. The input value of pixel gray value of read N point is 149; 4. Fill 149 into address unit 122 of the Look upon This shows that when the input Red component of the pixel gray level 122, in the hope of light intensity on the LCD should be Gamma 2.2 P point on the curve of the light intensity, but it is when the input value is 149, N point on the Red channel Gamma curve produced with the P point of light intensity, it can complete the above mentioned methods the Gamma correction of LCD, and make the color of the LCD display system to get accurate reduction.

. . Hardware design and image simulation of Gamma correction
First, the possible value of RGB component of 8bit was taken as the independent variable, and the correction value was calculated according to the correction step, and then stored in LUT (still 256 grades).During use, the RGB component value is taken as the address o set, and the Gamma correction of the input signal can be completed by looking up the table.
The realization of Gamma correction is through the Gamma correction processing of the three color component values of the input pixel, R, G and B, and the Look up Table (

. To shake
In many practical applications of LCD displays, a ected by the accuracy of speci c display terminals, the digital images represented by multi-bit bits in the processing process need to reduce the number of pixels before display to meet the requirements of display terminals, which results in a problem of conversion from high-precision display space to low-precision display space. This paper rstly analyzes the shortcomings of the basic methods to realize this transformation -direct interception. In order to obtain higher image display quality, the commonly used error diffusion halftone algorithm is discussed.
The appearance of "block e ect" is intolerable to the display system because it greatly reduces the display e ect of the image. The research on the principle of human eye vision shows that the ability of human retina to recognize the gray level is 1, that is, under the condition of 100 gray levels, if there is a change of 1 level, it can be recognized. Therefore, when an 8bits of gray scale information is converted to 6bits, its gray scale change rate is 1/64(1.56%). When an 8bits of gray scale information is converted to Obits, its gray scale change rate is 1/16 (6.25%). Therefore, the algorithm directly intercepting the redundant bits will inevitably cause the image quality recognized by human eyes to decline. However, in terms of the cost of hardware implementation, the 6bit LCD panel can reduce the cost compared with the 8bit LCD panel, and the pseudo-true color panel can reduce the maximum number of driving IC, thus reducing the di culty in visual Angle and contrast design. Therefore, in many applications, such as small and medium sized LCDS equipped with portable devices and mid -and low-end desktop LCDS, fake color panels with 6 bits or less are used. As a result, there is a contradiction between saving cost and greatly reducing image quality.
In order to improve the display quality of the image as much as possible, many algorithms are proposed, which are uniformly classi ed as digital halftone technology. The basic function of halftone processing is to eliminate the stepped striations caused by the discontinuous tone output of the image, so as to achieve the e ect of image color enhancement, and e ectively eliminate the inherent block-e ect defects of the image, so as to make the image smoother and softer, and further improve the quality of the image. The basis of digital halftone processing is that the human eye has a "spatial proximity characteristic" at the initial stage of processing visual information, so that spatially adjacent parts of the image are treated as a whole. In this way, the human eye has a low resolution of details within a certain visual Angle (also known as the low-pass property), and at the same time, the perception of the gray or color of a small facet by the human eye is the perception of the total gray or color of the facet at a certain distance. The gray image or color image is binaries by using this characteristic of human eye. As long as the binary pixel points are close enough in space, the human eye can see the continuous tone.
In halftone processing, gray is not provided by the halftone all source image gray level, there is a similar problem, with an approximate gray instead of the original gray level, there must be error, and simply give up, if this error is bound to a ect the image processing e ect, such as the change of the grey value and color value of jumping, etc. Therefore, how to deal with the error becomes the key of the problem, and the error di usion algorithm comes into being.
Error di usion is based on a single principle. Once a pixel is quantized, it has errors that a ect the pixels around it. The process by which the error a ects the surrounding pixels is called di usion, which means that the error is divided into components that are added to the gray scale values of the adjacent pixels. A negative feedback system is the system in which the system is in a selfcorrecting state through the di usion of errors. This algorithm is a neighborhood processing process, which diffuses the quantization error of the current pixel to the neighboring pixel in a certain proportion. In this way, the local quantization error is a compensation for the adjacent pixel points, so the error di usion system has the ability of self-correction. Moreover, it can guarantee that the total gray scale or total color of the image before and after processing is consistent on the whole.
Simple dithering can be achieved by using dithering matrix, like a typical BAYER matrix. However, the medical image processing e ect of this scheme is not very good. After matrix processing, the medical image produces block e ect. Therefore, we adopt the better Floyd-Steinberg error di usion algorithm. We adopt {1/16, 5/16, 3/16, 7/16} coe cient combination Floyd-Steinberg error di usion algorithm based on delta-sigma modulation. Noise-shaping feedback coder is a DSM for word length compression, and f-s algorithm is one of NSFC. The algorithm of NSFC is shown in Figure 3. The corresponding transfer function is: The noise transfer function corresponding to Floyd-Steinberg algorithm is: Error di usion algorithm is mainly composed of column and column counting module, control module, data path and First Input and First Output (FIFO) memory. The control module solves the sequence of reading and writing of FIFO. The data path mainly completes a weighted average of error di usion coe cient to obtain the current pixel value and calculate the corresponding di usion error. FIFO is used for error storage of adjacent two lines. Given that the error can be negative, a 3bit FIFO is used to store the signed error. Dual-ports Random Access Memory (RAM) automatically generated by VeriSilicon is adopted to produce FIFO that can read and write simultaneously.

. . Simulation results and discussion
In order to verify the e ectiveness of the above algorithms, we respectively used MATLAB language and Verilog language to simulate some algorithms of contrast adjustment, brightness adjustment and dithering, and provided the core code of MATLAB simulation and the comparison before and after medical image processing. Figure 4, presents the spectral response of the images. An image o ers resources as a global shutter and control of exposure time. Either the start or the exposure time can be controlled by parameters transmitted through interface. There are also parameters available to adjust single image acquisition or acquisition of continuous images. The start of exposition can also be controlled through a signal generated externally, and that is applied to entrance. The proposed algorithm is described below and simulation results are explained.  Figure 5 represents the experimental analysis of proposed scheme to evaluate the sparsity rank under various values of ρ for di erent defects in images. On the other hand the evaluated running time for various defects in images is depicted in Figure 6.
The evaluation of running time is an important parameter that is essential for the manufacturing process of industrial application. Figure 5, depicts the relation between the sparsity rank and values of ρ. Here ρ is considered as  The experimental analysis of designed model, which is implemented in FPGA reveals that with much improved modules, it can be substituted in commercial LCD. The practical implementation of proposed model reveals that it can be substituted with LCD for obtaining video image at high speed and absolute improved de nition. MATLAB simulation results are as follows: "LCD output image without correction" is smaller than the gray value of the source image, and the image appears darker, while the image processed by the algorithm proposed in this paper is darker. The "corrected image" has a higher gray value than the source image, and the image appears brighter, while the image processed by the algorithm proposed in this paper is brighter. The "corrected LCD output image" processed by the pre-modi ed sub-channel correction method proposed in this paper is closer to the original image than the "corrected LCD output image" processed by the Gamma= 2.2 correction method. Compared with the 8bit image, the 6bit image is slightly fuzzy, and there is a lack of detail in the image, but basically it has achieved a better e ect. The processing e ect of Floyd-Steinberg di usion matrix method is better than that of Bayer jitter method, and the "block e ect" is further improved. The dynamic error diffusion method based on the edge has the best processing e ect, and its "block e ect" is controlled to the maximum extent. Moreover, the edge details of the image are richer and ner than those of other algorithms, and the image edge is clearer.

Conclusion and future work
The synthesis design that involves adjustment of contrast and luminance along with Gamma correction, an improved image processing algorithm is presented in this article. With the development of science and technology, the medical image processing technology in our country is also in continuous progress, providing a lot of convenience for our daily life, but also happy our mood. However, there are still some defects in many medical image processing technologies at present. For example, medical image edge processing is too rough, color contrast is not strong, gray scale is not enough, etc., which makes the visual e ect of multi-degree medical images in practice not good, which not only a ects the aesthetic degree of its appearance, but also a ects its function. In this design, the timing of TCON is di erent for di erent LCD panels, but the display principle is basically the same. Although the improved algorithm of image processing designed in this paper is de cient in the details of the image, it has achieved relatively ideal results. The improved algorithm overcomes the problem of improper noise processing by traditional methods, and the disadvantage of rough image edge processing, so that the processed image has a clear viewing e ect. In addition, the design is versatile and supports LCD panels from most manufacturers in the market, such as AU, PVI, Samsung, LG, Sharp, Panasonic, Toshiba and Foxconn. The design of the timing controller has been successfully streamed separately by SMIC018 process and integrated with Video Processor, which has been applied in portable DVD, car TV and other elds, hoping to provide theoretical signi cance for better medical image processing in practice and convenient people's life.
Based on the current research and design, further research can be made in the two aspects. First is considering the Gamma correction process, study how to adopt multiple Gamma curves on the same picture to improve the animation quality, and adjust the Gamma curves dynamically based on the image content and color temperature. The second aspect is considering for the research of halftone technology algorithm, the current domestic research and the algorithm mentioned in this paper only focus on the processing of gray scale image. Therefore, the same processing method is adopted for the three color channels of RGB. However, in fact, human eyes have di erent visual characteristics for di erent colors and di erent color Spaces. In the future work, we can combine color space transformation and human vision characteristics to study the color image halftone algorithm.

Funding information:
The authors state no funding involved.
Author contributions: All authors have accepted responsibility for the entire content of this manuscript and approved its submission.

Con ict of interest:
The authors state no con ict of interest.