Image processing method and device, electronic equipment and storage medium

By redetermining the pixel category after scaling during image formation, and employing neighborhood pixel category judgment and adaptive filtering, the inaccuracy caused by changes in pixel category after scaling is solved, thus improving the quality and accuracy of image output.

CN119445225BActive Publication Date: 2025-11-07ZHUHAI PANTUM ELECTRONICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411514256.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-11-07
Estimated Expiration
2044-10-28

AI Technical Summary

Technical Problem

During image formation, scaling changes the pixel category, leading to inaccuracies in subsequent processing. This is especially true when there are inconsistent tags for text and images within an N×N area; scaling down or up can make it impossible to determine whether a tag is an image or text.

Method used

By determining the category of each pixel to be processed in the image data and redetermining the category of the scaled pixel based on the categories of pixels in the neighborhood, different methods are used for bilinear interpolation calculation or gradient value judgment. Combined with adaptive filtering and ink-saving processing, the accuracy of pixel category recognition is improved.

Benefits of technology

It reduces the inaccuracy caused by changes in pixel category after scaling, improves the quality and accuracy of image output, especially the clarity of grayscale features and lines, and improves the image formation effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119445225B_ABST
    Figure CN119445225B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide an image processing method and device, electronic equipment and storage medium. The method comprises: determining the category of each to-be-processed pixel in image data; performing first optimization processing on the image data according to the category of each to-be-processed pixel, to obtain first image data; performing reduction or enlargement processing on the first image data, to obtain second image data; and the method further comprises: taking any one to-be-processed pixel in the first image data as a target pixel, obtaining the category of each pixel in the neighborhood of the target pixel; and determining the manner of obtaining the category of the corresponding to-be-processed pixel in the second image data according to the category of each pixel in the neighborhood of the target pixel. Embodiments of the present application can use different manners to re-determine the category of the pixel after scaling, to reduce the problem of inaccurate subsequent processing caused by category change after scaling.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image forming, in particular to an image processing method and device, electronic equipment and storage medium. BACKGROUND

[0002] There is a technology in the field of image forming, which is called pipeline processing or pipeline, that is, data compression, data decompression, color space conversion and halftone and other image processing modules are associated with each other in a certain order, so that the input image data is sequentially processed by image processing technology.

[0003] In the traditional pipeline processing technology, the content feature recognition module can identify the category (referred to as tag) of each pixel according to the input RGB data, such as whether it is an edge pixel, whether it is a text, whether it is a picture, etc. After identifying the category, the subsequent pipeline module can perform different processing according to different tags. For example, the pixels after identifying the tag can be sequentially processed by rotation, scaling (scale), filtering (FIR) and other processes.

[0004] However, after performing scaling, the tag of the pixel may change, for example, an N x N picture contains text tags and image tags in the N x N area, that is, the tags in the area are not uniform, at this time if the N x N picture is scaled to 1 x 1, the tag value after scaling cannot be confirmed as a picture or a text; Similarly, 1 x 1 is enlarged to N x N, which may also cause the tag to change. SUMMARY

[0005] Therefore, the present application provides an image processing method, device, electronic equipment and storage medium for re-determining the category of the pixel after scaling.

[0006] In a first aspect, the embodiments of the present application provide an image processing method, comprising:

[0007] determining the category of each to-be-processed pixel in image data;

[0008] performing first optimization processing on the image data according to the category of each to-be-processed pixel, to obtain first image data;

[0009] performing scaling or enlargement processing on the first image data, to obtain second image data;

[0010] The method further comprises:

[0011] taking any one pixel to be processed in the first image data as a target pixel, obtaining the category of each pixel in the neighborhood of the target pixel;

[0012] determining a manner of obtaining the category of the corresponding pixel to be processed in the second image data according to the category of each pixel in the neighborhood of the target pixel.

[0013] In a possible implementation, the manner of obtaining the category of the corresponding pixel to be processed in the second image data according to the category of each pixel in the neighborhood of the target pixel includes:

[0014] determining the number of pixels of the first category and the number of pixels of the second category in the neighborhood of the target pixel according to the category of each pixel in the neighborhood of the target pixel;

[0015] if the number of pixels of the first category or the number of pixels of the second category in the neighborhood of the target pixel is greater than a preset threshold, obtaining the category of the corresponding pixel to be processed in the second image data according to a first manner, wherein the first manner is a bilinear interpolation calculation manner.

[0016] In a possible implementation, the method further includes:

[0017] if the number of pixels of the first category and the number of pixels of the second category in the neighborhood of the target pixel are both less than or equal to the preset threshold, obtaining the category of the corresponding pixel to be processed in the second image data according to a second manner.

[0018] In a possible implementation, the manner of obtaining the category of the corresponding pixel to be processed in the second image data according to the second manner includes:

[0019] determining a first attribute of the category of the corresponding pixel to be processed in the second image data according to a first attribute of the category of each pixel in the neighborhood of the target pixel, wherein the first attribute includes a gray attribute and a normal attribute;

[0020] determining a second attribute of the category of the corresponding pixel to be processed in the second image data according to a gradient value of the corresponding pixel to be processed in the second image data, wherein the second attribute includes a text, a line queue, an image, and / or a background;

[0021] determining the category of the corresponding pixel to be processed in the second image data according to the first attribute and the second attribute of the category of the corresponding pixel to be processed in the second image data.

[0022] In a possible implementation, the first attribute of the category of the corresponding to-be-processed pixel in the second image data is determined according to the first attribute of the category of the pixel in the neighborhood of the target pixel, and the first attribute includes a gray attribute and a normal attribute, and the method comprises the following steps.

[0023] The number of pixels with the first attribute of the category being the gray attribute and the number of pixels with the first attribute of the category being the normal attribute are determined.

