Color block positioning method and device in color card, electronic equipment and storage medium

Through automated color block parameter matching and morphological processing, efficient positioning of color card color blocks is achieved, and the positioning error and cumbersome problems in the existing technology are solved, and it is suitable for batch color cards.

CN119273742APending Publication Date: 2025-01-07SHANGHAI WINGTECH INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411283843.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-13
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

The existing color card color block positioning methods rely on manual operations, which are prone to positioning errors and are cumbersome in the process, which is not suitable for the positioning of batch color cards.

Method used

By acquiring the color card image, the color block is determined based on the parameter value and parameter calibration threshold of the color block, morphological processing and area of ​​interest detection are performed, and the color block is automatically positioned.

Benefits of technology

It improves the positioning accuracy and efficiency of color card color blocks, reduces labor and time costs, and is suitable for the positioning of batch color cards.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119273742A_ABST
    Figure CN119273742A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of color card positioning, and provides a color block positioning method and device in a color card, electronic equipment and a storage medium, and the method comprises the steps: obtaining a color card image of a to-be-detected color card; determining the color block of each color in the color card image based on the parameter value of the color block in the color card image and the parameter calibration threshold of different colors; determining a target contour of a color block of each color; and based on the target contour of the color block of each color, performing region-of-interest detection on the color block of each color to obtain a positioning result of the color block of each color in the to-be-detected color card. Therefore, the color blocks of different colors in the color card image are determined by performing parameter comparison on the color blocks in the color card image, and then the color blocks in the color card are positioned by determining the contours of the color blocks of different colors and detecting the region of interest. Therefore, the positioning precision and efficiency of the color blocks in the color cards are improved, the labor cost and the time cost are reduced, and the method is suitable for positioning the color blocks in batch color cards.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of color card positioning, and in particular to a method, device, electronic device and storage medium for positioning a color block in a color card. Background Art

[0002] A color card is a standard card containing 24 pure color blocks, also known as a 24-color card. It is widely used in camera color reproduction and white balance accuracy testing. In particular, the positioning results of each color block in the color card are of great significance in objective color evaluation.

[0003] Traditional color block positioning methods include two methods. The first method is to manually select the positioning results from each color block on the color card; the second method is to manually add markers at the four corners of the color card to assist in determining the positioning results of each color block. The problem with the first method is that there is a certain error in the positioning results of manual selection, which is not conducive to batch positioning; the problem with the second method is that if there is an error in the marker, it will cause errors in the positioning results of each color block, and the marker is determined in the scene where a person holds the color card and takes a photo. The process is cumbersome and time-consuming.

[0004] It can be seen that the existing method for locating color blocks in color cards relies on manual operation, is prone to positioning errors, and the process is cumbersome and is not suitable for locating color blocks in batch color cards. Summary of the invention

[0005] Based on this, it is necessary to provide a method, device, electronic device and storage medium for locating color blocks in a color card in order to solve the above technical problems.

[0006] The present application embodiment provides a method for locating a color block in a color card, including:

[0007] Obtain a color card image of a color card to be detected;

[0008] Determining the color blocks of each color in the color card image based on the parameter values ​​of the color blocks in the color card image and parameter calibration thresholds of different colors;

[0009] Determine the target outline of each color block;

[0010] Based on the target contours of the color blocks of each color, the region of interest detection is performed on the color blocks of each color to obtain the positioning results of the color blocks of each color in the color card to be detected.

[0011] In one embodiment, determining the color blocks of each color in the color card image based on the parameter values ​​of the color blocks in the color card image and parameter calibration thresholds of different colors includes:

[0012] Converting the color card image from a color space to a color space;

[0013] The parameter calibration thresholds of different colors in the color space are matched with the parameter values ​​of the color blocks to obtain the color blocks of each color in the color card image.

[0014] In one embodiment, determining the color blocks of each color in the color card image based on the parameter values ​​of the color blocks in the color card image and parameter calibration thresholds of different colors includes:

[0015] In the color space where the color card image is located, the parameter calibration thresholds of different colors contained in the color space are matched with the parameter values ​​of the color blocks to obtain the color blocks of each color in the color card image.

[0016] In one embodiment, determining the target contour of the color block of each color includes:

[0017] Morphological processing is performed on the color blocks of each color to obtain target contours of the color blocks of each color.

[0018] In one embodiment, performing morphological processing on the color blocks of each color to obtain the target contours of the color blocks of each color includes:

[0019] Performing expansion and corrosion processing on the color blocks of each color to obtain the initial outlines of the color blocks of each color;

[0020] Obtaining the color value of a pixel in the outline of the color block of each color, and determining the color value of a neighboring pixel of the pixel;

[0021] Based on the color value of the pixel and the color values ​​of the neighboring pixels of the pixel, noise points are removed from the initial contours of the color blocks of each color to obtain the target contours of the color blocks of each color.

[0022] In one embodiment, based on the target contours of the color blocks of each color, performing region of interest detection on the color blocks of each color to obtain the positioning results of the color blocks of each color in the color card to be detected includes:

