Color Detection Method and Device

By acquiring the first display area image of the display screen, determining the target threshold range, and detecting it in combination with HSV and RGB color spaces, the problem of low color detection accuracy in the prior art is solved, and higher detection accuracy and cost-effectiveness are achieved.

CN119915381BActive Publication Date: 2025-06-13SHENZHEN POWEROAK NEWENER CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510331533.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-20
Publication Date
2025-06-13
Estimated Expiration
2045-03-20

AI Technical Summary

Technical Problem

The existing color detection methods have low accuracy in the actual environment, making it difficult to effectively detect the color deviation of the display screen.

Method used

By obtaining the first display area image of the display screen to be tested under the preset display color, determining the target threshold range corresponding to the preset display color, and performing coarse detection and precision detection based on the HSV and RGB color spaces, comprehensive judgment is made to improve the accuracy of color detection.

Benefits of technology

It improves the accuracy of color detection, reduces the situation of error detection, and can accurately detect the color of the display screen under different environmental parameters, reducing labor and hardware costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119915381B_ABST
    Figure CN119915381B_ABST
Patent Text Reader

Abstract

The present application relates to a color detection method and device. The method includes: obtaining a first display area image of a display screen to be measured under a preset display color, and determining a target threshold range corresponding to the preset display color; and determining a rough detection result according to the target threshold range and the target pixel values of the first display area image in the HSV color space. When the rough detection result is qualified, determining a fine detection result according to the pixel values of the first display area image in the RGB color space, and determining the color detection result of the display screen to be measured according to the fine detection result; when the rough detection result is unqualified, determining the color detection result of the display screen to be measured according to the rough detection result. Among them, the target threshold range is determined according to a plurality of second display area images of qualified display screens under a plurality of environmental parameters and the preset display color. Using this method can improve the accuracy of color detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of detection technologies, and in particular, to a color detection method and apparatus. Background Art

[0002] The color display quality is an important indicator for measuring a display screen. Therefore, during the industrial production process, it is necessary to perform color detection on the display screen to determine whether there is a deviation in the color displayed by the display screen.

[0003] Currently, generally, manual experience is used to perform color detection on the display screen. However, the manual detection method is not efficient. Therefore, in related technologies, an industrial camera is usually used to collect images of a predefined color template and the display screen in the same environment, and template matching is performed based on the obtained images to perform color detection on the display screen. However, limited by the actual environment, there are still errors in the collected images.

[0004] Therefore, the above color detection method has the problem of low accuracy. Summary of the Invention

[0005] Based on this, in view of the above technical problems, it is necessary to provide a color detection method and apparatus with better accuracy.

[0006] In a first aspect, this application provides a color detection method, including:

[0007] Obtaining a first display area image of a display screen to be measured under a preset display color;

[0008] Determining a target threshold range corresponding to the preset display color; the target threshold range is determined according to a plurality of second display area images of a qualified display screen under a plurality of environmental parameters and the preset display color;

[0009] Determining a rough detection result according to the target threshold range and the target pixel value of the first display area image in the HSV color space;

[0010] In the case where the rough detection result is qualified, determining a fine detection result according to the pixel value of the first display area image in the RGB color space, and determining a color detection result of the display screen to be measured according to the fine detection result;

[0011] In the case where the rough detection result is unqualified, determining a color detection result of the display screen to be measured according to the rough detection result.

[0012] In a second aspect, this application also provides a color detection apparatus, including:

[0013] An obtaining module, configured to obtain a first display area image of a display screen to be measured under a preset display color;

[0014] The first determination module is configured to determine a target threshold range corresponding to a preset display color; the target threshold range is determined according to multiple second display area images of a qualified display screen under multiple environmental parameters and the preset display color;

[0015] The second determination module is configured to determine a rough detection result according to the target threshold range and the target pixel values of the first display area image in the HSV color space;

[0016] The third determination module is configured to, when the rough detection result is qualified, determine a fine detection result according to the pixel values of the first display area image in the RGB color space, and determine the color detection result of the display screen to be tested according to the fine detection result;

[0017] The fourth determination module is configured to, when the rough detection result is unqualified, determine the color detection result of the display screen to be tested according to the rough detection result.

[0018] The above color detection method and device can obtain the first display area image of the display screen to be tested under the preset display color, determine the target threshold range corresponding to the preset display color, and determine the rough detection result according to the target threshold range and the target pixel values of the first display area image in the HSV color space. Further, when the rough detection result is qualified, the fine detection result is determined according to the pixel values of the first display area image in the RGB color space, and the color detection result of the display screen to be tested is determined according to the fine detection result. When the rough detection result is unqualified, the color detection result of the display screen to be tested is determined according to the rough detection result. On the one hand, since the target threshold range is determined according to multiple second display area images of a qualified display screen under multiple environmental parameters and the preset display color, the target threshold range can take into account the influence of the actual environment. In this way, a more accurate rough detection result can be obtained by using the target threshold range. On the other hand, not only can the rough detection be based on the HSV color space, but also the fine detection can be based on the RGB color space. By combining the HSV color space and the RGB color space for comprehensive judgment, the situation of false detection can be reduced, and the accuracy of color detection is improved. Description of the Drawings

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the following will briefly introduce the drawings required to be used in the description of the embodiments of the present application or the related art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.

[0020] Figure 1 It is an application environment diagram of the color detection method in an embodiment;

[0021] Figure 2 Schematic flowchart of a color detection method in an embodiment;

[0022] Figure 3 Schematic flowchart of a process for determining a target threshold range in an embodiment;

[0023] Figure 4 Schematic flowchart of a process for determining an initial hue range in an embodiment;

[0024] Figure 5 Schematic flowchart of another process for determining a target threshold range in an embodiment;

[0025] Figure 6 Schematic flowchart of a process for determining a rough detection result in an embodiment;

[0026] Figure 7 Schematic flowchart of a process for determining a color space distance in an embodiment;

[0027] Figure 8 Schematic diagram of a three - dimensional coordinate system in an embodiment;

[0028] Figure 9 Schematic flowchart of a relocating process in an embodiment;

[0029] Figure 10 Schematic diagram of bad pixel marking in an embodiment;

[0030] Figure 11 Schematic flowchart of a process for determining a fine detection result in an embodiment;

[0031] Figure 12 Schematic flowchart of a process for determining an image of a display area in an embodiment;

[0032] Figure 13 Schematic diagram of a process for obtaining an image of a display area in an embodiment;

[0033] Figure 14 Block diagram of a color detection device in an embodiment. Detailed implementation manners

[0034] In order to make the objectives, technical solutions and advantages of the present application clearer and more understandable, the following further elaborates on the present application in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0035] Figure 1 Application environment diagram of a color detection method in an embodiment. In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as Figure 1As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface.

[0036] Those skilled in the art can understand that Figure 1 the structure shown in is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0037] Figure 2 is a schematic flowchart of a color detection method in an embodiment. In an exemplary embodiment, as Figure 2 shown, a color detection method is provided. Taking the method applied to the computer device in Figure 1 as an example, it includes the following S201 to S205.

[0038] S201, obtain a first display area image of the display screen to be measured under a preset display color.

[0039] In this embodiment, the display screen to be measured refers to the display screen that needs to be color-tested. The preset display color can be set according to requirements, and it includes but is not limited to any one color or multiple colors such as black with an RGB value of (0, 0, 0), white with an RGB value of (255, 255, 255), red with an RGB value of (255, 0, 0), blue with an RGB value of (0, 0, 255), orange with an RGB value of (255, 165, 0), and green with an RGB value of (0, 255, 0). The first display area image refers to the display area image of the display screen to be measured when displaying the preset display color, and it is usually an image corresponding to the rectangular display area of the display screen to be measured obtained.

[0040] Optionally, the computer device can obtain the first display area image from a preset storage space, or receive the first display area image sent by a vision sensor. In some embodiments, the computer device can also obtain an initial image of the display screen to be measured under a preset display color through the vision sensor, and determine the corresponding first display area image according to the initial image. For example, the computer device can analyze the initial image to obtain the first display area image. Another example is that the computer device can determine the first display area from the initial image according to the position of the first display area of the display screen to be measured under other preset display colors when the position of the vision sensor relative to the display screen to be measured has not changed. The acquisition method of the first display area image in this embodiment is not limited. Among them, the vision sensor includes but is not limited to a camera.