[0024] When the number of pixels with the first attribute of the category being the gray attribute is greater than the number of pixels with the first attribute of the category being the normal attribute, the first attribute of the category of the corresponding to-be-processed pixel in the second image data is adjusted to the gray attribute; and when the number of pixels with the first attribute of the category being the gray attribute is less than or equal to the number of pixels with the first attribute of the category being the normal attribute, the first attribute of the category of the corresponding to-be-processed pixel in the second image data is adjusted to the normal attribute.

[0025] In a possible implementation, the second attribute of the category of the corresponding to-be-processed pixel in the second image data is determined according to the gradient value of the corresponding to-be-processed pixel in the second image data, and the method comprises the following steps.

[0026] The gradient value of the corresponding to-be-processed pixel in the second image data is obtained.

[0027] The second attribute of the category of the corresponding to-be-processed pixel is determined according to the gradient value.

[0028] In a possible implementation, the method further comprises the following steps.

[0029] The first image data is subjected to a reduction and / or rotation processing, or an enlargement and / or rotation processing, to obtain the second image data, wherein when the rotation processing is performed on the first image data, the category of each to-be-processed pixel in the first image data is synchronously rotated with the corresponding to-be-processed pixel in the first image data.

[0030] In a possible implementation, the method further comprises the following steps.

[0031] Any pixel with an RGB value greater than an RGB value of a background pixel in the image data is taken as a first pixel, and the first pixel is assigned a value.

[0032] Edge detection is performed on the first pixel after the assignment, to obtain a gradient value of the first pixel.

[0033] An initial second attribute of the category of the first pixel is determined based on the gradient value.

[0034] adjusting the initial second attribute of the category of the first pixel based on the initial second attribute of the category of the pixels in the connected domain of the first pixel, to obtain a second attribute of the category of the first pixel;

[0035] determining a first attribute of the category of the first pixel according to the RGB mean value of the pixels in the neighborhood of the first pixel;

[0036] determining the category of each pixel to be processed in the image data according to the first attribute of the category of each first pixel and the second attribute of the category of each first pixel.

[0037] In a possible implementation, the determining of the initial second attribute of the category of the first pixel based on the gradient value includes:

[0038] determining whether the first pixel is a line queue by a preset fixed template;

[0039] determining the initial second attribute of the category of the first pixel as a line queue if the first pixel is a line queue;

[0040] determining a gradient value range of the first pixel if the first pixel is not a line queue;

[0041] determining the initial second attribute of the category of the first pixel as a character, an image or a background according to the gradient value range of the first pixel.

[0042] In a possible implementation, the adjusting of the initial second attribute of the category of the first pixel based on the initial second attribute of the category of the pixels in the connected domain of the first pixel includes:

[0043] obtaining a number of pixels in the connected domain of the first pixel whose initial second attribute of the category is a line queue;

[0044] adjusting the initial second attribute of the category of the first pixel whose initial second attribute of the category is a character to a line queue if the number of pixels is greater than a first preset value.

[0045] In a possible implementation, the adjusting of the initial second attribute of the category of the first pixel based on the initial second attribute of the category of the pixels in the connected domain of the first pixel includes:

[0046] obtaining a number of pixels in the connected domain of the first pixel whose initial second attribute of the category is an image;

[0047] adjusting the initial second attribute of the category of the first pixel whose initial second attribute of the category is a character to an image if the number of pixels is greater than a second preset value.

[0048] In a possible implementation, after the second image data is obtained, the method further includes:

[0049] performing adaptive filtering processing on the second image data based on the category of each pixel to be processed in the second image data, the adaptive filtering processing including moire processing, text sharpening processing, and line queue contrast and sharpening processing.

[0050] In a possible implementation, after the second image data is obtained, the method further includes:

[0051] performing ink saving processing on a black text region of the second image data based on the category of each pixel to be processed in the second image data.

[0052] In a possible implementation, after the second image data is obtained, the method further includes:

[0053] performing color trapping processing on the second image data based on the category of each pixel to be processed in the second image data.

[0054] In a possible implementation, after the second image data is obtained, the method further includes:

[0055] performing lightening processing on a halftone region of the second image data based on the category of each pixel to be processed in the second image data.

[0056] In a possible implementation, after the second image data is obtained, the method further includes:

[0057] for a pixel whose first attribute of the category is a gray attribute, performing an image forming operation only by using black toner.

[0058] In a second aspect, an embodiment of the present application provides an image processing apparatus, including:

[0059] a first determination unit, configured to determine a category of each pixel to be processed in image data;

[0060] a first optimization processing unit, configured to perform first optimization processing on the image data according to the category of each pixel to be processed, to obtain first image data;

[0061] a zooming or enlarging processing unit, configured to perform zooming or enlarging processing on the first image data, to obtain second image data;

[0062] The apparatus further includes:

[0063] an acquisition unit, configured to take any one pixel to be processed in the first image data as a target pixel, and acquire a category of each pixel in a neighborhood of the target pixel;

[0064] A second determining unit is configured to determine a manner of obtaining the category of a corresponding to-be-processed pixel in the second image data according to the category of each pixel in the neighborhood of the target pixel.

[0065] In a third aspect, an electronic device is provided, including:

[0066] a processor;

[0067] a memory;

[0068] The memory stores a computer program, which, when executed, causes the electronic device to perform the method of any one of the first aspect.

[0069] In a fourth aspect, a computer-readable storage medium is provided, including a stored program, wherein the program, when executed, controls a device in which the computer-readable storage medium is located to perform the method of any one of the first aspect.

[0070] Compared with the prior art, the embodiments of the present application can determine the category of the scaled pixel in different ways, thereby reducing the problem of inaccurate subsequent processing caused by category change after scaling. BRIEF DESCRIPTION OF DRAWINGS