[0023] Determining the center point position of the color block of each color based on the target contour of the color block of each color;

[0024] Determine the position of the region of interest of the color block of each color according to the center point position of the color block of each color, the center point position of the color card to be detected, and a preset fixed length;

[0025] The position of the region of interest in the color block of each color is used as the positioning result of the color block of each color in the color card to be detected.

[0026] In one embodiment, based on the target contours of the color blocks of each color, performing region of interest detection on the color blocks of each color to obtain the positioning results of the color blocks of each color in the color card to be detected includes:

[0027] Determine the target contour of the color card to be detected;

[0028] Calculating the contour proportion of the color blocks of each color based on the target contour of the color block of each color and the target contour of the color card to be detected;

[0029] Determining the shrinkage ratio of the color blocks of each color according to the outline ratio of the color blocks of each color and the shrinkage ratios corresponding to the different outline ratios;

[0030] Determining the position of the region of interest of the color block of each color based on the target contour of the color block of each color and the shrinkage ratio of the color block of each color;

[0031] The position of the region of interest in the color block of each color is used as the positioning result of the color block of each color in the color card to be detected.

[0032] The embodiment of the present application provides a color block positioning device in a color card, comprising:

[0033] An image acquisition module, used to acquire a color card image of a color card to be detected;

[0034] A color block determination module, used to determine the color blocks of each color in the color card image based on the parameter values ​​of the color blocks in the color card image and parameter calibration thresholds of different colors;

[0035] A contour determination module, used to determine the target contour of each color block;

[0036] The color block positioning module is used to perform region of interest detection on the color blocks of each color based on the target contours of the color blocks of each color, and obtain the positioning results of the color blocks of each color in the color card to be detected.

[0037] An embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the color block positioning method of the color card provided in any embodiment of the present application are implemented.

[0038] An embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the color block positioning method of the color card provided in any embodiment of the present application are implemented.

[0039] The color block positioning method, device, electronic device and storage medium provided in the embodiment of the present application obtain the color card image of the color card to be detected; determine the color blocks of each color in the color card image based on the parameter values ​​of the color blocks in the color card image and the parameter calibration thresholds of different colors; determine the target contour of the color blocks of each color; based on the target contour of the color blocks of each color, perform region of interest detection on the color blocks of each color to obtain the positioning result of the color blocks of each color in the color card to be detected. In this way, by performing parameter comparison on the color blocks in the color card image, the color blocks of different colors in the color card image are determined, and then the color blocks in the color card are positioned by determining the contours of the color blocks of each color and the region of interest detection method. Therefore, the positioning accuracy and efficiency of the color blocks in the color card are improved, the labor cost and time cost are reduced, and it is suitable for positioning the color blocks in batch color cards. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 It is a schematic diagram of a flow chart of a method for locating a color block in a color card in one embodiment;

[0041] Figure 2 It is a schematic diagram of the effect of the region of interest of the color block of each color in the color card to be detected in one embodiment;

[0042] Figure 3 is a schematic structural diagram of a color block positioning device in a color card in one embodiment;

[0043] Figure 4 FIG. 1 is a schematic diagram of the structure of an electronic device in an embodiment. DETAILED DESCRIPTION

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

[0045] In the related art, the color blocks in the color card are also located based on the cross mark carried by the color card itself. The cross mark carried by the color card itself is located at the four corners of the edge of the color card. Specifically, the color blocks in the color card are located based on the position of the cross mark and the relative position of the cross mark and each color block in the color card. However, the size of the cross mark carried by the color card itself is extremely small, and it is difficult for the existing positioning algorithm to detect it accurately. In addition, the cross mark carried by the color card itself is prone to blur, which also affects the positioning accuracy of the color blocks in the color card.

[0046] In one embodiment, Figure 1As shown, a method for locating color blocks in a color card is provided. This embodiment uses the method applied to an electronic device as an example. It can be understood that the method can also be applied to a server, and can also be applied to a system including an electronic device and a server, and is implemented through the interaction between the electronic device and the server.

[0047] In this embodiment, the method includes the following steps:

[0048] Step 102: Acquire a color card image of a color card to be detected.

[0049] The color card to be tested refers to a color card used for testing the color reproduction and white balance accuracy of a camera. The color card to be tested may include 24 pure color blocks.

[0050] The color card image refers to an image captured by an image acquisition device (such as a camera) after shooting the color card to be detected.

[0051] In actual application, in order to improve the positioning accuracy of the color block in the color card, the color card to be detected is placed in a controllable light source environment (such as a light box / laboratory / real scene) and the color card is photographed to obtain a color card image.

[0052] Step 104 : Determine the color blocks of each color in the color card image based on the parameter values ​​of the color blocks in the color card image and the parameter calibration thresholds of different colors.

[0053] The parameter value of the color block refers to the parameter value of the color in the space where the card image is located. The parameter calibration thresholds of different colors include the maximum parameter and the minimum parameter of different colors.

