Color detection method and device

By acquiring the image of the display screen in the color detection method, determining the target threshold range, and detecting it in combination with the information of the HSV and RGB color space, the problem of low color detection accuracy in the prior art is solved, and higher detection accuracy is achieved.

CN119915381AActive Publication Date: 2025-05-02SHENZHEN POWEROAK NEWENER CO LTD

Patent Information

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

AI Technical Summary

Technical Problem

The existing color detection methods have low accuracy in the actual environment, and it is difficult to accurately determine whether there is a deviation in the color displayed on the display screen.

Method used

By acquiring the first display area image of the preset display color of the display screen to be tested, a target threshold range corresponding to the preset display color is determined, and coarse detection is performed based on the target threshold range and the target pixel value of the first display area image in the HSV color space. When the rough detection result is qualified, the precision detection is further performed based on the RGB color space, and the comprehensive judgment is made based on the information of the HSV and RGB color space.

Benefits of technology

It improves the accuracy of color detection, reduces the situation of error detection, and can more accurately determine whether the color of the display screen meets the standards.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119915381A_ABST
    Figure CN119915381A_ABST
Patent Text Reader

Abstract

The invention relates to a color detection method and device. The method comprises the following steps: acquiring a first display area image of a display screen to be detected under a preset display color, and determining a target threshold range corresponding to the preset display color; and determining a coarse detection result according to the target threshold range and the target pixel value of the first display area image in the HSV color space. And determining a fine detection result according to the pixel value of the first display area image in the RGB color space under the condition that the coarse detection result is qualified, determining a color detection result of the display screen to be detected according to the fine detection result, and determining a color detection result of the display screen to be detected according to the coarse detection result under the condition that the coarse detection result is unqualified. Wherein the target threshold range is determined according to a plurality of second display area images of the qualified display screen under a plurality of environment parameters and preset display colors. By adopting the method, the accuracy of color detection can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of detection technology, and in particular to a color detection method and device. Background Art

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

[0003] At present, the color detection of display screens is generally done manually based on experience, but the manual detection method is not efficient. Therefore, in the related art, industrial cameras are usually used to collect images of predefined color templates and display screens in the same environment, and template matching is performed based on the acquired images to detect the color of the display screen. However, due to the limitations of the actual environment, the collected images still have errors.

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

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

[0006] In a first aspect, the present application provides a color detection method, comprising:

[0007] Acquire a first display area image of the display screen to be tested under a preset display color;

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

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

[0010] If the rough detection result is qualified, determine the fine detection result according to the pixel value 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;

[0011] 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.

[0012] In a second aspect, the present application also provides a color detection device, comprising:

[0013] 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;

[0014] A first determination module is used to determine a target threshold range corresponding to a preset display color; the target threshold range is determined based on a plurality of second display area images of a qualified display screen under a plurality of environmental parameters and a preset display color;

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

[0016] 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;

[0017] 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.

[0018] The color detection method and device described above 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 value 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 value 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 the qualified display screen under multiple environmental parameters and preset display colors, the target threshold range can take into account the influence of the actual environment, so that 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. Combined with the comprehensive judgment of the HSV color space and the RGB color space, the situation of false detection can be reduced and the accuracy of color detection can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0020] Figure 1 A diagram showing an application environment of a color detection method in an embodiment;

[0021] Figure 2 Schematic diagram of a color detection method in one embodiment;

[0022] Figure 3 A schematic diagram of a process for determining a target threshold range in one embodiment;

[0023] Figure 4 A schematic diagram of a process for determining an initial hue range in one embodiment;

[0024] Figure 5 A schematic diagram of a process for determining a target threshold range in another embodiment;

[0025] Figure 6 A schematic diagram of a process for determining a rough detection result in an embodiment;

[0026] Figure 7 A schematic diagram of a process for determining a color space distance in one embodiment;

[0027] Figure 8 is a schematic diagram of a three-dimensional coordinate system in one embodiment;

[0028] Fig. 9 is a schematic diagram of a relocation process in one embodiment;

[0029] Fig.10 A schematic diagram of bad pixel marking in one embodiment;

[0030] Fig.11 A schematic diagram of a process for determining a precise detection result in one embodiment;

[0031] Fig.12 A schematic diagram of a process of determining a display area image in one embodiment;

[0032] Fig.13 A schematic diagram of a process of obtaining a display area image in one embodiment;

[0033] Fig.14 FIG. 4 is a structural block diagram of a color detection device in one embodiment. DETAILED DESCRIPTION

[0034] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below 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 FIG. 1 is an 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 shown in FIG. Figure 1The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface.

[0036] Those skilled in the art will understand that Figure 1 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present 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 a different arrangement of components.