[0071] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0072] Figure 1 A schematic diagram of an image pipeline processing flow in the related art;

[0073] Figure 2 A schematic diagram of an image processing method provided by the embodiments of the present application;

[0074] Figure 3 A schematic diagram of a method for determining the category of a to-be-processed pixel provided by the embodiments of the present application;

[0075] Figure 4 A schematic diagram of a method for determining the initial second attribute of the category of a first pixel provided by the embodiments of the present application;

[0076] Figure 5 A schematic diagram of a line queue provided by the embodiments of the present application;

[0077] Figure 6 A schematic diagram of the structure of an image processing device provided by the embodiments of the present application;

[0078] Figure 7 A structural schematic diagram of an electronic device is provided in an embodiment of the present application. DETAILED DESCRIPTION

[0079] For better understanding of the technical solutions of the present application, the embodiments of the present application are described in detail below with reference to the drawings.

[0080] It should be clear that the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the present application.

[0081] The terms used in the embodiments of the present application are only for the purpose of describing the specific embodiments, and are not intended to limit the present application. The singular forms "a", "an" and "the" used in the embodiments of the present application and the appended claims are also intended to include the plural forms, unless the context clearly indicates otherwise.

[0082] It should be understood that the term "and / or" used herein is only to describe the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B, which can represent the three cases of A alone, A and B together, and B alone. In addition, the character " / " in this paper generally represents that the front and rear associated objects are in an "or" relationship.

[0083] There is a technology called pipeline processing or pipeline in the image forming field, which is a technology of associating data compression, data decompression, color space conversion and halftone and other image processing modules in a certain order to sequentially perform image processing on input image data. Referring to Figure 1 A schematic diagram of an image pipeline processing flow in the related art is shown. As Figure 1 The image pipeline processing flow includes a scanning data input interface, a printing data input interface, a printing output interface, and a content feature recognition module, a rotation scaling module, a filtering module, a scanning module, a sharpening module and the like arranged between the interfaces, which can realize scanning, printing, copying and the like by transferring image data between the modules in the direction indicated by the arrows in the figure.

[0084] As Figure 1As shown, in the conventional pipeline processing technology, the content feature recognition module can recognize the category (hereinafter referred to as tag) to which each pixel belongs according to the input RGB data, for example: whether it is an edge pixel, whether it is a text, whether it is a picture, etc. Specifically, the pixel features of the other 8 pixels within the 3x3 range around the pixel can be used to determine the category to which the pixel belongs. After the category is recognized, the subsequent pipeline module can perform different processing according to different tags. For example, the pixels after tag recognition can be sequentially subjected to rotation and scaling (scale), filtering (FIR), etc.

[0085] However, after scaling, the tag of the pixel may change, for example, an N x N picture contains text tags and image tags in the N x N area, that is, the tags in the area are not uniform, at this time, if the N x N picture is reduced to 1 x 1, the tag value after scaling cannot be confirmed as a picture or a text; similarly, 1 x 1 enlargement to N x N may also cause the tag to change.

[0086] It should be noted that, Figure 1 The specific principles and functions of the modules in the above embodiment can refer to the content description in the related art, and for the sake of brevity, the present application embodiment will not be described here.

[0087] To solve the above problems, the present application provides an image processing method, device, electronic equipment and storage medium, and the present application embodiment can determine the category of the pixel after scaling according to the category of the pixel in the neighborhood of the pixel before scaling, thereby reducing the problem that the subsequent processing is inaccurate due to the change of the category of the pixel after scaling. The following will be described in detail with reference to the accompanying drawings.

[0088] Referring to Figure 2 A flowchart of an image processing method provided by the present application embodiment is shown. The image processing method can use the modules shown in Figure 1 , as shown in Figure 2 , which mainly includes the following steps.

[0089] S201: Determine the category of each pixel to be processed in the image data.

[0090] In the present application embodiment, after the image data is obtained, the content feature recognition module can be used to determine the category of each pixel to be processed in the image data, wherein the category of the pixel includes eight categories of text, gray text, line, gray line, image, gray image, background and gray background.

[0091] In a specific implementation, the attribute of the pixel category can be divided into a first attribute and a second attribute according to the category of the pixel, where the first attribute includes a gray attribute and a non-gray attribute, and the non-gray attribute is also referred to as a normal attribute. For example, the first attribute of the text, line, image, and background categories is a normal attribute, the first attribute of the gray text, gray line, gray image, and gray background categories is a gray attribute, and the second attribute includes text, line, image, and background. For example, the second attribute of the text and gray text categories is text, the second attribute of the line and gray line categories is a line, the second attribute of the image and gray image is an image, and the second attribute of the background and gray background is background. Therefore, when the image data is obtained, the category of each to-be-processed pixel can be obtained by determining the first attribute and the second attribute of the category of each to-be-processed pixel in the image data.

[0092] Referring to Figure 3 FIG. 1 is a flowchart of a process for determining a category of a to-be-processed pixel according to an embodiment of the present application. As shown in FIG. 1, the process includes the following steps. Figure 3

[0093] S301: Any pixel with an RGB value greater than an RGB value of a background pixel in image data is regarded as a first pixel, and the first pixel is assigned a value.

[0094] In the embodiment of the present application, the RGB value of the background pixel in the image data can be detected by using a histogram, and then any pixel with an RGB value greater than the RGB value of the background pixel in the image data is regarded as the first pixel, and the first pixel is assigned a value. For example, the image obtained by scanning is generally dark, and the RGB value of the background pixel detected by using the histogram is generally about 190. In this case, any pixel with an RGB value greater than 190 in the image data is regarded as the first pixel, and the RGB value of the first pixel is assigned as 255 (white). By brightening the dark background value to white, the gradient of the text can be improved, which facilitates subsequent detection.

[0095] S302: The first pixel after being assigned a value is subjected to edge detection to obtain a gradient value of the first pixel.