[0054] In one case, if the color card image is in the color space (RGB space), the parameter values ​​of the color blocks include red (R), green (G), and blue (B). Accordingly, the parameter calibration thresholds of different colors include the minimum red value, the maximum red value, the minimum green value, the maximum green value, the minimum blue value, and the maximum blue value.

[0055] In another case, if the color card image is in the color space (HSV space), the parameter values ​​of the color block include hue (H), saturation (S), and brightness (V). Correspondingly, the parameter calibration thresholds of different colors include minimum hue, maximum hue, minimum saturation, maximum saturation, minimum brightness, and maximum brightness.

[0056] In order to more accurately determine the color blocks in the color card image, the color card image can also be preprocessed to remove the noise mixed in the color card image. Optionally, the preprocessing method of the color card image includes but is not limited to one or both of linear filtering and nonlinear filtering. The linear filtering method includes but is not limited to one or more combinations of mean filtering, box filtering, and Gaussian filtering. The nonlinear filtering method includes but is not limited to one or both of median filtering and bilateral filtering.

[0057] Specifically, the electronic device can match the parameter values ​​of the color blocks in the color card image with the parameter calibration thresholds of different colors in the same space to determine the color blocks of each color in the color card image.

[0058] Step 106: Determine the target contour of each color block.

[0059] The target contour of the color block of each color refers to the peripheral area of ​​the color block of each color.

[0060] Step 108 : Based on the target contour of the color block of each color, perform region of interest detection on the color block of each color to obtain the positioning result of the color block of each color in the color card to be detected.

[0061] The region of interest of the color block of each color refers to a partial area determined along a specific length outward from the center point of the color block of each color.

[0062] Optionally, the shape of the region of interest of the color block of each color is consistent with the shape of the color block of each color, and may also be other shapes such as a circle.

[0063] For easier understanding, see Figure 2 The schematic diagram of the effect of the region of interest of the color block of each color in the color card to be detected is shown. Figure 2 The color card to be tested shown includes 24 color blocks (large squares), and different color blocks correspond to different colors ( Figure 2 The color is not shown), and the shape of the region of interest (small box) of each color block is a square.

[0064] The positioning result of the color block of each color may be the coordinate range of the region of interest of the color block of each color.

[0065] In the above-mentioned method for locating color blocks in the color card, when it is necessary to locate the color blocks in the color card, obtain the color card image of the color card to be detected; determine the color blocks of each color in the color card image based on the parameter values ​​of the color blocks in the color card image and the parameter calibration thresholds of different colors; determine the target contours of the color blocks of each color; based on the target contours of the color blocks of each color, perform region of interest detection on the color blocks of each color, and obtain the positioning results of the color blocks of each color in the color card to be detected. In this way, by performing parameter comparison on the color blocks in the color card image, the color blocks of different colors in the color card image are determined, and then the color blocks in the color card are located by determining the contours of the color blocks of each color and the region of interest detection method. Therefore, the positioning accuracy and efficiency of the color blocks in the color card are improved, the labor cost and time cost are reduced, and it is suitable for locating color blocks in batch color cards.

[0066] In one embodiment, based on the parameter values ​​of the color blocks in the color card image and the parameter calibration thresholds of different colors, the color blocks of each color in the color card image are determined, including: converting the color card image from the color space to the color space; matching the parameter calibration thresholds of different colors in the color space with the parameter values ​​of the color blocks to obtain the color blocks of each color in the color card image.

[0067] Wherein, the color space is RGB space, the parameter values ​​of the color block include red (R), green (G), and blue (B), and correspondingly, the parameter calibration thresholds of different colors include the minimum red value, the maximum red value, the minimum green value, the maximum green value, the minimum blue value, and the maximum blue value. The color space is HSV space, the parameter values ​​of the color block include hue (H), saturation (S), and brightness (V), and correspondingly, the parameter calibration thresholds of different colors include the minimum hue value, the maximum hue value, the minimum saturation value, the maximum saturation value, the minimum brightness value, and the maximum brightness value.

[0068] Specifically, after the electronic device obtains the color card image in the color space, it converts the color card image from the color space to the color space based on the spatial conversion relationship between the color space and the color space. Since any color can be uniquely determined by the three dimensions of H, S, and V, each color block in the color card image can be represented by HSV. The matching colors of different color blocks are determined by matching the parameter calibration thresholds of different colors in the color space with the parameter values ​​of the color blocks, thereby obtaining the color blocks of each color in the color card image.

[0069] For ease of understanding, Table 1 shows parameter calibration thresholds for 10 colors.

[0070] Table 1: Parameter calibration thresholds for 10 colors

[0071]

[0072]

[0073] For example, if the HSV parameter value of a color block is: 120, 100, 90, it can be determined that the HSV parameter value of the color block matches the parameter calibration threshold of blue, and the color of the color block is determined to be blue.

[0074] In order to improve the efficiency of determining the color blocks of each color in the color card image, the electronic device can also fine-tune the parameter calibration thresholds of different colors in the color space, and then match the fine-tuned parameter calibration thresholds of different colors with the parameter values ​​of the color blocks to obtain the color blocks of each color in the color card image.