[0037] Figure 2 FIG. 1 is a flow chart of a color detection method in an embodiment. In an exemplary embodiment, as shown in FIG. Figure 2 As shown, a color detection method is provided, which is applied to Figure 1 The computer device in is used as an example for explanation, including the following S201 to S205.

[0038] S201, obtaining a first display area image of a display screen to be tested in a preset display color.

[0039] In this embodiment, the display screen to be tested refers to a display screen that needs to be tested for color. The preset display color can be set as required, including but not limited to any one or more of 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, 0, 255). The first display area image refers to the display area image of the display screen to be tested when it displays the preset display color, which can usually be an image corresponding to the rectangular display area of ​​the display screen to be tested.

[0040] Optionally, the computer device can obtain the first display area image from a preset storage space, or can receive the first display area image sent by a visual sensor. In some embodiments, the computer device can also obtain an initial image of the display screen to be tested under a preset display color through a visual sensor, and determine the corresponding first display area image based on the initial image. For example, the computer device can analyze the initial image to obtain the first display area image. For another example, the computer device can determine the first display area from the initial image based on the position of the first display area of ​​the display screen to be tested under other preset display colors when the position of the visual sensor relative to the display screen to be tested does not change. This embodiment does not limit the method for obtaining the first display area image. Among them, the visual sensor includes but is not limited to a camera.

[0041] S202, determining a target threshold range corresponding to a 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 preset display colors.

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

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

[0044] It is understandable that when a display screen is captured using a visual sensor, the pixel values ​​of the pixels in the image will deviate from the actual values ​​due to the influence of the shooting angle, distance, brightness, etc. Therefore, the target threshold range needs to be determined based on multiple second display area images of a qualified display screen under multiple environmental parameters and preset display colors.

[0045] Among them, a qualified display screen refers to a display screen whose color detection result is qualified. The number of qualified display screens can be one or more. The qualified display screens can be manually selected or determined 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 in which the qualified display screen is located when acquiring 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 ambient brightness of the qualified display screen, and the color temperature. The second display area image refers to the display area image of the qualified display screen under multiple environmental parameters and displaying a preset display color, which is also usually an image corresponding to a rectangular display area.

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

[0048] For example, the environmental parameters include installation height and installation angle. Let the preset display color be C, there are N qualified display screens, and M environmental parameters. Then, when the installation height is , installation angle is When the i-th qualified display screen is collected by the visual sensor, the image of the second display area of ​​the i-th qualified display screen under the preset display color C can be determined. ; When the installation height is , installation angle is When the i-th qualified display screen is acquired through the visual sensor, the second display area image of the i-th qualified display screen under the preset display color C can be determined. ; ...When the installation height is , installation angle is When the i-th qualified display screen is collected by the visual sensor, the image of the second display area 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. Wherein, N and M are both integers greater than or equal to 1, and i ranges from 1 to N.

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

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

[0051] Related technologies usually rely on the RGB value of pixels when detecting colors. 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 in addition to the R value and G value being obviously much larger than the B value, how much larger and the range of the R value and G value are uncertain. The comparison of the R value, G value, and B value has 255×255×255 colors, so color detection based only on RGB values ​​is not feasible.

[0052] Therefore, in this embodiment, after the computer device obtains the first display area image, it determines the target pixel value 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 value in the HSV color space. The target pixel value in the HSV color space may include at least one of a hue (Hue, H) value, a saturation (Saturation, S), and a brightness (Value, V) value.

[0053] Further, the computer device can determine the rough detection result according to the target threshold range and the target pixel value corresponding to the first display area image. The rough detection result may include qualified or unqualified. For example, if the target pixel value corresponding to at least one pixel in the first display area image is not within the target threshold range, the rough detection result is determined to be unqualified. Conversely, if the target pixel values ​​corresponding to all pixels in the first display area image are within the target threshold range, the rough detection result is determined to be qualified. Unqualified means that there are dead pixels or abnormal pixels on the display screen to be tested. For example, when the display screen to be tested is controlled to display red, there is a certain position on the display screen to be tested that does not display red, then there are dead pixels in the position area, that is, the display screen to be tested is unqualified.

[0054] S204, 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 a 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 the installation height and / or the 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 needs to further perform fine detection to determine the fine detection result according to the pixel value of the first display area image in the RGB color space. The fine detection result may include qualified or unqualified. The pixel value in the RGB color space includes 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 within a corresponding reference range. If all pixel values ​​in the first display area image are within the corresponding reference range, the precise detection result is determined to be qualified; otherwise, the precise detection result is determined to be 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 tested 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 tested 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 tested under the preset display color is unqualified.

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

[0059] S205, when the rough detection result is unqualified, determining the color detection result of the display screen to be tested 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 tested based on the rough detection result, without further fine detection. For example, if the rough detection result is unqualified, it means that the color detection result of the display screen to be tested under the preset display color is unqualified.

