Method, apparatus, and device for generating a halftone image
Through point-by-point scanning and dot table matrix retrieval processing, half-tone images are generated, which solves the problems of low efficiency and low accuracy of half-tone image generation in the prior art, and achieves fast and efficient half-tone image generation.
Patent Information
- Application Number
- CN202411346286.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2044-09-26
AI Technical Summary
The prior art has low efficiency and low accuracy in image hard copy copying, and it is impossible to accurately realize digital halftone electronic hanging network.
By acquiring the original image data, the initial grayscale hierarchy value is determined by point-by-point scanning process, the dot table matrix is determined based on the preset dot matrix, and the data blocks of each initial grayscale hierarchy value in the dot table matrix are determined, and a half-tone image is generated.
It realizes rapid generation of halftone images, improves generation efficiency, and ensures generation accuracy, and accurately realizes digital halftone electronic hanging network.
Smart Images

Figure CN119444883B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image hard copy reproduction, and particularly to a method, device and equipment for generating halftone images. Background Art
[0002] The hard copy reproduction of images mainly involves the screening technology for printers and high-grade printing plate-making equipment. The screening technology used for image hard copy reproduction is also called digital image halftone technology. In the existing image hard copy reproduction technology, the most widely used and most versatile is the amplitude modulation halftone digital screening technology. Usually, the initial amplitude modulation halftone screening adopts a single-cell screening algorithm, which has a large deviation in the control accuracy of the screen angle and screen ruling, and there is also uncontrollability for the halftone screening levels, so that digital halftone electronic screening cannot be accurately realized. If the entire image is scanned and calculated multiple times during halftone processing of the image, although the deviation can be reduced to a certain extent, it will seriously affect the generation speed of the halftone image; for example, in the process of large-scale traditional printing or digital printing, this efficiency lags far behind and reduces the production cycle and production efficiency. Summary of the Invention
[0003] The present invention provides a method, device and equipment for generating halftone images, which solves the problems of low generation efficiency and low accuracy of halftone images existing in the process of processing halftone images.
[0004] To solve the above technical problems, the technical solution of the present invention is as follows:
[0005] An embodiment of the present invention provides a method for generating a halftone image, including:
[0006] Obtaining original image data;
[0007] Performing point-by-point scanning processing on the original image data to determine the initial gray level value of each image point in the original image data;
[0008] Determining a dot table matrix according to a preset dot matrix;
[0009] Retrieving the dot table matrix according to the initial gray level value to determine the data block corresponding to each initial gray level value in the dot table matrix;
[0010] Generating a halftone image according to the data block.
[0011] Optionally, determining a dot table matrix according to a preset dot matrix includes:
[0012] Determining the width of the dot table matrix according to the width of the preset dot matrix;
[0013] Determine the height of the dot table matrix according to the preset gray level number of the dot table matrix and the height of the preset dot matrix;
[0014] Determine the data format of the dot table matrix according to the height of the preset dot matrix and the dot table matrix;
[0015] Determine the dot table entry matrix in the dot table matrix according to the height and width of the preset dot matrix;
[0016] Determine the dot table matrix according to the preset gray level number, width, height, data format of the dot table matrix and the dot table entry matrix in the dot table matrix.
[0017] Optionally, determine the data format of the dot table matrix according to the height of the preset dot matrix and the dot table matrix, including:
[0018] Determine the dot levels of the dot table matrix according to the height of the dot table matrix;
[0019] Determine the dot level corresponding to each dot table entry matrix in the dot table matrix.
[0020] Optionally, determine the dot table entry matrix in the dot table matrix according to the height and width of the preset dot matrix, including:
[0021] Determine the basic parameters of the dot table entry matrix in the dot table matrix according to the height and width of the preset dot matrix;
[0022] According to the preset dot matrix and preset rules, through the formula Determine each lattice point data in each dot table entry matrix where, i represents the dot level corresponding to the current dot table entry matrix in the dot table matrix; i ∈ [0, N - 1], N is the preset gray level number; M represents the preset dot matrix, j is the index value in the preset dot matrix, j ∈ [0, W * H - 1], W represents the width of the preset dot matrix, and H represents the height of the preset dot matrix.
[0023] Optionally, the preset rule is: the current dot table entry matrix is constructed based on the lattice point data of the previous dot table entry matrix through the preset dot matrix.
[0024] Optionally, perform a retrieval process on the dot table matrix according to the initial gray level value to determine the data block corresponding to each initial gray level value in the dot table matrix, including:
[0025] Perform a retrieval process on the dot table matrix according to the initial gray level value to determine the dot table entry matrix corresponding to each initial gray level value in the dot table matrix;
[0026] According to the dot table entry matrix, determine the data block of each initial gray level value in the dot table matrix through a preset proportionality coefficient.
[0027] Optionally, according to the dot table entry matrix, determine the data block of each initial gray level value in the dot table matrix through a preset proportionality coefficient, including:
[0028] According to the height of the original image and the height of the halftone image to be generated or according to the width of the original image and the width of the halftone image to be generated, through the formula Determine the proportionality coefficient k; where d is the height or width of the number of dots of the halftone image to be generated, and s is the height or width of the number of dots of the original image;
[0029] According to the proportionality coefficient, determine the block-taking matrix;
[0030] According to the dot table entry matrix, through the block-taking matrix, determine the data block of each initial gray level value in the dot table matrix.
[0031] An embodiment of the present invention further provides a halftone image generation device, including:
[0032] An acquisition module, configured to acquire original image data;
[0033] A processing module, configured to perform point-by-point scanning processing on the original image data to determine the initial gray level value of each image point in the original image data; determine the dot table matrix according to a preset dot matrix; perform a retrieval process on the dot table matrix according to the initial gray level value to determine the data block corresponding to each initial gray level value in the dot table matrix; generate a halftone image according to the data block.
[0034] An embodiment of the present invention further provides a computing device, including: a processor and a memory storing a computer program. When the computer program is run by the processor, the above method is executed.
[0035] An embodiment of the present invention further provides a computer-readable storage medium, including: stored instructions. When the instructions are run on a computer, the computer is caused to execute the above method.
[0036] The above solution of the present invention has at least the following beneficial effects:
[0037] The method for generating a halftone image according to the present invention includes obtaining original image data; performing point-by-point scanning on the original image data to determine the initial gray level value of each image point in the original image data; determining a dot table matrix according to a preset dot matrix; retrieving the dot table matrix according to the initial gray level value to determine the data block corresponding to each initial gray level value in the dot table matrix; and generating a halftone image according to the data block. The rapid generation of the halftone image is realized, the generation efficiency of the halftone image is improved, and the generation accuracy of the halftone image is ensured at the same time. Brief Description of the Drawings
[0038] Figure 1 is a schematic flow chart of the method for generating a halftone image according to the present invention;
[0039] Figure 2 is a schematic structural diagram of the preset dot matrix of the method for generating a halftone image according to the present invention;
[0040] Figure 3 is a schematic structural diagram of the dot table matrix of the method for generating a halftone image according to the present invention;
[0041] Figure 4 is a schematic diagram of generating a first data block according to an index in the method for generating a halftone image according to the present invention;
[0042] Figure 5 is a schematic diagram of generating a second data block according to an index in the method for generating a halftone image according to the present invention;
[0043] Figure 6 is a schematic diagram of generating a third data block according to an index in the method for generating a halftone image according to the present invention;
[0044] Figure 7 is a schematic flow chart of quickly looking up a table to generate a halftone image in the method for generating a halftone image according to the present invention;
[0045] Figure 8 is a schematic diagram of generating a halftone image from an original image in the method for generating a halftone image according to the present invention;
[0046] Figure 9 is a schematic diagram of the module block of the device for generating a halftone image according to the present invention. Detailed Embodiments
[0047] Hereinafter, exemplary embodiments of the present disclosure will be described in more detail with reference to the drawings. Although the exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present disclosure can be more thoroughly understood and the scope of the present disclosure can be fully conveyed to those skilled in the art.
[0048] As Figures 1 to 8 shown, an embodiment of the present invention provides a method for generating a halftone image, including:
[0049] Step 11, obtaining original image data;
[0050] Step 12, performing point-by-point scanning processing on the original image data to determine the initial gray level value of each image point in the original image data;
[0051] Step 13, determining a dot table matrix according to a preset dot matrix;
[0052] Step 14, performing a retrieval process on the dot table matrix according to the initial gray level value to determine the data block corresponding to each initial gray level value in the dot table matrix;
[0053] Step 15, generating a halftone image according to the data block.
[0054] In this embodiment, the original image data includes data such as the height, width, and initial gray level value of the original image; the original image data is a two-dimensional array, where each element represents the gray value of a pixel, and the gray value is usually between 0 and 255, 0 represents black, 255 represents white, and other values represent different degrees of gray; an image processing library (such as OpenCV or PIL in Python) is used to read the image data; the width and height of the image are obtained for point-by-point scanning; a double loop is used to traverse each pixel point and extract its gray value; Step 15 can specifically be mapping each data block back to the corresponding position of the image to generate a halftone image; when the method for generating a halftone image performs halftone processing, through the dot table matrix and according to the initial gray level value, the design of performing a retrieval process on the dot table matrix to determine the data block corresponding to each initial gray level value in the dot table matrix can convert the original complex point-by-point calculation and comparison operations into fast and simple data block operations such as retrieval, table lookup, and value extraction, realizing the binarization conversion of the image and efficiently integrating the calculation of the magnification of the number of image pixels before and after the conversion, thereby greatly improving the efficiency of image processing. By using the method of the present invention, when outputting high-resolution and large-image data, the halftone binarization data conversion output of the image can be efficiently and perfectly completed, thereby quickly generating a halftone image, solving the problems in the existing halftone image processing process that multiple scans are required, and when facing large-image data, a halftone image cannot be quickly generated, and in the process of large-scale traditional printing or digital printing, the efficiency is extremely lagged and the production cycle and production efficiency are reduced; realizing the rapid generation of halftone images, improving the generation efficiency of halftone images, and at the same time ensuring the generation accuracy of halftone images, and being able to accurately realize digital halftone electronic screening.
[0055] In an alternative embodiment of the present invention, step 13 may include:
[0056] Step 131: Determine the width of the dot table matrix according to the width of the preset dot matrix.
[0057] Step 132: Determine the height of the dot table matrix according to the preset gray level number of the dot table matrix and the height of the preset dot matrix.
[0058] Step 133: Determine the data format of the dot table matrix according to the heights of the preset dot matrix and the dot table matrix.
[0059] Step 134: Determine the dot table entry matrix in the dot table matrix according to the height and width of the preset dot matrix.
[0060] Step 135: Determine the dot table matrix according to the preset gray level number, width, height, data format of the dot table matrix, and the dot table entry matrix in the dot table matrix.
[0061] As Figure 2 shown, in this embodiment, the preset dot matrix M includes a series of matrix data such as halftone dot pattern, screen angle, dot size, etc.; the width of the preset dot matrix M is W, and the height is H; optionally, the width and height dimensions of the preset dot matrix M are W = H = 9, and the preset dot matrix M is as Figure 2 shown; specifically, in step 131, the width of the dot table matrix T is equal to the width W of the preset dot matrix M; specifically, in step 132, the height of the dot table matrix T is N*H, where N is the preset gray level number of the dot table matrix; H is the height of the preset dot matrix M; specifically, step 135 may be to stack the dot table entry matrices in sequence according to the preset gray level number, width, height, data format of the dot table matrix, and the dot table entry matrix in the dot table matrix to obtain the dot table matrix.
[0062] In an alternative embodiment of the present invention, step 133 may include:
[0063] Step 1331: Determine the dot level of the dot table matrix according to the height of the dot table matrix.
[0064] Step 1332: Determine the dot level corresponding to each dot table entry matrix in the dot table matrix.
[0065] In this embodiment, specifically, in step 1331, the dot level N i of the dot table matrix is N i ∈[0, N - 1], and specifically, in step 1332, each dot table entry matrix T i corresponds to a gray level N i, where i represents the index of the entry in the dot matrix table T, and its value range is i ∈ [0, N - 1]; when N = 81, as Figure 3 shown, Figure 3 the values in it represent the dot levels N in the dot matrix table i There are a total of 80 levels; Figure 3 and the corresponding to the dot level is the dot entry matrix T of the dot matrix table i .
[0066] In an alternative embodiment of the present invention, step 134 may include:
[0067] Step 1341, determining the basic parameters of the dot entry matrix in the dot matrix table according to the height and width of the preset dot matrix;
[0068] Step 1342, according to the preset dot matrix and the preset rule, through the formula determine each lattice point data in each dot entry matrix where i represents the corresponding dot level of the current dot entry matrix in the dot matrix table; i ∈ [0, N - 1], N is the preset gray level number; M represents the preset dot matrix, j is the index value in the preset dot matrix, j ∈ [0, W * H - 1], W represents the width of the preset dot matrix, and H represents the height of the preset dot matrix;
[0069] wherein, the preset rule is: the current dot entry matrix is constructed based on the lattice point data of the previous dot entry matrix through the preset dot matrix.
[0070] In this embodiment, the basic parameters of the dot entry matrix T i include data such as the height and width of the dot entry matrix T i ; the dot entry matrix T i is a matrix of the same size as the preset dot matrix M; each lattice point data i in the dot entry matrix T is either 0 or 1, and each lattice point data can specifically be obtained by traversing each element M of the preset dot matrix M for each dot level i (from 0 to N - 1) j (from 0 to W × H - 1): if the current dot level i is less than the corresponding preset dot matrix element M j , then if the current dot level i is greater than the corresponding preset dot matrix M j , then Thus, the dot entry matrix is determined; when determining multiple dot entry matrices, for each adjacent dot entry matrix, it is necessary to be constructed in combination with the preset rule. Specifically, for each adjacent entry T i+1is based on the previous table entry T i and specifically, T i+1 will add several data 1s on the basis of T i ; the number of added 1s is determined by the data in the preset dot matrix M; specifically, the value of each element in the preset dot matrix M determines how many data 1s need to be added when generating the next dot table entry matrix, and the specific number of added data 1s can be determined by the formula ; for example, assuming that the value at a certain position in the preset dot matrix M is 2, it means that when generating the next dot table entry matrix, two additional data 1s of the current level of the dot table entry matrix will be added to the dot table entry matrix T i+1 ; in this embodiment, through this increasing relationship between adjacent table entries, the preset dot matrix T can effectively represent the dot distributions of different gray levels and provide necessary basic data for subsequent image processing or design.
[0071] In an alternative embodiment of the present invention, step 14 may include:
[0072] Step 141, according to the initial gray level value, perform a retrieval process on the dot table matrix to determine the dot table entry matrix corresponding to each initial gray level value in the dot table matrix;
[0073] Step 142, according to the dot table entry matrix, determine the data block of each initial gray level value in the dot table matrix through a preset proportionality coefficient.
[0074] In an alternative embodiment of the present invention, step 142 may include:
[0075] Step 1421, according to the height of the original image and the height of the halftone image to be generated or according to the width of the original image and the width of the halftone image to be generated, determine the proportionality coefficient k through the formula ; where d is the height or width of the number of dots of the halftone image to be generated, and s is the height or width of the number of dots of the original image;
[0076] Step 1422, according to the proportionality coefficient, determine the block-taking matrix;
[0077] Step 1423, according to the dot table entry matrix, through the block-taking matrix, determine the data block of each initial gray level value in the dot table matrix.
[0078] In this embodiment, step 141 is specifically to perform a hierarchical look-up table index calculation for the dot table matrix T; obtain the initial gray level value g corresponding to an original image data point, and retrieve the corresponding dot level N in the dot table matrix T g , according to the dot table entry matrix and the dot level N gThe one-to-one correspondence can directly determine the corresponding dot matrix T of the dot table entry g , and then calculate the dot matrix corresponding to each initial gray level value by looking up the table once according to the preset hierarchical table lookup rule; the preset hierarchical table lookup rule can be to scan row by row from left to right and perform index calculation; step 1421 is specifically determined according to the number of points of the original image and the number of points of the target image. One pixel corresponds to one point. For example, if the ratio of the number of points of the original image to the number of points of the target image is 4, then k is taken as 4; in this embodiment, step 1422 is specifically that the width and height size of the block matrix Q can be set to k*k;
[0079] Such as Figures 4 to 6 shown below, a specific embodiment will be used to illustrate the specific implementation process of step 142:
[0080] Assume that the initial gray level value corresponding to the first original point (x-1, y) of the original image data is 20, the second original point (x, y) is the point corresponding to a one-unit translation to the right, and the initial gray level value corresponding to the second original point is 70. The third original point (x, y+1) is the point corresponding to a one-unit translation downward, and the initial gray level value corresponding to the third original point is 50; then first find the corresponding gray level N in the dot table matrix according to the initial gray level value of 20 corresponding to the first original point i That is, N 20 , and then according to N 20 Get the dot matrix T of the dot table entry 20 , such as Figure 4 shown, then find the first target point (u-1, v) corresponding to the first original point in the dot matrix T of the dot table entry 20 , based on the first target point (u-1, v), and take the data block according to the size k*k (k = 4) of the block matrix Q to obtain the first data block, and output the first data block. Then, find the corresponding gray level N in the dot table matrix according to the initial gray level value of 70 corresponding to the second original point i That is, N 70 , and get the dot matrix T of the dot table entry 70 , such as Figure 5 shown, then translate one unit to the right (the unit here is k*k) on the basis of the previous point (that is, the first target point (u-1, v)) to get the second target point (u, v). Based on the second target point (u, v), take the data block according to the block matrix Q to obtain the second data block, and output the second data block. Then, find the corresponding gray level N in the dot table matrix according to the initial gray level value of 50 corresponding to the third original point i That is, N 50 , and get the dot matrix T of the dot table entry 50, such as Figure 6 shown. Then, based on the previous point (i.e., the second target point (u, v)), translate it downward by one unit (the unit here is 4*4) to determine the third target point (u + 1, v). Based on the third target point (u + 1, v), take data blocks according to the block matrix Q, obtain the third data block, and output the third data block; and so on. According to the initial gray level values of the original image data, determine the data blocks of each initial gray level value in the dot table matrix, and map them back to the corresponding positions of the image according to the order in which the data blocks are obtained to generate a halftone image.
[0081] The following takes a specific embodiment as an example to illustrate the specific process of the method for generating a halftone image according to the present invention:
[0082] Assume that the width and height dimensions of the preset dot matrix M are W = H = 9, and the preset dot matrix M is as Figure 2 shown; the preset number of gray levels of the dot table matrix T is N = 81, as Figure 3 shown. Then, the size of the dot table matrix T is 9 in width and 9x81 in height; the data format of the dot table matrix T can be described by the following characteristics: each dot table entry matrix T i corresponds to a dot level N i , where N i ∈[0, 81 - 1]. The width and height dimensions of each dot table entry matrix T i are 9x9, where i represents the entry index of the dot table matrix T, and its value is i ∈ [0, 81 - 1]; each data in the dot table entry matrix T i is 0 or 1, and it is calculated from the data in the preset dot matrix M by the following method: where j represents the index value in the preset dot matrix M, j ∈ [0, 9x9 - 1]; assume that the ratio of the height of the original image to the halftone image to be generated is 4, then k = 4, and the size of the block matrix Q is 4x4; after determining the dot table matrix and the block matrix Q, start scanning the original image data point by point and obtain the gray level value of each point. To quickly implement image halftoning, in the embodiment, a fast row-by-row image scanning method is adopted, that is, the scanning order of the original image coordinate values [x, y] is as follows:
[0083] [0, 0], [0, 1], …, [0, 8]
[0084] [1, 0], [1, 1], …, [1, 8]
[0085] ……, ……, ……, ……
[0086] [8, 0], [8, 1], …, [8, 8]
[0087] After scanning the initial gray level value g at the current coordinates (x, y), as Figure 7 shown, first determine the dot level corresponding to the initial gray level value g in the dot table matrix according to the initial gray level value g, and then extract the corresponding dot table entry matrix T according to the dot level i , then according to the target point (u, v) corresponding to the current coordinates (x, y), and take a block according to the block-taking matrix Q, so as to obtain the corresponding data block. At this time, the coordinates corresponding to each grid of the taken data block are (in order from left to right by row):
[0088] (4x, 4y), (4x + 1, 4y), (4x + 2, 4y), (4x + 3, 4y);
[0089] (4x, 4y + 1), (4x + 1, 4y + 1), (4x + 2, 4y + 1), (4x + 3, 4y + 1);
[0090] (4x, 4y + 2), (4x + 1, 4y + 2), (4x + 2, 4y + 2), (4x + 3, 4y + 2);
[0091] (4x, 4y + 3), (4x + 1, 4y + 3), (4x + 2, 4y + 3), (4x + 3, 4y + 3);
[0092] As Figure 8 shown, then sequentially scan and take blocks to obtain all data blocks corresponding to the initial gray level values in the dot table matrix, and generate a halftone image according to the data blocks.
[0093] The method for generating a halftone image according to the present invention can, on the basis of a preset dot matrix, dynamically calculate and pre-convert the preset matrix into a multi-level binary dot table mode, while calculating and retaining the multi-level gray levels and various inherent characteristics of the original dots in the preset matrix; during halftone processing, convert the original complex point-by-point calculation and comparison operations into simple data operations such as retrieval, table lookup, and value extraction, that is, realize the binary conversion of the image and efficiently fuse the calculation of the magnification of the number of image pixels before and after conversion, thereby greatly improving the efficiency of image processing. By using the method of the present invention, when outputting high-resolution and large image data volume, the halftone binary data conversion output of the image can be efficiently and perfectly completed.
[0094] As Figure 9 shown, an embodiment of the present invention also provides a halftone image generation device 90, including:
[0095] An acquisition module 91, configured to acquire original image data;
[0096] A processing module 92 is configured to perform point-by-point scanning on the original image data to determine the initial gray level value of each image point in the original image data; determine a halftone dot table matrix according to a preset halftone dot matrix; perform a retrieval process on the halftone dot table matrix according to the initial gray level value to determine the data block corresponding to each initial gray level value in the halftone dot table matrix; and generate a halftone image according to the data block.
[0097] Obtain the original image data;
[0098] Perform point-by-point scanning on the original image data to determine the initial gray level value of each image point in the original image data;
[0099] Determine a halftone dot table matrix according to a preset halftone dot matrix;
[0100] Perform a retrieval process on the halftone dot table matrix according to the initial gray level value to determine the data block corresponding to each initial gray level value in the halftone dot table matrix;
[0101] Generate a halftone image according to the data block.
[0102] Optionally, determining a halftone dot table matrix according to a preset halftone dot matrix includes:
[0103] Determine the width of the halftone dot table matrix according to the width of the preset halftone dot matrix;
[0104] Determine the height of the halftone dot table matrix according to the preset number of gray levels of the halftone dot table matrix and the height of the preset halftone dot matrix;
[0105] Determine the data format of the halftone dot table matrix according to the preset halftone dot matrix and the height of the halftone dot table matrix;
[0106] Determine the halftone dot entry matrix in the halftone dot table matrix according to the height and width of the preset halftone dot matrix;
[0107] Determine the halftone dot table matrix according to the preset number of gray levels, width, height, data format of the halftone dot table matrix, and the halftone dot entry matrix in the halftone dot table matrix.
[0108] Optionally, determining the data format of the halftone dot table matrix according to the preset halftone dot matrix and the height of the halftone dot table matrix includes:
[0109] Determine the halftone level of the halftone dot table matrix according to the height of the halftone dot table matrix;
[0110] Determine the halftone level corresponding to each halftone dot entry matrix in the halftone dot table matrix.
[0111] Optionally, determining the halftone dot entry matrix in the halftone dot table matrix according to the height and width of the preset halftone dot matrix includes:
[0112] Determine the basic parameters of the dot table entry matrix in the dot table matrix according to the height and width of the preset dot matrix;
[0113] According to the preset dot matrix and preset rules, through the formula Determine each lattice point data in each dot table entry matrix where, i represents the dot level corresponding to the current dot table entry matrix in the dot table matrix; i ∈ [0, N - 1], N is the preset number of gray levels; M represents the preset dot matrix, j is the index value in the preset dot matrix, j ∈ [0, W * H - 1], W represents the width of the preset dot matrix, and H represents the height of the preset dot matrix.
[0114] Optionally, the preset rule is: the current dot table entry matrix is constructed based on the lattice point data of the previous dot table entry matrix through the preset dot matrix.
[0115] Optionally, according to the initial gray level value, perform a retrieval process on the dot table matrix to determine the data block corresponding to each initial gray level value in the dot table matrix, including:
[0116] According to the initial gray level value, perform a retrieval process on the dot table matrix to determine the dot table entry matrix corresponding to each initial gray level value in the dot table matrix;
[0117] According to the dot table entry matrix, determine the data block corresponding to each initial gray level value in the dot table matrix through a preset scale factor.
[0118] Optionally, according to the dot table entry matrix, determine the data block corresponding to each initial gray level value in the dot table matrix through a preset scale factor, including:
[0119] According to the height of the original image and the height of the halftone image to be generated or according to the width of the original image and the width of the halftone image to be generated, through the formula Determine the scale factor k; where, d is the height or width of the number of dots of the halftone image to be generated, and s is the height or width of the number of dots of the original image;
[0120] Determine the block extraction matrix according to the scale factor;
[0121] According to the dot table entry matrix, determine the data block corresponding to each initial gray level value in the dot table matrix through the block extraction matrix.
[0122] It should be noted that this device is the device corresponding to the above method, and all implementation manners in the above method are applicable to the embodiments of this device and can also achieve the same technical effects.
[0123] An embodiment of the present invention further provides a computing device, including: a processor, and a memory storing a computer program. When the computer program is run by the processor, the above-mentioned method is executed. All implementation manners in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.
[0124] An embodiment of the present invention further provides a computer-readable storage medium, including: stored instructions. When the instructions are run on a computer, the computer is made to execute the above-mentioned method. All implementation manners in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.
[0125] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0126] Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.
[0127] In the embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of devices or units can be in an electrical, mechanical, or other form.
[0128] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they can be located in one place, or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0129] In addition, the functional units in each embodiment of the present invention can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.
[0130] If a function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical discs that can store program codes.
[0131] In addition, it should be noted that in the devices and methods of the present invention, obviously, each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent solutions of the present invention. And, the steps of performing the above series of processes can naturally be executed in chronological order according to the described order, but it is not necessary to execute them in chronological order. Certain steps can be executed in parallel or independently of each other. For those of ordinary skill in the art, it can be understood that all or any steps or components of the methods and devices of the present invention can be implemented in any computing device (including a processor, a storage medium, etc.) or a network of computing devices in the form of hardware, firmware, software, or a combination thereof, which can be achieved by those of ordinary skill in the art using their basic programming skills after reading the description of the present invention.
[0132] Therefore, the object of the present invention can also be achieved by running a program or a set of programs on any computing device. The computing device can be a well-known general-purpose device. Therefore, the object of the present invention can also be achieved only by providing a program product containing program codes for implementing the method or device. That is to say, such a program product also constitutes the present invention, and the storage medium storing such a program product also constitutes the present invention. Obviously, the storage medium can be any well-known storage medium or any storage medium developed in the future. It should also be noted that in the devices and methods of the present invention, obviously, each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent solutions of the present invention. And, the steps of performing the above series of processes can naturally be executed in chronological order according to the described order, but it is not necessary to execute them in chronological order. Certain steps can be executed in parallel or independently of each other.
[0133] The above are the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.
Claims
1. A method for generating a halftone image, characterized in that: include: Get the original image data; Scan the original image data point by point to determine the initial grayscale value of each image point in the original image data; Determine the dot table matrix according to the preset dot matrix; According to the initial grayscale level value, the dot table matrix is searched and processed to determine the data block corresponding to each initial grayscale level value in the dot table matrix; generating a halftone image according to the data block; Wherein, determining the dot table matrix according to the preset dot matrix includes: Determine the width of the dot matrix according to the preset width of the dot matrix; Determine the height of the dot table matrix according to the preset number of gray levels of the dot table matrix and the preset height of the dot matrix; Determine the data format of the dot table matrix according to the heights of the preset dot matrix and the dot table matrix; Determine a dot table entry matrix in a dot table matrix according to a preset dot matrix height and width; Determine the dot table matrix according to the preset grayscale level number, width, height, data format of the dot table matrix and the dot table item matrix in the dot table matrix; According to the initial grayscale level value, the dot table matrix is searched and processed to determine the data block corresponding to each initial grayscale level value in the dot table matrix, including: According to the initial grayscale level value, the dot table matrix is searched and processed to determine the dot table entry matrix corresponding to each initial grayscale level value in the dot table matrix; According to the dot table entry matrix, the data block of each initial gray level value in the dot table matrix is determined by a preset proportional coefficient.
2. The method for generating a halftone image according to claim 1, characterized in that: According to the height of the preset dot matrix and the dot table matrix, the data format of the dot table matrix is determined, including: Determine the dot level of the dot table matrix according to the height of the dot table matrix; Determine the dot level corresponding to each dot table entry matrix in the dot table matrix.
3. The method for generating a halftone image according to claim 1, characterized in that: According to the height and width of the preset dot matrix, a dot table entry matrix in the dot table matrix is determined, including: Determine basic parameters of the dot table entry matrix in the dot table matrix according to the height and width of the preset dot matrix; According to the preset dot matrix and preset rules, through the formula Determine each grid point data in each grid point table matrix Among them, i represents the corresponding dot level of the current dot table entry matrix in the dot table matrix; i∈[0,N-1], N is the preset grayscale level number; M represents the preset dot matrix, j is the index value in the preset dot matrix, j∈[0,W*H-1], W represents the width of the preset dot matrix, and H represents the height of the preset dot matrix.
4. The method for generating a halftone image according to claim 3, characterized in that: The preset rule is: the current dot table entry matrix is constructed by using the preset dot matrix based on the grid point data of the previous dot table entry matrix.
5. The method for generating a halftone image according to claim 1, characterized in that: According to the dot table entry matrix, the data block of each initial gray level value in the dot table matrix is determined by a preset proportional coefficient, including: According to the height of the original image and the height of the halftone image to be generated, or according to the width of the original image and the width of the halftone image to be generated, the formula Determine the scale factor k; wherein d is the height or width of the halftone image dots to be generated, and s is the height or width of the original image dots; According to the proportionality coefficient, determining a block matrix; According to the dot table entry matrix, the data block of each initial gray level value in the dot table matrix is determined by taking the block matrix.
6. A device for generating a halftone image, characterized in that: include: An acquisition module, used for acquiring original image data; The processing module is used to scan the original image data point by point to determine the initial grayscale value of each image point in the original image data; determine the dot table matrix according to the preset dot matrix; perform retrieval processing on the dot table matrix according to the initial grayscale value to determine the data block corresponding to each initial grayscale value in the dot table matrix; generating a halftone image according to the data block; Wherein, determining the dot table matrix according to the preset dot matrix includes: Determine the width of the dot matrix according to the preset width of the dot matrix; Determine the height of the dot table matrix according to the preset number of gray levels of the dot table matrix and the preset height of the dot matrix; Determine the data format of the dot table matrix according to the heights of the preset dot matrix and the dot table matrix; Determine a dot table entry matrix in a dot table matrix according to a preset dot matrix height and width; Determine the dot table matrix according to the preset grayscale level number, width, height, data format of the dot table matrix and the dot table item matrix in the dot table matrix; According to the initial grayscale level value, the dot table matrix is searched and processed to determine the data block corresponding to each initial grayscale level value in the dot table matrix, including: According to the initial grayscale level value, the dot table matrix is searched and processed to determine the dot table entry matrix corresponding to each initial grayscale level value in the dot table matrix; According to the dot table entry matrix, the data block of each initial gray level value in the dot table matrix is determined by a preset proportional coefficient.
7. A computing device, characterized in that include: A processor and a memory storing a computer program, wherein when the computer program is executed by the processor, the method according to any one of claims 1 to 5 is performed.
8. A computer-readable storage medium, characterized in that: Instructions are stored, and when the instructions are executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Image processing method and device
CN101404714A
Method and device for multi-bit-depth halftone amplitude modulation dot generating
CN103139440A