Method for optimizing printing effect and related device
By evaluating and adjusting the image and barcode characteristics of the printing results in real time in printing technology, the problem of inability to adjust the printing effect in the prior art is solved, and a more efficient and economical printing process is achieved, and the printing quality and user experience are improved.
Patent Information
- Application Number
- CN202510064560.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-15
- Publication Date
- 2025-04-15
AI Technical Summary
The existing printing technology lacks the ability to evaluate whether the current printing results meet user needs in real time before printing, resulting in the inability to adjust the printing effect in time, increasing the user's printing costs, and possibly causing waste of resources.
By obtaining target printing data and target printing instructions, the image and barcode feature information in the initial printing result is determined, the image gap and barcode edge evaluation value are calculated, and the image and barcode are adjusted based on this information to obtain optimized printing results.
Real-time evaluation and adjustment of printing effects before printing is achieved, reducing material waste and printing costs, and improving print quality and user experience.
Smart Images

Figure CN119832279A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of printers, and in particular to a method for optimizing printing effects and related devices. Background Art
[0002] With the continuous innovation and development of the printer industry, various printer products emerge in an endless stream and are constantly integrated into users' daily lives, making printing technology more popular and convenient. However, existing printing technology mainly relies on static printing settings and subsequent manual inspections. Users need to manually adjust parameters such as print quality, color configuration, paper type, etc. before printing, and perform visual inspections after printing to confirm the printing effect. It is impossible to evaluate in real time whether the current printing results meet the user's needs before printing, which not only increases the user's printing costs, but may also lead to a waste of resources. Summary of the invention
[0003] The main purpose of the embodiments of the present invention is to provide a method and related devices for optimizing printing effects, aiming to solve the problem that the related technology lacks the ability to evaluate in real time whether the current printing result meets the user's needs before printing, resulting in the inability to adjust the printing effect in time, thereby increasing the user's printing costs and possibly causing waste of resources.
[0004] In a first aspect, an embodiment of the present invention provides a method for optimizing printing effects, comprising:
[0005] Obtaining target printing data and a target printing instruction corresponding to the target printing data, and determining an initial printing result corresponding to the target printing data according to the target printing instruction;
[0006] Obtaining a first image and a second image contrasting with the first image from the initial printing result, and obtaining a corresponding initial barcode from the initial printing result;
[0007] Performing feature mining on the first image and the second image to obtain first feature information corresponding to the first image and second feature information corresponding to the second image;
[0008] determining an image difference between the first image and the second image according to the first feature information and the second feature information;
[0009] Adjusting the second image according to the image difference to obtain a third image corresponding to the second image;
[0010] Performing edge feature evaluation on the initial barcode to obtain an edge evaluation value corresponding to the initial barcode;
[0011] Adjusting the initial barcode according to the edge evaluation value to obtain a corresponding target barcode;
[0012] The initial printing result is adjusted according to the third image and the target barcode to obtain a target printing result.
[0013] In some optional embodiments, performing feature mining on the first image and the second image to obtain first feature information corresponding to the first image and second feature information corresponding to the second image includes:
[0014] Performing variance calculation on the first image to obtain a first variance and performing variance calculation on the second image to obtain a second variance;
[0015] Performing entropy calculation on the first image to obtain a first entropy value and performing entropy calculation on the second image to obtain a second entropy value;
[0016] fusing the first variance and the first entropy value to obtain a first quality coefficient corresponding to the first image, and fusing the second variance and the second entropy value to obtain a second quality coefficient corresponding to the second image;
[0017] determining the first feature information corresponding to the first image according to the first variance, the first entropy value, and the first quality coefficient;
[0018] The second feature information corresponding to the second image is determined according to the second variance, the second entropy value, and the second quality coefficient.
[0019] In some optional embodiments, determining the image difference between the first image and the second image according to the first feature information and the second feature information includes:
[0020] determining a first difference between the first image and the second image according to the first variance and the second variance;
[0021] determining a second difference between the first image and the second image according to the first entropy value and the second entropy value;
[0022] determining a third difference between the first image and the second image based on the first quality coefficient and the second quality coefficient;
[0023] Determine a target window, and interactively calculate the first image and the second image according to the target window to obtain a third difference between the first image and the second image;
[0024] determining a first similarity between image structures of the first image and the second image according to the first variance, the second variance, and the third variance;
[0025] determining a second similarity between image contrasts of the first image and the second image based on the first variance and the second variance;
[0026] Determine the image gap between the first image and the second image by fusing the first difference, the second difference, the third difference, the first similarity, and the second similarity;
[0027] The third difference and the image difference are obtained according to the following formula:
[0028] ;
[0029]
[0030] in, represents the third difference, N represents the number of images corresponding to the first image or the second image under the target window, M represents the length corresponding to the target window, and L represents the width corresponding to the target window. represents the pixel value corresponding to the i-th window image corresponding to the target window under the first image when the horizontal coordinate is m and the vertical direction is n, represents the average pixel value corresponding to the i-th window image corresponding to the target window under the first image, represents the pixel value corresponding to the i-th window image corresponding to the target window under the second image when the horizontal coordinate is m and the vertical direction is n, represents the average pixel value corresponding to the i-th window image corresponding to the target window under the second image, represents the pixel value corresponding to the jth window image of the target window under the first image when the horizontal coordinate is m and the vertical direction is n, represents the average pixel value corresponding to the j-th window image corresponding to the target window under the first image, represents the pixel value corresponding to the jth window image corresponding to the target window under the second image when the horizontal coordinate is m and the vertical direction is n, represents the average pixel value corresponding to the j-th window image corresponding to the target window under the second image; represents the image difference between the first image and the second image, represents the first variance, represents the second variance, represents the first entropy value, represents the second entropy value, represents the first quality coefficient, represents the second quality coefficient, represents the first difference, represents the second difference, and represents a constant, , , , , represents the adjustment weight, and ln represents the natural logarithm.
[0031] In some optional embodiments, adjusting the second image according to the image difference to obtain a third image corresponding to the second image includes:
[0032] When the image difference is smaller than a first preset value, obtaining an associated image corresponding to the second image from the target print data;
[0033] Calculating the maximum brightness value of the associated image in a brightness channel to obtain the maximum brightness value corresponding to the associated image;
[0034] Performing brightness compensation on the second image according to the maximum brightness value to obtain a corrected image;
[0035] Performing brightness analysis on the corrected image to obtain a target brightness area corresponding to the corrected image;
[0036] Determining, according to the corrected image and the target brightness area, a first correlation degree that each target pixel in the corrected image belongs to a bright area and a second correlation degree that each target pixel belongs to a dim area;
[0037] The first correlation degree and the second correlation degree are combined to determine a brightness adjustment parameter corresponding to each target pixel in the corrected image;
[0038] The corrected image is adjusted according to the brightness adjustment parameter to obtain the third image corresponding to the second image.
[0039] In some optional embodiments, performing brightness compensation on the second image according to the maximum brightness value to obtain a corrected image includes:
[0040] Obtaining a first associated image corresponding to the second image in a first channel, obtaining a second associated image corresponding to the second image in a second channel, and obtaining a third associated image corresponding to the second image in a third channel;
[0041] Obtaining a first brightness mean and a first brightness variance corresponding to the first associated image, obtaining a second brightness mean and a second brightness variance corresponding to the second associated image, and obtaining a third brightness mean and a third brightness variance corresponding to the third associated image;
[0042] Obtaining a fourth brightness mean and a fourth brightness variance corresponding to the second image at the maximum brightness value;
[0043] Dividing the fourth brightness variance by the first brightness variance to obtain a first ratio, and performing brightness compensation on the first associated image according to the first ratio combined with the first brightness mean and the fourth brightness mean to obtain a first compensated image;
[0044] Dividing the fourth brightness variance by the second brightness variance to obtain a second ratio, and performing brightness compensation on the second associated image according to the second ratio combined with the second brightness mean and the fourth brightness mean to obtain a second compensated image;
[0045] Dividing the fourth brightness variance by the third brightness variance to obtain a third ratio, and performing brightness compensation on the third associated image according to the third ratio combined with the third brightness mean and the fourth brightness mean to obtain a third compensated image;
[0046] The corrected image is obtained by fusing the first compensated image, the second compensated image and the third compensated image.
[0047] In some optional embodiments, performing edge feature evaluation on the initial barcode to obtain an edge evaluation value corresponding to the initial barcode includes:
[0048] Obtain a first pixel point adjacent to a barcode pixel point corresponding to the initial barcode in a horizontal direction and a second pixel point adjacent to the first pixel point;
[0049] Calculating a first difference between the barcode pixel and the first pixel and calculating a second difference between the first pixel and the second pixel;
[0050] Fusion of the first difference and the second difference to determine a horizontal edge value corresponding to the barcode pixel point;
[0051] Obtaining a third pixel point adjacent to the barcode pixel point in the vertical direction and a fourth pixel point adjacent to the third pixel point;
[0052] Calculating a third difference between the barcode pixel and the third pixel and calculating a fourth difference between the third pixel and the fourth pixel;
[0053] Fusion of the third difference and the fourth difference to determine the vertical edge value corresponding to the barcode pixel point;
[0054] Summing the horizontal edge values of all the barcode pixel points to obtain a first total, and summing the vertical edge values of all the barcode pixel points to obtain a second total;
[0055] The edge evaluation value corresponding to the initial barcode is determined according to the first total number and the second total number.
[0056] In some optional embodiments, after obtaining the target printing result, the method further includes:
[0057] Displaying the initial printing result and the target printing result to obtain a target display result;
[0058] A target operation of a target user on the target display result is received, and the target printing data is printed according to the target operation to obtain a real printing result.
[0059] In a second aspect, an embodiment of the present invention provides a device for optimizing printing effects, comprising:
[0060] A data acquisition module, used for acquiring target printing data and a target printing instruction corresponding to the target printing data, and determining an initial printing result corresponding to the target printing data according to the target printing instruction;
[0061] An image acquisition module, used to obtain a first image and a second image contrasting with the first image from the initial printing result, and to obtain a corresponding initial barcode from the initial printing result;
[0062] A feature mining module, used to perform feature mining on the first image and the second image to obtain first feature information corresponding to the first image and second feature information corresponding to the second image;
[0063] a gap calculation module, configured to determine an image gap between the first image and the second image according to the first feature information and the second feature information;
[0064] An image adjustment module, configured to adjust the second image according to the image difference to obtain a third image corresponding to the second image;
[0065] A feature evaluation module, used for performing edge feature evaluation on the initial barcode to obtain an edge evaluation value corresponding to the initial barcode;
[0066] A barcode adjustment module, used for adjusting the initial barcode according to the edge evaluation value to obtain a corresponding target barcode;
[0067] A data adjustment module is used to adjust the initial printing result according to the third image and the target barcode to obtain a target printing result.
[0068] In some optional embodiments, the feature mining module is further configured to:
[0069] A variance calculation module, configured to perform variance calculation on the first image to obtain a first variance and perform variance calculation on the second image to obtain a second variance;
[0070] An entropy value calculation module, configured to perform entropy value calculation on the first image to obtain a first entropy value and perform entropy value calculation on the second image to obtain a second entropy value;
[0071] a quality calculation module, configured to obtain a first quality coefficient corresponding to the first image by fusing the first variance and the first entropy value, and to obtain a second quality coefficient corresponding to the second image by fusing the second variance and the second entropy value;
[0072] A first combining module, configured to determine the first feature information corresponding to the first image according to the first variance, the first entropy value, and the first quality coefficient;
[0073] A second combining module is used to determine the second feature information corresponding to the second image according to the second variance, the second entropy value and the second quality coefficient.
[0074] In some optional embodiments, the gap calculation module is further configured to:
[0075] A first calculation module, configured to determine a first difference between the first image and the second image according to the first variance and the second variance;
[0076] a second calculation module, configured to determine a second difference between the first image and the second image according to the first entropy value and the second entropy value;
[0077] a third calculation module, configured to determine a third difference between the first image and the second image according to the first quality coefficient and the second quality coefficient;
[0078] an interactive calculation module, used to determine a target window, and perform interactive calculation on the first image and the second image according to the target window to obtain a third difference between the first image and the second image;
[0079] A first similarity calculation module, configured to determine a first similarity between image structures of the first image and the second image according to the first variance, the second variance, and the third variance;
[0080] a second similarity calculation module, configured to determine a second similarity between image contrasts of the first image and the second image according to the first variance and the second variance;
[0081] a data fusion module, configured to fuse the first difference, the second difference, the third difference, the first similarity, and the second similarity to determine the image gap between the first image and the second image;
[0082] The third difference and the image difference are obtained according to the following formula:
[0083] ;
[0084]
[0085] in, represents the third difference, N represents the number of images corresponding to the first image or the second image under the target window, M represents the length corresponding to the target window, and L represents the width corresponding to the target window. represents the pixel value corresponding to the i-th window image corresponding to the target window under the first image when the horizontal coordinate is m and the vertical direction is n, represents the average pixel value corresponding to the i-th window image corresponding to the target window under the first image, represents the pixel value corresponding to the i-th window image corresponding to the target window under the second image when the horizontal coordinate is m and the vertical direction is n, represents the average pixel value corresponding to the i-th window image corresponding to the target window under the second image, represents the pixel value corresponding to the jth window image of the target window under the first image when the horizontal coordinate is m and the vertical direction is n, represents the average pixel value corresponding to the j-th window image corresponding to the target window under the first image, represents the pixel value corresponding to the jth window image corresponding to the target window under the second image when the horizontal coordinate is m and the vertical direction is n, represents the average pixel value corresponding to the j-th window image corresponding to the target window under the second image; represents the image difference between the first image and the second image, represents the first variance, represents the second variance, represents the first entropy value, represents the second entropy value, represents the first quality coefficient, represents the second quality coefficient, represents the first difference, represents the second difference, and represents a constant, , , , , represents the adjustment weight, and ln represents the natural logarithm.
[0086] In some optional embodiments, the image adjustment module is further configured to:
[0087] A data judgment module, configured to obtain an associated image corresponding to the second image from the target printing data when the image difference is less than a first preset value;
[0088] A brightness judgment module, used to calculate the maximum brightness value of the associated image under the brightness channel to obtain the maximum brightness value corresponding to the associated image;
[0089] a brightness compensation module, configured to perform brightness compensation on the second image according to the maximum brightness value to obtain a corrected image;
[0090] A brightness analysis module, used for performing brightness analysis on the corrected image to obtain a target brightness area corresponding to the corrected image;
[0091] An association analysis module, configured to determine, based on the corrected image and the target brightness region, a first association degree of each target pixel in the corrected image belonging to a bright region and a second association degree of each target pixel belonging to a dim region;
[0092] A parameter determination module, configured to fuse the first correlation degree and the second correlation degree to determine a brightness adjustment parameter corresponding to each target pixel in the corrected image;
[0093] An image correction module is used to adjust the corrected image according to the brightness adjustment parameter to obtain the third image corresponding to the second image.
[0094] In some optional embodiments, the brightness compensation module is further configured as follows:
[0095] An image splitting module, used to obtain a first associated image corresponding to the second image in a first channel, obtain a second associated image corresponding to the second image in a second channel, and obtain a third associated image corresponding to the second image in a third channel;
[0096] A first brightness calculation module, used to obtain a first brightness mean and a first brightness variance corresponding to the first associated image, obtain a second brightness mean and a second brightness variance corresponding to the second associated image, and obtain a third brightness mean and a third brightness variance corresponding to the third associated image;
[0097] A second brightness calculation module, used to obtain a fourth brightness mean and a fourth brightness variance corresponding to the second image at the maximum brightness value;
[0098] a first compensation module, configured to obtain a first ratio by dividing the fourth brightness variance by the first brightness variance, and to perform brightness compensation on the first associated image according to the first ratio combined with the first brightness mean and the fourth brightness mean to obtain a first compensated image;
[0099] a second compensation module, configured to obtain a second ratio by dividing the fourth brightness variance by the second brightness variance, and to perform brightness compensation on the second associated image according to the second ratio combined with the second brightness mean and the fourth brightness mean to obtain a second compensated image;
[0100] a third compensation module, configured to obtain a third ratio by dividing the fourth brightness variance by the third brightness variance, and to perform brightness compensation on the third associated image according to the third ratio combined with the third brightness mean and the fourth brightness mean to obtain a third compensated image;
[0101] A compensation fusion module is used to fuse the first compensation image, the second compensation image and the third compensation image to obtain the corrected image.
[0102] In some optional embodiments, the feature evaluation module is configured to:
[0103] A first acquisition module, used to obtain a first pixel point adjacent to a barcode pixel point corresponding to the initial barcode in a horizontal direction and a second pixel point adjacent to the first pixel point;
[0104] A horizontal difference calculation module, used for calculating a first difference between the barcode pixel and the first pixel and a second difference between the first pixel and the second pixel;
[0105] A horizontal difference fusion module, used for fusing the first difference and the second difference to determine the horizontal edge value corresponding to the barcode pixel point;
[0106] A second acquisition module, used to obtain a third pixel point adjacent to the barcode pixel point in the vertical direction and a fourth pixel point adjacent to the third pixel point;
[0107] A vertical difference calculation module, used for calculating a third difference between the barcode pixel and the third pixel and a fourth difference between the third pixel and the fourth pixel;
[0108] A vertical difference fusion module, used for fusing the third difference and the fourth difference to determine the vertical edge value corresponding to the barcode pixel point;
[0109] A data summing module, configured to sum the horizontal edge values of all the barcode pixel points to obtain a first total, and sum the vertical edge values of all the barcode pixel points to obtain a second total;
[0110] An evaluation calculation module is used to determine the edge evaluation value corresponding to the initial barcode according to the first total number and the second total number.
[0111] In some optional embodiments, the device for optimizing printing effect may be further configured as follows:
[0112] A data display module, used for displaying the initial printing result and the target printing result to obtain a target display result;
[0113] The data printing module is used to receive a target operation of a target user on the target display result, and print the target printing data according to the target operation to obtain a real printing result.
[0114] In a third aspect, an embodiment of the present invention further provides a terminal device, comprising a processor, a memory, a computer program stored in the memory and executable by the processor, and a data bus for realizing connection and communication between the processor and the memory, wherein when the computer program is executed by the processor, the steps of any method for optimizing printing effects provided in the specification of the present invention are implemented.
[0115] In a fourth aspect, an embodiment of the present invention further provides a storage medium for computer-readable storage, characterized in that the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of any method for optimizing printing effects provided in the specification of the present invention.
[0116] The embodiment of the present invention provides a method for optimizing printing effect and a related device, the method comprising: obtaining target printing data and a target printing instruction corresponding to the target printing data, and determining an initial printing result corresponding to the target printing data according to the target printing instruction; obtaining a first image and a second image contrasting with the first image from the initial printing result, and obtaining a corresponding initial barcode from the initial printing result; performing feature mining on the first image and the second image to obtain first feature information corresponding to the first image and second feature information corresponding to the second image; determining the image gap corresponding to the first image and the second image according to the first feature information and the second feature information; adjusting the second image according to the image gap to obtain a third image corresponding to the second image; performing edge feature evaluation on the initial barcode to obtain an edge evaluation value corresponding to the initial barcode; adjusting the initial barcode according to the edge evaluation value to obtain a corresponding target barcode; adjusting the initial printing result according to the third image and the target barcode to obtain a target printing result. The method analyzes the image gap in the initial printing result and the edge evaluation value of the initial barcode, and then timely adjusts the second image and the initial barcode, thereby avoiding the problem of low printing quality caused by improper setting of the target printing instruction, thereby reducing material waste and printing costs, and effectively improving printing quality and user experience. It also solves the problem that the related technology lacks the ability to evaluate in real time whether the current printing result meets the user's needs before printing, which makes it impossible to adjust the printing effect in time, thereby increasing the user's printing cost and possibly causing waste of resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0117] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0118] Figure 1 A flow chart of a method for optimizing printing effects provided by an embodiment of the present invention;
[0119] Figure 2 A schematic diagram of the module structure of a device for optimizing printing effects provided by an embodiment of the present invention;
[0120] Figure 3 A schematic block diagram of the structure of a terminal device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0121] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0122] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0123] It should be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0124] The embodiment of the present invention provides a method for optimizing printing effects and a related device. The method for optimizing printing effects can be applied to a terminal device, which can be an electronic device such as a tablet computer, a laptop computer, a desktop computer, a personal digital assistant, and a wearable device. The terminal device can be a server or a server cluster. The terminal device can also be a printer with a screen.
[0125] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0126] Please refer to Figure 1 , Figure 1 A schematic flow chart of a method for optimizing printing effects provided by an embodiment of the present invention.
[0127] like Figure 1 As shown, the method for optimizing printing effect includes steps S101 to S108.
[0128] Step S101: obtaining target printing data and a target printing instruction corresponding to the target printing data, and determining an initial printing result corresponding to the target printing data according to the target printing instruction.
[0129] Exemplarily, target printing data corresponding to the target user and target printing instructions corresponding to the target printing data set by the target user are obtained, where the target printing instructions include but are not limited to paper size, printing direction, color setting, and the like.
[0130] Exemplarily, printer parameters are set according to the target printing instruction, such as selecting the paper type, setting the ink / toner usage, adjusting the printing speed, etc., so as to generate the initial printing result corresponding to the target printing data according to the target printing instruction combined with the image prediction model. The initial printing result is the printing effect that the target printing data may present under the target printing instruction. That is, the initial printing result is not the actual printing result corresponding to the target printing data.
[0131] For example, the image prediction model uses machine learning or deep learning algorithms (such as convolutional neural networks, generative adversarial networks, etc.), and the image prediction model can predict the corresponding initial printing results according to the target printing instructions. Therefore, the target printing instructions and target printing data are input into the trained image prediction model, and the model processes the target printing data according to the target printing instructions, simulates the printing process, and generates the initial printing results.
[0132] Step S102: obtaining a first image and a second image contrasting with the first image from the initial printing result, and obtaining a corresponding initial barcode from the initial printing result.
[0133] For example, when there are two contrasting images in the target print data, if the print quality is poor, the target user cannot observe content similar to the text description of the changes between the two images in the target print data from the two images, thereby reducing the value of the images in the target print data. In addition, when there is barcode information in the initial print result, if the barcode print quality is poor, subsequent work cannot be performed. Therefore, the present application obtains a first image and a second image that contrasts with the first image from the initial print result, and obtains a corresponding initial barcode from the initial print result, thereby providing support for the subsequent determination of the quality of the initial print result. Among them, the second image is an improved or corrected result of the first image.
[0134] For example, if the target print data contains the text " Figure 1 Perform image enhancement to obtain Figure 2 ,thereby Figure 2 Compare Figure 1 You can get clearer image details, etc.", then the initial print result Figure 1 is the first image, Figure 2 is the second image. If the target print data contains the text " Figure 3 Perform noise addition to obtain Figure 2 ,thereby Figure 2 Obviously Figure 3 Get more blurred image details, etc.", then the initial print result Figure 3 is the second image, Figure 2 is the first image. That is, the image quality of the first image is lower than that of the second image.
[0135] Step S103: performing feature mining on the first image and the second image to obtain first feature information corresponding to the first image and second feature information corresponding to the second image.
[0136] Exemplarily, a convolutional neural network is used to extract high-level semantic features of a first image to obtain first feature information corresponding to the first image, and a convolutional neural network is used to extract high-level semantic features of a second image to obtain second feature information corresponding to the second image.
[0137] In some embodiments, the feature mining of the first image and the second image to obtain first feature information corresponding to the first image and second feature information corresponding to the second image includes: performing variance calculation on the first image to obtain a first variance and performing variance calculation on the second image to obtain a second variance; performing entropy calculation on the first image to obtain a first entropy value and performing entropy calculation on the second image to obtain a second entropy value; fusing the first variance and the first entropy value to obtain a first quality coefficient corresponding to the first image and fusing the second variance and the second entropy value to obtain a second quality coefficient corresponding to the second image; determining the first feature information corresponding to the first image according to the first variance, the first entropy value and the first quality coefficient; determining the second feature information corresponding to the second image according to the second variance, the second entropy value and the second quality coefficient.
[0138] Exemplarily, the first image is grayed and then the variance of the gray value of the image is calculated to obtain a first variance, which measures the degree of dispersion of the first image. The larger the variance, the higher the contrast and the richer the details of the first image. Similarly, the same operation is performed on the second image to obtain a second variance.
[0139] Exemplarily, the grayscale histogram of the first image is calculated, and then the information entropy of the image is calculated according to the histogram to obtain a first entropy value. The first entropy value measures the amount of information in the first image. The larger the entropy value, the more information the image contains and the richer the details. The same operation is performed on the second image to obtain a second entropy value.
[0140] Exemplarily, a first constant and a second constant are determined, the first constant and the first variance are summed to obtain first data, the first data are then exponentially solved to obtain a first exponential value, the first exponential value and the second constant are then summed to obtain second data, and the first entropy value and the second data are divided to obtain a first quality coefficient. The first variance represents the contrast of the first image, and the first entropy value represents the amount of information of the second image.
[0141] For example, by solving the exponential and summing the constants, the contributions of the two are fused in a nonlinear manner, which can more comprehensively evaluate the image quality. By introducing the first constant and the second constant, the sensitivity of the index to the image quality evaluation can be adjusted. For example, when the contrast of the first image is not obvious, appropriately increasing the first constant can improve the sensitivity of the algorithm to the image details.
[0142] Similarly, the first constant and the second variance are summed to obtain third data, and then the third data is exponentially solved to obtain a second exponential value, and then the second exponential value and the second constant are summed to obtain fourth data, and then the second entropy value and the fourth data are divided to obtain a second quality coefficient.
[0143] Exemplarily, the first variance, the first entropy value and the first quality coefficient are combined to determine the first feature information corresponding to the first image, and the second variance, the second entropy value and the second quality coefficient are combined to determine the second feature information corresponding to the second image.
[0144] Step S104: determining an image difference between the first image and the second image according to the first feature information and the second feature information.
[0145] Exemplarily, the first feature information is represented as a feature vector, for example, the first variance, the first entropy value, and the first quality coefficient are respectively used as the three components of the vector. The second feature information is represented as a feature vector, for example, the second variance, the second entropy value, and the second quality coefficient are respectively used as the three components of the vector, and then the similarity between the first image and the second image is determined by using Manhattan distance, cosine similarity, Mahalanobis distance, etc., and then 1 minus the similarity is determined as the image difference between the first image and the second image. The greater the similarity, the smaller the image difference, indicating that the two images are more similar, and the worse the printing quality; the smaller the similarity, the greater the image difference, indicating that the two images are less similar, and the better the printing quality. That is, the image difference is proportional to the printing quality, the greater the image difference, the better the printing quality, and the smaller the image difference, the worse the printing quality.
[0146] In some embodiments, the determining the image gap corresponding to the first image and the second image according to the first feature information and the second feature information includes: determining a first difference between the first image and the second image according to the first variance and the second variance; determining a second difference between the first image and the second image according to the first entropy value and the second entropy value; determining a third difference between the first image and the second image according to the first quality coefficient and the second quality coefficient; determining a target window, and interactively calculating the first image and the second image according to the target window to obtain a third difference between the first image and the second image; determining a first similarity between the image structures of the first image and the second image according to the first variance, the second variance, and the third difference; determining a second similarity between the image contrasts of the first image and the second image according to the first variance and the second variance; and fusing the first difference, the second difference, the third difference, the first similarity, and the second similarity to determine the image gap corresponding to the first image and the second image; wherein the third difference and the image gap are obtained according to the following formula:
[0147] ;
[0148]
[0149] in, represents the third difference, N represents the number of images corresponding to the first image or the second image under the target window, M represents the length corresponding to the target window, and L represents the width corresponding to the target window. represents the pixel value corresponding to the i-th window image corresponding to the target window under the first image when the horizontal coordinate is m and the vertical direction is n, represents the average pixel value corresponding to the i-th window image corresponding to the target window under the first image, represents the pixel value corresponding to the i-th window image corresponding to the target window under the second image when the horizontal coordinate is m and the vertical direction is n, represents the average pixel value corresponding to the i-th window image corresponding to the target window under the second image, represents the pixel value corresponding to the jth window image of the target window under the first image when the horizontal coordinate is m and the vertical direction is n, represents the average pixel value corresponding to the j-th window image corresponding to the target window under the first image, represents the pixel value corresponding to the jth window image corresponding to the target window under the second image when the horizontal coordinate is m and the vertical direction is n, represents the average pixel value corresponding to the j-th window image corresponding to the target window under the second image; represents the image difference between the first image and the second image, represents the first variance, represents the second variance, represents the first entropy value, represents the second entropy value, represents the first quality coefficient, represents the second quality coefficient, represents the first difference, represents the second difference, and represents a constant, , , , , represents the adjustment weight, and ln represents the natural logarithm.
[0150] Exemplarily, the first variance is subtracted from the second variance and the absolute value is taken to obtain the first difference between the first image and the second image; the first entropy value and the second entropy value are subtracted from each other and the absolute value is taken to obtain the second difference between the first image and the second image; the first quality coefficient and the second quality coefficient are subtracted from each other and the absolute value is taken to obtain the third difference between the first image and the second image.
[0151] Exemplarily, a target window is determined, and the target window is slid in the first image and the second image to obtain a corresponding window image, and then a third difference between the first image and the second image is obtained by interactive calculation according to the window image, wherein the third difference is obtained according to the following formula:
[0152] ;
[0153] in, represents the third difference, N represents the number of images corresponding to the first image or the second image under the target window, M represents the length corresponding to the target window, and L represents the width corresponding to the target window. It indicates the pixel value of the i-th window image corresponding to the target window under the first image when the horizontal coordinate is m and the vertical direction is n. It represents the average pixel value of the i-th window image corresponding to the target window under the first image. It represents the pixel value corresponding to the i-th window image of the target window under the second image when the horizontal coordinate is m and the vertical direction is n. It represents the average pixel value of the i-th window image corresponding to the target window under the second image. It indicates the pixel value of the jth window image corresponding to the target window under the first image when the horizontal coordinate is m and the vertical direction is n. It represents the average pixel value of the jth window image corresponding to the target window under the first image. It represents the pixel value corresponding to the jth window image of the target window under the second image when the horizontal coordinate is m and the vertical direction is n. Represents the average pixel value of the jth window image corresponding to the target window in the second image.
[0154] For example, by calculating the difference in pixel values corresponding to the first image and the second image under the target window, focusing on local details of the image, such as edges and textures, the difference between the images can be analyzed more carefully. Calculating the average pixel value under the target window can reduce the impact of image noise on the difference calculation and improve the robustness of the image difference calculation. Using multiple target windows for analysis can comprehensively consider the differences in different areas of the image and reduce the randomness of single window analysis. Therefore, by integrating using the third difference formula, the first image and the second image can be interactively calculated from different dimensions, thereby obtaining the third difference between the first image and the second image.
[0155] Exemplarily, a third constant is determined, and then the third variance and the third constant are added to obtain fifth data, and then the first variance and the second variance are multiplied and added to the third constant to obtain sixth data, and then the fifth data and the sixth data are divided to obtain a first similarity between the image structures of the first image and the second image, wherein the first similarity is obtained according to the following formula:
[0156]
[0157] in, represents the first similarity, represents the third constant, Indicates third-party difference, represents the first variance, represents the second variance.
[0158] Exemplarily, a fourth constant is determined, and then the first variance and the second variance are multiplied and then expanded by 2 times and then added to the fourth constant to obtain seventh data, and then the first variance is squared and then added to the second variance and then added to the fourth constant to obtain eighth data, and then the seventh data and the eighth data are divided to obtain the second similarity between the image contrasts of the first image and the second image, wherein the second similarity is obtained according to the following formula:
[0159]
[0160] in, represents the second similarity, represents the fourth constant, represents the first variance, represents the second variance.
[0161] Exemplarily, the image difference between the first image and the second image is determined by fusing the first difference, the second difference, the third difference, the first similarity and the second similarity according to the following formula:
[0162]
[0163] in, Indicates third party difference; represents the image difference between the first image and the second image, represents the first variance, represents the second variance, represents the first entropy value, represents the second entropy value, represents the first quality coefficient, represents the second quality coefficient, represents the first difference, represents the second difference, and represents a constant, , , , , represents the adjustment weight, and ln represents the natural logarithm.
[0164] Exemplarily, the image gap calculated by the above formula combines the square difference of variance, entropy value and quality coefficient, the nonlinear combination of the first similarity and the second similarity, and the nonlinear adjustment of the interaction term, which can more comprehensively and complexly reflect the differences between images and provide a more accurate basis for optimizing printing effects.
[0165] Step S105: adjusting the second image according to the image difference to obtain a third image corresponding to the second image.
[0166] Exemplarily, when the image difference is less than a preset value, the second image is adjusted to obtain a third image corresponding to the second image. When the image difference is greater than or equal to the preset value, the second image is directly determined as the third image.
[0167] Exemplarily, associated text related to the first image and the second image is obtained from the target printing data, and then an optimization algorithm corresponding to the second image relative to the first image is obtained based on the associated text, and then the second image is adjusted based on the optimization algorithm to obtain a third image corresponding to the second image.
[0168] In some embodiments, the adjusting the second image according to the image difference to obtain the third image corresponding to the second image includes: when the image difference is less than a first preset value, obtaining the associated image corresponding to the second image from the target printing data; calculating the maximum brightness value of the associated image under the brightness channel to obtain the maximum brightness value corresponding to the associated image; performing brightness compensation on the second image according to the maximum brightness value to obtain a corrected image; performing brightness analysis according to the corrected image to obtain a target brightness area corresponding to the corrected image; determining a first correlation degree of each target pixel in the corrected image belonging to a bright area and a second correlation degree of each target pixel belonging to a dim area according to the corrected image and the target brightness area; fusing the first correlation degree and the second correlation degree to determine the brightness adjustment parameter corresponding to each target pixel in the corrected image; adjusting the corrected image according to the brightness adjustment parameter to obtain the third image corresponding to the second image.
[0169] Exemplarily, associated text related to the first image and the second image is obtained from the target printing data, and then a first preset value is obtained by querying in a mapping table according to corresponding keywords in the associated text, so that when the image difference is less than the first preset value, an associated image corresponding to the second image is obtained from the target printing data, that is, the associated image is the real image corresponding to the second image when it is not printed.
[0170] Exemplarily, brightness comparison is performed on each pixel in the associated image in the three RGB channels, and the brightness value corresponding to the maximum brightness in the three channels is determined as the maximum brightness value corresponding to the associated image.
[0171] Exemplarily, a target brightness range is obtained from the associated image, and then a brightness compensation coefficient is calculated based on the relationship between the maximum brightness value and the target brightness range. For example, if the maximum brightness value is low and the goal is to increase it to a higher brightness level, a compensation coefficient greater than 1 can be calculated. Conversely, if the maximum brightness value is too high and the goal is to reduce the brightness, a compensation coefficient between 0 and 1 can be used to obtain a corrected image.
[0172] Exemplarily, a brightness analysis is performed on the corrected image to identify a target brightness region in the image. The target brightness region is generally a region with higher or lower brightness in the image. For each target pixel in the corrected image, a first correlation degree belonging to a bright region and a second correlation degree belonging to a dim region are calculated in combination with the target brightness region.
[0173] For example, a first brightness value corresponding to each target pixel in the corrected image under the first channel and a second brightness value corresponding to the first pixel in the target brightness area under the first channel are obtained, and then the ratio between the first brightness value and the second brightness value is calculated to obtain a first division result, and then a third brightness value corresponding to each target pixel in the corrected image under the second channel and a fourth brightness value corresponding to the first pixel in the target brightness area under the second channel are obtained, and then the ratio between the third brightness value and the fourth brightness value is calculated to obtain a second division result, and a fifth brightness value corresponding to each target pixel in the corrected image under the third channel and a sixth brightness value corresponding to the first pixel in the target brightness area under the third channel are obtained, and then the ratio between the fifth brightness value and the sixth brightness value is calculated to obtain a third division result, thereby obtaining the minimum value of the first division result, the second division result and the third division result, and then obtaining the minimum value between each target pixel in the corrected image and other pixels in the target brightness area, and then obtaining all the minimum values between each target pixel in the corrected image and the target brightness area, and then obtaining the maximum value of all the minimum values, and then subtracting 1 from the maximum value to obtain each target pixel in the corrected image and calculate its first association degree belonging to the bright area in combination with the target brightness area.
[0174] Exemplarily, a first brightness value corresponding to each target pixel in the corrected image under the first channel and a second brightness value corresponding to the first pixel in the target brightness area under the first channel are obtained, and then a first brightness difference between the first brightness value and the second brightness value is calculated, and then 1 is subtracted from the second brightness value to obtain a second brightness difference, and then the ratio between the first brightness difference and the second brightness difference is calculated to obtain a fourth division result, a third brightness value corresponding to each target pixel in the corrected image under the second channel and a fourth brightness value corresponding to the first pixel in the target brightness area under the second channel are obtained, and then a third brightness difference between the third brightness value and the fourth brightness value is calculated, and then 1 is subtracted from the fourth brightness value to obtain a fourth brightness difference, and then the ratio between the third brightness difference and the fourth brightness difference is calculated to obtain a fifth division result, and each target pixel in the corrected image is obtained. The fifth brightness value corresponding to the first target pixel in the third channel and the sixth brightness value corresponding to the first pixel in the target brightness area in the third channel are calculated, and then a fifth brightness difference between the fifth brightness value and the sixth brightness value is calculated, and then the sixth brightness difference is obtained by subtracting 1 from the sixth brightness value, and then the ratio between the fifth brightness difference and the sixth brightness difference is calculated to obtain a sixth division result, thereby obtaining the maximum value of the fourth division result, the fifth division result and the sixth division result, and then obtaining the maximum value between each target pixel in the corrected image and other pixels in the target brightness area, and then obtaining all the maximum values between each target pixel in the corrected image and the target brightness area, and then obtaining the minimum value of all the maximum values, and then determining the minimum value as the second correlation degree of each target pixel in the corrected image combined with the target brightness area to belong to the dim area.
[0175] Exemplarily, the difference between the maximum brightness and the minimum brightness of each target pixel in the corrected image is obtained, and the difference is then determined as the first weight corresponding to the first degree of association, and the value obtained by subtracting the first weight from 1 is determined as the second weight corresponding to the second degree of association, thereby fusing the first degree of association and the second degree of association according to the first weight and the second weight to obtain the brightness adjustment parameter corresponding to each target pixel in the corrected image.
[0176] Exemplarily, brightness compensation and adjustment are performed on each target pixel in the corrected image according to the brightness adjustment parameter to obtain the third image.
[0177] In some embodiments, performing brightness compensation on the second image according to the maximum brightness value to obtain a corrected image includes: obtaining a first associated image corresponding to the second image in a first channel, obtaining a second associated image corresponding to the second image in a second channel, and obtaining a third associated image corresponding to the second image in a third channel; obtaining a first brightness mean and a first brightness variance corresponding to the first associated image, obtaining a second brightness mean and a second brightness variance corresponding to the second associated image, and obtaining a third brightness mean and a third brightness variance corresponding to the third associated image; obtaining a fourth brightness mean and a fourth brightness variance corresponding to the second image under the maximum brightness value; and obtaining a first brightness variance by dividing the fourth brightness variance by the first brightness variance. ratio, and brightness compensation is performed on the first associated image according to the first ratio combined with the first brightness mean and the fourth brightness mean to obtain a first compensated image; a second ratio is obtained by dividing the fourth brightness variance and the second brightness variance, and brightness compensation is performed on the second associated image according to the second ratio combined with the second brightness mean and the fourth brightness mean to obtain a second compensated image; a third ratio is obtained by dividing the fourth brightness variance and the third brightness variance, and brightness compensation is performed on the third associated image according to the third ratio combined with the third brightness mean and the fourth brightness mean to obtain a third compensated image; and the first compensated image, the second compensated image and the third compensated image are fused to obtain the corrected image.
[0178] Exemplarily, a first channel, such as a red channel, is separated from the second image to obtain a first associated image.
[0179] A second channel, such as a green channel, is separated from the second image to obtain a second associated image. A third channel, such as a blue channel, is separated from the second image to obtain a third associated image.
[0180] Exemplarily, a first brightness mean and a first brightness variance of the first associated image are calculated, a second brightness mean and a second brightness variance of the second associated image are calculated, and a third brightness mean and a third brightness variance of the third associated image are calculated.
[0181] Exemplarily, a target matrix having the same size as the second image is formed according to the maximum brightness value corresponding to each pixel in the associated image, so as to calculate the fourth brightness mean and the fourth brightness variance corresponding to the second image according to the target matrix.
[0182] Exemplarily, the fourth brightness variance is divided by the first brightness variance to obtain a first ratio. The fourth brightness variance is divided by the second brightness variance to obtain a second ratio. The fourth brightness variance is divided by the third brightness variance to obtain a third ratio.
[0183] Exemplarily, the difference between the first brightness mean and the fourth brightness mean is calculated to obtain a first mean difference, and then 1 is subtracted from the first brightness mean to obtain a second mean difference, so that the first ratio, the first mean difference, and the second mean difference are multiplied and then multiplied with the target matrix, and then added to the first associated image to obtain a first compensated image.
[0184] Exemplarily, the difference between the second brightness mean and the fourth brightness mean is calculated to obtain a third mean difference, and then 1 is subtracted from the second brightness mean to obtain a fourth mean difference, so that the second ratio, the third mean difference, and the fourth mean difference are multiplied together and then multiplied with the target matrix, and then added to the second associated image to obtain the second compensated image.
[0185] Exemplarily, the difference between the third brightness mean and the fourth brightness mean is calculated to obtain the fifth mean difference, and then the third brightness mean is subtracted from 1 to obtain the sixth mean difference, so that the third ratio, the fifth mean difference, and the sixth mean difference are multiplied together and then multiplied with the target matrix, and then added to the third associated image to obtain the third compensated image.
[0186] Exemplarily, the first compensation image, the second compensation image and the third compensation image are fused by weighted averaging so that the three channel images are merged into a complete image, that is, a corrected image is obtained.
[0187] Step S106: Perform edge feature evaluation on the initial barcode to obtain an edge evaluation value corresponding to the initial barcode.
[0188] For example, edge detection operators (such as Sobel, Canny, etc.) are used to detect the edges of the barcode image, and a binary image representing the edge position is generated. Then, analysis tools in image processing tools, such as edge density map, edge intensity histogram, etc., are used to assist in identifying and quantifying edge features in the binary image. Thus, an edge evaluation value is quantified based on the analyzed edge features to represent the printing quality of the initial barcode.
[0189] In some embodiments, the edge feature evaluation of the initial barcode to obtain the edge evaluation value corresponding to the initial barcode includes: obtaining a first pixel point adjacent to a barcode pixel point corresponding to the initial barcode in the horizontal direction and a second pixel point adjacent to the first pixel point; calculating a first difference between the barcode pixel point and the first pixel point and a second difference between the first pixel point and the second pixel point; fusing the first difference and the second difference to determine the horizontal edge value corresponding to the barcode pixel point; obtaining a third pixel point adjacent to the barcode pixel point in the vertical direction and a fourth pixel point adjacent to the third pixel point; calculating a third difference between the barcode pixel point and the third pixel point and a fourth difference between the third pixel point and the fourth pixel point; fusing the third difference and the fourth difference to determine the vertical edge value corresponding to the barcode pixel point; summing the horizontal edge values of all the barcode pixels to obtain a first total, and summing the vertical edge values of all the barcode pixels to obtain a second total; determining the edge evaluation value corresponding to the initial barcode according to the first total and the second total.
[0190] Exemplarily, for each barcode pixel in the initial barcode, the first pixel adjacent to the barcode pixel in the horizontal direction, i.e., the pixel on the left of the barcode pixel, and the second pixel adjacent to the barcode pixel in the horizontal direction, i.e., the pixel on the left of the first pixel, are identified. And for each barcode pixel in the initial barcode, the third pixel adjacent to the barcode pixel in the vertical direction, i.e., the pixel on the bottom of the barcode pixel, and the fourth pixel adjacent to the barcode pixel in the vertical direction, i.e., the pixel on the bottom of the third pixel, are identified.
[0191] Exemplarily, the pixel value difference between the barcode pixel point and its horizontally adjacent first pixel point is calculated to obtain a first difference, and the pixel value difference between the first pixel point and its horizontally adjacent second pixel point is calculated to obtain a second difference, thereby averaging the first difference and the second difference to obtain a horizontal edge value.
[0192] Exemplarily, the pixel value difference between the barcode pixel point and the third pixel point vertically adjacent thereto is calculated to obtain a third difference, and the pixel value difference between the third pixel point and the fourth pixel point vertically adjacent thereto is calculated to obtain a fourth difference, thereby averaging the third difference and the fourth difference to obtain a vertical edge value.
[0193] Exemplarily, the horizontal edge values of all barcode pixels in the initial barcode are summed to obtain a first total number, and the vertical edge values of all barcode pixels in the initial barcode are summed to obtain a second total number.
[0194] Exemplarily, the barcode length and barcode width corresponding to the initial barcode are obtained, and then the first total and the second total are added to obtain the target total, and then the barcode length and the barcode width are multiplied to obtain the target product, and finally the target total is divided by the target product to obtain the edge evaluation value corresponding to the initial barcode.
[0195] Step S107: adjusting the initial barcode according to the edge evaluation value to obtain a corresponding target barcode.
[0196] Exemplarily, the second preset value is determined based on expert experience or historical experience, and when the edge evaluation value is less than the second preset value, the initial barcode is adjusted to obtain the corresponding target barcode; when the edge evaluation value is greater than or equal to the second preset value, the initial barcode is directly determined as the target barcode.
[0197] For example, the initial barcode is analyzed to obtain the compressed and information-lost parts of the initial barcode, and then the specific pixel width that needs to be enlarged (such as from 3 pixels to 7 pixels) is determined for the compressed and information-lost parts, and the new pixel allocation for each line and interval is clarified. Thus, the barcode segment that needs to be adjusted is enlarged to a predetermined pixel width (such as 7 pixels), and the pixel allocation for each line and interval is ensured to meet the requirements of the adjustment plan to obtain the target barcode.
[0198] For example, the initial barcode uses 3 dots to represent a section of content, and 2 lines each occupy 1 dot width, with a distance of 1.5 pixels between them. Then the barcode content of this section is not enough to be expressed within the limit of 3 pixels, and compression will occur. In this case, information loss may occur. For this description, the specific processing method is to enlarge it to 7 pixels wide, so that 2 lines each occupy 2 dots, and the distance between them is 3 dots. The content expressed by the barcode can be fully displayed, and the target barcode can be obtained.
[0199] Step S108: adjusting the initial printing result according to the third image and the target barcode to obtain a target printing result.
[0200] Exemplarily, the target printing instruction is adjusted to obtain an adjusted target printing instruction, so that the second image in the initial printing result can print an effect corresponding to the third image and the initial barcode can print an effect corresponding to the target barcode.
[0201] Exemplarily, the third image replaces the second image in the initial printing result and the target barcode replaces the initial barcode in the initial printing result to obtain the target printing result corresponding to the adjusted target printing instruction.
[0202] In some embodiments, after obtaining the target printing result, the method further includes: displaying the initial printing result and the target printing result to obtain a target display result; receiving a target operation of the target user on the target display result, and printing the target printing data according to the target operation to obtain a real printing result.
[0203] Exemplarily, in order to ensure the target user's right to know, the initial printing result and the optimized target printing result are displayed in the display interface at the same time. The target user can compare the difference between the two according to the target display result and independently select the final printing effect. Clear operation options are provided in the display interface, such as "select the initial printing result", "select the optimized printing result" or "further adjustment" to meet the needs of different users. According to the target user's choice of the target display result, the corresponding printing operation is performed. If the user selects the initial printing result, the initial printing result is directly used for printing; if the optimized printing result is selected, the optimized target printing result is used for printing to obtain the real printing result. This process not only ensures the target user's right to know and right to choose independently, but also helps the target user obtain more satisfactory printing results through optimization and comparative display.
[0204] See also Figure 2 , Figure 2The present invention provides a device 200 for optimizing printing effects, which includes a data acquisition module 201, an image acquisition module 202, a feature mining module 203, a gap calculation module 204, an image adjustment module 205, a feature evaluation module 206, a barcode adjustment module 207, and a data adjustment module 208. The data acquisition module 201 is used to obtain target printing data and a target printing instruction corresponding to the target printing data, and determine an initial printing result corresponding to the target printing data according to the target printing instruction; the image acquisition module 202 is used to obtain a first image and a second image contrasting with the first image from the initial printing result, and obtain a corresponding initial barcode from the initial printing result; the feature mining module 203 is used to compare the first image and the second image; The second image is subjected to feature mining to obtain first feature information corresponding to the first image and second feature information corresponding to the second image; a gap calculation module 204 is used to determine the image gap corresponding to the first image and the second image according to the first feature information and the second feature information; an image adjustment module 205 is used to adjust the second image according to the image gap to obtain a third image corresponding to the second image; a feature evaluation module 206 is used to perform edge feature evaluation on the initial barcode to obtain an edge evaluation value corresponding to the initial barcode; a barcode adjustment module 207 is used to adjust the initial barcode according to the edge evaluation value to obtain the corresponding target barcode; a data adjustment module 208 is used to adjust the initial printing result according to the third image and the target barcode to obtain a target printing result.
[0205] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the device 200 for optimizing printing effects described above can refer to the corresponding process in the aforementioned method embodiment for optimizing printing effects, and will not be repeated here.
[0206] See also Figure 3 , Figure 3 A schematic block diagram of the structure of a terminal device provided in an embodiment of the present invention.
[0207] like Figure 3 As shown, the terminal device 300 includes a processor 301 and a memory 302 , and the processor 301 and the memory 302 are connected via a bus 303 , such as an I2C (Inter-integrated Circuit) bus.
[0208] Specifically, the processor 301 is used to provide computing and control capabilities to support the operation of the entire terminal device. The processor 301 can be a central processing unit (CPU), and the processor 301 can also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
[0209] Specifically, the memory 302 may be a Flash chip, a read-only memory (ROM) disk, an optical disk, a USB flash drive, or a mobile hard disk.
[0210] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a partial structure related to the embodiment of the present invention, and does not constitute a limitation on the terminal device to which the embodiment of the present invention is applied. The specific server may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0211] The processor is used to run a computer program stored in the memory, and implement any one of the methods for optimizing printing effects provided by the embodiments of the present invention when executing the computer program.
[0212] In one embodiment, the processor is used to run a computer program stored in the memory, and implements the following steps when executing the computer program:
[0213] Obtaining target printing data and a target printing instruction corresponding to the target printing data, and determining an initial printing result corresponding to the target printing data according to the target printing instruction;
[0214] Obtaining a first image and a second image contrasting with the first image from the initial printing result, and obtaining a corresponding initial barcode from the initial printing result;
[0215] Performing feature mining on the first image and the second image to obtain first feature information corresponding to the first image and second feature information corresponding to the second image;
[0216] determining an image difference between the first image and the second image according to the first feature information and the second feature information;
[0217] Adjusting the second image according to the image difference to obtain a third image corresponding to the second image;
[0218] Performing edge feature evaluation on the initial barcode to obtain an edge evaluation value corresponding to the initial barcode;
[0219] Adjusting the initial barcode according to the edge evaluation value to obtain a corresponding target barcode;
[0220] The initial printing result is adjusted according to the third image and the target barcode to obtain a target printing result.
[0221] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the terminal device described above can refer to the corresponding process in the aforementioned method embodiment for optimizing printing effects, and will not be repeated here.
[0222] An embodiment of the present invention also provides a storage medium for computer-readable storage, wherein the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of any method for optimizing printing effects provided in the description of the embodiment of the present invention.
[0223] The storage medium may be an internal storage unit of the terminal device described in the foregoing embodiment, such as a hard disk or memory of the terminal device. The storage medium may also be an external storage device of the terminal device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc., equipped on the terminal device.
[0224] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In a hardware embodiment, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or transient medium). As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0225] It should be understood that the term "and / or" used in the present specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations. It should be noted that, in this article, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system 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, method, article or system. In the absence of further restrictions, an element defined by the sentence "including a..." does not exclude the presence of other identical elements in the process, method, article or system including the element.
[0226] The serial numbers of the embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. The above description is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A method for optimizing printing effect, characterized in that: The method comprises: Obtaining target printing data and a target printing instruction corresponding to the target printing data, and determining an initial printing result corresponding to the target printing data according to the target printing instruction; Obtaining a first image and a second image contrasting with the first image from the initial printing result, and obtaining a corresponding initial barcode from the initial printing result; Performing feature mining on the first image and the second image to obtain first feature information corresponding to the first image and second feature information corresponding to the second image; determining an image difference between the first image and the second image according to the first feature information and the second feature information; Adjusting the second image according to the image difference to obtain a third image corresponding to the second image; Performing edge feature evaluation on the initial barcode to obtain an edge evaluation value corresponding to the initial barcode; Adjusting the initial barcode according to the edge evaluation value to obtain a corresponding target barcode; The initial printing result is adjusted according to the third image and the target barcode to obtain a target printing result.
2. The method according to claim 1, characterized in that The performing feature mining on the first image and the second image to obtain first feature information corresponding to the first image and second feature information corresponding to the second image includes: Performing variance calculation on the first image to obtain a first variance and performing variance calculation on the second image to obtain a second variance; Performing entropy calculation on the first image to obtain a first entropy value and performing entropy calculation on the second image to obtain a second entropy value; fusing the first variance and the first entropy value to obtain a first quality coefficient corresponding to the first image, and fusing the second variance and the second entropy value to obtain a second quality coefficient corresponding to the second image; determining the first feature information corresponding to the first image according to the first variance, the first entropy value, and the first quality coefficient; The second feature information corresponding to the second image is determined according to the second variance, the second entropy value, and the second quality coefficient.
3. The method according to claim 2, characterized in that The determining the image difference between the first image and the second image according to the first feature information and the second feature information includes: determining a first difference between the first image and the second image according to the first variance and the second variance; determining a second difference between the first image and the second image according to the first entropy value and the second entropy value; determining a third difference between the first image and the second image based on the first quality coefficient and the second quality coefficient; Determine a target window, and interactively calculate the first image and the second image according to the target window to obtain a third difference between the first image and the second image; determining a first similarity between image structures of the first image and the second image according to the first variance, the second variance, and the third variance; determining a second similarity between image contrasts of the first image and the second image based on the first variance and the second variance; Determine the image gap between the first image and the second image by fusing the first difference, the second difference, the third difference, the first similarity, and the second similarity; The third difference and the image difference are obtained according to the following formula: ; ; in, represents the third difference, N represents the number of images corresponding to the first image or the second image under the target window, M represents the length corresponding to the target window, and L represents the width corresponding to the target window. represents the pixel value corresponding to the i-th window image corresponding to the target window under the first image when the horizontal coordinate is m and the vertical direction is n, represents the average pixel value corresponding to the i-th window image corresponding to the target window under the first image, represents the pixel value corresponding to the i-th window image corresponding to the target window under the second image when the horizontal coordinate is m and the vertical direction is n, represents the average pixel value corresponding to the i-th window image corresponding to the target window under the second image, represents the pixel value corresponding to the jth window image of the target window under the first image when the horizontal coordinate is m and the vertical direction is n, represents the average pixel value corresponding to the j-th window image corresponding to the target window under the first image, represents the pixel value corresponding to the jth window image corresponding to the target window under the second image when the horizontal coordinate is m and the vertical direction is n, represents the average pixel value corresponding to the j-th window image corresponding to the target window under the second image; represents the image difference between the first image and the second image, represents the first variance, represents the second variance, represents the first entropy value, represents the second entropy value, represents the first quality coefficient, represents the second quality coefficient, represents the first difference, represents the second difference, and represents a constant, , , , , represents the adjustment weight, and ln represents the natural logarithm.
4. The method according to claim 1, characterized in that: The adjusting the second image according to the image difference to obtain a third image corresponding to the second image includes: When the image difference is smaller than a first preset value, obtaining an associated image corresponding to the second image from the target print data; Calculating the maximum brightness value of the associated image in a brightness channel to obtain the maximum brightness value corresponding to the associated image; Performing brightness compensation on the second image according to the maximum brightness value to obtain a corrected image; Performing brightness analysis on the corrected image to obtain a target brightness area corresponding to the corrected image; Determining, according to the corrected image and the target brightness area, a first correlation degree that each target pixel in the corrected image belongs to a bright area and a second correlation degree that each target pixel belongs to a dim area; The first correlation degree and the second correlation degree are combined to determine a brightness adjustment parameter corresponding to each target pixel in the corrected image; The corrected image is adjusted according to the brightness adjustment parameter to obtain the third image corresponding to the second image.
5. The method according to claim 4, characterized in that The step of performing brightness compensation on the second image according to the maximum brightness value to obtain a corrected image includes: Obtaining a first associated image corresponding to the second image in a first channel, obtaining a second associated image corresponding to the second image in a second channel, and obtaining a third associated image corresponding to the second image in a third channel; Obtaining a first brightness mean and a first brightness variance corresponding to the first associated image, obtaining a second brightness mean and a second brightness variance corresponding to the second associated image, and obtaining a third brightness mean and a third brightness variance corresponding to the third associated image; Obtaining a fourth brightness mean and a fourth brightness variance corresponding to the second image at the maximum brightness value; Dividing the fourth brightness variance by the first brightness variance to obtain a first ratio, and performing brightness compensation on the first associated image according to the first ratio combined with the first brightness mean and the fourth brightness mean to obtain a first compensated image; Dividing the fourth brightness variance by the second brightness variance to obtain a second ratio, and performing brightness compensation on the second associated image according to the second ratio combined with the second brightness mean and the fourth brightness mean to obtain a second compensated image; Dividing the fourth brightness variance by the third brightness variance to obtain a third ratio, and performing brightness compensation on the third associated image according to the third ratio combined with the third brightness mean and the fourth brightness mean to obtain a third compensated image; The corrected image is obtained by fusing the first compensated image, the second compensated image and the third compensated image.
6. The method according to claim 1, characterized in that The step of evaluating the edge feature of the initial barcode to obtain an edge evaluation value corresponding to the initial barcode includes: Obtain a first pixel point adjacent to a barcode pixel point corresponding to the initial barcode in a horizontal direction and a second pixel point adjacent to the first pixel point; Calculating a first difference between the barcode pixel and the first pixel and calculating a second difference between the first pixel and the second pixel; Fusion of the first difference and the second difference to determine a horizontal edge value corresponding to the barcode pixel point; Obtaining a third pixel point adjacent to the barcode pixel point in the vertical direction and a fourth pixel point adjacent to the third pixel point; Calculating a third difference between the barcode pixel and the third pixel and calculating a fourth difference between the third pixel and the fourth pixel; Fusion of the third difference and the fourth difference to determine the vertical edge value corresponding to the barcode pixel point; Summing the horizontal edge values of all the barcode pixel points to obtain a first total, and summing the vertical edge values of all the barcode pixel points to obtain a second total; The edge evaluation value corresponding to the initial barcode is determined according to the first total number and the second total number.
7. The method according to any one of claims 1 to 6, characterized in that After obtaining the target printing result, the method further includes: Displaying the initial printing result and the target printing result to obtain a target display result; A target operation of a target user on the target display result is received, and the target printing data is printed according to the target operation to obtain a real printing result.
8. A device for optimizing printing effect, characterized in that: include: A data acquisition module, used for acquiring target printing data and a target printing instruction corresponding to the target printing data, and determining an initial printing result corresponding to the target printing data according to the target printing instruction; An image acquisition module, used to obtain a first image and a second image contrasting with the first image from the initial printing result, and to obtain a corresponding initial barcode from the initial printing result; A feature mining module, used to perform feature mining on the first image and the second image to obtain first feature information corresponding to the first image and second feature information corresponding to the second image; a gap calculation module, configured to determine an image gap between the first image and the second image according to the first feature information and the second feature information; An image adjustment module, configured to adjust the second image according to the image difference to obtain a third image corresponding to the second image; A feature evaluation module, used for performing edge feature evaluation on the initial barcode to obtain an edge evaluation value corresponding to the initial barcode; A barcode adjustment module, used for adjusting the initial barcode according to the edge evaluation value to obtain a corresponding target barcode; A data adjustment module is used to adjust the initial printing result according to the third image and the target barcode to obtain a target printing result.
9. A terminal device, characterized in that: The terminal device includes a processor and a memory; The memory is used to store computer programs; The processor is configured to execute the computer program and implement the method for optimizing printing effects according to any one of claims 1 to 7 when executing the computer program.
10. A computer storage medium for computer storage, characterized in that: The computer storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the method for optimizing printing effects according to any one of claims 1 to 7.