[0061] In the related art, an industrial camera is usually used to capture images of predefined color templates and display screens 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 limitations of the actual environment, the captured images have errors. Therefore, the color detection method in the related art has the problem of low accuracy.

[0062] In the above color detection method, the first display area image of the display screen to be tested under the preset display color can be obtained, the 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 value of the first display area image under the HSV color space. Further, when the rough detection result is qualified, the fine detection result is determined according to the pixel value of the first display area image under 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 the qualified display screen under multiple environmental parameters and preset display colors, the target threshold range can take into account the influence of the actual environment, so that 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. Combined with the comprehensive judgment of the HSV color space and the RGB color space, the situation of false detection can be reduced and the accuracy of color detection can be improved.

[0063] Moreover, the related technology usually requires matching light sources for industrial cameras, and there are also high requirements for the matching between industrial cameras and light sources. The color detection method provided in this application does not require manual detection, and does not require the use of industrial cameras and light sources. For example, color detection can be achieved using ordinary cameras, which can reduce labor costs and hardware costs.

[0064] Figure 3 FIG. 1 is a flow chart of determining a target threshold range in an embodiment. In an exemplary embodiment, as shown in FIG. Figure 3 As shown, if the target threshold range includes the hue reference range corresponding to the first type of color, S202 includes S301 to S303.

[0065] S301, obtaining a plurality of second display area images of a qualified display screen under a plurality of environmental parameters and a 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 means that the preset display color is the first type of color. When 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 multiple environmental parameters and the first type of color. The first type of color represents a color type, such as red, blue, orange or green.

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

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

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

[0070] In this embodiment, the computer device can determine the theoretical hue range corresponding to the first type of color, which is recorded as [ ].in, represents the lower limit value of the theoretical hue range corresponding to the first type color C, Indicates the upper limit value in the theoretical hue range corresponding to the first type 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 a color space table of some colors in the HSV color space. Please refer to Table 1. For example, if the first type of color C is blue, then [ ]=[100, 124]; if the first type 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 value of each pixel in each second display area image in the HSV color space, that is, determine the H value of each pixel in all second display area images in the HSV color space.

[0075] Furthermore, the computer device can be used to calculate the hue range based on the theoretical hue range [ ] and the hue value of each pixel in each second display area image in the HSV color space, determine the initial hue range corresponding to each qualified display screen, and record the initial hue range of the i-th qualified display screen under the preset display color C as , =[ Similarly, The initial hue range is The lower limit of The initial hue range is The upper limit value of .

[0076] Exemplarily, the computer device may count the hue values ​​of all pixels 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 a 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 can average the upper limit values ​​in the initial hue ranges of all qualified display screens based on 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 average 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): .in, is the lower limit of the hue reference range, It is the upper limit of the hue reference range.

[0080] (1)

[0081] In the above embodiment, since multiple second display area images of qualified display screens under multiple environmental parameters and first type colors can be obtained, the second display area images are images that take multiple environmental parameters into consideration under the first type colors. In this way, after the initial hue range corresponding to each qualified display screen is determined according to the theoretical hue range corresponding to the first type colors and the hue value of each pixel in each second display area image in the HSV color space, the hue reference range corresponding to the first type colors 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. 1 is a flow chart of determining an initial hue range in an embodiment. In an exemplary embodiment, as shown in FIG. Figure 4 As shown, S302 includes S401 to S404.

[0083] S401 , determining a basic hue range corresponding to each second display area image according to a hue value of each pixel in each second display area image in an HSV color space.