[0041] S202. Determine the target threshold range corresponding to the preset display color. The target threshold range is determined based on multiple second display area images of qualified display screens under multiple environmental parameters and the preset display color.

[0042] In this embodiment, the computer device can determine the target threshold range corresponding to the preset display color. Among them, the target threshold ranges corresponding to different preset display colors may be different. Optionally, the target threshold ranges corresponding to different types of preset display colors are different. For example, the first type of color corresponds to a hue reference range, and the second type of color corresponds to a color space threshold.

[0043] Further optionally, the computer device can obtain the target threshold range corresponding to the preset display color from the preset storage space, or can receive the target threshold range sent by other devices, which is not limited in this embodiment.

[0044] It can be understood that when the display screen is image-captured by the visual sensor, due to the influence of factors such as the photographing angle, distance, and brightness, there will be a deviation between the pixel values of the pixel points in the image and the actual situation. Therefore, the target threshold range needs to be determined based on multiple second display area images of qualified display screens under multiple environmental parameters and the preset display color.

[0045] Among them, a qualified display screen refers to a display screen with a qualified color detection result. The number of qualified display screens can be one or multiple. The qualified display screens can be selected manually or determined by using the color detection method provided in this application, which is not limited in this embodiment.

[0046] The environmental parameters are used to indicate the environment where the qualified display screen is located when obtaining the second display area image. The environmental parameters include but are not limited to at least one of the relative position between the visual sensor and the qualified display screen, the environmental brightness where the qualified display screen is located, and the color temperature. The second display area image refers to the display area image when the qualified display screen is under multiple environmental parameters and displays the preset display color, and it is also usually the image corresponding to a rectangular display area.

[0047] In an exemplary embodiment, optionally, the environmental parameters include the installation height and / or installation angle between the visual sensor and the display screen to be measured. Among them, the installation height can be the vertical height of the visual sensor relative to the qualified display screen, and the installation angle refers to the angle between the optical axis of the visual sensor and the straight line perpendicular to the qualified display screen.

[0048] Exemplarily, an example is given with the environmental parameters including the installation height and the installation angle. Denote the preset display color as C, there are a total of N qualified display screens, and M environmental parameters. Then, when the installation height is , and the installation angle is When the i-th qualified display screen is collected by the vision sensor, the second display area image of the i-th qualified display screen under the preset display color C can be determined. ; At the installation height of and the installation angle of when the i-th qualified display screen is collected by the vision sensor, the second display area image of the i-th qualified display screen under the preset display color C can be determined. ;... At the installation height of and the installation angle of when the i-th qualified display screen is collected by the vision sensor, the second display area image of the i-th qualified display screen under the preset display color C can be determined. , and so on. At least M*N second display area images can be obtained. Among them, both N and M are integers greater than or equal to 1, and i takes values from 1 to N.

[0049] In some embodiments, the value ranges of the installation height and the installation angle in the environmental parameters can be determined according to the actual installation height of the display screen to be measured and the actual installation angle of the display screen to be measured, respectively. For example, if the installation distance of the vision sensor during the actual detection of the display screen to be measured is L, then the value range of the installation height in the environmental parameters can be [L - 6, L + 6]; if the installation angle of the vision sensor during the actual detection of the display screen to be measured is A, then in the above collection process, the value range of the installation angle in the environmental parameters can be [A - 15°C, A + 15°C].

[0050] S203. Determine the rough detection result according to the target threshold range and the target pixel values of the first display area image in the HSV color space.

[0051] In related technologies, color detection usually relies on the RGB values of pixels. However, there is no clear division range for the R value, G value, and B value of each color. Taking yellow as an example, the RGB value (255, 255, 0) is pure yellow, the RGB value (242, 212, 100) is also yellow, and the RGB value (220, 196, 88) is still yellow. It can be seen that except that the R value and the G value are both significantly larger than the B value, how much larger and the ranges of the R value and the G value are uncertain. Moreover, the comparison of the R value, G value, and B value has 255×255×255 colors. Therefore, it is not feasible to perform color detection only based on the RGB values.

[0052] Therefore, in this embodiment, after the computer device acquires the first display area image, it will determine the target pixel values of the first display area image in the HSV color space. Optionally, the computer device can convert the first display area image to the HSV color space to determine the target pixel values in the HSV color space. Among them, the target pixel values in the HSV color space can include at least one of the hue (H), saturation (S), and value (V) values.

[0053] Furthermore, the computer device can determine the rough detection result according to the target threshold range and the target pixel values corresponding to the first display area image. Among them, the rough detection result can include qualified or unqualified. For example, if the target pixel values corresponding to at least one pixel point in the first display area image are not within the target threshold range, it is determined that the rough detection result is unqualified; conversely, if the target pixel values corresponding to all pixel points in the first display area image are within the target threshold range, it is determined that the rough detection result is qualified. Among them, unqualified means that there are defective pixels or abnormal pixels on the display screen to be tested. For example, when controlling the display screen to be tested to display red, if there is a position on the display screen to be tested that does not display red, there are defective pixels in that position area, that is, the display screen to be tested is unqualified.

[0054] S204, when the rough detection result is qualified, determine the fine detection result according to the pixel values of the first display area image in the RGB color space, and determine the color detection result of the display screen to be tested according to the fine detection result.

[0055] In this embodiment, although the target threshold range takes into account environmental factors such as installation height and / or installation angle, the target threshold range is expanded relative to the theoretical range value. Therefore, when the rough detection result is qualified, the computer device still needs to perform further fine detection to determine the fine detection result according to the pixel values of the first display area image in the RGB color space. Among them, the fine detection result can include qualified or unqualified. The pixel values in the RGB color space include R value, G value, and B value.

[0056] Optionally, the computer device can determine whether the pixel values of the first display area image in the RGB color space are located within the corresponding reference range. If all the pixel values in the first display area image are located within the corresponding reference range, it is determined that the fine detection result is qualified; otherwise, it is determined that the fine detection result is unqualified.

[0057] Further optionally, when the rough detection result is qualified, the computer device can determine the final color detection result of the display screen to be measured according to the fine detection result. For example, if the fine detection result is qualified, it means that the final color detection result of the display screen to be measured under the preset display color is qualified; if the fine detection result is unqualified, it means that the final color detection result of the display screen to be measured under the preset display color is unqualified.

[0058] In an exemplary embodiment, optionally, the computer device can perform color detection on the display screen to be measured for multiple preset display colors, and determine that the display screen to be measured is qualified only when the color detection results for all preset display colors are qualified.

[0059] S205, when the rough detection result is unqualified, determine the color detection result of the display screen to be measured according to the rough detection result.

[0060] In this embodiment, if the rough detection result is unqualified, the computer device can directly determine the color detection result of the display screen to be measured according to the rough detection result, without further performing fine detection. For example, if the rough detection result is unqualified, it means that the color detection result of the display screen to be measured under the preset display color is unqualified.

[0061] In the related art, an industrial camera is usually used to collect images of a predefined color template and a display screen in the same environment, and template matching is performed based on the acquired images to perform color detection on the display screen. However, due to the limitation of the actual environment, there are errors in the acquired images. Therefore, the color detection method in the related art has the problem of low accuracy.

[0062] In the above color detection method, an image of the first display area of the display screen to be measured under the preset display color can be obtained, a target threshold range corresponding to the preset display color can be determined, and the rough detection result can be determined according to the target threshold range and the target pixel values of the first display area image in the HSV color space. Further, when the rough detection result is qualified, the fine detection result is determined according to the pixel values of the first display area image in the RGB color space, and the color detection result of the display screen to be measured is determined according to the fine detection result. When the rough detection result is unqualified, the color detection result of the display screen to be measured is determined according to the rough detection result. On the one hand, since the target threshold range is determined according to multiple second display area images of qualified display screens under multiple environmental parameters and preset display colors, the target threshold range can take into account the influence of the actual environment. In this way, a relatively accurate rough detection result can be obtained by using the target threshold range. On the other hand, not only can rough detection be performed based on the HSV color space, but also fine detection can be performed based on the RGB color space. By combining the HSV color space and the RGB color space for comprehensive judgment, the situation of false detection can be reduced, and the accuracy of color detection is improved.