[0096] In the embodiment of the present application, the RGB three channels of the first pixel after being assigned a value are subjected to edge detection to obtain the gradient value of the first pixel. The specific content of the edge detection can refer to related technologies, and will not be described herein for brevity.

[0097] S303: An initial second attribute of the category of the first pixel is determined based on the gradient value.

[0098] ​In the embodiment of the present application, the gradient value of the first pixel can be used to determine whether the first pixel is a character, a line, an image or a background, that is, the initial second attribute of the category of the first pixel can be determined based on the gradient value. Specifically, a preset fixed template can be obtained first, and the preset fixed template can be used to determine whether the first pixel is a line. If the first pixel is a line, the initial second attribute of the category of the first pixel is determined as a line. If the first pixel is not a line, the gradient value range of the first pixel is determined, and the initial second attribute of the category of the first pixel is determined as a character, an image or a background according to the gradient value range of the first pixel. The preset fixed template is a template set according to common line conditions.

[0099] Specifically, as shown in FIG. 3, the step of determining the initial second attribute of the category of the first pixel based on the gradient value specifically includes the following steps. Figure 4

[0100] S3031: The preset fixed template is used to determine whether the first pixel is a line. If the first pixel is a line, S3032 is entered. If the first pixel is not a line, S3033 is entered.

[0101] The preset fixed template of the embodiment of the present application can be a neighborhood fixed template. If the result of the determination of the preset fixed template is a line, the initial second attribute of the category of the first pixel is determined as a line, and S3032 is entered. If the result of the determination of the preset fixed template is not a line, the initial second attribute of the category of the first pixel is not a line, and S3033 needs to be entered for further determination.

[0102] S3032: The tag of the first pixel is assigned as a line tag.

[0103] For the first pixel whose initial second attribute of the category is a line, the tag of the first pixel is assigned as a line tag.

[0104] S3033: It is determined whether the gradient value of the first pixel is within a character range. If the gradient value is within the character range, S3034 is entered. If the gradient value is not within the character range, S3035 is entered.

[0105] For the first pixel whose initial second attribute of the category is not a line, it is determined whether the gradient value of the first pixel is within a character range. If the gradient value of the first pixel is within the character range, the initial second attribute of the category of the first pixel is determined as a character, and S3034 is entered. If the gradient value of the first pixel is not within the character range, the initial second attribute of the category of the first pixel is not a character, and S3035 needs to be entered for further determination.

[0106] S3034: The tag of the first pixel is assigned as a character tag. ​​

[0107] For the first pixel whose initial second attribute of the category is text, the tag of the first pixel is assigned as a text label.

[0108] S3035: Determine whether the gradient value of the first pixel is within the image range. If the gradient value is within the image range, go to S3036. If the gradient value is not within the image range, go to S3037.

[0109] For the first pixel whose initial second attribute of the category is not text, determine whether the gradient value of the first pixel is within the image range. If the gradient value of the first pixel is within the image range, determine that the initial second attribute of the category of the first pixel is image, and go to S3036. If the gradient value of the first pixel is not within the image range, determine that the initial second attribute of the category of the first pixel is background, and go to S3035.

[0110] S3036: Assign the tag of the first pixel as an image label.

[0111] For the first pixel whose initial second attribute of the category is image, the tag of the first pixel is assigned as an image label.

[0112] S3037: Assign the tag of the first pixel as a background label.

[0113] For the first pixel whose initial second attribute of the category is background, the tag of the first pixel is assigned as a background label.

[0114] Embodiments of the present application can preliminarily determine the second attribute of the category of each to-be-processed pixel in image data, to obtain the initial second attribute of the category of each to-be-processed pixel.

[0115] It should be noted that in the embodiments of the present application, S3031 can also be executed before S302, that is, the pixels in the line queue are first distinguished, and then the gradient value of the first pixel is obtained, and the pixels of the categories of text, image and background are distinguished based on the gradient value. The embodiments of the present application do not make specific requirements thereon.

[0116] S304: Adjust the initial second attribute of the category of the first pixel based on the initial second attribute of the category of the pixels in the connected domain of the first pixel, to obtain the second attribute of the category of the first pixel.

[0117] In the embodiments of the present application, after the initial second attribute of the category of the first pixel is determined, the initial second attribute of the category of the first pixel can be determined again according to the initial second attribute of the category of the pixels in the connected domain of the first pixel, to adjust the initial second attribute of the first pixel whose initial second attribute of the category is incorrect.

[0118] Specifically, for the first pixel whose initial second attribute of the category is text, the number of pixels whose initial second attribute of the category is line group within the connected component of the first pixel is obtained. The first pixels whose initial second attribute of the category is line group within the connected component is determined to be greater than a first preset value are then adjusted to line group, thereby obtaining the second attribute of the category of the first pixel.

[0119] Specifically, for the first pixel whose initial second attribute of the category is text, the number of pixels whose initial second attribute of the category of the first pixel is image is obtained within the connected component of the first pixel. The first pixels whose initial second attribute of the category of the connected component is line image are determined to be greater than a second preset value. The initial second attribute of the category of these first pixels is adjusted to image, thereby obtaining the second attribute of the category of the first pixel.

[0120] The embodiments of this application can re-determine the initial second attribute of the category of the first pixel, ensuring the accuracy of pixel category change recognition and improving the output quality of the image.

[0121] As can be seen, in this embodiment, S304 is for the first pixel whose initial second attribute of the category is text. Therefore, in practical applications, for the first pixel whose initial second attribute of the category is other, it can directly enter S305 without going through S304.

[0122] S305: The first attribute for determining the category of the first pixel based on the RGB mean of the pixels in the neighborhood of the first pixel;