[0084] In this embodiment, continuing the above example, the computer device can display the second display area image. The hue value of each pixel in the HSV color space is used to determine the image in the second display area. The corresponding basic hue range [ The computer device may display the second display area image The maximum hue value of each pixel in the HSV color space is used as the upper limit of the basic hue range. , the second display area image The minimum hue value of each pixel in the HSV color space is taken as the lower limit of the basic hue range. . Where j ranges from 1 to M.

[0085] S402, for the same qualified display screen, determine the first average value corresponding to the 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 each basic hue range corresponding to the qualified display screen, and determine the second average value corresponding to the qualified display screen 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.

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

[0087] For example, the computer device may be configured to , determine the first average value corresponding to the i-th qualified display screen.

[0088] The process of determining the second average value is similar to the process of determining the first average value, and will not be described in detail here. , determine the first average value corresponding to the i-th qualified display screen.

[0089] S403: Determine 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.

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

[0091] (2)

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

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

[0094] (3)

[0095] When capturing images of a display screen, due to the influence of the shooting angle, distance, brightness, etc., the hue values ​​of the pixels in the display area of ​​the display screen will deviate. For example, according to Table 1 above, it can be seen that the theoretical range of the hue value corresponding to blue is between 100-124, but for a normal display screen without dead pixels, the hue values ​​of some pixels will deviate, and the hue values ​​of some pixels of 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 aforementioned basic hue range and the aforementioned 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, so that the detection result is more accurate.

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

[0097] 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, the rough detection result is determined to be 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.

[0098] Please refer to Table 1. The hue values ​​of color types other than black, white and gray are clearly distinguished. Therefore, for the first type of color, a rough detection can be performed by checking whether the H value falls within the corresponding hue reference range. In other words, when the preset display color includes the first type of color, the target pixel value is the hue (Hue, H) value. In this way, the first type of color can be efficiently and roughly detected by checking whether the hue value is within the hue reference range, thereby improving the detection efficiency.

[0099] It is worth noting 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 FIG. 4 is a flow chart of another method for determining a target threshold range in an embodiment. In an exemplary embodiment, as shown in FIG. Figure 5 As 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, obtaining a plurality of second display area images of a qualified display screen under a plurality of 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 means that the preset display color is the second type of color. When 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 , Second display area image , ..., the second display area image , Second display area image , ...second display area image , ...second display area image The process of S501 is similar to that of S301 and will not be described in detail here.

[0103] S502: Determine the color space distance between each pixel 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 hue value, in this embodiment, the computer device needs to determine the color space distance between each pixel 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 in the second display area image in the HSV color space, so as to subsequently roughly detect the second type of color by color space distance. The color space distance is used to indicate the similarity or closeness of two colors in the HSV color space.

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

[0106] Optionally, the computer device may store a mapping relationship, in which the color space distances between different pixel values ​​and different preset display colors are defined. For example, the mapping relationship includes the color space distance Z1 between the pixel value A and black in the HSV color space, the color space distance Z2 between the pixel value B and white in the HSV color space, and so on. Furthermore, after the computer device determines the color space distances between each pixel point and the second type of color in the second display area image, it can determine the corresponding color space distance based on the mapping relationship. For example, assuming that the second type of color is black, 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 and black in the second display area in the HSV color space is Z1.

[0107] S503: Determine a 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 of the color space distances corresponding to each pixel point. .

[0109] Further optionally, the computer device may average the color space distances of all pixels in the second display area image corresponding to the i-th qualified display screen to determine the color space threshold value corresponding to the i-th qualified display screen. , and based on the color space thresholds of all qualified displays , determine the color space threshold corresponding to the second type of color For example, 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 a qualified display screen under multiple environmental parameters and second type colors can be obtained, the second display area image is an image that takes multiple environmental parameters into consideration under the second type color. Furthermore, after determining the color space distance between each pixel point in the second display area image and the second type color in the HSV color space, a more accurate color space threshold corresponding to the second type color can be determined based on each color space distance.

[0112] Figure 6 FIG. 1 is a flow chart of determining a rough detection result in an embodiment. In an exemplary embodiment, as shown in FIG. Figure 6 As shown, in the case where the preset display colors include the second type of colors, S203 includes S601 to S603.

[0113] S601, determining a color space distance between each pixel in the first display area image and a second type of color in the HSV color space according to a pixel value of each pixel 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 (Hue, H) value, saturation (Saturation, S) and value (Value, V) value.

[0115] S602: If the color space distances corresponding to all the pixels in the first display area image are less than or equal to the color space threshold corresponding to the second type of color, then the rough detection result is determined to be qualified.

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

[0117] In the above embodiment, the color space distance between each pixel 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 in the first display area image in the HSV color space, and when the color space distances corresponding to each pixel in the first display area image are less than or equal to the color space threshold corresponding to the second type of color, the coarse detection result is determined to be qualified, and when 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 coarse detection result is determined to be unqualified. Therefore, the second type of color can be coarsely detected through the color space distance. On the one hand, the coarse detection can cover the second type of color and improve the application scope of color detection. On the other hand, the efficiency of color detection is also improved by the color space threshold.

[0118] The following will expand on a process for determining color space distance. Figure 7 FIG. 1 is a flow chart of determining the color space distance in one embodiment. In an exemplary embodiment, as shown in FIG. Figure 7 As shown, 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 S701 to S703.

[0119] S701, determining 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 a 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 is a schematic diagram of a three-dimensional coordinate system in one embodiment, such as Figure 8 As shown, the cone model is a model corresponding to the HSV color space, where the height of the cone model h=1, and the radius of the bottom of the cone model r=1. A three-dimensional coordinate system corresponding to the cone model can be established with black as the origin, where 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, and the H value of the HSV color space is given by the rotation angle of the H-axis around the V-axis of the HSV color space, and the H range 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, and the value range of the Z-axis is [0, 1].

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

[0122] Exemplarily, let the pixel value in the HSV color space be (H, S, V) and the coordinate in the three-dimensional coordinate system be (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 in the three-dimensional coordinate system according to the pixel value of the first candidate pixel in the HSV color space and the preset corresponding relationship. The first candidate pixel can be any pixel in the first display area image or the second display area image.

[0125] For example, assuming that the pixel value of the first candidate pixel in the HSV color space is (H1, S1, V1), the first coordinate (x1, y1, z1) of the pixel in the three-dimensional coordinate system can be determined according to the following formula (6). That is, 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, so the angle corresponding to H needs to be converted into radians before being substituted into formula (5).

[0126] (6)

[0127] S702: 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 a 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 correspondence, which is recorded as (x2, y2, z2). No further details are given here.

[0129] S703: 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.

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

[0131] (7)

[0132] Furthermore, the computer device may determine the color space distance between the first candidate pixel and the second type of color in the HSV color space according to the Euclidean distance ρ. For example, the computer device may directly use the Euclidean distance ρ as the color space distance between the first candidate pixel and the second type of color in the HSV color space. For another example, the computer device may obtain the corresponding color space distance after correcting the Euclidean distance ρ. The value range of the color space distance is [0, 1].

[0133] In the above embodiment, since the three-dimensional coordinate system is a coordinate system corresponding to the HSV color space, 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. Therefore, the first coordinate of the first candidate pixel in the three-dimensional coordinate system can be determined according to the pixel value of the first candidate pixel in the HSV color space and the preset corresponding relationship, 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 corresponding relationship. 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 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 is any pixel 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] Fig. 9 FIG. 1 is a flow chart of relocation in an embodiment. In an exemplary embodiment, as shown in FIG. Fig. 9 As shown, when the rough detection result is unqualified, the color detection method further includes a step of relocating the bad pixel of the first display area image, and the relocating step includes S901 to S907.

[0135] S901, determining bad pixels in an image in a first display area.

[0136] In this embodiment, if the rough detection result is unqualified, the computer device can determine the bad pixel in the image of the first display area, which is recorded as .Dead Pixels Refers to pixels with abnormal colors. Optionally, the computer device may treat pixels in the first display area image whose hue values ​​are not within the hue reference range as bad pixels. Alternatively, the pixels whose corresponding color space distance is greater than the color space threshold can be regarded as bad pixels. .

[0137] S902, performing connected domain analysis on the bad pixel to determine a first connected region corresponding to the bad pixel.

[0138] In this embodiment, the computer device determines the bad pixel After that, the bad pixels will be Perform connected domain analysis to identify bad pixels The corresponding first connected region is denoted as Among them, the first connected area The number can be one or more.

[0139] S903: Determine a first circumscribed region of the first connected region, and enlarge the first circumscribed region to determine a second circumscribed region.

[0140] Since the target threshold range is determined based on multiple second display area images of a qualified display screen under multiple environmental parameters and the preset display color, the target threshold range is expanded under the influence of the environmental parameters. This may cause the bad pixel obtained based on coarse detection to be inaccurate, causing the first external area to be smaller than the actual situation. Therefore, in this embodiment, it is necessary to further relocate the bad pixel.

[0141] Furthermore, after determining the first connected area, the computer device determines a first circumscribed area of ​​the first connected area. Determining the first circumscribed area refers to a circumscribed area that includes the first connected area. The following examples are all based on the example that the first circumscribed area is a circumscribed rectangular frame of the first connected area. It should be noted that this embodiment does not limit the shape of the circumscribed area, and the circumscribed area can be a circumscribed circle, a circumscribed polygon, or other irregular forms of circumscription.

[0142] Furthermore, the computer device may magnify the first circumscribed area to determine the second circumscribed area. For example, if the first circumscribed area is a circumscribed rectangular frame, the computer device may magnify the circumscribed rectangular frame by T pixels to obtain the second circumscribed area. T is a number greater than 0, such as 5.

[0143] S904: 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.

[0144] In this embodiment, the computer device uses each pixel point in the second circumscribed area as the first pixel set S1, and uses each pixel point corresponding to the outline of the second circumscribed area as the second pixel set S2.

[0145] The pixels corresponding to the contour of the second circumscribed area may be understood as the pixels on the contour of the second circumscribed area. Optionally, the computer device may extract the contour of the second circumscribed area and use all the pixels on the contour of the second circumscribed area as the second pixel set S2.

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

[0147] Further, the computer device may determine the difference 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 pixels belonging to the first pixel set S1 but not to the second pixel set S2.

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

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

[0150] Furthermore, the computer device may 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 point whose absolute value of the difference is less than a preset threshold value. The preset threshold value may 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 a preset threshold, the target pixel point includes 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 point does not include pixel point 2 in the third pixel set S3.

[0152] S907, determining a target bad pixel area according to the target pixel point and the first connected area.

[0153] In this embodiment, the target pixel point is a bad pixel determined after relocation. Therefore, the computer device can determine the target bad pixel area based on the target pixel point and the first connected area, that is, determine the new .

[0154] In one embodiment, optionally, the computer device may mark the target bad pixel area in the first display area image, and this embodiment does not limit the marking form. Fig.10 FIG. 1 is a schematic diagram of bad pixel marking in an embodiment. Fig.10 As shown in FIG. 1 (a), the computer device can mark the target bad pixel area in the first display area image using a rectangular frame.

[0155] In the above embodiment, since the bad pixel in the first display area image can be determined when the rough detection result is unqualified, the bad pixel is analyzed for the connected domain, the first connected area corresponding to the bad pixel is determined, and the first circumscribed area of ​​the first connected area is determined, and then the first circumscribed area is enlarged to determine the second circumscribed area, so that each pixel in the second circumscribed area is used as the first pixel set, and each pixel corresponding to the outline of the second circumscribed area is used as the second pixel set. In this way, the difference between the first pixel set and the second pixel set can be used as the third pixel set, and the target pixel is determined from the third pixel set, wherein the absolute value of the difference between the pixel value of the target pixel 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 in the second pixel set. Further, according to the target pixel and the first connected area, the bad pixel is relocated, a more accurate target bad pixel area is determined, and the error of directly locating the bad pixel based on the rough detection is reduced.

[0156] Under normal circumstances, the R value, G value, and B value of pixels that are close to each other in the display screen are relatively close, and there will not be a large change in value. Therefore, precise detection can be performed based on this. Fig.11 FIG. 1 is a flow chart of determining a precise detection result in an embodiment. In an exemplary embodiment, as shown in FIG. Fig.11 As shown, "determining a precise detection result according to the pixel value of the first display area image in the RGB color space" in S204 includes S1101 to S1103.

[0157] S1101, determine the interval pixel point 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 pixel distance between the interval pixel point and the second candidate pixel point in the row direction is less than the preset pixel distance.

[0158] In this embodiment, during the precise detection process, the computer device first determines the interval pixel points of the second candidate pixel points in the row direction, wherein the second candidate pixel point is any pixel point in the first display area image, and the pixel distance between the interval pixel point and the second candidate pixel point in the row direction is less than the preset pixel distance.

[0159] The preset pixel distance can be set according to actual needs. For example, assuming that the second candidate pixel is the kth pixel in the row direction, the interval pixel may include but is not limited to at least one of the k-1th pixel, the k-2th pixel, the k+1th pixel or the k+2th pixel, and the present embodiment is not limited thereto.

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

[0161] The preset value can also be set as required. For example, taking the preset value equal to 2 as an example, assuming that the second candidate pixel is the kth pixel in the row direction, the first interval pixel is the k-4th pixel, and the second interval pixel is the k-2th pixel. That is, the interval pixel includes the k-4th pixel and the k-2th pixel.

[0162] S1102: Determine an average difference value between the second candidate pixel and the interval pixel according to the pixel values ​​of the second candidate pixel and the interval pixel in the RGB color space.

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

[0164] Furthermore, the computer device can determine an average difference value between the second candidate pixel and the interval pixel according to the pixel values ​​of the second candidate pixel and the interval pixel in the RGB color space.

[0165] Optionally, the average difference value may include an average difference value of R values, an average difference value of G values, and an average difference value of B values ​​between the second candidate pixel points and the interval pixel points.

[0166] Continuing with the above example, taking the average difference value of R values ​​as an example, the computer device can determine the average difference value of R values ​​based on the absolute value of the difference between the R value of the kth pixel and the R value of the k-2th pixel, the absolute value of the difference between the R value of the kth pixel and the R value of the k-4th pixel, and the absolute value of the difference between the R value of the k-2th pixel and the R value of the k-4th pixel. The average difference value of G values ​​and the average difference value of B values ​​are similar, and will not be repeated here.

[0167] For example, the computer device may determine the average difference value of the R value according to the following formula (8): , the average difference of G value The average difference between the B value and .

[0168] (8)

[0169] Where k ≥ 5, represents the R value of the k-4th pixel, represents the R value of the k-2th pixel, represents the R value of the kth pixel. Similarly, , and They respectively represent the G value of the k-4th pixel, the G value of the k-2th pixel, and the G value of the kth pixel. , and They represent the B value of the k-4th pixel, the B value of the k-2th pixel, and the B value of the kth pixel respectively.

[0170] S1103, determining a precise detection result according to the average difference value and a preset difference threshold.

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

[0172] Optionally, the computer device may compare the average difference value with a preset difference threshold, and determine the precise 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 may calculate the average difference value of the R value , the average difference of G value The average difference between the B value and If any of the values ​​is greater than the preset difference threshold, the precision detection result of the k-th pixel is determined to be unqualified. , the average difference of G value The average difference between the B value and When all of them are less than or equal to the preset difference threshold, the precise detection result of the k-th pixel is determined to be qualified.

[0174] That is, the computer device can determine whether the fifth pixel is qualified by combining the pixel value of the first pixel and the pixel value of the third pixel, determine whether the sixth pixel is qualified by combining the pixel value of the second pixel and the pixel value of the fourth pixel, and so on.

[0175] Further optionally, the computer device can determine that the detection result of the display screen to be tested is qualified when the precise 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 the precise detection results of some second candidate pixel points are unqualified.

[0176] In the above embodiment, the second candidate pixel is any pixel in the first display area image, and the pixel distance between the interval pixel and the second candidate pixel in the row direction is less than the preset pixel distance. Since the interval pixel of the second candidate pixel in the row direction can be determined, and the average difference value between the second candidate pixel and the interval pixel in the RGB color space is determined according to the pixel values ​​of the second candidate pixel and the interval pixel, the precise detection result can be determined according to the average difference value and the preset difference threshold. In the above process, for any pixel in the first display area image, the interval pixel can be combined with the interval pixel for precise detection in the RGB color space, so that an accurate color detection result can be obtained in combination with the rough detection result.

[0177] In an exemplary embodiment, optionally, if the precision detection result is unqualified, the computer device can determine abnormal pixels in the first display area image. The abnormal pixels include the average difference value of the R value , the average difference of G value The average difference between the B value and Any second candidate pixel point whose difference is greater than a preset difference threshold.

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

[0179] Further optionally, the computer device may mark the external area corresponding to the second connected area in the first display area image, please refer to Fig.10 , for example, Fig.10 As shown in FIG. 2( b ), the computer device may use a rectangular frame to mark the external area corresponding to the second connected area in the first display area image to achieve the function of locating the bad pixel.

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

[0181] S1201, preprocessing a first initial image to obtain an intermediate image, where the first initial image is an initial image captured under a preset display color for a display screen to be tested or an initial image captured under a preset display color for a qualified display screen.

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

[0183] The first initial image is an initial image captured under a preset display color for the display screen to be tested, or the first initial image is an initial image captured under a preset display color for a qualified display screen. 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 captured under a preset display color for the display screen to be tested. For another example, when it is necessary to determine the target threshold range, the first initial image is an initial image captured under a preset display color for a qualified display screen.

[0184] Exemplarily, the computer device can communicate with the visual sensor, and the computer device sets the automatic focus of the visual sensor, 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 visual sensor to take a picture, so that the computer device obtains a first initial image. It is understandable 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, wherein the preprocessing includes but is not limited to at least one of grayscale processing, filtering processing and binarization processing.

[0186] Optionally, the computer device may perform grayscale processing on the first initial image to obtain a grayscale image, perform median filtering on the grayscale 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] Fig.13 FIG. 1 is a schematic diagram of a process of obtaining a display area image in an embodiment. Fig.13 As shown, illustratively, the first initial image is gray-scaled to obtain Fig.13 The grayscale image shown in Figure (a) is obtained by median filtering the grayscale image. Fig.13 The filtered image shown in Figure (b).