[0063] Moreover, in the related art, it is usually necessary to match a light source for an industrial camera, and there are also high requirements for the matching between the industrial camera and the light source. However, the color detection method provided in this application does not require manual detection, and industrial cameras and light sources can also be not used. For example, color detection can be achieved by using an ordinary camera, which can reduce labor costs and hardware costs.

[0064] Figure 3 FIG. is a schematic flowchart of a process for determining a target threshold range in an embodiment. In an exemplary embodiment, as Figure 3 shown, if the target threshold range includes the hue reference range corresponding to the first type of color, then S202 includes S301 to S303.

[0065] S301, obtain a plurality of second display area images of a qualified display screen under a plurality of environmental parameters and the first type of color.

[0066] In this embodiment, if the target threshold range includes the hue reference range corresponding to the first type of color, it indicates that the preset display color is the first type of color. In the case where the preset display color is the first type of color, the second display area image is the display area image of the qualified display screen under a plurality of environmental parameters and the first type of color. Among them, the first type of color represents a color type color, such as red, blue, orange, or green.

[0067] Optionally, the computer device can obtain the second display area image from a preset storage space, or receive the second display area image sent by a vision sensor. This embodiment is not limited thereto.

[0068] Continuing with the above example, it can be understood that assuming the preset display color C is the first type of color, the computer device can obtain the second display area image 、the second display area image 、……、the second display area image 、the second display area image 、……the second display area image 、……the second display area image .

[0069] S302, determine the initial hue range corresponding to each qualified display screen according to the theoretical hue range corresponding to the first type of color and the hue values of each pixel point in each second display area image in the HSV color space.

[0070] In this embodiment, the computer device can determine the theoretical hue range corresponding to the first type of color, denoted as . Among them, represents the lower limit value in the theoretical hue range corresponding to the first type of color C. represents the upper limit value in the theoretical hue range corresponding to the first type of color C.

[0071] It can be understood that the theoretical hue range refers to the reference hue range of the first type of color in the HSV color space. Table 1 shows the color space table of some colors in the HSV color space. Please refer to Table 1. Exemplarily, if the first type of color C is blue, then =[100, 124]; if the first type of color C is green, then =[35, 77], and so on.

[0072] Table 1 HSV color space table

[0073]

[0074] Furthermore, the computer device can determine the hue values of each pixel point in each second display area image in the HSV color space, that is, determine the H value of each pixel point in all second display area images in the HSV color space.

[0075] Even further, the computer device can, according to the theoretical hue range and the hue values of each pixel point in each second display area image in the HSV color space, determine the initial hue range corresponding to each qualified display screen. Denote the initial hue range of the i-th qualified display screen under the preset display color C as , = . Similarly, is the lower limit value of the initial hue range , is the upper limit value of the initial hue range .

[0076] Exemplarily, the computer device can count the hue values of all pixel points in the second display area image corresponding to the i-th qualified display screen in the HSV color space, determine the actual hue range of the i-th qualified display screen under the preset display color C, and correct the actual hue range according to the theoretical hue range to obtain the initial hue range of the i-th qualified display screen under the preset display color C .

[0077] S303. Determine the hue reference range corresponding to the first type of color according to the initial hue range corresponding to each qualified display screen and the number of qualified display screens.

[0078] In this embodiment, optionally, the computer device may calculate the average of the upper limit values in the initial hue ranges of all qualified display screens according to the number of qualified display screens to determine the upper limit value of the hue reference range corresponding to the first type of color, and calculate the average of the lower limit values in the initial hue ranges of all qualified display screens to determine the lower limit value of the hue reference range corresponding to the first type of color.

[0079] Exemplarily, the computer device may determine the hue reference range corresponding to the first type of color according to the following formula (1) . Wherein, is the lower limit value of the hue reference range, is the upper limit value of the hue reference range.

[0080] (1)

[0081] In the above embodiment, since multiple second display area images of the qualified display screens under multiple environmental parameters and the first type of color can be obtained, the second display area images are images of the first type of color considering multiple environmental parameters. Thus, after determining the initial hue range corresponding to each qualified display screen according to the theoretical hue range corresponding to the first type of color and the hue values of each pixel point in each second display area image in the HSV color space, the hue reference range corresponding to the first type of color can be determined more accurately according to the initial hue range corresponding to each qualified display screen and the number of qualified display screens.

[0082] Figure 4 FIG. is a schematic flowchart of determining the initial hue range in an embodiment. In an exemplary embodiment, as Figure 4 shown, S302 includes S401 to S404.

[0083] S401, determine the basic hue range corresponding to each second display area image according to the hue values of each pixel point in each second display area image in the HSV color space.

[0084] In this embodiment, continuing with the above example, the computer device may determine the basic hue range corresponding to the second display area image according to the hue values of each pixel point in the second display area image in the HSV color space. . Among them, the computer device may use the maximum hue value of each pixel point in the second display area image in the HSV color space as the upper limit value of the basic hue range , and use the minimum hue value of each pixel point in the second display area image in the HSV color space as the lower limit value of the basic hue range Among them, j takes values from 1 to M.

[0085] S402. For the same qualified display screen, according to the absolute value of the difference between the lower limit value of the theoretical hue range and the lower limit values of the respective basic hue ranges corresponding to the qualified display screen, determine the first average value corresponding to the qualified display screen, and according to the absolute value of the difference between the upper limit value of the theoretical hue range and the upper limit values of the respective basic hue ranges corresponding to the qualified display screen, determine the second average value corresponding to the qualified display screen.

[0086] In this embodiment, continuing with the above example, for the i-th qualified display screen, the lower limit values of the respective basic hue ranges corresponding to the i-th qualified display screen include , , . Furthermore, the computer device can determine the lower limit value of the theoretical hue range and the absolute value of the difference between the lower limit values of the respective basic hue ranges corresponding to the qualified display screen, and based on the sum of the absolute values of the above differences and the number M of qualified display screens, determine the first average value corresponding to the qualified display screen.

[0087] Exemplarily, the computer device can determine the first average value corresponding to the i-th qualified display screen according to .

[0088] The process of determining the second average value is similar to the process of determining the first average value, and will not be elaborated here. Exemplarily, the computer device can determine the first average value corresponding to the i-th qualified display screen according to .

[0089] S403. According to the difference between the lower limit value of the theoretical hue range and the first average value, determine the lower limit value of the initial hue range corresponding to the qualified display screen.

[0090] Exemplarily, the computer device can determine the lower limit value of the initial hue range corresponding to the i-th qualified display screen according to the following formula (2) .

[0091] (2)

[0092] S404. Determine the upper limit value of the initial hue range corresponding to the qualified display screen by adding the upper limit value of the theoretical hue range and the second average value.

[0093] Exemplarily, the computer device can determine the upper limit value of the initial hue range corresponding to the i-th qualified display screen according to the following formula (3) .

[0094] (3)

[0095] When collecting images of the display screen, due to the influence of shooting angle, distance, brightness, etc., the hue values of the pixel points in the display area of the display screen will deviate. For example, as can be seen from Table 1 above, the theoretical range of the hue value corresponding to blue is between 100 and 124. However, for a normal display screen without dead pixels, the hue values of some pixel points will deviate, and the hue values of some pixel points on the display screen may fall within the hue value range of cyan. Therefore, in the embodiment of the present application, when determining the hue reference range corresponding to the first type of color, the foregoing basic hue range and the foregoing theoretical hue range will be comprehensively considered. In this way, the theoretical hue range used to evaluate whether the display screen is qualified is corrected to obtain the final hue reference range used to evaluate whether the display screen is qualified, making the detection result more accurate.

[0096] In an exemplary embodiment, optionally, when the preset display color includes the first type of color, the above S203 can be implemented in the following manner:

[0097] If the hue values of all pixel points in the first display area image in the HSV color space are within the hue reference range corresponding to the first type of color, it is determined that the rough detection result is qualified; if there is at least one pixel point in the first display area image whose corresponding hue value is not within the hue reference range, it is determined that the rough detection result is unqualified.

[0098] Please refer to Table 1. The hue values of color types other than black, white, and gray have clear distinctions. Therefore, for the first type of color, rough detection can be performed by whether the H value falls within the corresponding hue reference range. That is to say, when the preset display color includes the first type of color, the target pixel value is the hue (Hue, H) value. In this way, rough detection of the first type of color can be efficiently performed by whether the hue value is within the hue reference range, improving the detection efficiency.

