Adaptive color printing repair method, device, terminal equipment and storage medium
Through the adaptive color printing repair method, the preset adaptive repair model and image domain model are used to automatically select the patch area, generate predictive repair pictures and perform color printing repair printing, solving the automatic repair problem of color printing defects and improving image quality.
Patent Information
- Application Number
- CN202411172882.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2044-08-26
AI Technical Summary
The prior art is difficult to effectively repair printing defects generated during the color printing process, resulting in poor image quality.
Adaptive color printing repair method is adopted, and the preset adaptive repair model is automatically selected based on the preset diffusion model and the image domain adaptive model, and predictive repair maps are generated and color printing repair printing is carried out to automatically repair the color printing defects.
This greatly reduces the omission of printing defect areas, improves the quality of color printing images, and realizes automatic repair of color printing defects.
Smart Images

Figure CN118683222B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to a field, and in particular to an adaptive color printing repair method, device, terminal equipment and storage medium. Background Art
[0002] When printing the initial image data, it is sometimes difficult to meet the printing requirements of the color image, so that the acquired image data cannot be well preserved and disseminated through printing. In the face of such a situation, on the one hand, the color image with poor image quality is processed through plate making technology and image restoration technology, and the original is properly restored according to experience to maximize the printing quality. On the other hand, the color tone difference and shape missing defect information generated during the color printing process can also be repaired twice.
[0003] Therefore, how to repair the printing defects of color printing is a technical problem that needs to be solved urgently. Summary of the invention
[0004] In view of this, the present invention provides an adaptive color printing repair method, which can automatically select a repair area from a global perspective to achieve automatic repair of printing defects in color printing.
[0005] An adaptive color printing repair method includes:
[0006] Obtaining a defect color print of the first image domain;
[0007] Obtaining a preset color print of the second image domain;
[0008] Based on the preset adaptive repair model, a predicted repair image in the second image domain is obtained according to the defect color printing image and the preset color printing image;
[0009] The predicted repair image is input into a printing device for color printing repair printing to obtain a repaired color printing image.
[0010] In one embodiment, based on a preset adaptive repair model, a predicted repair image in the second image domain is obtained according to the defect color printing image and the preset color printing image, wherein the preset adaptive repair model is based on a combination of a preset diffusion model and a preset image domain adaptive model, and the steps include:
[0011] Inputting the defect color print image into a preset diffusion model to generate a predicted repair feature map of the first image domain;
[0012] Based on a preset image domain adaptive model, a predicted patching map of a second image domain is obtained according to the predicted patching feature map and a preset color printing map.
[0013] In one embodiment, the preset adaptive repair model is trained by the following steps:
[0014] Obtain a first data training set of defective color printing images and a second data training set of corresponding preset color printing images, each defective color printing image in the first data training set and each preset color printing image in the second data training set Figure 1 One to one correspondence;
[0015] Inputting each defect color print image in the first data training set into an initial preset diffusion model to generate a predicted repair feature map of the first image domain;
[0016] Based on the initial preset image domain adaptive model, a restoration image in the second image domain is obtained according to the predicted repair feature map in the first image domain and the defect color printing map in the first image domain;
[0017] The restored image in the second image domain and the corresponding preset color print image are used as inputs of the loss function to perform model training, thereby obtaining a preset adaptive restoration model.
[0018] In one embodiment, based on a preset image domain adaptive model, the step of obtaining a predicted patching map in a second image domain according to the predicted patching feature map and a preset color printing map comprises:
[0019] The predicted patch feature map and the preset color printing map are divided into P*P pixel blocks of preset length respectively;
[0020] Transform each pixel block into a one-dimensional vector;
[0021] According to the predicted patch feature map and the preset color printing map, the predicted patch map of the second image domain is obtained using the following formula:
[0022] {x k} B =Attention(a{x m} A +b{x n} B )
[0023] Attention(X,Y)=softmax(X,Y)*Y
[0024] a and b are adjustment parameters obtained through training, Attention(X,Y) is the attention function, {x m} A denoted as the pixel of the predicted patch feature map in the first image domain A, where m ranges from 1 to the maximum number of pixel blocks; {x n} B represents the pixels of the preset color image in the second image domain B, where n ranges from 1 to the maximum number of pixel blocks; {x k} B Representing the pixels of the predicted patch image in the corresponding second image domain B, the maximum values of m, n and k are the same.
[0025] In one embodiment, the loss function is:
[0026] ;
[0027] L is the loss function, n is the number of all pixels, i is the position of the pixel, xi is the pixel in the restored image in the second image domain, and y is the pixel in the restored image in the second image domain. i Represents a pixel in a preset color print image in the corresponding second image domain.
[0028] In one embodiment, based on the initial preset image domain adaptive model, the step of obtaining a restored image in the second image domain according to the predicted repair feature map in the first image domain and the defect color printing map in the first image domain includes:
[0029] Converting the predicted patch feature map in the first image domain into a predicted patch map in the second image domain based on an initial preset image domain adaptive model;
[0030] Converting the defect color print image in the first image domain into the defect color print image in the second image domain based on the initial preset image domain adaptive model;
[0031] A restored image in the second image domain is obtained according to the predicted repair image in the second image domain and the defect color printing image in the second image domain.
[0032] In one embodiment, the step of obtaining a restored image in the second image domain according to the predicted repair image in the second image domain and the defect color printing image in the second image domain comprises:
[0033] Each pixel in the predicted repair image in the second image domain is added to each corresponding pixel in the defective color printing image in the second image domain, and the addition result of each corresponding pixel is truncated to between 0 and 255 to obtain a restored image in the second image domain.
[0034] In addition, an adaptive color printing repair device is provided, comprising:
[0035] A first acquisition unit, used for acquiring a defect color printing image of a first image domain;
[0036] A second acquisition unit, used for acquiring a preset color print image of a second image domain;
[0037] A patch image generating unit, used for obtaining a predicted patch image in a second image domain based on a preset adaptive patch model according to the defect color print image and the preset color print image, wherein the preset adaptive patch model is formed by combining a preset diffusion model and a preset image domain adaptive model;
[0038] The color printing image generating unit is used for inputting the predicted repair image into the printing device to perform color printing repair printing to obtain the repaired color printing image.
[0039] In addition, a terminal device is also provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the steps of the above-mentioned adaptive color printing repair method are implemented.
[0040] In addition, a storage medium is also provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned adaptive color printing repair method are implemented.
[0041] The above-mentioned adaptive color printing repair method includes obtaining a defective color printing image of a first image domain, obtaining a preset color printing image of a second image domain, and based on a preset adaptive repair model, obtaining a predicted repair image of the second image domain according to the defective color printing image and the preset color printing image, and inputting the predicted repair image into a printing device for color printing repair printing to obtain a repaired color printing image. The preset adaptive repair model can be used to obtain a predicted repair image of the second image domain, and then the predicted repair image is input into a printing device for color printing repair printing to obtain a repaired color printing image. In this way, according to the preset adaptive repair model, through a combination model of a preset diffusion model and a preset image domain adaptive model, a repair area can be automatically selected globally according to the defective color printing image and a predicted repair image of the second image domain can be generated, thereby realizing automatic repair of printing defects of color printing, greatly reducing the degree of omission of a certain defective area. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 This is a schematic diagram of the steps of the adaptive color printing repair method in one embodiment of the present application;
[0043] Figure 2 A schematic diagram of a method for obtaining a predicted repair image in an embodiment of the present application;
[0044] Figure 3 A schematic diagram of a training method for a preset adaptive repair model in an embodiment of the present application;
[0045] Figure 4 This is a schematic diagram of a method for obtaining a predicted repair image in another embodiment of the present application;
[0046] Figure 5 Schematic diagram of a method for obtaining a restored image in a second image domain in an embodiment of the present application;
[0047] Figure 6 This is a structural block diagram of an adaptive color printing repair device in an embodiment of the present application;
[0048] Figure 7 This is a schematic block diagram of the internal structure of a terminal device according to an embodiment of the present application.
[0049] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0050] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0051] In addition, if the descriptions of "first", "second", etc. are involved in this application, they are only used for descriptive purposes (such as for distinguishing the same or similar elements), and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0052] like Figure 1 As shown, an adaptive color printing repair method is provided, and the adaptive color printing repair method comprises:
[0053] Step S110, obtaining a defect color printing image of the first image domain.
[0054] Step S120, obtaining a preset color printing image of the second image domain.
[0055] Step S130, based on a preset adaptive repair model, according to the defect color print image and the preset color print image, a predicted repair image of the second image domain is obtained, wherein the preset adaptive repair model is based on a combination of a preset diffusion model and a preset image domain adaptive model.
[0056] In this embodiment, the defective color print is a printed image with defects, which can be obtained through a camera or other equipment. The preset color print is an electronic image input to the printer with clear pixel information. The two images have similar effects, but belong to different image domains. Even if the image content is the same, they will not have the same pixel values, and it is not easy to directly compare them.
[0057] The preset adaptive restoration model is composed of a preset diffusion model and a preset image domain adaptive model.
[0058] Step S140, inputting the predicted repair image into a printing device for color printing repair printing to obtain a repaired color printing image.
[0059] Among them, based on the preset adaptive repair model, the defective color print image in the first image domain can be converted into a defective color print image in the second image domain. After obtaining the predicted repair image in the second image domain, the predicted repair image is input into the printing device to perform color printing repair printing on the defective color print image in the second image domain to obtain a repaired color print image.
[0060] The above-mentioned adaptive color printing repair method includes obtaining a defective color printing image of a first image domain, obtaining a preset color printing image of a second image domain, and based on a preset adaptive repair model, obtaining a predicted repair image of the second image domain according to the defective color printing image and the preset color printing image, and inputting the predicted repair image into a printing device for color printing repair printing to obtain a repaired color printing image. The preset adaptive repair model can be used to obtain a predicted repair image of the second image domain, and then the predicted repair image is input into a printing device for color printing repair printing to obtain a repaired color printing image. In this way, according to the preset adaptive repair model, through the preset diffusion model and the preset image domain adaptive model, the repair area can be automatically selected globally according to the defective color printing image and the predicted repair image of the second image domain can be generated, thereby realizing automatic repair of printing defects of color printing, which greatly reduces the degree of omission of a certain defective area.
[0061] In one embodiment, Figure 2 As shown, step S130 includes:
[0062] Step S131, inputting the defect color printing image into a preset diffusion model to generate a predicted repair feature map of the first image domain.
[0063] Step S132, based on the preset image domain adaptive model, obtain the predicted repair map of the second image domain according to the predicted repair feature map and the preset color printing map.
[0064] In this embodiment, the defective color print is a printed image with defects, which can be obtained through a camera or other equipment. The preset color print is an electronic image input to the printer with clear pixel information. The two images have similar effects, but belong to different image domains. Even the same image content will not have the same pixel values, and it is not easy to directly compare them. Therefore, it is necessary to use a deep learning method to establish the relationship between the two image domains, that is, to establish the relationship between the two image domains through a preset diffusion model and a preset image domain adaptive model.
[0065] In one embodiment, Figure 3 As shown, the preset adaptive repair model is trained through the following steps:
[0066] Step S150, obtaining a first data training set of defective color printing images and a second data training set of corresponding preset color printing images, wherein each defective color printing image in the first data training set and each preset color printing image in the second data training set are Figure 1 One to one correspondence.
[0067] Step S160: input each defect color printing image in the first data training set into an initial preset diffusion model to generate a predicted repair feature map of the first image domain.
[0068] Step S170, based on the initial preset image domain adaptive model, a restored image in the second image domain is obtained according to the predicted repair feature map in the first image domain and the defect color printing map in the first image domain.
[0069] Step S180, using the restored image in the second image domain and the corresponding preset color printing image as inputs of the loss function to perform model training, thereby obtaining a preset adaptive restoration model.
[0070] In this embodiment, it is assumed that the size of the input defective color print image is LxL, which is RGB three-channel data, and the predicted repair feature map is also RGB three-channel data with a pixel range of 0-255 (obtained after normalization after image domain adaptation). Based on the acquired first data training set of the defective color print image and the corresponding second data training set of the preset color print image, the initial preset diffusion model and the initial preset image domain adaptive model are trained to obtain the preset adaptive repair model.
[0071] In one embodiment, Figure 4 As shown, step S132 includes:
[0072] Step S132a, dividing the predicted repair feature map and the preset color printing map into P*P pixel blocks of preset length respectively.
[0073] Step S132b, transform each pixel block into a one-dimensional vector.
[0074] Step S132c, according to the predicted patch feature map and the preset color printing map, the predicted patch map of the second image domain is obtained by using the following formula:
[0075] {x k} B =Attention(a{x m} A +b{x n} B )
[0076] Attention(X,Y)=softmax(X,Y)*Y
[0077] a and b are adjustment parameters obtained through training, Attention(X,Y) is the attention function, {x m} A denoted as the pixel of the predicted patch feature map in the first image domain A, where m ranges from 1 to the maximum number of pixel blocks; {x n} B represents the pixels of the preset color image in the second image domain B, where n ranges from 1 to the maximum number of pixel blocks; {x k} B Represented as pixels of the predicted patch image in the corresponding second image domain B, the maximum values of m, n and k are the same, and m, n and k are all positive integers.
[0078] In this embodiment, an image domain adaptive algorithm and an attention function are used to obtain a predicted repair image in the second image domain B by predicting a repair feature map and a preset color printing map, thereby laying a foundation for subsequent image repair printing.
[0079] In one embodiment, the loss function is:
[0080] ;
[0081] L is the loss function, n is the number of all pixels, i is the position of the pixel, xi is the pixel in the restored image in the second image domain, and y is the pixel in the restored image in the second image domain. i Represents a pixel in a preset color print image in the corresponding second image domain.
[0082] In one embodiment, Figure 5 As shown, step S170 includes:
[0083] Step S171: converting the predicted patch feature map in the first image domain into a predicted patch map in the second image domain based on an initial preset image domain adaptive model.
[0084] Step S172: converting the defect color printing image in the first image domain into a defect color printing image in the second image domain based on the initial preset image domain adaptive model.
[0085] Step S173, obtaining a restored image in the second image domain according to the predicted repair image in the second image domain and the defect color printing image in the second image domain.
[0086] In one embodiment, step S173 includes: adding each pixel in the predicted repair image in the second image domain to each corresponding pixel in the defective color printing image in the second image domain, and truncating the sum to between 0 and 255 to obtain a restored image in the second image domain.
[0087] In one embodiment, after the predicted repair image of the second image domain is obtained, it can be input into a printing device to perform secondary color printing on the defective color printing image of the second image domain to obtain a repaired color printing image.
[0088] In addition, if Figure 6 As shown, an adaptive color printing repair device 200 is also provided, comprising:
[0089] A first acquisition unit 210 is used to acquire a defect color printing image in a first image domain;
[0090] The second acquisition unit 220 is used to acquire a preset color print image in the second image domain;
[0091] A patch image generating unit 230 is used to obtain a predicted patch image in the second image domain based on a preset adaptive patch model according to the defect color print image and the preset color print image, wherein the preset adaptive patch model is formed by combining a preset diffusion model and a preset image domain adaptive model;
[0092] The color printing image generating unit 240 is used to input the predicted repair image into the printing device to perform secondary color printing on the defective color printing image to obtain a repaired color printing image.
[0093] In addition, a terminal device is also provided in an embodiment of the present application. The internal structure of the terminal device can be as follows: Figure 7 As shown. The terminal device includes a processor, a memory, a communication interface and a database connected via a system bus. The processor is used to provide computing and control capabilities. The memory of the terminal device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the terminal device is used to store data called by the computer program. The communication interface of the terminal device is used to communicate data with an external terminal. The input device of the terminal device is used to receive a signal input by an external device. When the computer program is executed by the processor, an adaptive color printing repair method as described in the above embodiment is implemented.
[0094] Those skilled in the art will understand that Figure 7 The structure shown in is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the terminal device to which the solution of the present application is applied.
[0095] In addition, the present application also proposes a storage medium, the storage medium includes a computer program, and when the computer program is executed by a processor, the steps of the adaptive color printing repair method described in the above embodiment are implemented. It can be understood that the storage medium in this embodiment can be a volatile storage medium or a non-volatile storage medium.
[0096] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented 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 memory, storage, database or other media provided in this application and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0097] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.
[0098] The above description is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. An adaptive color printing repair method, characterized in that: include: Obtaining a defect color print of the first image domain; Obtaining a preset color print of the second image domain; Based on a preset adaptive repair model, a predicted repair image in a second image domain is obtained according to the defect color print image and the preset color print image, wherein the preset adaptive repair model is formed by combining a preset diffusion model and a preset image domain adaptive model; Inputting the predicted repair image into a printing device for color printing repair printing to obtain a repaired color printing image; The step of obtaining a predicted repair image in the second image domain based on the preset adaptive repair model according to the defect color print image and the preset color print image, wherein the preset adaptive repair model is based on a combination of a preset diffusion model and a preset image domain adaptive model, comprises: Inputting the defect color print image into the preset diffusion model to generate a predicted repair feature map of the first image domain; Based on the preset image domain adaptive model, obtaining a predicted patching map in a second image domain according to the predicted patching feature map and the preset color printing map; The preset adaptive repair model is trained by the following steps: Acquire a first data training set of defect color printing images and a second data training set of corresponding preset color printing images, wherein each defect color printing image in the first data training set corresponds to each preset color printing image in the second data training set; Inputting each defect color print image in the first data training set into an initial preset diffusion model to generate a predicted repair feature map of the first image domain; Based on the initial preset image domain adaptive model, a restoration image in the second image domain is obtained according to the predicted repair feature map in the first image domain and the defect color printing map in the first image domain; Using the restored image in the second image domain and the corresponding preset color printing image as inputs of the loss function to perform model training, thereby obtaining the preset adaptive restoration model; The step of obtaining a predicted patching map in a second image domain based on the preset image domain adaptive model and according to the predicted patching feature map and the preset color printing map comprises: Respectively dividing the predicted repair feature map and the preset color printing map into P*P pixel blocks of preset length; Transform each pixel block into a one-dimensional vector; According to the predicted patch feature map and the preset color printing map, the predicted patch map of the second image domain is obtained by using the following formula: {x k } B =Attention(a{x m } A +b{x n } B ) Attention(X,Y)=softmax(X,Y)*Y a and b are adjustment parameters obtained through training, Attention(X,Y) is the attention function, {x m } A denoted as the pixel of the predicted patch feature map in the first image domain A, where m ranges from 1 to the maximum number of pixel blocks; {x n } B represents the pixels of the preset color image in the second image domain B, where n ranges from 1 to the maximum number of pixel blocks; {x k } B Representing the pixels of the predicted patch image in the corresponding second image domain B, the maximum values of m, n and k are the same.
2. The adaptive color printing repair method according to claim 1, characterized in that: The loss function is: ; L is the loss function, n is the number of all pixels, i is the position of the pixel, xi is the pixel in the restored image in the second image domain, and y is i Represents a pixel in a preset color print image in the corresponding second image domain.
3. The adaptive color printing repair method according to claim 1, characterized in that: The step of obtaining a restored image in the second image domain based on the initial preset image domain adaptive model according to the predicted repair feature map in the first image domain and the defect color printing map in the first image domain comprises: Converting the predicted patch feature map in the first image domain into a predicted patch map in the second image domain based on an initial preset image domain adaptive model; Converting the defect color print image in the first image domain into the defect color print image in the second image domain based on an initial preset image domain adaptive model; A restored image in the second image domain is obtained according to the predicted repair image in the second image domain and the defect color printing image in the second image domain.
4. The adaptive color printing repair method according to claim 3, characterized in that: The step of obtaining a restored image in the second image domain according to the predicted repair image in the second image domain and the defect color printing image in the second image domain comprises: Each pixel in the predicted repair image of the second image domain is added to each corresponding pixel in the defective color printing image of the second image domain, and the addition result of each corresponding pixel is truncated to between 0 and 255 to obtain a restored image of the second image domain.
5. A terminal device, characterized in that: The terminal device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the steps of the adaptive color printing repair method according to any one of claims 1 to 4 are implemented.
6. A storage medium, characterized in that: The storage medium stores a computer program, which, when executed by a processor, implements the steps of the adaptive color printing repair method according to any one of claims 1 to 4.