[0188] Furthermore, the computer device can perform binarization processing on the filtered image according to the global segmentation threshold based on the binarization function Cv2.Threshold in the Open Source Computer Vision Library (OpenCV) to obtain Fig.13 The middle image is shown in Figure (c) in FIG. Among them, the global segmentation threshold is used for binarization processing. In the filtered image, the pixel values ​​greater than the global segmentation threshold are set to 255 (white), and the remaining pixel values ​​are set to 0 (black). The global segmentation threshold can be set according to the needs. For example, the grayscale value of the surrounding environment of the display screen to be tested is approximately between 90 and 130, while the grayscale value of the black border of the display screen to be tested is below 10, and the grayscale value of the display area in the middle of the display screen to be tested is approximately above 160. Therefore, in order to better distinguish the surrounding environment from the display area in the middle, the global segmentation threshold can be 80.

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

[0190] In this embodiment, the computer device may optionally perform edge detection on the intermediate image using a preset edge detection algorithm to determine edge information of the intermediate image, wherein the edge information may be used to characterize the boundary or junction of an object where the gray value in the intermediate image changes sharply.

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

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

[0193] In this embodiment, the computer device can use a contour tracking algorithm to extract contours based on edge information to determine contour information of the intermediate image. The contour information can be used to characterize a complete curve of the contour of an object in the intermediate image. The contour tracking algorithm can use the topological relationship between pixels in the image, especially the connectivity information of the edge pixels. Therefore, based on the contour tracking algorithm, the computer device can extract the position of each edge pixel from the edge information, and connect the adjacent edge pixels into a contour through the topological relationship between the pixels 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 edge information based on the contour search function Cv2.FindContours in OpenCV to determine contour information of the intermediate image.

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