[0099] It should be noted that the second type of color represents a non-color type color, such as black or white. As can be seen from Table 1, among the six colors of red, blue, orange, green, white, and black, red, blue, orange, and green have corresponding H value color ranges, while the H value color ranges of white and black are both 0 - 180. Therefore, for the second type of color of black or white, it is not reasonable to use the hue value to detect whether the display color of the display screen is normal.

[0100] Figure 5 It is a schematic flowchart of another process for determining the target threshold range in an embodiment. In an exemplary embodiment, as Figure 5 shown, if the target threshold range includes the color space threshold corresponding to the second type of color, S202 includes S501 to S503.

[0101] S501. Obtain multiple second display area images of a qualified display screen under multiple environmental parameters and a second type of color.

[0102] In this embodiment, if the target threshold range includes the color space threshold corresponding to the second type of color, it indicates that the preset display color is the second type of color. In the case where the preset display color is the second type of color, the second display area image is the display area image of the qualified display screen under multiple environmental parameters and the second type of color. Continuing with the above example, assuming that the preset display color C is the second type of color, the computer device can also obtain the second display area image the second display area image ... the second display area image the second display area image ... the second display area image ... the second display area image . Among them, the process of S501 is similar to that of S301 and will not be elaborated here.

[0103] S502. Determine the color space distance between each pixel point in the second display area image and the second type of color in the HSV color space.

[0104] Since the second type of color cannot be roughly detected by the hue value, in this embodiment, the computer device needs to determine the color space distance between each pixel point in the second display area image and the second type of color in the HSV color space, that is, the distance between the second type of color and the pixel points in the second display area image in the HSV color space, so as to roughly detect the second type of color through the color space distance later. Among them, the color space distance is used to represent the similarity or proximity degree between two colors in the HSV color space.

[0105] Exemplarily, for the second display area image , the computer device can determine the color space distance 1 between the second type of color and pixel point 1 in the second display area image , the color space distance 2 between the second type of color and pixel point 2 in the second display area image , the color space distance 3 between the second type of color and pixel point 3 in the second display area image , and so on. The same applies to other second display area images. It can be understood that the color space distance 1 represents the similarity or proximity degree between the color corresponding to the second type of color and the color corresponding to pixel point 1 in the HSV color space. The same applies to others and will not be elaborated here.

[0106] Optionally, the computer device may store a mapping relationship that defines the color space distances between different pixel values and different preset display colors. For example, the mapping relationship includes the color space distance Z1 between the pixel value A in the HSV color space and black, the color space distance Z2 between the pixel value B in the HSV color space and white, and so on. Furthermore, after the computer device determines the color of each pixel point in the second display area image and the second type of color, it can determine the corresponding color space distance based on this mapping relationship. For example, assume that the second type of color is black, and the second display area image includes pixel point 1, and the pixel value of pixel point 1 is equal to pixel value A. Then, based on the mapping relationship, it can be determined that the color space distance between pixel point 1 in the second display area and black in the HSV color space is Z1.

[0107] S503. Determine the color space threshold corresponding to the second type of color according to each color space distance.

[0108] In this embodiment, optionally, the computer device may determine the color space threshold corresponding to the second type of color according to the average value among the color space distances corresponding to each pixel point. 。

[0109] Further optionally, the computer device may calculate the average of the color space distances of all pixel points in the second display area image corresponding to the i-th qualified display screen to determine the color space threshold corresponding to the i-th qualified display screen. ,and determine the color space threshold corresponding to the second type of color according to the color space thresholds of all qualified display screens. 。 Exemplarily, the computer device may determine the color space threshold according to the following formula (4). 。

[0110] (4)

[0111] In the above embodiment, since multiple second display area images of the qualified display screen under multiple environmental parameters and the second type of color can be obtained, the second display area image is an image of the second type of color considering multiple environmental parameters. Furthermore, after determining the color space distances between each pixel point in the second display area image and the second type of color in the HSV color space, the color space threshold corresponding to the second type of color can be determined more accurately according to each color space distance.

[0112] Figure 6 FIG. 30 is a flowchart of a process for determining a rough detection result. In an exemplary embodiment, as Figure 6 shown, when the preset display color includes the second type of color, S203 includes S601 to S603.

[0113] S601. Determine the color space distance between each pixel point in the first display area image and the second type of color in the HSV color space according to the pixel value of each pixel point in the first display area image in the HSV color space.

[0114] Among them, when the preset display color includes the second type of color, the target pixel value includes the pixel value of the pixel point in the HSV color space, that is, the target pixel value includes the hue (H), saturation (S), and value (V) values.

[0115] S602. If the color space distance corresponding to all pixel points in the first display area image is less than or equal to the color space threshold corresponding to the second type of color, determine that the rough detection result is qualified.

[0116] S603. If there is at least one pixel point in the first display area image whose corresponding color space distance is greater than the color space threshold, determine that the rough detection result is unqualified.

[0117] In the above embodiment, since the color space distance between each pixel point in the first display area image and the second type of color in the HSV color space is determined according to the pixel value of each pixel point in the first display area image in the HSV color space, and when the color space distance corresponding to each pixel point in the first display area image is less than or equal to the color space threshold corresponding to the second type of color, the rough detection result is determined to be qualified, and when there is at least one pixel point in the first display area image whose corresponding color space distance is greater than the color space threshold, the rough detection result is determined to be unqualified. Therefore, for the second type of color, rough detection can be performed through the color space distance. On the one hand, it can make the rough detection cover the second type of color and improve the application range of color detection. On the other hand, the color detection efficiency is also improved through the color space threshold.

[0118] The following will introduce a process for determining the color space distance in detail. Figure 7 It is a schematic flowchart of the process for determining the color space distance in an embodiment. In an exemplary embodiment, as Figure 7 shown, the first candidate pixel point is any pixel point in the first display area image or the second display area image. Determining the color space distance between the first candidate pixel point and the second type of color in the HSV color space includes S701 to S703.

[0119] S701. Determine the first coordinate of the first candidate pixel point in the three-dimensional coordinate system according to the pixel value of the first candidate pixel point in the HSV color space and the preset corresponding relationship. The three-dimensional coordinate system is the coordinate system corresponding to the HSV color space, and the preset corresponding relationship includes the conversion relationship between the coordinates in the three-dimensional coordinate system and the pixel values in the HSV color space.

[0120] In this embodiment, the HSV color space corresponds to a three-dimensional coordinate system. Figure 8 For a schematic diagram of a three-dimensional coordinate system in an embodiment, as Figure 8 shown, the cone model is the model corresponding to the HSV color space. Among them, the height h of the cone model is 1, and the radius r of the bottom surface of the cone model is 1. A three-dimensional coordinate system corresponding to the cone model can be established with black as the origin. Among them, the X-axis of the three-dimensional coordinate system is the S-axis in the HSV color space, and the value range of the S-axis is [0, 1]. The Y-axis of the three-dimensional coordinate system is the H-axis in the HSV color space. The H value in the HSV color space is given by the rotation angle of the H-axis around the V-axis perpendicular to the HSV color space, and the range of H is [0, 360°]. The Z-axis of the three-dimensional coordinate system is parallel to the V-axis in the HSV space system, and the positive direction of the Z-axis is opposite to the positive direction of the V-axis. The value range of the Z-axis is [0, 1].

[0121] Furthermore, the computer device can determine the preset corresponding relationship, which includes the conversion relationship between the coordinates in the three-dimensional coordinate system and the pixel values in the HSV color space.

[0122] Exemplarily, denote the pixel value in the HSV color space as (H, S, V), and the coordinate in the three-dimensional coordinate system as (x, y, z). Then the computer device can determine the preset corresponding relationship according to the following formula (5).

[0123] (5)

[0124] In this way, the computer device can determine the first coordinate of the first candidate pixel point in the three-dimensional coordinate system according to the pixel value of the first candidate pixel point in the HSV color space and the preset corresponding relationship. Among them, the first candidate pixel point can be any pixel point in the first display area image or the second display area image.

[0125] Exemplarily, assume that the pixel value of the first candidate pixel point in the HSV color space is (H1, S1, V1). Then the first coordinate (x1, y1, z1) of this pixel point in the three-dimensional coordinate system can be determined according to the following formula (6). That is to say, after substituting r = 1, h = 1, and H1, S1, and V1 in the pixel value into formula (5), the result shown in formula (6) can be obtained. It should be noted that H in the pixel value is an angle. Therefore, the angle corresponding to H needs to be converted into radians before substituting it into formula (5).

