Automatic color matching configuration method and apparatus suitable for marble
By recognizing marble images and generating baseline outlines, and automatically matching colors based on color proportions and pattern distribution, the problem of low efficiency in manual color matching in marble restoration is solved, achieving precise restoration and improved efficiency.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- CHINA CONSTR ENG DESIGN & RES INST CO LTD
- Filing Date
- 2024-12-25
- Publication Date
- 2026-07-02
AI Technical Summary
Existing marble color matching technologies suffer from problems such as significant differences between the resulting color and the original pattern, or the need for manual operation, leading to a waste of manpower.
By acquiring images of the marble to be repaired, identifying the outline to be repaired and generating a reference outline, determining the reference area, automatically matching colors based on color proportion and pattern distribution, forming a base coating, and generating a historical record.
It achieves precise color matching in marble repair areas, improving repair results and efficiency while reducing human intervention.
Smart Images

Figure CN2024142429_02072026_PF_FP_ABST
Abstract
Description
Automatic color matching method and apparatus for marble Technical Field
[0001] This invention relates to data processing technology, and more particularly to an automatic color matching method and apparatus suitable for marble. Background Technology
[0002] Marble possesses high compressive strength and excellent physical and chemical properties, and is easy to process. With economic development, its application scope is constantly expanding, and its usage is increasing, playing a vital role in people's lives. Especially in the last decade or so, large-scale mining, industrial processing, and international trade have led to a massive influx of decorative marble into the building decoration industry, used not only in luxurious public buildings but also in home decoration. However, imperfections such as dents or cracks may occur due to daily use, requiring timely repair.
[0003] The inventors discovered in their research that after polishing and repairing marble with imperfections such as dents or cracks, a crucial step is precisely color matching the surface of the repaired area to ensure the overall repair effect. Existing color matching techniques sometimes produce results that differ significantly from the original marble pattern, or require manual color matching, wasting considerable manpower. Summary of the Invention
[0004] In view of the above problems, the present invention is proposed to provide an automatic color matching method and apparatus for marble that overcomes or at least partially solves the above problems.
[0005] According to one aspect of the present invention, an automatic color matching configuration method suitable for marble is provided, comprising the following steps:
[0006] Obtain an image of the marble to be repaired, and perform image recognition based on the image to determine the repair contour located in the image;
[0007] In the image to be repaired, a reference contour is generated by extending outward along the contour to be repaired by a preset distance, and the area between the reference contour and the contour to be repaired is defined as the reference area.
[0008] The base coating is filled into the area to be repaired within the contour to be repaired, forming an initial base coating;
[0009] The base pixel value is determined based on the color proportion of the reference area, and the initial base coating is color matched based on the base pixel value to obtain the current base coating;
[0010] Based on the pattern distribution of the reference area, the current base coating is color-matched to obtain the repaired area, and the marble to be repaired is identified as the repaired marble.
[0011] Obtain the repaired image of the marble, and generate a history bar based on the repaired image and the image to be repaired.
[0012] Optionally, in the method according to the present invention, acquiring an image of the marble to be repaired and performing image recognition based on the image to determine the repair contour located in the image includes:
[0013] The ambient light intensity is obtained and compared with a preset intensity.
[0014] When the light intensity is less than or equal to the preset intensity, the preset lighting plugin is invoked, and the marble to be repaired is illuminated based on the preset lighting plugin;
[0015] A preset photo-taking plugin is invoked, and an image of the marble to be repaired is acquired based on the preset photo-taking plugin to obtain the image of the marble to be repaired.
[0016] The image to be repaired is input into a pre-trained image recognition model to determine the contour to be repaired located in the image.
[0017] Optionally, in the method according to the present invention, a reference contour is generated by extending a predetermined distance outward along the contour to be repaired in the image to be repaired, and the region between the reference contour and the contour to be repaired is determined as a reference region, including:
[0018] Based on the contour to be repaired, a circumcircle with which it has an external relationship is determined, and the radius of the circumcircle is determined to be a preset distance;
[0019] An initial contour is generated by extending a preset distance outward along the contour to be repaired, and it is determined whether the contour lines of the initial contour are all located within the image frame of the image to be repaired.
[0020] When at least a portion of the initial contour is outside the image to be repaired, the initial contour is updated based on the image frame of the image to be repaired to obtain a reference contour located in the image frame, and the region between the reference contour and the contour to be repaired is determined as the reference region.
[0021] Optionally, in the method according to the present invention, updating the initial contour based on the image frame of the image to be repaired to obtain a reference contour located in the image frame includes:
[0022] When all contour lines of the initial contour are outside the image to be repaired, the image frame of the image to be repaired is determined as the reference contour; or
[0023] When a portion of the initial contour line is outside the image to be repaired, each individual line segment in the portion contour line is determined.
[0024] Obtain the first intersection point and the second intersection point between each independent line segment and the image frame, and divide the image frame based on the first intersection point and the second intersection point to obtain the updated line segment corresponding to the independent line segment;
[0025] The initial contour is updated based on the updated line segment corresponding to each independent line segment to obtain the reference contour located in the image frame.
[0026] Optionally, in the method according to the present invention, determining the base pixel value based on the color proportion of the reference region, and performing base color matching based on the base pixel value on the initial base coating to obtain the current base coating includes:
[0027] Obtain each reference pixel point located in the reference region, and determine the reference pixel value corresponding to each reference pixel point respectively;
[0028] Multiple preset pixel value ranges are retrieved, and the reference pixel points corresponding to each reference pixel value in the same preset pixel value range are divided into groups to obtain each reference pixel group.
[0029] The number of pixels in each reference pixel group is counted to obtain the statistical counts for each reference pixel group.
[0030] Determine the pixel with the largest statistical count in each baseline pixel group, and define its corresponding preset pixel value range as the base interval;
[0031] Obtain the maximum and minimum endpoint values in the base interval, and calculate the mean value based on the maximum and minimum endpoint values to obtain the base pixel value;
[0032] The initial base coating is then subjected to base color matching based on the base pixel values to obtain the current base coating.
[0033] Optionally, in the method according to the invention, performing regional color matching on the current substrate coating based on the pattern distribution of the reference area to obtain the repaired area includes:
[0034] Obtain each pattern type located in the reference area, wherein different pattern types correspond to different pattern elements;
[0035] When at least two pattern elements belonging to the same pattern type extend to different positions connected to the outline to be repaired, the at least two pattern elements are extended to form a transition area that is connected to each other in a direction toward the area to be repaired.
[0036] The repaired areas are obtained by performing regional color matching based on the pattern type on each of the transition areas.
[0037] Optionally, in the method according to the invention, the method further includes:
[0038] Identify the pattern types that are far from the contour to be repaired, and determine the number of each reference element in the reference area for each pattern element corresponding to each pattern type.
[0039] Obtain the region ratio between the reference region and the region to be repaired, and determine the number of each repair element corresponding to the number of each reference element based on the region ratio;
[0040] Each pattern element corresponding to the number of each repair element is generated randomly in the area to be repaired, and each pattern element is assigned a regional color scheme based on the pattern type.
[0041] Optionally, in the method according to the invention, acquiring a repaired image of the repaired marble and generating a history bar based on the repaired image and the image to be repaired includes:
[0042] Retrieve the historical repair form, wherein the historical repair form includes blank record bars arranged in sequence, and each blank record bar includes a time slot and an image slot;
[0043] Select one of the blank record bars in sequence and designate that blank record bar as the record bar to be filled;
[0044] A preset photo-taking plugin is invoked, and an image of the repaired marble is acquired based on the preset photo-taking plugin to obtain the repaired image of the marble and the acquisition time.
[0045] The acquisition time is filled into the time slot, and the repaired image and the image to be repaired are filled into the image slot to obtain the history record bar.
[0046] Optionally, in the method according to the present invention, filling the image slot with the repaired image and the image to be repaired includes:
[0047] The image slot includes a preset blank layer, wherein the preset blank layer includes a first image area and a second image area;
[0048] The repaired image is filled into the first image area, and a first marker box is generated in the first image area to select the repaired area in the repaired image;
[0049] The image to be repaired is filled into the second image area, and a second marker box is generated in the second image area to select the area to be repaired in the image to be repaired.
[0050] Generate indicator box connecting lines, wherein the first end of the indicator box connecting lines is connected to the outline of the first indicator box, and the second end of the indicator box connecting lines is connected to the outline of the second indicator box.
[0051] According to another aspect of the present invention, an automatic color matching device suitable for marble is provided, comprising:
[0052] The recognition module is configured to acquire an image of the marble to be repaired, and perform image recognition based on the image to determine the contour to be repaired located in the image.
[0053] The contour generation module is configured to extend outward along the contour to be repaired by a preset distance in the image to be repaired to generate a reference contour surrounding the contour to be repaired, and to determine the area between the reference contour and the contour to be repaired as the reference area.
[0054] A filling module is configured to fill the area to be repaired within the contour to be repaired with a base coating to form an initial base coating.
[0055] The base color matching module is configured to determine the base pixel value based on the color proportion of the reference area, and to perform base color matching on the initial base coating based on the base pixel value to obtain the current base coating;
[0056] The regional color matching module is configured to perform regional color matching on the current base coating based on the pattern distribution of the reference area, obtain the repaired area, and identify the marble to be repaired as the repaired marble.
[0057] The form creation module is configured to obtain the repaired image of the repaired marble and create a historical repair form based on the repaired image and the image to be repaired.
[0058] According to the present invention, the server first acquires an image of the marble to be repaired and performs image recognition based on the image to determine the contour to be repaired within the image. Then, the server extends a preset distance outward from the contour to be repaired in the image to generate a reference contour surrounding the contour, and defines the area between the reference contour and the contour to be repaired as a reference area. Next, a base coating is filled into the area to be repaired to form an initial base coating. Based on the color proportion of the reference area, the base pixel value is determined, and the initial base coating is color-matched based on the base pixel value to obtain the current base coating. Then, based on the pattern distribution of the reference area, the current base coating is color-matched to obtain the repaired area, and the marble to be repaired is identified as the repaired marble. Finally, a repaired image of the repaired marble is acquired, and a history bar is generated based on the repaired image and the image to be repaired. This invention can objectively match the color of the base coating based on the color proportion of the reference area, greatly improving the repair effect and efficiency of the marble. Attached Figure Description
[0059] Figure 1 shows a flowchart of an automatic color matching configuration method for marble according to an embodiment of the present invention;
[0060] Figure 2 shows a schematic diagram of the machine end structure in this embodiment;
[0061] Figure 3 shows a structural block diagram of an automatic color matching device for marble according to another embodiment of the present invention. Detailed Implementation
[0062] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0063] Marble possesses high compressive strength and excellent physical and chemical properties, and is easy to process. With economic development, its application scope is constantly expanding, and its usage is increasing, playing a vital role in people's lives. Especially in the last decade or so, large-scale mining, industrial processing, and international trade have led to a massive influx of decorative marble into the building decoration industry, used not only in luxurious public buildings but also in home decoration. However, imperfections such as dents or cracks may occur due to daily use, requiring timely repair.
[0064] The inventors discovered in their research that after polishing and repairing marble with imperfections such as dents or cracks, a crucial step is precisely color matching the surface of the repaired area to ensure the overall repair effect. Existing color matching techniques sometimes produce results that differ significantly from the original marble pattern, or require manual color matching, wasting considerable manpower.
[0065] To address the problems existing in the prior art, the inventors proposed the solution of this invention. One embodiment of this invention provides an automatic color matching method suitable for marble, which can be executed in a computing device.
[0066] Figure 1 shows a flowchart of a method 100 according to an embodiment of the present invention, which is adapted to be performed in a computing device.
[0067] As shown in Figure 1, the purpose of method 100 is to implement an automatic color matching method suitable for marble, starting from step 102, which includes the following steps in step 1102:
[0068] Obtain an image of the marble to be repaired, and perform image recognition based on the image to determine the contour to be repaired located in the image.
[0069] For example, in this embodiment, the machine can be understood as a robot with infrared scanning, image acquisition and movement functions. The server controls the machine to acquire images of the marble to be repaired, thereby obtaining an image of the marble to be repaired, i.e. the image to be repaired, and performs image recognition on the image to be repaired. After recognition, the outline of the area to be repaired located in the image to be repaired, i.e. the outline to be repaired, can be determined.
[0070] For example, Figure 2 shows a schematic diagram of the machine end in this embodiment. As shown in Figure 2, the machine end includes a machine body 201 and a movable pulley 202. The movable pulley 202 can drive the machine body 201 to move and complete the corresponding color matching work.
[0071] Furthermore, the aforementioned "acquiring an image of the marble to be repaired, and performing image recognition based on the image to be repaired to determine the repair contour located in the image to be repaired" also includes the following steps:
[0072] The ambient light intensity is obtained and compared with a preset intensity.
[0073] When the light intensity is less than or equal to the preset intensity, the preset lighting plugin is invoked, and the marble to be repaired is illuminated based on the preset lighting plugin;
[0074] A preset photo-taking plugin is invoked, and an image of the marble to be repaired is acquired based on the preset photo-taking plugin to obtain the image of the marble to be repaired.
[0075] The image to be repaired is input into a pre-trained image recognition model to determine the contour to be repaired located in the image.
[0076] For example, in this embodiment, during the process of the server controlling the machine to acquire the image of the marble to be repaired, the server first controls the machine to acquire the current ambient light brightness and compares the brightness with a preset brightness, where the preset brightness can be the minimum brightness that the ambient light needs to reach when the image is acquired.
[0077] Furthermore, when the ambient light intensity is greater than the preset intensity, it indicates that the current ambient light intensity meets the image acquisition conditions. This means that the machine can clearly capture the image of the marble to be repaired under the current ambient light intensity. When the ambient light intensity is less than or equal to the preset intensity, the server controls the machine to retrieve the preset lighting plugin to illuminate the marble to be repaired, achieving the standard brightness for image acquisition. Then, the server further controls the machine to retrieve the preset image capture plugin to acquire the image of the marble to be repaired, obtaining the image of the marble to be repaired after image acquisition. The preset lighting plugin and preset image capture plugin can be pre-programmed onto the machine. The server will retrieve the preset lighting plugin or preset image capture plugin under appropriate usage conditions to achieve the lighting or image capture purpose.
[0078] After obtaining the image of the marble to be repaired, the server will input the image into a pre-trained image recognition model to determine the contour to be repaired in the image.
[0079] Step S104 includes the following:
[0080] In the image to be repaired, a reference contour is generated by extending a preset distance outward along the contour to be repaired, and the area between the reference contour and the contour to be repaired is determined as the reference area.
[0081] For example, in this embodiment, after obtaining the contour to be repaired, the server will extend a preset distance outward along the contour to be repaired in the image to be repaired to generate a contour surrounding the contour to be repaired, namely the reference contour, and determine the area between the contour to be repaired and the reference contour as the reference area. There are no flawed parts in the reference area, that is, the area in the reference area is intact, so it can be used as a reference.
[0082] Furthermore, the aforementioned "generating a reference contour around the contour to be repaired by extending a preset distance outward along the contour to be repaired in the image to be repaired, and determining the region between the reference contour and the contour to be repaired as the reference region" also includes the following steps:
[0083] Based on the contour to be repaired, a circumcircle with which it has an external relationship is determined, and the radius of the circumcircle is determined to be a preset distance;
[0084] An initial contour is generated by extending a preset distance outward along the contour to be repaired, and it is determined whether the contour lines of the initial contour are all located within the image frame of the image to be repaired.
[0085] When at least a portion of the initial contour is outside the image to be repaired, the initial contour is updated based on the image frame of the image to be repaired to obtain a reference contour located in the image frame, and the region between the reference contour and the contour to be repaired is determined as the reference region.
[0086] Furthermore, the aforementioned "updating the initial contour based on the image frame of the image to be repaired to obtain a reference contour located in the image frame" also includes the following steps:
[0087] When all contour lines of the initial contour are outside the image to be repaired, the image frame of the image to be repaired is determined as the reference contour; or
[0088] When a portion of the initial contour line is outside the image to be repaired, each individual line segment in the portion contour line is determined.
[0089] Obtain the first intersection point and the second intersection point between each independent line segment and the image frame, and divide the image frame based on the first intersection point and the second intersection point to obtain the updated line segment corresponding to the independent line segment;
[0090] The initial contour is updated based on the updated line segment corresponding to each independent line segment to obtain the reference contour located in the image frame.
[0091] For example, in this embodiment, the server extends outward by a preset distance along the contour to be repaired to generate an initial contour surrounding the contour to be repaired. The preset distance is calculated by the server generating an outer circle with an outer relationship to the contour to be repaired and determining the radius of the outer circle as the preset distance. This method does not require the management terminal to set additional values, and can quickly obtain the preset distance, while also ensuring that the reference area has a relatively suitable width.
[0092] After determining the initial contour, the server will further determine whether all the contour lines of the generated initial contour are within the image frame of the image to be repaired. If some contour lines of the initial contour are outside the image to be repaired, the server will update the initial contour according to the image frame of the image to be repaired, so as to obtain the contour that is entirely within the image frame, i.e. the reference contour, and determine the area between the reference contour and the contour to be repaired as the reference area.
[0093] It should be noted that the initial contour and the image frame of the image to be repaired generally have three different positional relationships. For example, the first positional relationship can be: the entire contour line of the initial contour is located within the image frame of the image to be repaired; the second positional relationship can be: part of the contour line of the initial contour is located outside the image frame of the image to be repaired; and the third positional relationship can be: the entire contour line of the initial contour is located outside the image frame of the image to be repaired.
[0094] Of these three positional relationships, the initial contours need to be updated for the second and third relationships. The update process specifically includes the following:
[0095] Regarding the second type of positional relationship, since some contour lines of the initial contour are located outside the image frame of the image to be repaired, firstly, we can obtain each independent line segment located outside the image frame of the image to be repaired. Here, an independent line segment can be understood as a contour line that is isolated from other contour lines located outside the image frame of the image to be repaired. That is, each independent line segment will have two intersection points with the image frame of the image to be repaired, namely the first intersection point and the second intersection point. Next, we can divide the image frame based on the first intersection point and the second intersection point to obtain the updated line segment corresponding to the independent line segment. Finally, we update the initial contour based on the updated line segment to obtain the reference contour located in the image frame, thus completing the update of the initial contour.
[0096] For the third type of positional relationship, since the initial contour is entirely outside the image frame of the image to be repaired (that is, the initial contour is surrounded by the image frame of the image to be repaired), and the image to be repaired is obtained for the marble to be repaired, the image frame of the image to be repaired can be directly determined as the reference contour to complete the update of the initial contour.
[0097] Here, the initial contour is updated based on the positional relationship between the initial contour and the image frame of the image to be repaired to obtain the corresponding reference contour. This ensures that the corresponding reference contour is located within the image frame of the image to be repaired, that is, that the area located in the reference contour is the area of the marble to be repaired, thereby ensuring the reference reference and improving the accuracy.
[0098] Step S106 includes the following:
[0099] The base coating is filled into the area to be repaired within the contour to be repaired, forming an initial base coating.
[0100] For example, in this embodiment, since the base of marble is usually one color, and there are patterns and other content on the upper layer of the base, such as a piece of marble being entirely white, there are patterns of other colors on the surface of white marble to increase the richness of the marble's color; therefore, when the server-controlled machine is repairing the marble to be repaired, it will first fill the base part of the area to be repaired with a base coating to form an initial base coating.
[0101] Step S108 includes the following:
[0102] The base pixel value is determined based on the color proportion of the reference area, and the initial base coating is then color-matched based on the base pixel value to obtain the current base coating.
[0103] For example, in this embodiment, since the base color generally accounts for a larger proportion of the color distribution of a marble, while the surface pattern accounts for a smaller proportion, the server first obtains the proportion of each color in the reference area and determines the base pixel value based on the proportion. Then, the initial base coating is color matched based on the base pixel value, and the current base coating is obtained after color matching.
[0104] Furthermore, the aforementioned "determining the base pixel value based on the color proportion of the reference region, and performing base color matching on the initial base coating based on the base pixel value to obtain the current base coating" also includes the following steps:
[0105] Obtain each reference pixel point located in the reference region, and determine the reference pixel value corresponding to each reference pixel point respectively;
[0106] Multiple preset pixel value ranges are retrieved, and the reference pixel points corresponding to each reference pixel value in the same preset pixel value range are divided into groups to obtain each reference pixel group.
[0107] The number of pixels in each reference pixel group is counted to obtain the statistical counts for each reference pixel group.
[0108] Determine the pixel with the largest statistical count in each baseline pixel group, and define its corresponding preset pixel value range as the base interval;
[0109] Obtain the maximum and minimum endpoint values in the base interval, and calculate the mean value based on the maximum and minimum endpoint values to obtain the base pixel value;
[0110] The initial base coating is then subjected to base color matching based on the base pixel values to obtain the current base coating.
[0111] For example, in this embodiment, the server can determine the color proportion of the reference area. First, the server obtains each reference pixel in the reference area and determines the reference pixel value corresponding to each reference pixel. Then, the server retrieves multiple preset pixel value ranges and divides each reference pixel value according to the preset pixel value ranges. Reference pixel values within a preset pixel value range are grouped together, that is, the reference pixels corresponding to each reference pixel value within the same preset pixel value range are grouped together to obtain each reference pixel group. The preset pixel value ranges can be preset by the management terminal according to the actual situation.
[0112] After obtaining each baseline pixel group, the server counts the number of pixels in each baseline pixel group, resulting in the total number of pixels in each baseline pixel group. The server then identifies the baseline pixel group with the largest count, indicating the largest color proportion, and defines its corresponding preset pixel value range as the base range. Since marble may experience slight color changes due to usage time (e.g., oxidation over a long period), the server obtains the maximum and minimum endpoint values within the base range and calculates their average to obtain the base pixel values. These base pixel values are more accurate, and the initial base coating is then color-matched based on these base pixel values to achieve the current base coating, thus improving the repair effect.
[0113] Step S110 includes the following:
[0114] Based on the pattern distribution of the reference area, the current base coating is color-matched to obtain the repaired area, and the marble to be repaired is identified as the repaired marble.
[0115] For example, in this embodiment, after obtaining the current base coating, the server will acquire the pattern distribution of the reference area, and perform regional color matching on the current base coating according to the pattern distribution to obtain the repaired area, and determine the marble to be repaired as the repaired marble.
[0116] Furthermore, the aforementioned "performing regional color matching on the current substrate coating based on the pattern distribution of the reference area to obtain the repaired area" also includes the following steps:
[0117] Obtain each pattern type located in the reference area, wherein different pattern types correspond to different pattern elements;
[0118] When at least two pattern elements belonging to the same pattern type extend to different positions connected to the outline to be repaired, the at least two pattern elements are extended to form a transition area that is connected to each other in a direction toward the area to be repaired.
[0119] The repaired areas are obtained by performing regional color matching based on the pattern type on each of the transition areas.
[0120] For example, in this embodiment, the server obtains various pattern types in the base area. Different pattern types correspond to different pattern elements; for example, the pattern element of the first pattern type is a flower, and the pattern element of the second pattern type is a sun. When two sun patterns are connected to both sides of the outline to be repaired, the area between these two sun patterns in the area to be repaired can be connected to form a transition area. When three sun patterns are connected to both sides of the outline to be repaired, for example, one sun pattern is connected to the left side of the outline to be repaired, and two sun patterns are connected to the right side, the left sun pattern is connected to the two right sun patterns in the area to be repaired to form two transition areas. That is, when at least two pattern elements of the same pattern type extend to different positions on the outline to be repaired and connect, the at least two pattern elements extend towards the area to be repaired to form interconnected transition areas. Then, each transition area is color-matched based on the pattern type, and the repaired area is obtained after color matching.
[0121] Furthermore, the above method also includes the following steps:
[0122] Identify the pattern types that are far from the contour to be repaired, and determine the number of each reference element in the reference area for each pattern element corresponding to each pattern type.
[0123] Obtain the region ratio between the reference region and the region to be repaired, and determine the number of each repair element corresponding to the number of each reference element based on the region ratio;
[0124] Each pattern element corresponding to the number of each repair element is generated randomly in the area to be repaired, and each pattern element is assigned a regional color scheme based on the pattern type.
[0125] For example, in this embodiment, the server identifies pattern types that are not connected to the contour to be repaired in the reference region, i.e., it identifies pattern types far from the contour to be repaired, and calculates the number of pattern elements for each pattern type in the reference region, i.e., the number of reference elements. At this point, the server obtains the region ratio between the reference region and the region to be repaired, and determines the number of pattern elements for each pattern type in the region to be repaired, i.e., the number of repair elements, based on the region ratio. For example, if the region ratio between the reference region and the region to be repaired is 1:1, it indicates that the number of repair elements in the region to be repaired is the same as the number of reference elements in the reference region.
[0126] After determining the number of each baseline element in the area to be repaired, the server will randomly generate pattern elements corresponding to each number of repair elements in the area, and then assign regional colors to each pattern element according to the color of each pattern type. This embodiment can determine the number of each repair element in the area to be repaired based on the area ratio between the baseline area and the area to be repaired, and the number of repair elements calculated in this way is more accurate.
[0127] Step S112 includes the following:
[0128] Obtain the repaired image of the marble, and generate a history bar based on the repaired image and the image to be repaired.
[0129] For example, in this embodiment, after the server determines that the marble has been repaired, it will obtain the repaired image of the marble and generate a history bar based on the repaired image and the image to be repaired, so that the management terminal can view it later.
[0130] Furthermore, the aforementioned "acquiring the repaired image of the repaired marble and generating a history bar based on the repaired image and the image to be repaired" also includes the following steps:
[0131] Retrieve the historical repair form, wherein the historical repair form includes blank record bars arranged in sequence, and each blank record bar includes a time slot and an image slot;
[0132] Select one of the blank record bars in sequence and designate that blank record bar as the record bar to be filled;
[0133] A preset photo-taking plugin is invoked, and an image of the repaired marble is acquired based on the preset photo-taking plugin to obtain the repaired image of the marble and the acquisition time.
[0134] The acquisition time is filled into the time slot, and the repaired image and the image to be repaired are filled into the image slot to obtain the history record bar.
[0135] For example, in this embodiment, after the server completes the repair of the area to be repaired on the control machine, it first retrieves the historical repair form. The historical repair form contains multiple blank record bars arranged in sequence, each with a time slot and an image slot. The server selects a blank record bar in sequence and designates it as the record bar to be filled. It then retrieves a preset camera plugin to capture an image of the repaired marble. After image capture, it obtains the repaired image of the marble and the capture time. The capture time is then filled into the time slot, and the repaired image and the image to be repaired are filled into the image slot. After completing the corresponding filling, a historical record bar is obtained, allowing the management terminal to view information related to the repaired marble in the future.
[0136] Furthermore, the aforementioned "filling the repaired image and the image to be repaired into the image slot" also includes the following steps:
[0137] The image slot includes a preset blank layer, wherein the preset blank layer includes a first image area and a second image area;
[0138] The repaired image is filled into the first image area, and a first marker box is generated in the first image area to select the repaired area in the repaired image;
[0139] The image to be repaired is filled into the second image area, and a second marker box is generated in the second image area to select the area to be repaired in the image to be repaired.
[0140] Generate indicator box connecting lines, wherein the first end of the indicator box connecting lines is connected to the outline of the first indicator box, and the second end of the indicator box connecting lines is connected to the outline of the second indicator box.
[0141] For example, in this embodiment, the server fills the image slots with relevant content. There is a pre-set blank layer in the image slots, namely a preset blank layer, which contains two image areas: a first image area and a second image area. The server fills the first image area with the repaired image and selects the repaired area within that area, generating a first marker box. Next, the server fills the second image area with the image to be repaired and selects the area to be repaired within that area, generating a second marker box. After generating the first and second marker boxes, the server connects them with a connecting line, generating an indicator box connecting line. The first end of the indicator box connecting line connects to the outline of the first marker box, and the second end connects to the outline of the second marker box. This embodiment allows for quick location of the repaired marble area when viewing image-related information on the repaired marble in the future, saving considerable time.
[0142] According to the present invention, the server first acquires an image of the marble to be repaired and performs image recognition based on the image to determine the contour to be repaired within the image. Next, the server extends a preset distance outward from the contour to be repaired in the image to generate a reference contour surrounding the contour, and defines the area between the reference contour and the contour to be repaired as a reference region. Then, a base coating is filled into the region to be repaired to form an initial base coating. Based on the color proportion of the reference region, the base pixel value is determined, and the initial base coating is color-matched based on the base pixel value to obtain the current base coating. Then, based on the pattern distribution of the reference region, the current base coating is color-matched to obtain the repaired area, and the marble to be repaired is identified as the repaired marble. Finally, a repaired image of the repaired marble is acquired, and a history bar is generated based on the repaired image and the image to be repaired. This invention can objectively match the color of the base coating based on the color proportion of the reference region, greatly improving the repair effect and efficiency of marble.
[0143] Another embodiment of the present invention provides an automatic color matching device suitable for marble, and Figure 3 is a block diagram of the corresponding device. The system includes:
[0144] The recognition module is configured to acquire an image of the marble to be repaired, and perform image recognition based on the image to determine the contour to be repaired located in the image.
[0145] The contour generation module is configured to extend outward along the contour to be repaired by a preset distance in the image to be repaired to generate a reference contour surrounding the contour to be repaired, and to determine the area between the reference contour and the contour to be repaired as the reference area.
[0146] A filling module is configured to fill the area to be repaired within the contour to be repaired with a base coating to form an initial base coating.
[0147] The base color matching module is configured to determine the base pixel value based on the color proportion of the reference area, and to perform base color matching on the initial base coating based on the base pixel value to obtain the current base coating;
[0148] The regional color matching module is configured to perform regional color matching on the current base coating based on the pattern distribution of the reference area, obtain the repaired area, and identify the marble to be repaired as the repaired marble.
[0149] The form creation module is configured to obtain the repaired image of the repaired marble and create a historical repair form based on the repaired image and the image to be repaired.
[0150] By way of example, and not limitation, readable media include readable storage media and communication media. Readable storage media stores information such as computer-readable instructions, data structures, program modules, or other data. Communication media generally embodies computer-readable instructions, data structures, program modules, or other data in the form of modulated data signals such as carrier waves or other transmission mechanisms, and includes any information delivery medium. Any combination of the above is also included within the scope of readable media.
[0151] In the specification provided herein, the algorithms and displays are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used with the examples of this invention. The required structure for constructing such systems is apparent from the above description. Furthermore, this invention is not directed to any particular programming language. It should be understood that the contents of the invention described herein can be implemented using various programming languages, and the above description of specific languages is for the purpose of disclosing preferred embodiments of the invention.
[0152] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.
[0153] Similarly, it should be understood that, in order to streamline this disclosure and aid in understanding one or more of the various aspects of the invention, in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof. However, this method of disclosure should not be interpreted as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as reflected in the following claims, inventive aspects lie in fewer than all features of a single foregoing disclosed embodiment. Therefore, the claims following the detailed description are hereby expressly incorporated into this detailed description, wherein each claim itself is a separate embodiment of the invention.
[0154] Those skilled in the art will understand that modules, units, or components of the devices disclosed in the examples herein can be arranged in the devices described in this embodiment, or alternatively, can be located in one or more devices different from the devices in this example. The modules in the foregoing examples can be combined into a single module or, in addition, can be divided into multiple sub-modules.
[0155] Those skilled in the art will understand that modules in the device of the embodiments can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiments can be combined into a single module, unit, or component, and further, they can be divided into multiple sub-modules, sub-units, or sub-components. Except where at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or device so disclosed. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.
[0156] Furthermore, those skilled in the art will understand that although some embodiments described herein include certain features but not others included in other embodiments, combinations of features from different embodiments are intended to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.
[0157] Furthermore, some of the embodiments described herein are methods or combinations of method elements that can be implemented by a processor of a computer system or by other means of performing the functions. Therefore, a processor having the necessary instructions for implementing the methods or method elements forms means for implementing the methods or method elements. Furthermore, the elements described herein in the apparatus embodiments are examples of means for implementing the functions performed by elements for the purposes of carrying out the invention.
[0158] As used herein, unless otherwise specified, the use of ordinal numbers such as “first,” “second,” “third,” etc., to describe ordinary objects merely indicates different instances of similar objects and is not intended to imply that the objects being described must have a given order in time, space, ordering, or any other manner.
[0159] Although the invention has been described with respect to a limited number of embodiments, those skilled in the art will understand from the foregoing description that other embodiments are conceivable within the scope of the invention described herein. Furthermore, it should be noted that the language used in this specification has been chosen primarily for readability and edibility purposes, and not for the purpose of interpreting or limiting the subject matter of the invention. Therefore, many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the appended claims. The disclosure of the invention is illustrative rather than restrictive, and the scope of the invention is defined by the appended claims.
Claims
1. An automatic color matching method for marble, characterized in that, Includes the following steps: Obtain an image of the marble to be repaired, and perform image recognition based on the image to determine the repair contour located in the image; In the image to be repaired, a reference contour is generated by extending outward along the contour to be repaired by a preset distance, and the area between the reference contour and the contour to be repaired is defined as the reference area. The base coating is filled into the area to be repaired within the contour to be repaired, forming an initial base coating; The base pixel value is determined based on the color proportion of the reference area, and the initial base coating is color matched based on the base pixel value to obtain the current base coating; Based on the pattern distribution of the reference area, the current base coating is color-matched to obtain the repaired area, and the marble to be repaired is identified as the repaired marble. Obtain the repaired image of the marble, and generate a history bar based on the repaired image and the image to be repaired.
2. The automatic color matching method for marble according to claim 1, characterized in that, Acquire an image of the marble to be repaired, and perform image recognition based on the image to determine the repair contour located in the image, including: The ambient light intensity is obtained and compared with a preset intensity. When the light intensity is less than or equal to the preset intensity, the preset lighting plugin is invoked, and the marble to be repaired is illuminated based on the preset lighting plugin; A preset photo-taking plugin is invoked, and an image of the marble to be repaired is acquired based on the preset photo-taking plugin to obtain the image of the marble to be repaired. The image to be repaired is input into a pre-trained image recognition model to determine the contour to be repaired located in the image.
3. The automatic color matching method for marble according to claim 1, characterized in that, In the image to be repaired, a reference contour is generated by extending outwards by a predetermined distance along the contour to be repaired, and the region between the reference contour and the contour to be repaired is defined as the reference region, including: Based on the contour to be repaired, a circumcircle with which it has an external relationship is determined, and the radius of the circumcircle is determined to be a preset distance; An initial contour is generated by extending a preset distance outward along the contour to be repaired, and it is determined whether the contour lines of the initial contour are all located within the image frame of the image to be repaired. When at least a portion of the initial contour is outside the image to be repaired, the initial contour is updated based on the image frame of the image to be repaired to obtain a reference contour located in the image frame, and the region between the reference contour and the contour to be repaired is determined as the reference region.
4. The automatic color matching method for marble according to claim 3, characterized in that, The initial contour is updated based on the image frame of the image to be repaired to obtain a reference contour located in the image frame, including: When all contour lines of the initial contour are outside the image to be repaired, the image frame of the image to be repaired is determined as the reference contour; or When a portion of the initial contour line is outside the image to be repaired, each individual line segment in the portion contour line is determined. Obtain the first intersection point and the second intersection point between each independent line segment and the image frame, and divide the image frame based on the first intersection point and the second intersection point to obtain the updated line segment corresponding to the independent line segment; The initial contour is updated based on the updated line segment corresponding to each independent line segment to obtain the reference contour located in the image frame.
5. The automatic color matching method for marble according to claim 1, characterized in that, The base pixel value is determined based on the color proportion of the reference region, and the initial base coating is then color-matched based on the base pixel value to obtain the current base coating, including: Obtain each reference pixel point located in the reference region, and determine the reference pixel value corresponding to each reference pixel point respectively; Multiple preset pixel value ranges are retrieved, and the reference pixel points corresponding to each reference pixel value in the same preset pixel value range are divided into groups to obtain each reference pixel group. The number of pixels in each reference pixel group is counted to obtain the statistical counts for each reference pixel group. Determine the pixel with the largest statistical count in each baseline pixel group, and define its corresponding preset pixel value range as the base interval; Obtain the maximum and minimum endpoint values in the base interval, and calculate the mean value based on the maximum and minimum endpoint values to obtain the base pixel value; The initial base coating is then subjected to base color matching based on the base pixel values to obtain the current base coating.
6. The automatic color matching method for marble according to claim 1, characterized in that, Based on the pattern distribution of the reference area, the current base coating is color-matched to obtain the repaired area, including: Obtain each pattern type located in the reference area, wherein different pattern types correspond to different pattern elements; When at least two pattern elements belonging to the same pattern type extend to different positions connected to the outline to be repaired, the at least two pattern elements extend in a direction toward the area to be repaired to form a transition area that is connected to each other. The repaired areas are obtained by performing regional color matching based on the pattern type on each of the transition areas.
7. The automatic color matching method for marble according to claim 6, characterized in that, The method further includes: Identify the pattern types that are far from the contour to be repaired, and determine the number of each reference element in the reference area for each pattern element corresponding to each pattern type. Obtain the region ratio between the reference region and the region to be repaired, and determine the number of each repair element corresponding to the number of each reference element based on the region ratio; Each pattern element corresponding to the number of each repair element is generated randomly in the area to be repaired, and each pattern element is assigned a regional color scheme based on the pattern type.
8. The automatic color matching method for marble according to claim 1, characterized in that, Acquire repaired images of the restored marble, and generate a history bar based on the repaired images and the images to be repaired, including: Retrieve the historical repair form, wherein the historical repair form includes blank record bars arranged in sequence, and each blank record bar includes a time slot and an image slot; Select one of the blank record bars in sequence and designate that blank record bar as the record bar to be filled; A preset photo-taking plugin is invoked, and an image of the repaired marble is acquired based on the preset photo-taking plugin to obtain the repaired image of the marble and the acquisition time. The acquisition time is filled into the time slot, and the repaired image and the image to be repaired are filled into the image slot to obtain the history record bar.
9. The automatic color matching method for marble according to claim 8, characterized in that, Filling the image slots with the repaired image and the image to be repaired includes: The image slot includes a preset blank layer, wherein the preset blank layer includes a first image area and a second image area; The repaired image is filled into the first image area, and a first marker box is generated in the first image area to select the repaired area in the repaired image; The image to be repaired is filled into the second image area, and a second marker box is generated in the second image area to select the area to be repaired in the image to be repaired. Generate indicator box connecting lines, wherein the first end of the indicator box connecting lines is connected to the outline of the first indicator box, and the second end of the indicator box connecting lines is connected to the outline of the second indicator box.
10. An automatic color matching device for marble, characterized in that, include: The recognition module is configured to acquire an image of the marble to be repaired, and perform image recognition based on the image to determine the contour to be repaired located in the image. The contour generation module is configured to extend outward along the contour to be repaired by a preset distance in the image to be repaired to generate a reference contour surrounding the contour to be repaired, and to determine the area between the reference contour and the contour to be repaired as a reference area. A filling module is configured to fill the area to be repaired within the contour to be repaired with a base coating to form an initial base coating. The base color matching module is configured to determine the base pixel value based on the color proportion of the reference area, and to perform base color matching on the initial base coating based on the base pixel value to obtain the current base coating; The regional color matching module is configured to perform regional color matching on the current base coating based on the pattern distribution of the reference area, obtain the repaired area, and identify the marble to be repaired as the repaired marble. The form creation module is configured to obtain the repaired image of the repaired marble and create a historical repair form based on the repaired image and the image to be repaired.