[0075] In the above scheme, the color card image in the color space is converted into the color space, and the color blocks of each color in the color card image are accurately determined by matching the parameter values ​​of the color blocks with the parameter calibration thresholds of different colors in the color space.

[0076] In one embodiment, based on the parameter values ​​of the color blocks in the color card image and the parameter calibration thresholds of different colors, the color blocks of each color in the color card image are determined, including: in the color space where the color card image is located, the parameter calibration thresholds of different colors contained in the color space are matched with the parameter values ​​of the color blocks to obtain the color blocks of each color in the color card image.

[0077] Specifically, the electronic device obtains a color card image in a color space. Since any color can be uniquely determined by the three dimensions of R, G, and B, each color block in the color card image can be represented by RGB. Then, directly in the color space, the parameter calibration thresholds of the different colors contained in the color space are matched with the parameter values ​​of the color blocks to determine the matching colors of the different color blocks, thereby obtaining the color blocks of each color in the color card image.

[0078] In the above scheme, after the color card image is acquired in the color space, the color blocks of each color in the color card image are accurately determined directly in the color space by matching the parameter values ​​of the color blocks with the parameter calibration thresholds of different colors in the color space.

[0079] In one embodiment, determining the target contour of the color block of each color includes: performing morphological processing on the color block of each color to obtain the target contour of the color block of each color.

[0080] In this embodiment, morphological processing is performed on color blocks of each color to obtain target contours of the color blocks of each color, including: dilation processing and erosion processing are performed on the color blocks of each color to obtain the initial contours of the color blocks of each color; the color values ​​of the pixels in the contours of the color blocks of each color are obtained, and the color values ​​of the neighboring pixels of the pixel points are determined; based on the color values ​​of the pixels and the color values ​​of the neighboring pixels of the pixel points, noise points are removed from the initial contours of the color blocks of each color to obtain the target contours of the color blocks of each color.

[0081] Specifically, the electronic device first randomly determines the center point in the color block of each color; then, starting from the randomly determined center point in the color block of each color, the color block of each color is opened to realize the corrosion processing and then the expansion processing of the color block of each color, so as to eliminate small objects, or the color block of each color is closed to realize the expansion processing and then the corrosion processing of the color block of each color, so as to fill the small holes inside the object, thereby obtaining the initial contour of the color block of each color; then, the color value of the pixel point on the contour of the color block of each color is read, and at the same time, the color value of the pixel point of the four neighborhoods or eight neighborhoods of the pixel point on the contour is read; then, since the color value of the noise point on the initial contour of the color block of each color is very different from the color value of the pixel point in its neighborhood, the noise point can be removed from the initial contour of the color block of each color based on the difference between the color value of the pixel point and the color value of the neighboring pixel point; finally, based on the remaining pixel points on the initial contour of the color block of each color except the noise point, the target contour of the color block of each color is drawn.

[0082] In the above scheme, the color blocks of each color are firstly expanded and eroded to preliminarily determine the initial contours of the color blocks of each color, and then the initial contours of the color blocks of each color are corrected by combining the color values ​​of the pixels in the contours of the color blocks of each color and the color values ​​of the pixels in the neighborhood of the pixels, so as to accurately determine the target contours of the color blocks of each color.

[0083] In one embodiment, based on the target contour of the color block of each color, the color block of each color is detected for the region of interest to obtain the positioning result of the color block of each color in the color card to be detected, including: determining the center point position of the color block of each color based on the target contour of the color block of each color; determining the position of the region of interest of the color block of each color according to the center point position of the color block of each color, the center point position of the color card to be detected and a preset fixed length; and using the position of the region of interest in the color block of each color as the positioning result of the color block of each color in the color card to be detected.

[0084] The center point position of the color card to be detected refers to the coordinate data of the calibration center of the color card to be detected.

[0085] The preset fixed length refers to a drawing length used to determine the size of the region of interest, and the preset fixed length can be predetermined.

[0086] Specifically, the electronic device first obtains four vertices from the target contour of the color block of each color, and calculates the coordinate average of the four vertices on the target contour of the color block of each color, obtains the coordinates of the center point of the color block of each color, and uses them as the center point position of the color block of each color; then, determines the line segment formed by the center point position of the color block of each color and the center point position of the color card to be detected, and uses the line segment as the hypotenuse, and generates a right triangle based on the center point position of the color block of each color and the center point position of the color card to be detected; then, uses the directions of the two right-angled sides of the right triangle as the drawing directions of the regions of interest of the color blocks of each color; then, starting from the center point position of the color block of each color, draws a preset fixed length according to the drawing direction of the regions of interest of the color blocks of each color, and obtains the positions of the regions of interest of the color blocks of each color; then, uses the positions of the regions of interest in the color blocks of each color as the positioning results of the color blocks of each color in the color card to be detected.