[0126] (6)

[0127] S702. Determine the second coordinate of the second type of color in the three-dimensional coordinate system according to the pixel value of the second type of color in the HSV color space and the preset corresponding relationship.

[0128] The principle of this embodiment is similar to that of S701. The pixel value of the second type of color in the HSV color space is clear. Therefore, the computer device can also determine the second coordinate of the second type of color in the three-dimensional coordinate system according to the pixel value of the second type of color in the HSV color space and the preset corresponding relationship, denoted as (x2, y2, z2), which will not be elaborated here.

[0129] S703. Determine the color space distance between the first candidate pixel point and the second type of color in the HSV color space according to the Euclidean distance between the first coordinate and the second coordinate.

[0130] In this embodiment, continuing with the above example, the computer device can determine the Euclidean distance ρ between the first coordinate (x1, y1, z1) and the second coordinate (x2, y2, z2) based on the following formula (7).

[0131] (7)

[0132] Furthermore, the computer device can determine the color space distance between the first candidate pixel point and the second type of color in the HSV color space according to the Euclidean distance ρ. For example, the computer device can directly use the Euclidean distance ρ as the color space distance between the first candidate pixel point and the second type of color in the HSV color space. Another example is that the computer device can perform a correction process on the Euclidean distance ρ to obtain the corresponding color space distance. Among them, the value range of the color space distance is [0, 1].

[0133] In the above embodiments, since the three-dimensional coordinate system is the coordinate system corresponding to the HSV color space, and the preset correspondence includes the conversion relationship between the coordinates in the three-dimensional coordinate system and the pixel values in the HSV color space. Therefore, the first coordinate of the first candidate pixel point in the three-dimensional coordinate system can be determined according to the pixel value of the first candidate pixel point in the HSV color space and the preset correspondence, and the second coordinate of the second type of color in the three-dimensional coordinate system can be determined according to the pixel value of the second type of color in the HSV color space and the preset correspondence. In this way, according to the Euclidean distance between the first coordinate and the second coordinate, the color space distance between the first candidate pixel point and the second type of color in the HSV color space can be efficiently determined. It can be understood that since the first candidate pixel point is any pixel point in the first display area image or the second display area image, the above S502 and S601 can determine the corresponding color space distance through the process of S701~S703.

[0134] Figure 9 FIG. is a schematic flowchart of relocating in an embodiment. In an exemplary embodiment, as Figure 9 shown, when the rough detection result is unqualified, the above color detection method further includes a step of relocating the bad pixels of the first display area image, and the relocating step includes S901 to S907.

[0135] S901, determine the bad pixels in the first display area image.

[0136] In this embodiment, if the rough detection result is unqualified, the computer device can determine the bad pixels in the first display area image, denoted as . The bad pixels refer to the pixels with abnormal colors. Optionally, the computer device can use the pixel points in the first display area image whose hue values are not within the hue reference range as bad pixels , or can use the pixel points whose corresponding color space distances are greater than the color space threshold as bad pixels .

[0137] S902, perform connected component analysis on the bad pixels to determine the first connected region corresponding to the bad pixels.

[0138] In this embodiment, after the computer device determines the bad pixels , it will perform connected component analysis on the bad pixels to determine the first connected region corresponding to the bad pixels , denoted as . Among them, the number of the first connected regions can be one or more.

[0139] S903. Determine the first circumscribed region of the first connected region, and perform a magnification process on the first circumscribed region to determine the second circumscribed region.

[0140] Since the target threshold range is determined based on multiple second display region images of qualified display screens under multiple environmental parameters and the preset display color, under the influence of environmental parameters, the target threshold range expands, which may cause the defective pixel points obtained based on the rough detection to be inaccurate, resulting in the first circumscribed region being relatively smaller than the actual situation. Therefore, in this embodiment, it is necessary to further relocate the defective pixel points.

[0141] Furthermore, after determining the first connected region, the computer device will determine the first circumscribed region of the first connected region. Herein, determining the first circumscribed region means the circumscribed region that includes the first connected region. The following examples are all based on the first circumscribed region being the circumscribed rectangle of the first connected region. It should be noted that the shape of the circumscribed region in this embodiment is not limited, and the circumscribed region can be a circumscribed circle, a circumscribed polygon, or other irregular circumscribed forms.

[0142] Further, the computer device will perform a magnification process on the first circumscribed region to determine the second circumscribed region. Taking the first circumscribed region as a circumscribed rectangle as an example, the computer device can magnify each side of the circumscribed rectangle by T pixel points to obtain the second circumscribed region. T is a number greater than 0, for example, 5.

[0143] S904. Use the pixel points in the second circumscribed region as the first pixel set, and use the pixel points corresponding to the contour of the second circumscribed region as the second pixel set.

[0144] In this embodiment, the computer device uses the pixel points in the second circumscribed region as the first pixel set S1, and uses the pixel points corresponding to the contour of the second circumscribed region as the second pixel set S2.

[0145] Among them, the pixel points corresponding to the contour of the second circumscribed region can be understood as the pixel points on the contour of the second circumscribed region. Optionally, the computer device can extract the contour of the second circumscribed region and use all the pixel points on the contour of the second circumscribed region as the second pixel set S2.

[0146] S905. Use the difference set between the first pixel set and the second pixel set as the third pixel set.

[0147] Further, the computer device can determine the difference set between the first pixel set S1 and the second pixel set S2 as the third pixel set S3, S3 = S1 - S2. In other words, the third pixel set S3 includes the pixel points that belong to the first pixel set S1 but do not belong to the second pixel set S2.

[0148] S906. Determine a target pixel point from the third pixel set, where the absolute value of the difference between the pixel value of the target pixel point and the third average value is less than a preset threshold; the third average value is the average value of the pixel values of each pixel point in the second pixel set.

[0149] In this embodiment, the computer device can determine the third average value. Among them, the third average value is the average value of the pixel values of each pixel point in the second pixel set S2.

[0150] Furthermore, the computer device can traverse all pixel points in the third pixel set S3 to determine the absolute value of the difference between the pixel value of each pixel point in the third pixel set S3 and the third average value, and determine the target pixel points whose absolute value of the difference is less than the preset threshold. Among them, the preset threshold can be set according to actual needs.

[0151] Exemplarily, if the absolute value of the difference between the pixel value of pixel point 1 in the third pixel set S3 and the third average value is less than the preset threshold, the target pixel points include pixel point 1 in the third pixel set S3. If the absolute value of the difference between the pixel value of pixel point 2 in the third pixel set S3 and the third average value is less than the preset threshold, the target pixel points do not include pixel point 2 in the third pixel set S3.

[0152] S907. Determine a target bad pixel area according to the target pixel points and the first connected area.

[0153] In this embodiment, the target pixel points are the bad pixels determined after repositioning. Therefore, the computer device can determine the target bad pixel area according to the target pixel points and the first connected area, that is, determine a new .

[0154] In one embodiment, optionally, the computer device can mark the target bad pixel area in the first display area image. The form of marking is not limited in this embodiment. Figure 10 For a schematic diagram of bad pixel marking in one embodiment, as Figure 10 shown in FIG. (a) in it, the computer device can mark the target bad pixel area in the first display area image with a rectangular border.

[0155] In the above embodiments, when the rough detection result is unqualified, the defective pixel in the first display area image can be determined, and the connected component analysis is performed on the defective pixel to determine the first connected region corresponding to the defective pixel, and the first circumscribed region of the first connected region is determined. Then, the first circumscribed region is magnified to determine the second circumscribed region, so that each pixel point in the second circumscribed region is used as the first pixel set, and each pixel point corresponding to the contour of the second circumscribed region is used as the second pixel set. In this way, the difference set between the first pixel set and the second pixel set can be used as the third pixel set, and the target pixel point is determined from the third pixel set, where the absolute value of the difference between the pixel value of the target pixel point and the third average value is less than the preset threshold, and the third average value is the average value of the pixel values of each pixel point in the second pixel set. Further, based on the target pixel point and the first connected region, the repositioning of the defective pixel is realized, and the relatively accurate target defective region is determined, reducing the error of directly locating the defective pixel according to the rough detection.