[0123] In this embodiment of the application, it can be achieved through the first pixel. The RGB mean of the neighboring pixels determines the first attribute of the first pixel's category. Specifically, each of the first pixel's RGB values ​​is obtained. The RGB mean values ​​of the pixels in the neighborhood are calculated, and the difference between each RGB mean value is determined. It is then determined whether the difference between the RGB mean values ​​is less than a set value, such as less than 10. If the difference between the RGB mean values ​​is less than the set value, then the first attribute of the category of the first pixel is confirmed to be grayscale; otherwise, the first attribute of the category of the first pixel is normal.

[0124] S306: Determine the category of each pixel to be processed in the image data based on the first attribute of the category of each first pixel and the second attribute of the category of each first pixel.

[0125] In the embodiment of the present application, after the first attribute and the second attribute of the category of each first pixel are acquired, the category of each to-be-processed pixel in the image data can be determined. For example, if the acquired first attribute of the category of the first pixel is the normal attribute and the second attribute is the text, it can be determined that the category of the first pixel in the image data is the text; if the acquired first attribute of the category of the first pixel is the gray attribute and the second attribute is the line queue, it can be determined that the category of the first pixel in the image data is the gray line queue.

[0126] In actual application, the line queue (line group) is a kind of image data different from the text, and has different attributes from the text, for example, Figure 5 As shown in the figure, and the prior art does not distinguish the text from the line queue, based on this, the embodiment of the present application improves the content feature recognition module, increases the distinction between the line queue and the text on the basis of the traditional image-text segmentation, which can facilitate the subsequent additional processing of the line queue, make it more obvious, and thus increase the output image quality.

[0127] S202: performing first optimization processing on the image data according to the category of each to-be-processed pixel to obtain first image data.

[0128] The embodiment of the present application can perform first optimization processing on the image data according to the category of each to-be-processed pixel to obtain first image data, wherein the first optimization processing can include removing moire, text sharpening, original type analysis, and automatic contrast adjustment, etc. In specific implementation, the user can change the optimization processing means of the first optimization processing module according to the processing requirements of the image data, and the embodiment of the present application does not make specific requirements thereon.

[0129] S203: taking any one to-be-processed pixel in the first image data as a target pixel, and acquiring the category of each pixel in the neighborhood of the target pixel.

[0130] S204: determining the manner of acquiring the category of the corresponding to-be-processed pixel in the second image data according to the category of each pixel in the neighborhood of the target pixel, wherein the second image data is image data obtained by performing reduction or enlargement processing on the first image data.

[0131] In the embodiment of the present application, since the reduction or enlargement processing on the first image data can cause the category of each to-be-processed pixel in the first image data to change, for example, if the horizontal and vertical directions of the first image data are both reduced by 2 times, that is, four pixel points in the first image data are combined into one pixel point, if the categories of the four pixel points are relatively disordered, some are texts and some are images, then the category of the pixel obtained after reduction cannot be determined.

[0132] In the prior art, for the category change of the pixels after the zoom-in or zoom-out processing, a simple bilinear interpolation calculation is generally directly used, but the accuracy of the category is lost by simply performing the bilinear interpolation calculation on the category of the pixels without considering the disorder degree of the category. That is, when the bilinear interpolation calculation is performed on the category of the pixels, if the categories of the surrounding pixels are relatively uniform, the calculation result is correct, and if the categories of the surrounding pixels are relatively disordered, the result after the interpolation is inaccurate. For example, the category of a text is 1 and the category of an image is 0, if the surrounding pixels are all text and image, the value obtained may be 0.4, which does not belong to any category.

[0133] Based on this, the embodiment of the present application provides a method for determining which way to calculate the category change of the pixels after the zoom-in or zoom-out processing. Specifically, in the embodiment of the present application, any one pixel to be processed in the first image data can be taken as a target pixel, the category of each pixel in the neighborhood of the target pixel is obtained, and the attribute of the category of each pixel in the neighborhood of the target pixel is judged, so as to determine the way to adjust the category of the pixel to be processed in the image data after the zoom-in or zoom-out processing is performed. The neighborhood of the target pixel is preferably the neighborhood of the target pixel.

[0134] In a possible implementation, the text, the line queue, the gray text and the gray line queue can be taken as the first category, and the image, the background, the gray image and the gray background can be taken as the second category. After the category of each pixel in the neighborhood of the target pixel is obtained, the number of pixels with the category of the first category and the number of pixels with the category of the second category in the neighborhood of the target pixel are determined. If the number of pixels with the category of the first category or the number of pixels with the category of the second category is greater than a preset threshold, that is, the number of pixels belonging to the same category in the neighborhood of the target pixel is relatively large, and the categories of the pixels are relatively uniform, the category of the corresponding pixel to be processed in the second image data is obtained according to the first way, wherein the first way is a bilinear interpolation calculation, that is, the category of the pixel to be processed in the second image data can be obtained by only performing the bilinear interpolation calculation on the category of the pixel in the first image data.

[0135] If the number of pixels with the category of the first category and the number of pixels with the category of the second category are both less than or equal to the preset threshold, it is proved that the categories of the pixels in the neighborhood of the target pixel are relatively disordered, and the category of the corresponding pixel to be processed in the second image data is obtained according to the second way, wherein the category of the corresponding pixel to be processed in the second image data obtained according to the second way specifically includes:

[0136] The first attribute of the category of the corresponding to-be-processed pixel in the second image data is determined according to the first attribute of the category of the pixel in the neighborhood of the target pixel, the second attribute of the category of the corresponding to-be-processed pixel in the second image data is determined according to the gradient value of the corresponding to-be-processed pixel in the second image data, and the category of the corresponding to-be-processed pixel in the second image data is determined according to the first attribute and the second attribute of the category of the corresponding to-be-processed pixel in the second image data.