[0196] In this embodiment, please continue to refer to Fig.13 For example, the computer device may continue to determine all rectangular contours in the intermediate image based on the contour information based on the contour search function Cv2.FindContours in OpenCV, and determine the largest rectangular contour among all rectangular contours by traversing, 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, such as Fig.13 As shown in Figure (e).

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

[0198] In this embodiment, the target color can be set as required. The following example uses white as the target color. Fig.13 For example, the computer device may fill the area corresponding to the target outline with white based on the area filling function Cv2.FillPoly in OpenCV to obtain a filled image corresponding to the first initial image, such as Fig.13 As shown in Figure (f).

[0199] S1206, determining a rectangular area corresponding to the target contour from the filled image according to the gray value of each pixel in the filled image.

[0200] In this embodiment, continuing to take the target color of white as an example, since the grayscale value of white is 255, the computer device can traverse all the pixels in the fill image and determine the coordinates of the pixels with a grayscale value of 255 to fill the rectangular area corresponding to the target outline in the image.

[0201] S1207: Post-process the rectangular area to determine a display area image in the first initial image.

[0202] In this embodiment, in order to prevent the influence of factors such as inaccurate edge capture, the computer device will post-process the rectangular area to determine the display area image in the first initial image. The post-processing may include but is not limited to enlargement processing or reduction processing. Exemplarily, the computer device may reduce the four sides of the rectangular area by Y pixels, and select the display area image from the first initial image based on the reduced rectangular area. Y is an integer greater than or equal to 1,