[0156] Under normal circumstances, the R values, G values, and B values of relatively adjacent pixel points in the display screen are relatively close and there will be no situation where the values change greatly. Therefore, fine detection can be performed based on this. Figure 11 It is a schematic flowchart of determining the fine detection result in an embodiment. In an exemplary embodiment, as Figure 11 shown, "determine the fine detection result according to the pixel values of the first display area image in the RGB color space" in S204 includes S1101 to S1103.

[0157] S1101, determine the spaced pixel points of the second candidate pixel point in the row direction. The second candidate pixel point is any pixel point in the first display area image, and the spaced pixel points are less than the preset pixel distance from the second candidate pixel point in the row direction.

[0158] In this embodiment, during the fine detection process, the computer device will first determine the spaced pixel points of the second candidate pixel point in the row direction. Among them, the second candidate pixel point is any pixel point in the first display area image, and the spaced pixel points are less than the preset pixel distance from the second candidate pixel point in the row direction.

[0159] The preset pixel distance can be set according to actual needs. Exemplarily, assuming that the second candidate pixel point is the kth pixel point in the row direction, the spaced pixel points can include but are not limited to at least one of the (k - 1)th pixel, the (k - 2)th pixel point, the (k + 1)th pixel point, or the (k + 2)th pixel point. This embodiment is not limited thereto.

[0160] In an exemplary embodiment, optionally, the spaced pixels include a first spaced pixel and a second spaced pixel. The first spaced pixel, the second spaced pixel, and the second candidate pixel are arranged in sequence in the row direction, and the first pixel spacing and the second pixel spacing are the same preset value. Wherein, the first pixel spacing is the pixel spacing between the first spaced pixel and the second spaced pixel, and the second pixel spacing is the pixel spacing between the second spaced pixel and the second candidate pixel.

[0161] Wherein, the preset value can also be set according to requirements. Exemplarily, taking the preset value equal to 2 as an example, assuming that the second candidate pixel is the k-th pixel in the row direction, then the first spaced pixel is the (k - 4)-th pixel, and the second spaced pixel is the (k - 2)-th pixel. That is to say, the spaced pixels include the (k - 4)-th pixel and the (k - 2)-th pixel.

[0162] S1102. Determine the average difference value between the second candidate pixel and the spaced pixels according to the pixel values of the second candidate pixel and the spaced pixels in the RGB color space.

[0163] In this embodiment, after determining the second candidate pixel and the corresponding spaced pixels, the computer device can determine the pixel values of the second candidate pixel and the spaced pixels in the RGB color space. Continuing the above example, the computer device can determine the R value, G value, and B value of the k-th pixel, the R value, G value, and B value of the (k - 2)-th pixel, and the R value, G value, and B value of the (k - 4)-th pixel.

[0164] Further, the computer device can determine the average difference value between the second candidate pixel and the spaced pixels according to the pixel values of the second candidate pixel and the spaced pixels in the RGB color space.

[0165] Optionally, the average difference value can include the average difference value of the R values, the average difference value of the G values, and the average difference value of the B values between the second candidate pixel and the spaced pixels pairwise.

[0166] Continuing the above example, taking the average difference value of the R values as an example, the computer device can determine the average difference value of the R values according to the absolute value of the difference between the R value of the k-th pixel and the R value of the (k - 2)-th pixel, the absolute value of the difference between the R value of the k-th pixel and the R value of the (k - 4)-th pixel, and the absolute value of the difference between the R value of the (k - 2)-th pixel and the R value of the (k - 4)-th pixel. The average difference values of the G values and the B values are the same and will not be elaborated here.

[0167] Exemplarily, the computer device can determine the average difference value of the R values according to the following formula (8) and the average difference value of the G values Average difference value of the A and B values .

[0168] (8)

[0169] where k ≥ 5, represents the R value of the (k - 4)-th pixel point, represents the R value of the (k - 2)-th pixel point, represents the R value of the k-th pixel point. Similarly, 、 and represent the G values of the (k - 4)-th pixel point, the (k - 2)-th pixel point, and the k-th pixel point respectively. 、 and represent the B values of the (k - 4)-th pixel point, the (k - 2)-th pixel point, and the k-th pixel point respectively.

[0170] S1103. Determine the fine detection result according to the average difference value and the preset difference threshold.

[0171] In this embodiment, the preset difference threshold can be set according to requirements, and it is a number greater than 0. Exemplarily, the preset difference threshold can be 30.

[0172] Optionally, the computer device can compare the average difference value with the preset difference threshold and determine the fine detection result according to the comparison result between the average difference value and the preset difference threshold.

[0173] Further optionally, for the k-th pixel point, the computer device can determine that the fine detection result of the k-th pixel point is unqualified when any one of the average difference value of the R value 、the average difference value of the G value and the average difference value of the B value is greater than the preset difference threshold, and determine that the fine detection result of the k-th pixel point is qualified when the average difference value of the R value 、the average difference value of the G value and the average difference value of the B value are all less than or equal to the preset difference threshold.

[0174] That is to say, the computer device can determine whether the 5th pixel point is qualified by combining the pixel values of the 1st pixel point and the 3rd pixel point, determine whether the 6th pixel point is qualified by combining the pixel values of the 2nd pixel point and the 4th pixel point, and so on.

[0175] Further optionally, the computer device may determine that the detection result of the display screen to be tested is qualified when the fine detection results of all the second candidate pixel points are qualified, and determine that the detection result of the display screen to be tested is unqualified when there is a second candidate pixel point with an unqualified fine detection result.

[0176] In the above embodiment, the second candidate pixel point is any pixel point in the first display area image, and the pixel distance between the spaced pixel points and the second candidate pixel point in the row direction is less than the preset pixel distance. Since the spaced pixel points of the second candidate pixel point in the row direction can be determined, and the average difference value between the second candidate pixel point and the spaced pixel points can be determined according to the pixel values of the second candidate pixel point and the spaced pixel points in the RGB color space, therefore, according to the average difference value and the preset difference threshold, the fine detection result can be determined. In the above process, for any pixel point in the first display area image, fine detection can be performed in the RGB color space in combination with the spaced pixel points. In this way, an accurate color detection result can be obtained by combining the rough detection result.

[0177] In an exemplary embodiment, optionally, if the fine detection result is unqualified, the computer device may determine the abnormal pixels in the first display area image. Among them, the abnormal pixels include the average difference value of the R value , the average difference value of the G value and the average difference value of the B value where any one of the second candidate pixel points greater than the preset difference threshold.

[0178] Further optionally, the computer device may perform connected component analysis on the abnormal pixels in the first display area image, determine the second connected region, and determine the circumscribed region corresponding to each second connected region.

[0179] Further optionally, the computer device may mark the circumscribed region corresponding to the second connected region in the first display area image. Please refer to Figure 10 , for example, as shown in (b) of Figure 10 , the computer device may mark the circumscribed region corresponding to the second connected region in the first display area image with a rectangular border to implement the function of locating the bad pixels.

[0180] Figure 12 is a schematic flow chart of determining the display area image in an embodiment. In an exemplary embodiment, as shown in Figure 12 , obtaining the first display area image or the second display area image includes S1201 to S1207.

[0181] S1201. Preprocess the first initial image to obtain an intermediate image. The first initial image is an initial image collected for the display screen to be tested under a preset display color or an initial image collected for a qualified display screen under a preset display color.

[0182] In this embodiment, the computer device can obtain the first initial image. Optionally, the computer device can obtain the first initial image from a preset storage space or receive the first initial image sent by a vision sensor. This embodiment is not limited thereto.

[0183] Among them, the first initial image is an initial image collected for the display screen to be tested under a preset display color, or the first initial image is an initial image collected for a qualified display screen under a preset display color. For example, when it is necessary to determine the color detection result of the display screen to be tested, the first initial image is an initial image collected for the display screen to be tested under a preset display color. For another example, when it is necessary to determine the target threshold range, the first initial image is an initial image collected for a qualified display screen under a preset display color.

[0184] Exemplarily, the computer device can communicate with the vision sensor to set the vision sensor to autofocus by the computer device, and the computer device can communicate with the display screen to be tested through a serial port to control the display screen to be tested to display a preset display color. Furthermore, the computer device controls the vision sensor to take a picture so that the computer device can obtain the first initial image. It can be understood that if multiple preset display colors need to be detected, the computer device can control the display screen to be tested to display the preset display colors respectively.

