Geometric transformation-based 24-color card color block position identification method
The geometric transformation method recognizes the color block positions of 24 color cards, which solves the problem of manual intervention and position relationship neglect in the prior art, and realizes automated, accurate and efficient color block position matching.
Patent Information
- Application Number
- CN202411306380.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2024-12-31
AI Technical Summary
The existing 24-color card color block position recognition method requires manual intervention to set thresholds, and ignore the relative position relationship between color blocks, resulting in inaccurate recognition results.
Using a geometric transformation method, the color images of 24 color cards are obtained for preprocessing, the rectangular communication domain is identified, the center point distance is calculated, the reference 24 color blocks are constructed, the transformation matrix is generated, and the geometric transformation is performed to match the center position of the color block.
Reduced manual intervention, improved the accuracy and speed of recognition, and significantly improved matching efficiency when processing large-scale images.
Smart Images

Figure CN119228835A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a method for identifying color block positions of a 24-color card based on geometric transformation. Background Art
[0002] Color reproduction is the ability of a camera to reproduce true colors, and is an important factor affecting image quality. For color testing, it is important to measure the camera's color difference, that is, its color shift, color saturation, and white balance effects. For color testing, you can choose a suitable image test card, among which the 24-color card is one of them. It consists of 24 blocks of different colors, and each block represents a specific color. In practical applications, it is necessary to accurately identify the position of each block in the 24-color card for further processing and application.
[0003] In identifying the position of each color block in the 24-color card, the existing solution is usually to obtain contour lines by preprocessing, edge detection, contour extraction, and contour filtering of the image containing the 24-color card, and then filter the contour lines to make the minimum circumscribed rectangle of each contour line, and then cluster the minimum circumscribed rectangle to obtain a specific number of rectangles, and finally sort the specific rectangles according to the threshold value, and the sorted rectangles are the detected 24 color blocks.
[0004] However, existing technologies still have some problems in practical applications. First, existing technologies usually require manual intervention, for example, thresholds need to be manually set for certain processing, which is not only time-consuming and labor-intensive, but may also lead to errors due to subjective factors. Second, existing technologies often ignore the relative position relationship between color blocks, which may lead to inaccurate color block recognition results. Summary of the invention
[0005] In view of the shortcomings of the prior art, the present invention provides a method for identifying the positions of color blocks of a 24-color card based on geometric transformation, which solves the technical problem that the traditional method has inaccurate recognition results when identifying the position of each color block.
[0006] To solve the above technical problems, the present invention provides the following technical solution: a method for identifying color block positions of 24 color cards based on geometric transformation, the method comprising the following steps:
[0007] S1, obtaining a color image I of a 24-color card shot in a color temperature box, and preprocessing the color image I to obtain an image I Close ;
[0008] S2. Identify image I according to constraints Close The rectangular connected domain S in 1 ,S 2 ,…,S n}, and mark the center coordinates corresponding to the center point of each rectangular connected domain S as (X center ,Y center );
[0009] S3, traverse all the center points of the rectangular connected domain S, and calculate the two center points with the farthest distance according to the center coordinates, record them as (X a ,Y a ) and (X b ,Y b );
[0010] S4. Construct 24 reference color blocks based on the relative position relationship between the color blocks, and mark the reference center point of the color block in the reference 24 color blocks.
[0011] S5. Select the two reference center points farthest from each other among the reference 24 color blocks. and and with the center point (X a ,Y a ) and (X b ,Y b ) performs geometric transformation to obtain the transformation matrix P;
[0012] S6. According to the transformation matrix P, the reference center point Perform geometric transformation to find the center coordinates (X mea ,Y mea ).
[0013] Further, in step S2, specifically: a rectangular connected domain recognition method is used to identify the image I Close The rectangular connected domain S in is identified.
[0014] Furthermore, in step S2, the constraint condition is:
[0015] The area of the rectangular connected domain S in the image I Close The identification and screening is carried out within the range of 0.1% to 2.5% of the total area.
[0016] Further, in step S4, the color blocks of the reference 24 color blocks are distributed into 4 rows and 6 columns, the reference center point of the color block is represented by a dot, and the length and width of the color block are both wid.
[0017] Further, in step S4, the reference center point The calculation formula is:
[0018]
[0019] Wherein, m={1,2,…,24}; rem(m-1,6) represents the remainder when m-1 is divided by 6; mod(m-1,6) represents the quotient when m-1 is divided by 6.
[0020] Furthermore, in step S5, the process of solving the transformation matrix P is:
[0021] Assuming the reference center point and With the center point (X a ,Y a ) and (X b ,Y b ) is the transformation matrix of the geometric transformation between , and has:
[0022]
[0023] but:
[0024]
[0025] Among them, p,k∈m and p≠k.
[0026] Further, in step S6, the center position coordinates (X mea ,Y mea ) is:
[0027]
[0028] Among them, X mea ={X mea_1 ,X mea_2 ,…,X mea_m},Y mea = {Y mea_1 ,Y mea_2 ,…,Y mea_m}, m={1,2,…,24}.
[0029] By means of the above technical solution, the present invention provides a method for identifying color block positions of 24 color cards based on geometric transformation, which has at least the following beneficial effects:
[0030] 1. The present invention greatly reduces the need for manual intervention, saves time and manpower, and also reduces errors caused by subjective factors by automatically performing image binarization segmentation, morphological processing, connected domain screening and other operations on images containing 24 color cards.
[0031] 2. When matching the center positions of color blocks, the present invention takes into account the relative position relationship between the color blocks and makes the matching result more accurate through geometric transformation fitting.
[0032] 3. The present invention presets a transformation matrix of the center positions of the reference 24 color blocks and quickly matches the center positions of the color blocks with the transformation matrix, which greatly improves the processing speed. Especially when processing large-scale 24-color card images, the advantage is more obvious. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0034] Figure 1 Schematic diagram of the reference 24 color patches created for the present invention. DETAILED DESCRIPTION
[0035] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific implementation methods, so that the implementation process of how the present application uses technical means to solve technical problems and achieve technical effects can be fully understood and implemented accordingly.
[0036] Please refer to Figure 1 This embodiment proposes a method for identifying the position of a 24-color card color block based on geometric transformation. When matching the center position of the color block, the relative position relationship between the color blocks is taken into account, and the matching result is made more accurate through geometric transformation fitting. The method includes the following steps:
[0037] S1, obtaining a color image I of a 24-color card shot in a color temperature box, and preprocessing the color image I to obtain an image I Close Specifically, first convert the color image I into a grayscale image I Gray , and then use the Otsu method to calculate the global image threshold, and convert the grayscale image I Gray Binarization to obtain image I Binary , use morphological closing operation to image I Binary Processing to obtain image I Close This embodiment performs image binarization segmentation, morphological processing, connected domain screening and other operations on an image containing 24 color cards to find the center position of a rectangular connected domain. This method can effectively reduce manual intervention and improve the efficiency and accuracy of image processing and color recognition.
[0038] S2. Identify image I according to constraints Close The rectangular connected domain S in 1 ,S 2 ,…,s n}, and mark the center coordinates corresponding to the center point of each rectangular connected domain S as (X center ,Y center), specifically, the area of the connected domain in image I Close The range of 0.1% to 2.5% of the total area is used for condition identification and screening of the rectangular connected domain S that meets the conditions. After obtaining the rectangular connected domain S that meets the conditions, the center coordinates of its center point can also be determined and marked at the same time, then X center ={X center_1 ,X center_2 ,…,X center_n},Y center = {Y center_1 ,Y center_2 ,…,Y center_n}; Use the rectangular connected domain recognition method to identify the image I Close The rectangular connected domain S in the image is identified, and the constraint condition is: the area of the rectangular connected domain S is in the image I Close The identification and screening is carried out within the range of 0.1% to 2.5% of the total area.
[0039] S3, traverse all the center points of the rectangular connected domain S, and calculate the two center points with the farthest distance according to the center coordinates, record them as (X a ,Y a ) and (X b ,Y b ); Specifically, two rectangular connected domains S n The distance between them is calculated using the Euclidean distance, so the two center points with the farthest distance are the two points with the farthest Euclidean distance. The two centers with the farthest distance among the center positions of all rectangular connected domains are calculated, such as Figure 1 The center positions of color block 19 and color block 6. Assume that the center coordinates of the two points are (X center_i ,Y center_i ) and (X center_j ,Y center_j ), then the Euclidean distance D between two points i,j The calculation formula is:
[0040]
[0041] Among them, i=1,2,…,n, j=1,2,…,n, and i≠j.
[0042] S4. Construct 24 reference color blocks based on the relative position relationship between the color blocks, and mark the reference center point of the color block in the reference 24 color blocks. but And m={1,2,…,24}; Figure 1 As shown in the figure, the color blocks of the reference 24 color blocks are distributed in 4 rows and 6 columns. The reference center point of the color block is represented by a dot, and the length and width of the color block are both wid. The calculation formula is:
[0043]
[0044] Among them, rem(m-1,6) represents the remainder when m-1 is divided by 6; mod(m-1,6) represents the quotient when m-1 is divided by 6.
[0045] The reference 24 color blocks constructed in this embodiment have color block center positions distributed in 4 rows and 6 columns, the distance between the center positions of adjacent color blocks in the same row and the same column is d, and the color blocks are marked in sequence as color block 1, color block 2, color block 3, color block 4, color block 5, ... color block 24. This method can make full use of the relative position relationship between color blocks and improve the accuracy of color block center position matching.
[0046] S5. Select the two reference center points farthest from each other among the reference 24 color blocks. and and with the center point (X a ,Y a ) and (X b ,Y b ) is geometrically transformed to obtain the transformation matrix P; the solution process of the transformation matrix P is:
[0047] Assuming the reference center point and With the center point (X a ,Y a ) and (X b ,Y a ) is the transformation matrix of the geometric transformation between , and has:
[0048]
[0049] but:
[0050]
[0051] Among them, p,k∈m and p≠k.
[0052] In this embodiment, for the two reference center points that are farthest apart in the reference 24 color blocks, and The selection can be achieved by the same method as step S3, that is, calculating the Euclidean distance between the two reference center points to select the two reference center points with the farthest distance, where Figure 1 As shown, the two reference center points with the farthest distance correspond to color block 19 and color block 6. The two reference center points are Assuming the transformation matrix is P, we have:
[0053]
[0054] Then the transformation matrix P can be calculated:
[0055]
[0056] After obtaining the transformation matrix P, the reference center point of each color block on the reference 24 color blocks and the rectangular connected domain S can be determined. n The conversion relationship between the corresponding center points can quickly obtain the center position of each color block. In this embodiment, the center coordinates of the reference color block 19 and the color block 6 are compared with the center points (X a ,Y a ) and (X b ,Y b ) to perform geometric transformation fitting. This method can improve the processing speed and efficiency when processing large-scale 24-color card images.
[0057] S6. According to the transformation matrix P, the reference center point Perform geometric transformation to find the center coordinates (X mea ,Y mea ),Right now:
[0058]
[0059] Among them, X mea ={X mea_1 ,X mea_2 ,…,X mea_m},Y mea = {Y mea_1 ,Y mea_2 ,…,Y mea_m}, m = {1, 2, ..., 24}; the obtained (X mea ,Y mea ) is the center position coordinates of the 24 color blocks of the 24-color card image to be tested. This method can further improve the accuracy of color block center position matching.
[0060] According to the above embodiments, the present application has the following beneficial effects:
[0061] 1. High degree of automation: This technical solution greatly reduces the need for manual intervention, saves time and manpower, and also reduces errors caused by subjective factors by automatically performing image binary segmentation, morphological processing, connected domain screening and other operations on images containing 24 color cards.
[0062] 2. High matching accuracy: This technical solution takes into account the relative position relationship between color blocks when matching the center position of color blocks, and makes the matching result more accurate through geometric transformation fitting.
[0063] 3. Fast processing speed: This technical solution quickly matches the center position of the color block with the transformation matrix by presetting the reference 24 color block center positions, which greatly improves the processing speed. Especially when processing large-scale 24-color card images, the advantage is more obvious.
[0064] Those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a program, so the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0065] Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the above embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0066] The above implementation methods have been described in detail. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for identifying color block positions of 24 color cards based on geometric transformation, characterized in that: The method comprises the following steps: S1, obtaining a color image I of a 24-color card shot in a color temperature box, and preprocessing the color image I to obtain an image I Close ; S2. Identify image I according to constraints Close The rectangular connected domain S in the n }, and mark the center coordinates corresponding to the center point of each rectangular connected domain S as (X center , Y center ); S3, traverse all the center points of the rectangular connected domain S, and calculate the two center points with the farthest distance according to the center coordinates, record them as (X a , Y a ) and (X b , Y b ); S4. Construct 24 reference color blocks based on the relative position relationship between the color blocks, and mark the reference center point of the color block in the reference 24 color blocks. S5. Select the two reference center points farthest from each other among the reference 24 color blocks. and and with the center point (X a , Y a ) and (X b , Y b ) performs geometric transformation to obtain the transformation matrix P; S6. According to the transformation matrix P, the reference center point Perform geometric transformation to find the center coordinates of the 24 color blocks corresponding to the color image I 2. The method for identifying color block positions of 24 color cards according to claim 1, characterized in that: In step S2, specifically: a rectangular connected domain recognition method is used to identify the image I Close The rectangular connected domain S in is identified.
3. The method for identifying color block positions of 24 color cards according to claim 1, characterized in that: In step S2, the constraints are: The area of the rectangular connected domain S in the image I Close The identification and screening is carried out within the range of 0.1% to 2.5% of the total area.
4. The method for identifying color block positions of 24 color cards according to claim 1, characterized in that: In step S4, the color blocks of the reference 24 color blocks are distributed into 4 rows and 6 columns, the reference center point of the color block is represented by a dot, and the length and width of the color block are both wid.
5. The method for identifying color block positions of 24 color cards according to claim 1, characterized in that: In step S4, the reference center point The calculation formula is: Wherein, m={1,2,…,24}; rem(m-1,6) represents the remainder when m-1 is divided by 6; mod(m-1,6) represents the quotient when m-1 is divided by 6.
6. The method for identifying color block positions of 24 color cards according to claim 1, characterized in that: In step S5, the process of solving the transformation matrix P is: Assuming the reference center point and With the center point (X a ,Y a ) and (X b ,Y b ) is the transformation matrix of the geometric transformation between , and has: but: Among them, p,k∈m and p≠k.
7. The method for identifying color block positions of 24 color cards according to claim 1, characterized in that: In step S6, the center position coordinates (X mea ,Y mea ) is: Among them, X mea = {X mea_1 , X mea_2 , …, X mea_m}, Y mea = {Y mea_1 , Y mea_2 , …, Y mea_m}, m = {1, 2, …, 24}.