[0203] The display area image includes a first display area image or a second display area image. It is understandable that, when the first initial image is an initial image captured under a preset display color for the display screen to be tested, the display area image in the first initial image is the first display area image; when the first initial image is an initial image captured under a preset display color for a qualified display screen, 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 under a preset display color for the display screen to be tested or an initial image collected under a preset display color for a qualified display screen. Since the first initial image can be preprocessed to obtain an intermediate image, edge detection can be performed based on the intermediate image to more easily determine the edge information of the intermediate image, and then contour extraction can be performed based on the edge information. After the contour information of the intermediate image is determined, the largest rectangular contour in the intermediate image can be efficiently used as the target contour based on 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 the rectangular area corresponding to the target contour is determined from the filled image according to the gray value of each pixel in the filled image, the rectangular area is post-processed, and the display area image in the first initial image can be more accurately determined.

[0205] The following combination Figure 2 To expand the overall process of a color detection method, please continue to refer to Figure 2 The computer device executes the color detection method according to the process of S201 to S205. In S201, the process of determining the first display area image can refer to S1201 to S1207.

[0206] In S202, if the preset display color is the first type of color, the target threshold range includes a 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 a 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, then when the hue values ​​of each pixel in the first display area image in the HSV color space are all within the hue reference range corresponding to the first type of color, the rough detection result is determined to be qualified, and when there is at least one pixel in the first display area image whose corresponding hue value is not all within the hue reference range, the rough detection result is determined to be unqualified. If the preset display color is the second type of color, the rough detection result is determined by the method of S601~S603.