[0185] Furthermore, the computer device preprocesses the first initial image to obtain an intermediate image corresponding to the first initial image. Among them, the preprocessing includes but is not limited to at least one of gray processing, filtering processing, and binarization processing.

[0186] Optionally, the computer device can perform gray processing on the first initial image to obtain a gray image, perform median filtering processing on the gray image to obtain a filtered image, and perform binarization processing on the filtered image according to a global segmentation threshold to obtain an intermediate image.

[0187] Figure 13 It is a schematic diagram of the process of obtaining a display area image in an embodiment, as Figure 13 shown. Exemplarily, gray processing is performed on the first initial image to obtain Figure 13 the gray image shown in Figure (a) in Figure 13 . Median filtering processing is performed on the gray image to obtain

[0188] Further, the computer device can perform binarization processing on the filtered image based on the binarization function Cv2.Threshold in the Open Source Computer Vision Library (OpenCV) according to the global segmentation threshold to obtain Figure 13 the intermediate image shown in Figure (c) of

[0189] S1202. Perform edge detection based on the intermediate image to determine the edge information of the intermediate image.

[0190] In this embodiment, optionally, the computer device can use a preset edge detection algorithm to perform edge detection on the intermediate image to determine the edge information of the intermediate image. Among them, the edge information can be used to represent the object boundary or junction where the gray value changes sharply in the intermediate image.

[0191] Please continue to refer to Figure 13 , for example, the computer device can perform Sobel operations in the X direction and Y direction on the intermediate image based on the Sobel function Cv2.Sobel in OpenCV, and integrate the images after Sobel operations in the X direction and Y direction together to obtain the edge information of the intermediate image shown in Figure (d) of Figure 13 . Among them, the convolution kernels used in the X direction and Y direction in the Sobel operation can be different.

[0192] S1203. Perform contour extraction based on the edge information to determine the contour information of the intermediate image.

[0193] In this embodiment, the computer device can use a contour tracking algorithm to perform contour extraction based on the edge information to determine the contour information of the intermediate image. Among them, the contour information can be used to represent the complete curve of the object contour in the intermediate image. The contour tracking algorithm can use the topological relationship between pixel points in the image, especially the connectivity information of the edge pixels. Therefore, based on the contour tracking algorithm, the computer device can extract the positions of each edge pixel point from the edge information, and connect the adjacent edge pixel points into a contour through the topological relationship between the pixel points to form a closed loop or curve, thereby obtaining the contour information of the intermediate image.

[0194] Exemplarily, the computer device may perform contour extraction based on the edge information by using the contour finding function Cv2.FindContours in OpenCV to determine the contour information of the intermediate image.

[0195] S1204. According to the contour information, use the largest rectangular contour in the intermediate image as the target contour.

[0196] In this embodiment, please continue to refer to Figure 13 , exemplarily, the computer device may continue to use the contour finding function Cv2.FindContours in OpenCV to determine all rectangular contours in the intermediate image according to the contour information, and traverse to determine the largest rectangular contour among all rectangular contours, so as to use the largest rectangular contour in the intermediate image as the target contour. Further, the computer device may draw the area corresponding to the target contour based on the contour drawing function Cv2.DrawContours in OpenCV, as shown in Figure 13 Figure (e) in.

[0197] S1205. Fill the area corresponding to the target contour according to the target color to obtain the filled image corresponding to the first initial image.

[0198] In this embodiment, the target color can be set according to requirements. Hereinafter, an example is given with the target color being white. Please continue to refer to Figure 13 , exemplarily, the computer device may use the area filling function Cv2.FillPoly in OpenCV to fill the area corresponding to the target contour with white to obtain the filled image corresponding to the first initial image, as shown in Figure 13 Figure (f) in.

[0199] S1206. Determine the rectangular area corresponding to the target contour from the filled image according to the gray values of the pixel points in the filled image.

[0200] In this embodiment, still taking the target color being white as an example, since the gray value of white is 255, the computer device may traverse all pixel points in the filled image to determine the coordinates of the pixel points with the gray value of 255, so as to determine the rectangular area corresponding to the target contour in the filled image.

[0201] S1207. Perform post-processing on the rectangular area to determine the display area image in the first initial image.

[0202] In this embodiment, in order to prevent the influence of factors such as inaccurate edge grasping, the computer device will post-process the rectangular area to determine the display area image in the first initial image. Among them, the post-processing may include, but is not limited to, magnification processing or reduction processing. Exemplarily, the computer device may reduce Y pixel points on the four sides of the rectangular area, and according to the reduced rectangular area, obtain the display area image from the first initial image. Y is an integer greater than or equal to 1.

[0203] Among them, the display area image includes the first display area image or the second display area image. It can be understood that in the case where the first initial image is an initial image collected for the to-be-tested display screen under a preset display color, the display area image in the first initial image is the first display area image; in the case where the first initial image is an initial image collected for the qualified display screen under a preset display color, the display area image in the first initial image is the second display area image.

[0204] In the above embodiment, the first initial image is an initial image collected for the to-be-tested display screen under a preset display color or an initial image collected for the qualified display screen under a preset display color. Since the first initial image can be preprocessed to obtain an intermediate image, and then edge detection is performed based on the intermediate image, it is easier to determine the edge information of the intermediate image. Furthermore, after contour extraction is performed based on the edge information to determine the contour information of the intermediate image, the largest rectangular contour in the intermediate image can be efficiently used as the target contour according to the contour information. Further, the area corresponding to the target contour is filled according to the target color to obtain the filled image corresponding to the first initial image, and after determining the rectangular area corresponding to the target contour from the filled image according to the gray values of the pixel points in the filled image, post-processing is performed on the rectangular area, and the display area image in the first initial image can be determined more accurately.

[0205] The following combines Figure 2 to expand the overall process of a color detection method. Please continue to refer to Figure 2 , and the computer device executes the color detection method according to the processes of S201~S205. Among them, in S201, the process of determining the first display area image can refer to S1201~S1207.

[0206] In S202, if the preset display color is the first type of color, the target threshold range includes the hue reference range, and the process of determining the hue reference range can refer to the above S301~S303 and S401~404. If the preset display color is the second type of color, the target threshold range includes the color space threshold, and the process of determining the color space threshold can refer to the above S501~S503.

[0207] In S203, if the preset display color is the first type of color, when the hue values of all pixel points in the first display area image in the HSV color space are within the hue reference range corresponding to the first type of color, it is determined that the rough detection result is qualified; and when there is at least one pixel point in the first display area image whose corresponding hue value is not within the hue reference range, it is determined that the rough detection result is unqualified. If the preset display color is the second type of color, the rough detection result is determined in the manner of S601 - S603.

[0208] In S204, the process of determining the fine detection result can refer to S701 - S703.

[0209] In S205, if the rough detection result is unqualified, the color detection result of the display screen to be measured is determined according to the rough detection result. Further, when the rough detection result is unqualified, the bad pixel of the first display area image can also be re - located, and the re - location process can refer to the above - mentioned S901 - S907.

[0210] Based on the same inventive concept, an embodiment of the present application also provides a color detection device for implementing the above - mentioned color detection method. The implementation solution provided by this device to solve the problem is similar to the implementation solution described in the above method. Therefore, the specific limitations in one or more embodiments of the following color detection device can refer to the limitations on the color detection method in the above text, and will not be repeated here.

[0211] Figure 14 For the structural block diagram of the color detection device in an embodiment, in an exemplary embodiment, as Figure 14 shown, a color detection device 1400 is provided, including: an acquisition module 1401, a first determination module 1402, a second determination module 1403, a third determination module 1404, and a fourth determination module 1405, where:

[0212] An acquisition module 1401 is configured to acquire a first display area image of a display screen to be tested under a preset display color. A first determination module 1402 is configured to determine a target threshold range corresponding to the preset display color; the target threshold range is determined according to a plurality of second display area images of a qualified display screen under a plurality of environmental parameters and the preset display color. A second determination module 1403 is configured to determine a rough detection result according to the target threshold range and target pixel values of the first display area image in the HSV color space. A third determination module 1404 is configured to, when the rough detection result is qualified, determine a fine detection result according to pixel values of the first display area image in the RGB color space, and determine a color detection result of the display screen to be tested according to the fine detection result. A fourth determination module 1405 is configured to, when the rough detection result is unqualified, determine a color detection result of the display screen to be tested according to the rough detection result.