[0137] In a possible implementation, the first attribute of the category of the corresponding to-be-processed pixel in the second image data is determined according to the first attribute of the category of the pixel in the neighborhood of the target pixel, and specifically includes the following steps.

[0138] When the number of pixels with the first attribute of the category as the gray attribute is greater than the number of pixels with the first attribute of the category as the normal attribute, the first attribute of the category of the corresponding to-be-processed pixel in the second image data is adjusted to the gray attribute; and when the number of pixels with the first attribute of the category as the gray attribute is less than or equal to the number of pixels with the first attribute of the category as the normal attribute, the first attribute of the category of the corresponding to-be-processed pixel in the second image data is adjusted to the normal attribute.

[0139] In a possible implementation, the second attribute of the category of the corresponding to-be-processed pixel in the second image data is determined according to the gradient value of the corresponding to-be-processed pixel in the second image data, and specifically includes the following steps.

[0140] The gradient value of the corresponding to-be-processed pixel in the second image data is obtained, and the second attribute of the category of the corresponding to-be-processed pixel in the second image data is determined according to the gradient value, where the specific process of determining the second attribute of the category of the corresponding to-be-processed pixel in the second image data according to the gradient value can refer to the specific content in S303-S304, and for the sake of brevity, the embodiments of the present application will not be described here.

[0141] The embodiments of the present application not only can re-identify the category of the scaled pixel, but also can re-identify the category of the scaled pixel in different ways according to the category of the pixel in the neighborhood, thereby ensuring effective identification of the change of the pixel category and reducing the problem that subsequent processing is inaccurate due to the change of the tag and inaccurate identification of the change of the tag after scaling.

[0142] In a possible implementation, the processing of the first image data not only includes scaling, but also can include rotation, that is, the second image data can be obtained by performing scaling and / or rotation processing on the first image data or performing scaling and / or rotation processing on the first image data. At this time, if the rotation processing is performed, since the pixel points before and after rotation are one-to-one corresponding, the category of each to-be-processed pixel in the first image data can be synchronized with the corresponding to-be-processed pixel in the first image data by rotation.

[0143] In a possible implementation, to improve the quality of the final output image, the embodiment of the present application further improves the module after the rotation and scaling module based on the category of the pixels, to improve the optimization processing performance of the subsequent module. Figure 1

[0144] Specifically, the embodiment of the present application improves the filtering module, so that the filtering module can perform adaptive filtering processing on the second image data based on the category of each pixel to be processed in the second image data, where the adaptive filtering processing includes performing the de-mottling processing, the text sharpening processing and the processing of improving the contrast and sharpening of the line queue on the second image data, that is, the contrast of the line queue is improved before the sharpening processing on the line queue is performed, to ensure the definition of the line queue, so that the overall quality of the image is improved. In addition, the filtering module of the embodiment of the present application can also perform a separate de-mottling operation on the image area, so that the image quality is improved and the sharpening degree of the text is not affected.

[0145] Specifically, the embodiment of the present application also improves the Gamma (gamma, not shown in the figure) module, so that the Gamma module can perform the brightening processing on the image area of the second image data based on the category of each pixel to be processed in the second image data, and does not process the text area, so that the brightness of the image area is improved, the effect of saving ink is achieved, and the effect of the text area is not affected. Figure 1

[0146] Specifically, the embodiment of the present application also improves the ink saving part, so that the ink saving part can perform the ink saving processing on the black text area of the second image data based on the category of each pixel to be processed in the second image data, that is, the embodiment of the present application can apply a separate ink saving algorithm to the black text area, to save ink without changing the image quality.

[0147] Specifically, the embodiment of the present application also adds the color trapping processing (not shown in the figure) after the scanning module, to further judge whether the pixel is black when the first attribute of the category is gray, and only perform the color trapping processing on the black color. The color trapping refers to the color compensation of the color around the black pixel, and the compensated color is the same as the color around the pixel, to compensate the color matching accuracy of the image forming device and improve the printing image quality. Figure 1 Specifically, the embodiment of the present application also improves the printing color correction module (not shown in the figure), so that the printing color correction module only uses black carbon powder to perform the image forming operation on the pixel whose first attribute of the category is the gray attribute, to reduce the influence of the inaccurate color matching, and avoid the color deviation of the gray image.

[0148] Figure 1

[0149] ​​​​In practical applications, for the gray attribute, it is generally converted into a gray value to improve the quality of the gray text, and in the printing pipeline, the gray part is corrected to pure gray by a printing color correction module (not shown in the figure) Figure 1 but since the pixels of the gray attribute are printed by a mixed K composed of CMYK, the gray image may be again color cast, and the embodiment of the present application improves the quality of the gray image during printing by printing the gray part of the image by pure K after detecting the gray part. Specifically, since printing is performed by mapping the RGB to CMKY through a mapping table, after identifying the gray attribute, another mapping table can be used for mapping for the pixels of the gray attribute, and the gray of the mapping table is printed by pure K to reduce the color cast problem of the gray pixels during printing.

[0150] The identification method of the pixel category of the embodiment of the present application does not affect the accuracy of the category, can greatly improve the image-text segmentation effect, is convenient for subsequent optimization processing, and improves the image quality; at the same time, the embodiment of the present application has special attribute values for the gray feature and the line queue, can solve the color cast problem of the gray feature in the output image, and improve the clarity of the line queue; at the same time, the embodiment of the present application also performs different processing based on different tags in the subsequent filtering module, and improves the image processing effect as a whole.

[0151] Corresponding to the above embodiment, the embodiment of the present application also provides an image processing device.