[0087] In the above scheme, the center point position of each color block is first determined based on the target contour of the color block of each color, and then the center point position of each color block, the center point position of the color card to be detected and the preset fixed length are combined to accurately determine the positioning result of the color block of each color in the color card to be detected.

[0088] In one embodiment, based on the target contour of the color block of each color, the color block of each color is detected for the region of interest to obtain the positioning result of the color block of each color in the color card to be detected, including: determining the target contour of the color card to be detected; calculating the contour proportion of the color block of each color based on the target contour of the color block of each color and the target contour of the color card to be detected; determining the shrinkage ratio of the color block of each color according to the contour proportion of the color block of each color and the shrinkage ratios corresponding to different contour proportions; determining the position of the region of interest of the color block of each color based on the target contour of the color block of each color and the shrinkage ratio of the color block of each color; and using the position of the region of interest in the color block of each color as the positioning result of the color block of each color in the color card to be detected.

[0089] The target contour of the color card to be detected refers to the peripheral area of ​​the color card to be detected.

[0090] The contour proportion of the color block of each color refers to the ratio of the peripheral area of ​​the color block of each color to the peripheral area of ​​the color card to be detected.

[0091] Specifically, the electronic device first obtains four vertices from the color card to be detected, and determines the target contour of the color card to be detected based on the positions of the four vertices; then, the ratio between the target contour of the color block of each color and the target contour of the color card to be detected is calculated to obtain the contour proportion of the color block of each color; then, based on the contour proportion of the color block of each color and the shrinkage proportions corresponding to different contour proportions, the shrinkage proportion of the color block of each color is determined; finally, according to the shrinkage proportion of the color block of each color, the target contour of the color block of each color is shrunk inward to obtain the position of the area of ​​interest of the color block of each color, thereby obtaining the positioning result of the color block of each color in the color card to be detected.

[0092] In the above scheme, the target contour of the color card to be detected is first determined, and then the shrinkage ratio of each color block is determined based on the contour ratio of the color block of each color. Finally, the target contour of the color block of each color and the shrinkage ratio of the color block of each color are combined to accurately determine the positioning result of the color block of each color in the color card to be detected.

[0093] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0094] In one embodiment, Figure 3 As shown, a color block positioning device in a color card is provided, comprising:

[0095] An image acquisition module 301 is used to acquire a color card image of a color card to be detected;

[0096] A color block determination module 302 is used to determine the color blocks of each color in the color card image based on the parameter values ​​of the color blocks in the color card image and parameter calibration thresholds of different colors;

[0097] The contour determination module 303 is used to determine the target contour of the color block of each color;

[0098] The color block positioning module 304 is used to perform region of interest detection on the color blocks of each color based on the target contours of the color blocks of each color, and obtain the positioning results of the color blocks of each color in the color card to be detected.

[0099] Optionally, the color block determination module 302 includes:

[0100] A space conversion unit, used for converting the color card image from a color space to a color space;

[0101] The first matching unit is used to match the parameter calibration thresholds of different colors in the color space with the parameter values ​​of the color blocks to obtain the color blocks of each color in the color card image.

[0102] Optionally, the color block determination module 302 includes:

[0103] The second matching unit is used to match the parameter calibration thresholds of different colors contained in the color space where the color card image is located with the parameter values ​​of the color blocks to obtain the color blocks of each color in the color card image.

[0104] Optionally, the contour determination module 303 includes:

[0105] The morphological processing unit is used to perform morphological processing on the color blocks of each color to obtain the target contours of the color blocks of each color.

[0106] Optionally, the morphological processing unit comprises:

[0107] The expansion and erosion subunit performs expansion processing and erosion processing on the color blocks of each color to obtain the initial outline of the color blocks of each color;

[0108] A color value acquisition subunit is used to acquire the color value of a pixel point in the outline of the color block of each color, and determine the color value of a neighboring pixel point of the pixel point;

[0109] The noise removal subunit is used to remove noise points from the initial contours of the color blocks of each color based on the color value of the pixel point and the color values ​​of the neighboring pixels of the pixel point to obtain the target contours of the color blocks of each color.

[0110] Optionally, the color block positioning module 304 includes:

[0111] A first position determination unit, configured to determine the center point position of the color block of each color based on the target contour of the color block of each color;

[0112] A second position determination unit, configured to determine the position of the region of interest of the color block of each color according to the center point position of the color block of each color, the center point position of the color card to be detected, and a preset fixed length;

[0113] The first positioning unit is used to use the position of the region of interest in the color block of each color as the positioning result of the color block of each color in the color card to be detected.

[0114] Optionally, the color block positioning module 304 includes:

[0115] A target contour determining unit, used to determine the target contour of the color card to be detected;

[0116] A contour ratio determination unit, configured to calculate the contour ratio of the color blocks of each color based on the target contour of the color blocks of each color and the target contour of the color card to be detected;

[0117] A shrinkage ratio determination unit, configured to determine the shrinkage ratio of the color blocks of each color according to the contour ratio of the color blocks of each color and the shrinkage ratios corresponding to different contour ratios;