[0208] In S204, the process of determining the precise detection result may refer to S701 to S703.

[0209] In S205, if 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. Further, in the case where the rough detection result is unqualified, the bad pixel of the image in the first display area can be relocated, and the relocation process can refer to the above S901 to S907.

[0210] Based on the same inventive concept, the embodiment of the present application also provides a color detection device for implementing the color detection method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more color detection device embodiments provided below can refer to the limitations on the color detection method above, and will not be repeated here.

[0211] Fig.14 FIG. 1 is a structural block diagram of a color detection device in an embodiment. In an exemplary embodiment, as shown in FIG. Fig.14 As shown, a color detection device 1400 is provided, comprising: 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, wherein:

[0212] The acquisition module 1401 is used to obtain the first display area image of the display screen to be tested under the preset display color. The first determination module 1402 is used to determine the target threshold range corresponding to the preset display color; the target threshold range is determined according to multiple second display area images of the qualified display screen under multiple environmental parameters and preset display colors. The second determination module 1403 is used to determine the 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. The third determination module 1404 is used to determine the 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 1405 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.

[0213] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, 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, they should be considered to be within the scope of this application.

[0214] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached 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 lower 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

  • Display compensation method, computer equipment and medium

    CN114999414A

  • 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

  • Technique for color profiling of a display device

    EP3285252A1

Cited By

  • Water leakage detection method and device based on color change, medium and equipment

    CN120279118A

  • Image color adjustment method and device, equipment, medium and product

    CN121258857A