[0152] Referring to Figure 6 , a structural schematic diagram of an image processing device provided by the embodiment of the present application is shown. As Figure 6 shown, the image processing device 600 includes: a first determination unit 601 configured to determine the category of each to-be-processed pixel in image data; a first optimization processing unit 602 configured to perform first optimization processing on the image data according to the category of each to-be-processed pixel to obtain first image data; a reduction or enlargement processing unit 603 configured to perform reduction or enlargement processing on the first image data to obtain second image data; an acquisition unit 604 configured to take any one to-be-processed pixel in the first image data as a target pixel, and acquire the category of each pixel in the neighborhood of the target pixel; and a second determination unit 605 configured to determine the manner of acquiring the category of the corresponding to-be-processed pixel in the second image data according to the category of each pixel in the neighborhood of the target pixel.

[0153] The specific content of the embodiment of the present application can be referred to the description of the above method embodiment, and is not described herein again for brevity.

[0154] Corresponding to the above embodiment, the embodiment of the present application also provides an image processing device.

[0155] Referring toFigure 7 Fig. 7 shows a schematic diagram of an electronic device according to an embodiment of the present application. The electronic device 700 can include a processor 710, a memory 720, and a communication unit 730. These components communicate with each other through one or more buses. Those skilled in the art will understand that the structure of the electronic device shown in the figure does not limit the embodiments of the present application. It can be a bus structure or a star structure. It can include more or fewer components than those shown in the figure, or combine some components, or arrange different components.

[0156] The communication unit 730 is configured to establish a communication channel, so that the electronic device can communicate with other devices. It receives user data from other devices or sends user data to other devices.

[0157] The processor 710 is the control center of the electronic device. It connects various parts of the electronic device through various interfaces and lines, and executes software programs, instructions, and / or modules stored in the memory 720, and calls data stored in the memory, to perform various functions of the electronic device and / or process data. The processor can be composed of integrated circuits (ICs). For example, it can be composed of a single packaged IC, or composed of multiple packaged ICs with the same or different functions connected together. For example, the processor 710 can only include a central processing unit (CPU). In the embodiments of the present application, the CPU can be a single operation core or include multiple operation cores.

[0158] The memory 720 is configured to store execution instructions of the processor 710. The memory 720 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0159] When the execution instructions in the memory 720 are executed by the processor 710, the electronic device 700 can perform Figure 2 some or all of the steps in the embodiments shown.

[0160] In particular implementations, the embodiments of the present application further provide a computer storage medium, wherein the computer storage medium can store a program, and the program can include some or all of the steps in each of the embodiments of the image carding method provided by the embodiments of the present application when executed. The storage medium can be a magnetic disc, an optical disc, a read-only memory (ROM), a random access memory (RAM), or the like.

[0161] In particular implementations, the embodiments of the present application further provide a computer program product, wherein the computer program product contains executable instructions, and when the executable instructions are executed on a computer, the computer executes some or all of the steps in each of the embodiments of the image carding method provided by the embodiments of the present application.

[0162] Those skilled in the art can clearly understand that the technologies in the embodiments of the present application can be realized by means of software and necessary general hardware platforms. Based on such understanding, the technical solutions in the embodiments of the present application can be embodied in the form of a software product, and the computer software product can be stored in a storage medium, such as a ROM / RAM, a magnetic disc, an optical disc, or the like, and includes a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in the embodiments of the present application or some parts of the embodiments.

[0163] The same or similar parts among the various embodiments in the specification can be referred to each other. In particular, for the device embodiments and the terminal embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description in the method embodiments.

Claims

1. An image processing method, comprising: determining a category of each to-be-processed pixel in image data; performing a first optimization processing on the image data according to the category of each to-be-processed pixel, to obtain first image data; performing a reduction or enlargement processing on the first image data, to obtain second image data; characterized in that the method further comprises: taking any one to-be-processed pixel in the first image data as a target pixel, and obtaining a category of each pixel in a neighborhood of the target pixel; determining a manner of obtaining a category of a corresponding to-be-processed pixel in the second image data according to the category of each pixel in the neighborhood of the target pixel; the manner of obtaining the category of the corresponding to-be-processed pixel in the second image data according to the category of each pixel in the neighborhood of the target pixel comprises: determining a number of pixels of a first category and a number of pixels of a second category in the neighborhood of the target pixel according to the category of each pixel in the neighborhood of the target pixel; if the number of pixels of the first category or the number of pixels of the second category in the neighborhood of the target pixel is greater than a preset threshold, obtaining the category of the corresponding to-be-processed pixel in the second image data according to a first manner, wherein the first manner is a bilinear interpolation calculation manner.

2. The image processing method of claim 1, wherein, the method further comprises: if the number of pixels of the first category and the number of pixels of the second category in the neighborhood of the target pixel are both less than or equal to the preset threshold, obtaining the category of the corresponding to-be-processed pixel in the second image data according to a second manner.

3. The image processing method of claim 2, wherein, the obtaining of the category of the corresponding to-be-processed pixel in the second image data according to the second manner comprises: determining a first attribute of the category of the corresponding to-be-processed pixel in the second image data according to a first attribute of the category of the pixels in the neighborhood of the target pixel, wherein the first attribute comprises a gray attribute and a normal attribute; determining a second attribute of the category of the corresponding to-be-processed pixel in the second image data according to a gradient value of the corresponding to-be-processed pixel in the second image data, wherein the second attribute comprises a character, a line, an image and / or a background; determining the category of the corresponding to-be-processed pixel in the second image data according to the first attribute and the second attribute of the category of the corresponding to-be-processed pixel in the second image data.

4. The image processing method of claim 3, wherein, the determining of the first attribute of the category of the corresponding to-be-processed pixel in the second image data according to the first attribute of the category of the pixels in the neighborhood of the target pixel, wherein the first attribute comprises a gray attribute and a normal attribute, comprises: determining a number of pixels of the first attribute of the category and a number of pixels of the normal attribute of the category in the neighborhood of the target pixel; when the number of pixels of the gray attribute is greater than the number of pixels of the normal attribute, adjusting the first attribute of the category of the corresponding to-be-processed pixel in the second image data to the gray attribute, and when the number of pixels of the gray attribute is less than or equal to the number of pixels of the normal attribute, adjusting the first attribute of the category of the corresponding to-be-processed pixel in the second image data to the normal attribute.