[0118] a third position determination unit, configured to determine the position of the region of interest of the color block of each color based on the target contour of the color block of each color and the shrinkage ratio of the color block of each color;

[0119] The second positioning unit is used to use the position of the region of interest in the color block of each color as the positioning result of the color block of each color in the color card to be detected.

[0120] The color block positioning device in the color card provided in the embodiment of the present application, when it is necessary to position the color blocks in the color card, obtains the color card image of the color card to be detected; based on the parameter values ​​of the color blocks in the color card image and the parameter calibration thresholds of different colors, determines the color blocks of each color in the color card image; determines the target contour of the color blocks of each color; based on the target contour of the color blocks of each color, performs region of interest detection on the color blocks of each color, and obtains the positioning result of the color blocks of each color in the color card to be detected. In this way, by performing parameter comparison on the color blocks in the color card image, the color blocks of different colors in the color card image are determined, and then the color blocks in the color card are positioned by determining the contours of the color blocks of each color and the region of interest detection method. Therefore, the positioning accuracy and efficiency of the color blocks in the color card are improved, the labor cost and time cost are reduced, and it is suitable for positioning the color blocks in batch color cards.

[0121] For the specific definition of the color block positioning device in the color card, please refer to the definition of the color block positioning method in the color card above, which will not be repeated here. Each module in the color block positioning device in the color card can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0122] In one embodiment, an electronic device is provided. The electronic device may be a terminal device or a server, and its internal structure diagram may be as follows: Figure 4As shown. The electronic device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the electronic device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a method for classifying short messages is implemented. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the housing of the electronic device, or an external keyboard, touchpad or mouse, etc.

[0123] Those skilled in the art will understand that Figure 4 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0124] In one embodiment, the color block positioning device in the color card provided by the present application can be implemented in the form of a computer program. The computer program can be Figure 4 The memory of the electronic device may store various program modules constituting the color block positioning device in the color card, for example, Figure 3 The image acquisition module 301, the color block determination module 302, the contour determination module 303, and the color block positioning module 304 are shown. The computer program composed of various program modules enables the processor to execute the steps of the color block positioning method in the color card of each embodiment of the present application described in this specification.

[0125] For example, Figure 4 The electronic device shown can be Figure 3 The image acquisition module 301 in the device shown is used to acquire a color card image of a color card to be detected; the color block determination module 302 is used to determine the color blocks of each color in the color card image based on the parameter values ​​of the color blocks in the color card image and the parameter calibration thresholds of different colors; the contour determination module 303 is used to determine the target contour of the color blocks of each color; the color block positioning module 304 is used to perform region of interest detection on the color blocks of each color based on the target contour of the color blocks of each color, and obtain the positioning result of the color blocks of each color in the color card to be detected.

[0126] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining a color card image of the color card to be detected; determining the color blocks of each color in the color card image based on the parameter values ​​of the color blocks in the color card image and the parameter calibration thresholds of different colors; determining the target contours of the color blocks of each color; and performing region of interest detection on the color blocks of each color based on the target contours of the color blocks of each color to obtain the positioning results of the color blocks of each color in the color card to be detected.

[0127] In one embodiment, when the processor executes the computer program, the following steps are also implemented: the color blocks of each color in the color card image are determined based on the parameter values ​​of the color blocks in the color card image and the parameter calibration thresholds of different colors, including: converting the color card image from a color space to a color space; matching the parameter calibration thresholds of different colors in the color space with the parameter values ​​of the color blocks to obtain the color blocks of each color in the color card image.

[0128] In one embodiment, when the processor executes the computer program, the following steps are also implemented: the color blocks of each color in the color card image are determined based on the parameter values ​​of the color blocks in the color card image and the parameter calibration thresholds of different colors, including: in the color space where the color card image is located, the parameter calibration thresholds of different colors contained in the color space are matched with the parameter values ​​of the color blocks to obtain the color blocks of each color in the color card image.

[0129] In one embodiment, when the processor executes the computer program, the following steps are further implemented: the determining of the target contour of the color block of each color includes: performing morphological processing on the color block of each color to obtain the target contour of the color block of each color.

[0130] In one embodiment, the processor further implements the following steps when executing the computer program: the morphological processing is performed on the color blocks of each color to obtain the target contours of the color blocks of each color, including: dilation processing and erosion processing are performed on the color blocks of each color to obtain the initial contours of the color blocks of each color; the color values ​​of the pixels in the contours of the color blocks of each color are obtained, and the color values ​​of the neighboring pixels of the pixels are determined; based on the color values ​​of the pixels and the color values ​​of the neighboring pixels of the pixels, noise points are removed from the initial contours of the color blocks of each color to obtain the target contours of the color blocks of each color.

[0131] In one embodiment, when the processor executes the computer program, the following steps are also implemented: based on the target contours of the color blocks of each color, the color blocks of each color are detected with respect to the region of interest to obtain the positioning results of the color blocks of each color in the color card to be detected, including: based on the target contours of the color blocks of each color, the center point positions of the color blocks of each color are determined; according to the center point positions of the color blocks of each color, the center point positions of the color card to be detected and a preset fixed length, the positions of the regions of interest of the color blocks of each color are determined; and the positions of the regions of interest in the color blocks of each color are used as the positioning results of the color blocks of each color in the color card to be detected.