[0213] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this application.

[0214] The above-described embodiments merely represent several implementation manners of this application. The description is relatively specific and detailed, but it should not be construed as a limitation to the patent scope of this application. It should be noted that for those of ordinary skill in the art, without departing from the concept of this application, several modifications and improvements can still be made, and these all belong to the protection scope of this application. Therefore, the protection scope of this application should be subject to the appended claims.

Claims

1. A color detection method, characterized in that: The method comprises: Acquire a first display area image of the display screen to be tested under a preset display color; Determine a target threshold range corresponding to the preset display color; the target threshold range is determined according to a plurality of second display area images of a qualified display screen under a plurality of environmental parameters and the preset display color; Determine a rough detection result according to the target threshold range and a target pixel value of the first display area image in the HSV color space; When the rough detection result is qualified, a fine detection result is determined according to the pixel value of the first display area image in the RGB color space, and a color detection result of the display screen to be tested is determined according to the fine detection result; In the case where the rough detection result is unqualified, a color detection result of the display screen to be tested is determined according to the rough detection result.

2. The method according to claim 1, characterized in that If the target threshold range includes a hue reference range corresponding to the first type of color, then determining the target threshold range corresponding to the preset display color includes: Acquire a plurality of second display area images of the qualified display screen under the plurality of environmental parameters and the first type of color; Determine an initial hue range corresponding to each of the qualified display screens according to a theoretical hue range corresponding to the first type of color and a hue value of each pixel in each of the second display area images in the HSV color space; According to the initial hue range corresponding to each of the qualified display screens and the number of the qualified display screens, a hue reference range corresponding to the first type of color is determined.

3. The method according to claim 2, characterized in that Determining the initial hue range corresponding to each of the qualified display screens according to the theoretical hue range corresponding to the first type of color and the hue value of each pixel in each of the second display area images in the HSV color space includes: Determining a basic hue range corresponding to each of the second display area images according to a hue value of each pixel point in each of the second display area images in the HSV color space; For the same qualified display screen, a first average value corresponding to the qualified display screen is determined according to the absolute value of the difference between the lower limit value of the theoretical hue range and the lower limit values ​​of each basic hue range corresponding to the qualified display screen, and a second average value corresponding to the qualified display screen is determined according to the absolute value of the difference between the upper limit value of the theoretical hue range and the upper limit values ​​of each basic hue range corresponding to the qualified display screen; Determining the lower limit value of the initial hue range corresponding to the qualified display screen according to the difference between the lower limit value of the theoretical hue range and the first average value; The upper limit value of the initial hue range corresponding to the qualified display screen is determined by the sum of the upper limit value of the theoretical hue range and the second average value.

4. The method according to claim 2, characterized in that: In a case where the preset display color includes a first type of color, determining a rough detection result according to the target threshold range and a target pixel value of the first display area image in an HSV color space includes: If the hue values ​​of all pixels in the first display area image in the HSV color space are within the hue reference range corresponding to the first type of color, determining that the rough detection result is qualified; If there is at least one pixel in the first display area image whose corresponding hue value is not within the hue reference range, the rough detection result is determined to be unqualified.

5. The method according to claim 1, characterized in that If the target threshold range includes the color space threshold corresponding to the second type of color, then determining the target threshold range corresponding to the preset display color includes: Acquire a plurality of second display area images of the qualified display screen under the plurality of environmental parameters and the second type of color; Determine a color space distance between each pixel in the second display area image and the second type of color in the HSV color space; A color space threshold corresponding to the second type of color is determined according to each of the color space distances.

6. The method according to claim 5, characterized in that In a case where the preset display color includes a second type of color, determining a rough detection result according to the target threshold range and a target pixel value of the first display area image in the HSV color space includes: Determine, according to the pixel value of each pixel in the first display area image in the HSV color space, the color space distance between each pixel in the first display area image and the second type of color in the HSV color space; If the color space distances corresponding to the pixels in the first display area image are all less than or equal to the color space threshold corresponding to the second type of color, then determining that the rough detection result is qualified; If there is at least one pixel in the first display area image whose corresponding color space distance is greater than the color space threshold, the rough detection result is determined to be unqualified.

7. The method according to claim 6, characterized in that The first candidate pixel is any pixel in the first display area image or the second display area image, and determining the color space distance between the first candidate pixel and the second type of color in the HSV color space includes: Determine, according to the pixel value of the first candidate pixel in the HSV color space and a preset corresponding relationship, a first coordinate of the first candidate pixel in a three-dimensional coordinate system; the three-dimensional coordinate system is a coordinate system corresponding to the HSV color space, and the preset corresponding relationship includes a conversion relationship between the coordinates in the three-dimensional coordinate system and the pixel values ​​in the HSV color space; Determine a second coordinate of the second type of color in the three-dimensional coordinate system according to the pixel value of the second type of color in the HSV color space and the preset corresponding relationship; Determine a color space distance between the first candidate pixel and the second type of color in the HSV color space according to the Euclidean distance between the first coordinate and the second coordinate.

8. The method according to any one of claims 1 to 7, characterized in that: In the case where the rough detection result is unqualified, the method further comprises the step of relocating the bad pixel of the first display area image: Determining bad pixels in the first display area image; Performing a connected domain analysis on the bad pixel to determine a first connected region corresponding to the bad pixel; Determine a first circumscribed region of the first connected region, and amplify the first circumscribed region to determine a second circumscribed region; Taking each pixel point in the second circumscribed area as a first pixel set, and taking each pixel point corresponding to the outline of the second circumscribed area as a second pixel set; taking a difference between the first pixel set and the second pixel set as a third pixel set; Determine a target pixel point from the third pixel set, wherein an absolute value of a difference between a pixel value of the target pixel point and a third average value is less than a preset threshold; the third average value is an average value of pixel values ​​of each pixel point in the second pixel set; A target bad pixel area is determined according to the target pixel point and the first connected area.

9. The method according to any one of claims 1 to 7, characterized in that: The determining of the precise detection result according to the pixel value of the first display area image in the RGB color space includes: Determine an interval pixel point of a second candidate pixel point in a row direction, where the second candidate pixel point is any pixel point in the first display area image, and a pixel distance between the interval pixel point and the second candidate pixel point in the row direction is less than a preset pixel distance; According to the pixel values ​​of the second candidate pixel and the interval pixel in the RGB color space, an average difference value between the second candidate pixel and the interval pixel is determined, The precise detection result is determined according to the average difference value and a preset difference threshold.

10. The method according to any one of claims 1 to 7, characterized in that: Acquiring the first display area image or the second display area image includes: Preprocessing the first initial image to obtain an intermediate image, wherein the first initial image is an initial image captured for the display screen to be tested under the preset display color or an initial image captured for the qualified display screen under the preset display color; Perform edge detection based on the intermediate image to determine edge information of the intermediate image; Performing contour extraction based on the edge information to determine contour information of the intermediate image; According to the contour information, taking the largest rectangular contour in the intermediate image as the target contour; Filling the area corresponding to the target outline according to the target color to obtain a filled image corresponding to the first initial image; Determine a rectangular area corresponding to the target outline from the filled image according to the gray value of each pixel in the filled image; The rectangular area is post-processed to determine a display area image in the first initial image.

11. The method according to any one of claims 1 to 7, characterized in that: The environmental parameters include an installation height and / or an installation angle between the visual sensor and the display screen to be tested.

12. A color detection device, characterized in that: The device comprises: An acquisition module, used for acquiring an image of a first display area of ​​the display screen to be tested under a preset display color; A first determination module is used to determine a target threshold range corresponding to the preset display color; the target threshold range is determined according to a plurality of second display area images of a qualified display screen under a plurality of environmental parameters and the preset display color; A second determination module, used to determine a rough detection result according to the target threshold range and a target pixel value of the first display area image in the HSV color space; A third determination module is used to determine a fine detection result according to the pixel value of the first display area image in the RGB color space when the rough detection result is qualified, and determine the color detection result of the display screen to be tested according to the fine detection result; The fourth determination module is used to determine the color detection result of the display screen to be tested according to the rough detection result when the rough detection result is unqualified.

Citation Information

Patent Citations

  • Screen quality detection method and device, bracelet and computer readable storage medium

    CN115049633A

  • Chromatic aberration detection system and method for liquid crystal display screen

    CN119048454A