5. The image processing method of claim 3, wherein, The second attribute of the category of the corresponding to-be-processed pixel in the second image data is determined according to a gradient value of the corresponding to-be-processed pixel in the second image data, and the second attribute of the category of the corresponding to-be-processed pixel in the second image data includes: The gradient value of the corresponding to-be-processed pixel in the second image data is obtained; The second attribute of the category of the corresponding to-be-processed pixel is determined according to the gradient value.

6. The image processing method of claim 1, wherein, The method further includes: The first image data is subjected to a reduction and / or rotation processing, or an enlargement and / or rotation processing, to obtain the second image data, wherein when the rotation processing is performed on the first image data, the category of each to-be-processed pixel in the first image data is synchronously rotated with the corresponding to-be-processed pixel in the first image data.

7. The image processing method of claim 1, wherein, The category of each to-be-processed pixel in the image data is determined, and the method includes: Any pixel with an RGB value greater than that of a background pixel in the image data is taken as a first pixel, and the first pixel is assigned a value; An edge detection is performed on the assigned first pixel to obtain a gradient value of the first pixel; An initial second attribute of the category of the first pixel is determined based on the gradient value; The initial second attribute of the category of the first pixel is adjusted based on the initial second attribute of the category of the pixels within the connected domain of the first pixel to obtain a second attribute of the category of the first pixel; A first attribute of the category of the first pixel is determined according to the average RGB value of the pixels within the neighborhood of the first pixel; The category of each to-be-processed pixel in the image data is determined according to the first attribute of the category of each first pixel and the second attribute of the category of each first pixel.

8. The image processing method of claim 7, wherein, The initial second attribute of the category of the first pixel is determined based on the gradient value, and the method includes: It is determined whether the first pixel is a line queue through a preset fixed template; The initial second attribute of the category of the first pixel is determined as a line queue if the first pixel is a line queue; The gradient value range of the first pixel that is not a line queue is determined; The initial second attribute of the category of the first pixel is determined as a character, an image or a background according to the gradient value range of the first pixel.

9. The image processing method of claim 7, wherein, The initial second attribute of the category of the first pixel is adjusted based on the initial second attribute of the category of the pixels within the connected domain of the first pixel, and the method includes: The number of pixels with the initial second attribute of the category as a line queue within the connected domain of the first pixel is obtained; The initial second attribute of the category of the first pixel with the initial second attribute as a character is adjusted as a line queue if the number of pixels is greater than a first preset value.

10. The image processing method of claim 7, wherein, The initial second attribute of the category of the first pixel is adjusted based on the initial second attribute of the category of the pixels within the connected domain of the first pixel, and the method includes: The number of pixels with the initial second attribute of the category as an image within the connected domain of the first pixel is obtained; The initial second attribute of the category of the first pixel with the initial second attribute as a character is adjusted as an image if the number of pixels is greater than a second preset value.

11. The image processing method of claim 1, wherein, After the second image data is obtained, the method further includes: perform adaptive filtering processing on the second image data based on the category of each pixel to be processed in the second image data, the adaptive filtering processing including moire processing, text sharpening processing, and line queue contrast and sharpening processing.

12. The image processing method of claim 1, wherein, After the second image data is obtained, the method further includes: performing ink saving processing on a black text region of the second image data based on the category of each pixel to be processed in the second image data.

13. The image processing method of claim 1, wherein, After the second image data is obtained, the method further includes: performing color trap processing on the second image data based on the category of each pixel to be processed in the second image data.

14. The image processing method of claim 1, wherein, After the second image data is obtained, the method further includes: performing lightening processing on a halftone region of the second image data based on the category of each pixel to be processed in the second image data.

15. The image processing method of claim 3, wherein, After the second image data is obtained, the method further includes: for a pixel of which the first attribute of the category is a gray attribute, only black toner is used for image forming operation.

16. An image processing apparatus, comprising: a first determination unit configured to determine a category of each pixel to be processed in image data; a first optimization processing unit configured to perform first optimization processing on the image data according to the category of each pixel to be processed, to obtain first image data; a reduction or enlargement processing unit configured to perform reduction or enlargement processing on the first image data, to obtain second image data; characterized in that the apparatus further comprises: an acquisition unit configured to, taking any one pixel to be processed in the first image data as a target pixel, acquire a category of each pixel in a neighborhood of the target pixel; a second determination unit configured to determine a manner of acquiring a category of a corresponding pixel to be processed in the second image data according to the category of each pixel in the neighborhood of the target pixel; the second determination unit is specifically configured to determine a number of pixels of a first category and a number of pixels of a second category in the neighborhood of the target pixel according to the category of each pixel in the neighborhood of the target pixel; and if the number of pixels of the first category or the number of pixels of the second category in the neighborhood of the target pixel is greater than a preset threshold, acquire the category of the corresponding pixel to be processed in the second image data according to a first manner, wherein the first manner is a bilinear interpolation calculation manner.

17. An electronic device, comprising: comprising: a processor; a memory; the memory has stored therein a computer program, which, when executed, causes the electronic device to perform the method of any one of claims 1-15.

18. A computer-readable storage medium, characterized in that, The computer readable storage medium includes a stored program, wherein the program, when executed, controls the device in which the computer readable storage medium is located to perform the method of any one of claims 1-15.

Citation Information

Patent Citations

  • Image resampling method and device, terminal and computer readable storage medium

    CN110738625A

  • Image processing method, device and equipment and storage medium

    CN112734654A