[0132] In one embodiment, when the processor executes the computer program, the following steps are also implemented: based on the target contours of the color blocks of each color, the color blocks of each color are detected with respect to the region of interest to obtain the positioning results of the color blocks of each color in the color card to be detected, including: determining the target contour of the color card to be detected; calculating the contour proportion of the color blocks of each color based on the target contours of the color blocks of each color and the target contour of the color card to be detected; determining the shrinkage ratio of the color blocks of each color according to the contour proportion of the color blocks of each color and the shrinkage ratios corresponding to different contour proportions; determining the position of the region of interest of the color blocks of each color based on the target contours of the color blocks of each color and the shrinkage ratio of the color blocks of each color; and using the position of the region of interest in the color blocks of each color as the positioning result of the color blocks of each color in the color card to be detected.

[0133] In the embodiment of the present application, when it is necessary to locate the color blocks in the color card, a color card image of the color card to be detected is obtained; based on the parameter values ​​of the color blocks in the color card image and the parameter calibration thresholds of different colors, the color blocks of each color in the color card image are determined; the target contours of the color blocks of each color are determined; based on the target contours of the color blocks of each color, the color blocks of each color are detected by the region of interest, and the positioning results of the color blocks of each color in the color card to be detected are obtained. In this way, the color blocks of different colors in the color card image are determined by performing parameter comparison on the color blocks in the color card image, and then the color blocks in the color card are located by determining the contours of the color blocks of each color and the region of interest detection method. Therefore, the positioning accuracy and efficiency of the color blocks in the color card are improved, the labor cost and time cost are reduced, and it is suitable for locating the color blocks in batches of color cards.

[0134] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: obtaining a color card image of a color card to be detected; determining color blocks of each color in the color card image based on parameter values ​​of color blocks in the color card image and parameter calibration thresholds of different colors; determining target contours of color blocks of each color; and performing region of interest detection on the color blocks of each color based on the target contours of the color blocks of each color to obtain positioning results of color blocks of each color in the color card to be detected.

[0135] In one embodiment, when the processor executes the computer program, the following steps are also implemented: the color blocks of each color in the color card image are determined based on the parameter values ​​of the color blocks in the color card image and the parameter calibration thresholds of different colors, including: converting the color card image from a color space to a color space; matching the parameter calibration thresholds of different colors in the color space with the parameter values ​​of the color blocks to obtain the color blocks of each color in the color card image.

[0136] In one embodiment, when the processor executes the computer program, the following steps are also implemented: the color blocks of each color in the color card image are determined based on the parameter values ​​of the color blocks in the color card image and the parameter calibration thresholds of different colors, including: in the color space where the color card image is located, the parameter calibration thresholds of different colors contained in the color space are matched with the parameter values ​​of the color blocks to obtain the color blocks of each color in the color card image.

[0137] In one embodiment, when the processor executes the computer program, the following steps are further implemented: the determining of the target contour of the color block of each color includes: performing morphological processing on the color block of each color to obtain the target contour of the color block of each color.

[0138] In one embodiment, the processor further implements the following steps when executing the computer program: the morphological processing is performed on the color blocks of each color to obtain the target contours of the color blocks of each color, including: dilation processing and erosion processing are performed on the color blocks of each color to obtain the initial contours of the color blocks of each color; the color values ​​of the pixels in the contours of the color blocks of each color are obtained, and the color values ​​of the neighboring pixels of the pixels are determined; based on the color values ​​of the pixels and the color values ​​of the neighboring pixels of the pixels, noise points are removed from the initial contours of the color blocks of each color to obtain the target contours of the color blocks of each color.

[0139] In one embodiment, when the processor executes the computer program, the following steps are also implemented: based on the target contours of the color blocks of each color, the color blocks of each color are detected with respect to the region of interest to obtain the positioning results of the color blocks of each color in the color card to be detected, including: based on the target contours of the color blocks of each color, the center point positions of the color blocks of each color are determined; according to the center point positions of the color blocks of each color, the center point positions of the color card to be detected and a preset fixed length, the positions of the regions of interest of the color blocks of each color are determined; and the positions of the regions of interest in the color blocks of each color are used as the positioning results of the color blocks of each color in the color card to be detected.

[0140] In one embodiment, when the processor executes the computer program, the following steps are also implemented: based on the target contours of the color blocks of each color, the color blocks of each color are detected with respect to the region of interest to obtain the positioning results of the color blocks of each color in the color card to be detected, including: determining the target contour of the color card to be detected; calculating the contour proportion of the color blocks of each color based on the target contours of the color blocks of each color and the target contour of the color card to be detected; determining the shrinkage ratio of the color blocks of each color according to the contour proportion of the color blocks of each color and the shrinkage ratios corresponding to different contour proportions; determining the position of the region of interest of the color blocks of each color based on the target contours of the color blocks of each color and the shrinkage ratio of the color blocks of each color; and using the position of the region of interest in the color blocks of each color as the positioning result of the color blocks of each color in the color card to be detected.

[0141] In the embodiment of the present application, when it is necessary to locate the color blocks in the color card, a color card image of the color card to be detected is obtained; based on the parameter values ​​of the color blocks in the color card image and the parameter calibration thresholds of different colors, the color blocks of each color in the color card image are determined; the target contours of the color blocks of each color are determined; based on the target contours of the color blocks of each color, the color blocks of each color are detected by the region of interest, and the positioning results of the color blocks of each color in the color card to be detected are obtained. In this way, the color blocks of different colors in the color card image are determined by performing parameter comparison on the color blocks in the color card image, and then the color blocks in the color card are located by determining the contours of the color blocks of each color and the region of interest detection method. Therefore, the positioning accuracy and efficiency of the color blocks in the color card are improved, the labor cost and time cost are reduced, and it is suitable for locating the color blocks in batches of color cards.

[0142] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in various forms, such as static random access memory (SRAM) and dynamic random access memory (DRAM).

[0143] The technical features of the above embodiments may be arbitrarily combined. 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 specification.

[0144] The above 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 invention patent. 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 patent of the present application shall be subject to the attached claims.

Claims

1. A method for locating color blocks in a color card, characterized in that: include: Obtain a color card image of a color card to be detected; Determining the color blocks of each color in the color card image based on the parameter values ​​of the color blocks in the color card image and parameter calibration thresholds of different colors; Determine the target outline of each color block; Based on the target contours of the color blocks of each color, the region of interest detection is performed on the color blocks of each color to obtain the positioning results of the color blocks of each color in the color card to be detected.

2. The method according to claim 1, characterized in that The step of determining the color blocks of each color in the color card image based on the parameter values ​​of the color blocks in the color card image and parameter calibration thresholds of different colors includes: Converting the color card image from a color space to a color space; The parameter calibration thresholds of different colors in the color space are matched with the parameter values ​​of the color blocks to obtain the color blocks of each color in the color card image.

3. The method according to claim 1, characterized in that The step of determining the color blocks of each color in the color card image based on the parameter values ​​of the color blocks in the color card image and parameter calibration thresholds of different colors includes: In the color space where the color card image is located, the parameter calibration thresholds of different colors contained in the color space are matched with the parameter values ​​of the color blocks to obtain the color blocks of each color in the color card image.

4. The method according to claim 1, characterized in that: Determining the target contour of the color block of each color includes: Morphological processing is performed on the color blocks of each color to obtain target contours of the color blocks of each color.

5. The method according to claim 4, characterized in that The performing morphological processing on the color blocks of each color to obtain the target contour of the color blocks of each color includes: Performing expansion and corrosion processing on the color blocks of each color to obtain the initial outlines of the color blocks of each color; Obtaining the color value of a pixel in the outline of the color block of each color, and determining the color value of a neighboring pixel of the pixel; Based on the color value of the pixel and the color values ​​of the neighboring pixels of the pixel, noise points are removed from the initial contours of the color blocks of each color to obtain the target contours of the color blocks of each color.

6. The method according to claim 1, characterized in that The step of performing region of interest detection on the color blocks of each color based on the target contour of the color blocks of each color to obtain the positioning result of the color blocks of each color in the color card to be detected includes: Determining the center point position of the color block of each color based on the target contour of the color block of each color; Determine the position of the region of interest of the color block of each color according to the center point position of the color block of each color, the center point position of the color card to be detected, and a preset fixed length; The position of the region of interest in the color block of each color is used as the positioning result of the color block of each color in the color card to be detected.

7. The method according to claim 1, characterized in that The step of performing region of interest detection on the color blocks of each color based on the target contour of the color blocks of each color to obtain the positioning result of the color blocks of each color in the color card to be detected includes: Determine the target contour of the color card to be detected; Calculating the contour proportion of the color blocks of each color based on the target contour of the color block of each color and the target contour of the color card to be detected; Determining the shrinkage ratio of the color blocks of each color according to the outline ratio of the color blocks of each color and the shrinkage ratios corresponding to the different outline ratios; Determining the position of the region of interest of the color block of each color based on the target contour of the color block of each color and the shrinkage ratio of the color block of each color; The position of the region of interest in the color block of each color is used as the positioning result of the color block of each color in the color card to be detected.

8. A color block positioning device for a color card, characterized in that: include: An image acquisition module, used to acquire a color card image of a color card to be detected; A color block determination module, used to determine the color blocks of each color in the color card image based on the parameter values ​​of the color blocks in the color card image and parameter calibration thresholds of different colors; A contour determination module, used to determine the target contour of each color block; The color block positioning module is used to perform region of interest detection on the color blocks of each color based on the target contours of the color blocks of each color, and obtain the positioning results of the color blocks of each color in the color card to be detected.

9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.