Card preparation method, card printing equipment and storage medium
By printing images in parallel by multiple laser printing components, the problem of inefficient printing of existing certificate cards is solved, efficient parallel printing of multiple certificate cards and separate printing of single certificate cards is realized, and printing efficiency and quality are improved.
Patent Information
- Application Number
- CN202510407580.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-02
- Publication Date
- 2025-07-04
AI Technical Summary
In the existing card printing technology, using a single laser printhead to print images one by one leads to inefficient efficiency and cannot efficiently process the image printing requirements of multiple card cards.
The image is printed in parallel by multiple laser printing components. Through image segmentation and processing technology, the image to be printed is divided into multiple target images, and the laser printing components are concurrently controlled to print on the certificate card, realizing parallel printing of multiple certificate cards and parallel printing of a single certificate card.
It improves the image printing efficiency of the certificate card, reduces the time cost of preparing the certificate card, and ensures high accuracy and consistency of the image.
Smart Images

Figure CN120245613A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of card printing, and in particular to a method for preparing a card, a card printing device, and a storage medium. Background Art
[0002] In the existing card printing technology, generally only one laser printing head is used to print an image on a blank card. When an image needs to be printed, it is necessary to control the laser printing head to print the image on the blank card in the order from one end of the image to the other end of the image. Moreover, when the number of images to be printed is multiple, it is also necessary to control the laser printing head to print the images on the blank card one by one in the queue order of the multiple images, which results in low card printing efficiency. Summary of the Invention
[0003] The main purpose of the embodiments of this application is to propose a method for preparing a card, a card printing device, and a storage medium, which can enable multiple laser printing components to print images in parallel on the same card to be printed, improve the image printing efficiency of the card, and reduce the time cost of preparing the card.
[0004] To achieve the above purpose, the first aspect of the embodiments of this application proposes a method for preparing a card, which is applied to a laser printing device. The laser printing device is provided with multiple laser printing components. The method includes: Obtain multiple images to be printed, where the multiple images to be printed are multiple first images with the same style but different contents, or multiple third sub-images split from a second image; Perform image processing on each image to be printed to obtain multiple target images; Send each target image to the corresponding laser printing component; Control each laser printing component concurrently to print the corresponding target image on the card to be printed to obtain a target card.
[0005] Further, in one embodiment, when the multiple images to be printed are multiple third sub-images split from a second image, the multiple images to be printed are obtained through the following steps: Obtain image segmentation parameters for characterizing the segmentation mode; If the image segmentation parameters characterize the automatic segmentation mode, then automatically perform image segmentation processing on the second image through a preset region segmentation method to obtain multiple third sub-images; Or, if the image segmentation parameters characterize the custom segmentation mode, then customarily perform image segmentation processing on the second image through a preset mask annotation method to obtain multiple third sub-images.
[0006] Further, in one embodiment, the second image is automatically subjected to image segmentation processing by a preset region segmentation method to obtain a plurality of third sub-images, including: Select one or more pixels from the second image as the seed region according to the preset printing style rules; According to the similarity criterion, each pixel adjacent to the seed region and meeting the conditions is correspondingly merged into the seed region to form a new seed region, and this step is repeated until all pixels adjacent to the seed region and meeting the conditions have been merged into the seed region. The finally formed seed region is the segmentation region; Perform image segmentation processing on the second image according to the segmentation region to obtain a plurality of third sub-images.
[0007] Further, in one embodiment, according to the similarity criterion, each pixel adjacent to the seed region and meeting the conditions is correspondingly merged into the seed region to form a new seed region, and this step is repeated until all pixels adjacent to the seed region and meeting the conditions have been merged into the seed region. The finally formed seed region is the segmentation region, including: Take each region adjacent to the seed region as an adjacent region, and compare the difference degree between each adjacent region and the seed region to obtain a plurality of adjacent similarity values; Among each adjacent region, determine the adjacent region with the corresponding adjacent similarity value greater than or equal to the preset similarity value as the region to be merged, and merge the pixels of the region to be merged into the seed region to obtain the merged region; Take the merged region as the seed region again, and repeat the above two steps until the adjacent similarity values of all adjacent regions are less than the preset similarity value, then stop merging the pixels of the adjacent region into the seed region. The finally formed seed region is the segmentation region.
[0008] Further, in one embodiment, the plurality of adjacent similarity values include at least one of the following: the first adjacent similarity value, the second adjacent similarity value, and the third adjacent similarity value; wherein, comparing the difference degree between each adjacent region and the seed region to obtain a plurality of adjacent similarity values includes one of the following steps: Calculate the grayscale value difference between each adjacent region and the seed region to obtain a plurality of first adjacent similarity values; Or, Calculate the color space distance metric between the pixels corresponding to each adjacent region and the pixels of the seed region to obtain a plurality of second adjacent similarity values; Or, Calculate the grayscale value differences between each adjacent region and the seed region to obtain multiple first adjacent similarity values. Moreover, calculate the color space distance metrics between the pixels of each adjacent region and the pixels of the seed region to obtain multiple second adjacent similarity values, and respectively perform weighted operations on each first adjacent similarity value and the corresponding second adjacent similarity value to obtain multiple third adjacent similarity values.
[0009] Furthermore, in one embodiment, perform image segmentation processing on the second image customarily through a preset mask annotation method to obtain multiple third sub-images, including: Determine the printing position and printing area of the second image on the ID card to be printed, and create a mask image with an image area equal to the printing area according to the printing position; Divide a custom region in the mask image, set the pixels of the custom region to a first mask value, and set the pixels of the remaining regions outside the custom region to a second mask value; Overlay the mask image on the second image, and extract the region corresponding to the custom region in the second image according to the first mask value to obtain multiple third sub-images.
[0010] Furthermore, in one embodiment, when multiple images to be printed are multiple first images with the same style but different contents, the multiple images to be printed are obtained through the following steps: Initialize multiple style images with the same style, and determine the difference content features between each style image; Obtain a preset template file, where the template file includes multiple field parameters and multiple laser printing parameters, and each field parameter corresponds to each laser printing parameter one by one; Respectively match each field parameter with each difference content feature one by one to obtain the difference content filling indexes corresponding to each style image; According to each difference content filling index, respectively fill each laser printing parameter into the difference content features of the corresponding style image to obtain multiple first images.
[0011] Furthermore, in one embodiment, perform image processing on each image to be printed to obtain multiple target images, including: Perform grayscale processing on each image to be printed to obtain multiple grayscale images; Perform filtering processing on each grayscale image to obtain multiple filtered images; Perform image enhancement processing on each filtered image to obtain multiple target images.
[0012] To achieve the above object, a second aspect of the embodiments of the present application provides a card printing device, including: one or more processors; a memory storing one or more programs, which when executed by the one or more processors, cause the one or more processors to implement the card preparation method of the first aspect embodiment above.
[0013] To achieve the above object, a third aspect of the embodiments of the present application provides a storage medium, which is a computer-readable storage medium storing a computer program that implements the card preparation method of the first aspect embodiment above when executed by a processor.
[0014] The embodiments of the present application have the following beneficial effects: By obtaining a plurality of images to be printed when preparing a target card, where the plurality of images to be printed are a plurality of first images with the same style but different contents, or a plurality of third sub-images split from a second image. Then, image processing is performed on each image to be printed to obtain a plurality of target images. Next, each target image is sent to the corresponding laser printing component. Finally, each laser printing component is concurrently controlled to print the corresponding target image on the card to be printed, obtaining the target card. Thus, when multiple cards need to be printed on the device, multi-image parallel printing corresponding to multiple cards can be achieved through multiple laser printing components. And when a single card needs to be printed on the device, the single image corresponding to the single card can also be printed in a divided area in parallel through multiple laser printing components, improving the image printing efficiency of the card and reducing the time cost of preparing the card. Description of the Drawings
[0015] Figure 1 is a flowchart of a card preparation method provided by an embodiment of the present application; Figure 2 is a schematic diagram of a plurality of first images provided by an embodiment of the present application; Figure 3 is a schematic diagram of a plurality of third sub-images provided by an embodiment of the present application; Figure 4 is provided by an embodiment of the present application Figure 1 flowchart of step S110 in; Figure 5 is provided by an embodiment of the present application Figure 4 flowchart of step S420 in; Figure 6 is provided by an embodiment of the present application Figure 5 flowchart of step S520 in; Figure 7 is provided by an embodiment of the present application Figure 6 flowchart of step S610 in; Figure 8 It is provided by an embodiment of the present application Figure 4 and is the flowchart of step S430 in Figure 9 It is provided by an embodiment of the present application Figure 1 and is the flowchart of step S110 in Figure 10 It is provided by an embodiment of the present application Figure 1 and is the flowchart of step S120 in Figure 11 and is the schematic diagram of the hardware structure of the card printing device provided by an embodiment of the present application. Detailed implementation manners
[0016] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0017] In the description of the present application, it should be understood that for the orientation description, such as the orientation or positional relationship indicated by up, down, front, back, left, right, etc. is based on the orientation or positional relationship shown in the drawings, and is only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation to the present application.
[0018] It should also be noted that in the description of the present application, the meaning of several is more than one, the meaning of multiple is more than two, greater than, less than, exceeding, etc. are understood as not including the present number, and above, below, within, etc. are understood as including the present number. If the first and second are described only for the purpose of distinguishing technical features, they cannot be understood as indicating or implying relative importance or implicitly indicating the quantity of the indicated technical features or implicitly indicating the sequence relationship of the indicated technical features.
[0019] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which the present application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.
[0020] In the description of this application, the description referring to terms such as "one embodiment", "an embodiment", "schematic embodiment", "example", "specific example", or "some examples" means that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of this application. In this specification, the schematic expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples.
[0021] In the prior art, generally only one laser printing head is used for image printing. When an image needs to be printed, the laser printing head starts printing from the head of the image in sequence. And when there are multiple images to be printed, the laser printing head also needs to queue up and print one by one, thus resulting in low printing efficiency.
[0022] Based on this, the embodiments of this application provide a method for preparing a security card, a security card printing device, and a storage medium. By obtaining multiple images to be printed when preparing a target security card, where the multiple images to be printed are multiple first images with the same style but different contents, or multiple third sub-images split from a second image. Then, image processing is performed on each image to be printed to obtain multiple target images. Next, each target image is sent to the corresponding laser printing component. Finally, each laser printing component is concurrently controlled to print the corresponding target image on the security card to be printed, obtaining the target security card. Thus, when multiple security cards need to be printed on the device, multi-image parallel printing corresponding to multiple security cards can be achieved through multiple laser printing components. And when a single security card needs to be printed on the device, the single image corresponding to the single security card can also be printed in parallel in different regions through multiple laser printing components, improving the image printing efficiency of the security card and reducing the time cost of preparing the security card.
[0023] A method for preparing a security card, a security card printing device, and a storage medium provided by the embodiments of this application will be specifically described through the following embodiments. First, a method for preparing a security card in the embodiments of this application will be described.
[0024] Refer to Figure 1 as shown Figure 1 is a flowchart of a method for preparing a security card provided by an embodiment of this application. The method for preparing a security card may include but is not limited to steps S110 to S140.
[0025] Step S110: Obtain multiple images to be printed when preparing a target security card.
[0026] Among them, refer to Figure 2 as shown Figure 2It is a schematic diagram of multiple first images provided by an embodiment of the present application. The multiple images to be printed are multiple first images with the same style but different contents; or, referring to Figure 3 as shown in Figure 3 It is a schematic diagram of multiple third sub-images provided by an embodiment of the present application. The multiple images to be printed are multiple third sub-images split from a second image.
[0027] Step S120: Perform image processing on each image to be printed to obtain multiple target images.
[0028] Specifically, unify the formats (such as PNG, TIFF), resolutions (such as above 300 DPI to meet the printing requirements), and color modes (such as CMYK for printing) of all images to be printed. Then, use algorithms such as Gaussian filtering and median filtering to remove the noise of the images to be printed. Next, automatically or manually correct the tilt, distortion, and perspective distortion of the images to be printed (such as aligning the edges of document scans, cropping or scaling the images according to the printing size, and maintaining the aspect ratio). Then, solve the overexposure or underexposure problems by performing histogram equalization and adaptive brightness adjustment on the images to be printed.
[0029] Step S130: Send each target image to the corresponding laser printing component.
[0030] Specifically, confirm that the image file format is compatible with the printing component. Then, name each transfer file according to the printing task number or content category, embed the printing parameters (such as paper size, color mode, resolution, etc.) corresponding to each target image into the corresponding transfer file, and use an efficient communication protocol (such as FTP, SMB, or HTTP) within the local area network to send the corresponding transfer file to the corresponding laser printing component.
[0031] Step S140: Control each laser printing component to print the corresponding target image on the card to be printed concurrently to obtain the target card.
[0032] Specifically, through concurrent scheduling and precise control, each laser printing component can work collaboratively at the same time, each undertaking different parts of the target image processing tasks. In this control mode, each component quickly converts the preset printing data into the processes of laser scanning, exposure, imaging, and transfer, so that the entire printing system can output synchronously, ensuring that the target image is transferred to the card to be printed with high precision and stable quality to obtain the target card. Such concurrent control not only greatly improves the printing speed and efficiency, but also ensures the consistency of image details and colors, further reducing the risk of overall printing quality degradation caused by the abnormality of a single component.
[0033] Further, referring to Figure 4 as shown in Figure 4This is provided by an embodiment of the present application Figure 1 It is a flowchart of step S110 in Figure 1 . The method for preparing the identification card may include, but is not limited to, steps S410 to S430.
[0034] Step S410: Obtain image segmentation parameters for characterizing the segmentation mode.
[0035] Specifically, obtain image segmentation parameters for characterizing the segmentation mode.
[0036] Step S420: If the image segmentation parameters characterize an automatic segmentation mode, then automatically perform image segmentation processing on the second image through a preset region segmentation method to obtain a plurality of third sub-images.
[0037] Specifically, through a preset region segmentation strategy, the system first comprehensively scans and analyzes the second image, and automatically divides the image pixels into several similar regions according to predefined feature criteria (such as color, texture, brightness, etc.); in this process, each region represents a part of the image with unique visual features. Subsequently, the system independently extracts these divided regions, and each region forms a new third sub-image, thus realizing the refined and hierarchical segmentation processing of the original image. Such automatic segmentation processing not only greatly reduces the need for manual intervention, but also provides a clearer and more structured data basis for subsequent target detection, feature extraction, and image content analysis.
[0038] Step S430: Or, if the image segmentation parameters characterize a custom segmentation mode, then perform image segmentation processing on the second image through a preset mask annotation method to obtain a plurality of third sub-images.
[0039] Specifically, through a preset mask annotation method and according to user-defined rules, perform precise image segmentation processing on the second image to generate a plurality of third sub-images. In this process, the system will pre-define or generate a set of masks through interactive annotation, and these masks clearly identify the boundaries and internal structures of each subdivision region in the image. Then, using these preset masks, the second image is segmented into several independent regions, and each region is extracted to form an independent third sub-image. This method not only allows users to flexibly define the segmentation criteria, but also retains the detailed information and shape features of the target region during the segmentation process, providing more structured and high-quality data support for subsequent target detection, feature extraction, or further image analysis.
[0040] Further, as shown in Figure 5 shown, Figure 5 This is provided by an embodiment of the present application Figure 4Flowchart of step S420 in the method for preparing a card, and the method for preparing a card may include, but is not limited to, steps S510 to S530.
[0041] Step S510: Select one or more pixels from the second image as the seed region according to a preset printing style rule.
[0042] In this process, pixel points that meet specific conditions are automatically identified according to a predetermined rule as candidate seed regions. Subsequently, one or more of the most representative pixel points are selected from these candidate pixels as the starting points for subsequent image segmentation and printing processing. These seed regions not only reflect the important local information in the image, but also ensure that the final printed output can be consistent with the preset printing style in terms of style, contrast, and detail presentation, thereby improving the accuracy of the printing effect and the overall visual consistency.
[0043] Step S520: According to the similarity criterion, merge each pixel adjacent to the seed region and meeting the conditions into the seed region to form a new seed region, and repeat this step until all pixels adjacent to the seed region and meeting the conditions have been merged into the seed region. The finally formed seed region is the segmentation region.
[0044] Specifically, in the image segmentation process, once the seed region is determined, the system evaluates all pixels on the edge of the seed region one by one according to the preset similarity criterion. Specifically, the system traverses the neighborhood of the seed region and compares each adjacent pixel with the pixels in the seed region in terms of features such as color, brightness, and texture; when the similarity measure (such as cosine similarity or other specific similarity metrics) is greater than or equal to the set threshold, the pixel is considered to have a high consistency with the seed region and is thus merged into the region. This process is usually an iterative expansion process: each time a new pixel is merged, the boundary of the seed region is updated accordingly, and the new boundary pixels are again included in the evaluation range until the entire region can no longer be expanded. In this way, the originally discrete seed region can gradually grow into a continuous, complete, and region that meets the requirements of the expected printing style, laying a solid foundation for subsequent image printing or further processing.
[0045] Step S530: Perform image segmentation processing on the second image according to the segmentation region to obtain a plurality of third sub-images.
[0046] Specifically, perform image segmentation processing on the second image according to the segmentation region to obtain a plurality of third sub-images.
[0047] Refer to Figure 6 as shown Figure 6 This is provided by an embodiment of the present application Figure 5Flowchart of step S520 in the method, and the ID card preparation method may include but is not limited to steps S610 to S630.
[0048] Step S610: Take each area adjacent to the seed area as an adjacent area, and compare the difference degree between each adjacent area and the seed area to obtain a plurality of adjacent similarity values.
[0049] During the image segmentation process, first define all unclassified pixels located at the edge of the seed area as adjacent pixels, and define the area of these adjacent pixels as the adjacent area. Next, conduct a detailed feature comparison between each adjacent pixel in each adjacent area and the pixels in the seed area. Common features include color, grayscale, texture, etc. By calculating the difference degree between these features (such as using cosine similarity, Pearson correlation coefficient or other specific similarity metrics), the similarity value between each adjacent area and the seed area can be obtained. Each similarity value reflects the matching degree of each adjacent area and the seed area in visual characteristics, that is, the higher the similarity, the closer the features of the pixel are to the seed area; on the contrary, a low similarity indicates an obvious difference between the two. Finally, the system organizes the obtained plurality of adjacent similarity values to provide a quantitative basis for subsequent pixel merging operations, so that under the set similarity threshold conditions, the adjacent areas that meet the requirements can be selectively merged into the corresponding seed areas, thereby gradually expanding and improving the overall result of image segmentation.
[0050] Step S620: Among each adjacent area, determine the adjacent areas whose corresponding adjacent similarity values are greater than or equal to the preset similarity value as the areas to be merged, and merge the pixels of the areas to be merged into the seed area to obtain a merged area.
[0051] Furthermore, according to the preset similarity threshold (preset similarity value), screen all adjacent areas, and mark the areas whose similarity values of adjacent areas are greater than or equal to the preset similarity value as the areas to be merged. These areas to be merged represent local areas with high consistency with the seed area in terms of color, brightness or texture, etc. Next, the system integrates the pixels of these eligible areas to be merged into the original seed area, making it continuously expand, and finally forms a continuous and coherent merged area. Such processing not only ensures the uniformity of internal features of the segmented area, but also makes the final segmentation result better reflect the edges and structures of real objects in the image by dynamically expanding the area boundary, providing accurate area information for subsequent further analysis and printing output.
[0052] Step S630: Regard the merged area as the seed area again, and repeat the above steps S610 and S620 until the adjacent similarity values of all adjacent areas are less than the preset similarity value, then stop merging the pixels of the adjacent areas into the seed area, and the finally formed seed area is the segmented area.
[0053] Specifically, regard the merged area as the seed area again, and repeat the above steps S610 and S620 until the adjacent similarity values of all adjacent areas are less than the preset similarity value, then stop merging the pixels of the adjacent areas into the seed area.
[0054] It should be noted that the above multiple adjacent similarity values include at least one of the following: the first adjacent similarity value, the second adjacent similarity value, and the third adjacent similarity value.
[0055] Refer to Figure 7 as shown Figure 7 is provided by an embodiment of the present application Figure 6 The flowchart of step S610 in which the ID card preparation method may include, but is not limited to, steps S710 to S730.
[0056] Step S710: Calculate the grayscale value difference between each adjacent area and the seed area to obtain a plurality of first adjacent similarity values.
[0057] During the image segmentation process, in order to quantify the grayscale difference between the seed area and its surrounding adjacent areas, it is first necessary to determine the representative grayscale value of the seed area and the representative grayscale value of the adjacent area. Usually, the average grayscale or median of all pixels in the area can be selected. Subsequently, for each adjacent area located at the edge of the seed area, calculate the absolute difference between its grayscale value and the representative grayscale of the seed area. This calculation process will generate a first adjacent similarity value for each adjacent area, and these first adjacent similarity values reflect the specific difference situation between the adjacent area and the seed area in terms of grayscale value. By comparing these first adjacent similarity values with a preset threshold, it can be further determined which areas have a high similarity with the seed area, thereby providing a quantitative basis for subsequent area expansion or merging. This mechanism ensures that only those pixels with grayscale characteristics close to the seed area are considered for inclusion, thereby improving the uniformity and accuracy of the final segmented area.
[0058] Step S720: Alternatively, calculate the color space distance metric between the pixels of each adjacent area and the pixels of the seed area to obtain a plurality of second adjacent similarity values.
[0059] First, by statistically analyzing the color data of all pixels within the seed region (e.g., vector representation in RGB or CIELAB color space), a representative color vector can be obtained, which is typically determined by calculating the mean or median of the pixels within the region. Next, for each adjacent region located at the boundary of the seed region, its color is also represented in vector form. Using the Euclidean distance or other suitable color distance metrics (such as CIEDE2000), the distance between the color vector of the pixels in the adjacent region and the representative color vector of the pixels in the seed region can be calculated, and this distance is referred to as the second adjacent similarity value.
[0060] These second adjacent similarity values not only quantitatively reflect the similarity degree of each adjacent region to the seed region in terms of color information but also provide a basis for subsequent judgment on whether to merge the adjacent region into the seed region. Generally speaking, if the second adjacent similarity value of a certain adjacent region is greater than or equal to a preset threshold, it indicates that its color is relatively close to that of the seed region and has a high possibility of belonging; otherwise, it indicates that there is an obvious color difference between the pixel and the seed region, and it should be retained as an independent region or used as boundary information.
[0061] This method of calculating multiple second adjacent similarity values through color space distance can effectively support region expansion, pixel classification, and subsequent merging strategies during the image segmentation process, thereby ensuring that the finally obtained segmented regions have high quality in terms of color consistency and boundary accuracy.
[0062] Step S730: Alternatively, calculate the grayscale value difference between each adjacent region and the seed region to obtain multiple first adjacent similarity values, and calculate the color space distance metric between the pixels of each adjacent region and the pixels of the seed region to obtain multiple second adjacent similarity values, and then perform weighted operations on each first adjacent similarity value and the corresponding second adjacent similarity value respectively to obtain multiple adjacent similarity values.
[0063] In order to integrate the grayscale difference and color difference into a similarity index, it is necessary to weight the first adjacent similarity value and the second adjacent similarity value. Set weight parameters 𝛼 and 𝛽 (𝛼 + 𝛽 = 1), which correspond to the weights of the grayscale difference and color difference respectively.
[0064] For each adjacent region, calculate the adjacent similarity value S: 𝑆 = 𝛼 × first adjacent similarity value + 𝛽 × second adjacent similarity value. By adjusting the values of α and β, the influence degrees of the grayscale difference and color difference in the similarity metric can be controlled. For example, if more importance is attached to the color difference, 𝛽 can be set to be greater than 𝛼; vice versa.
[0065] Further, as shown in Figure 8 shown, Figure 8 is provided by an embodiment of the present applicationFigure 4 Flowchart of step S430 in the method for preparing an identification card, which may include, but is not limited to, steps S810 to S830.
[0066] Step S810: Determine the printing position and printing area of the second image on the identification card to be printed, and create a mask image with an image area equal to the printing area according to the printing position.
[0067] First, it is necessary to measure and evaluate the size and available printing area of the identification card to be printed to determine the maximum size and position range where the second image can be placed. Then, through the analysis of the image source file, determine the printing position and printing area of the second image on the identification card to be printed, while considering the specific requirements of the printing task, such as resolution, image quality, etc.
[0068] Next, according to the requirements of the printing position, create a mask image with an image area equal to the printing area. The role of the mask image is to allow only the image content in a specific area to be printed during the printing process, thereby ensuring the integrity, clarity, and consistency of the image. The creation of the mask image requires precisely matching the size of the printing area and being completely aligned with the printing position of the second image to ensure that the mask image can accurately cover all parts of the second image during printing.
[0069] Step S820: Divide a custom area in the mask image, set the pixels in the custom area to a first mask value, and set the pixels in the remaining areas outside the custom area to a second mask value.
[0070] Specifically, manually select a custom area in the mask image. For the pixels in the custom area, uniformly set their values to the first mask value. This value is usually a specific number, such as 255 (white) or 1, which is used to indicate that the pixels in this area will be retained or undergo special processing in subsequent operations; for the pixels outside the custom area in the mask image, uniformly set their values to the second mask value. This value is usually a different number, such as 0 (black) or 254, which is used to indicate that the pixels in this area will be ignored or undergo different processing in subsequent operations. Through the above steps, a mask image is generated. In this image, the pixel values in the custom area are the first mask value, and the pixel values in other areas outside the custom area are the second mask value.
[0071] Step S830: Superimpose and apply the mask image to the second image, and extract the area corresponding to the custom area in the second image according to the first mask value to obtain multiple third sub-images.
[0072] It should be noted that the logical AND operation is used to determine whether the corresponding bits of two binary numbers are both 1. If both bits are 1, the result is 1; otherwise, the result is 0. In image processing, this operation is usually used to extract specific parts of a target image according to the area defined by a mask image.
[0073] Specifically, first, the created mask image is precisely superimposed on the second image, and each pixel point in the mask image is aligned with the corresponding pixel point in the second image to ensure that the behavior of each pixel can be accurately controlled in subsequent processing. Then, a logical AND operation is performed on each pixel point of the superimposed mask image and the second image. The first mask value (such as 255) in the mask image represents the area to be retained, and the pixel value at the corresponding position in the second image will be retained, while the pixel values in other areas will be set to 0 (black). In this way, the superimposed area corresponding to the first mask value in the second image can be extracted to form a third sub-image.
[0074] Similarly, through the logical AND operation, the area corresponding to the second mask value in the second image can be extracted. Here, the second mask value (such as 0) represents the area not to be retained, and then these areas can be extracted through an inverse operation (that is, taking the inverse of the mask image). After taking the inverse of the mask image and performing the logical AND operation, the superimposed area corresponding to the second mask value in the second image can be extracted to form another third sub-image.
[0075] Finally, through the above process, multiple third sub-images can be obtained, and each image corresponds to a specific mask value area. These images can be further used for various image processing tasks, such as image segmentation, region analysis, feature extraction, etc.
[0076] Furthermore, referring to Figure 9 as shown, Figure 9 is a flowchart of step S110 provided by an embodiment of the present application. The ID card preparation method may include but is not limited to steps S910 to S940. Figure 1 Step S910: Initialize multiple style images with the same style and determine the difference content features between each style image.
[0077]
[0078] First, create a style template that contains the basic style features of the image, such as color, shape, layout, texture, etc. This template will serve as the basis for generating multiple images with the same style. Then, based on the style template, use programming or the batch processing function of image processing software to generate multiple style images with the same style. These images are consistent in overall style and visual effect, but may have differences in some details. Next, perform feature extraction on each style image to identify the key content features in the image, such as specific shapes, color regions, texture patterns, etc. These features can be extracted through image processing algorithms (such as edge detection, color segmentation, texture analysis, etc.). Finally, compare and analyze the extracted features to determine the different content features between each style image. For example, some images may differ in the text to be printed in a specific area, or there may be differences in the size and position of some shapes.
[0079] Step S920: Obtain a preset template file.
[0080] Among them, the template file includes multiple field parameters and multiple laser printing parameters, and each field parameter corresponds to each laser printing parameter one by one.
[0081] Step S930: Match each field parameter with each different content feature one by one to obtain the different content filling indexes corresponding to each style image.
[0082] Specifically, in the actual operation process, first, it is necessary to extract numerous field parameters one by one. These field parameters may cover multiple aspects such as the color mode, resolution, size, etc. of the image. At the same time, various different content features also need to be sorted out, such as the shape changes of the main objects in the image, the thickness differences of the textures, the saturation changes of the colors, etc. Then, through preset logical rules, each field parameter is precisely matched with each different content feature. For example, match the color mode field parameter with the color saturation difference feature, and the resolution parameter with the image clarity difference feature, etc. After such meticulous matching work, the different content filling indexes corresponding to each style image can be obtained. These indexes are like labels pointing to specific different contents, which can more accurately locate and fill the different parts in different style images, so as to better achieve related tasks such as image processing or image generation, and meet the actual needs in many fields such as image design and image analysis.
[0083] Step S940: According to each different content filling index, fill each laser printing parameter into the different content features of the corresponding style image to obtain multiple first images.
[0084] Specifically, by filling the index according to each difference content, different laser printing parameters can be filled into the difference content features of the corresponding style image one by one. The core of this process lies in combining the settings of laser printing with the features of the image to ensure that the details of each style image can be properly processed.
[0085] In specific implementation, when filling the index according to each difference content, it is necessary to identify the difference content features of each style image respectively, such as the edges, textures, color depths, etc. of the image. Then, according to these features, the corresponding field parameters are matched, and then the corresponding laser printing parameters, such as speed, power, line spacing, etc., are read according to the corresponding field parameters. These parameters will directly affect the quality and effect of the final image. For example, a lower line spacing can produce a denser filling effect, while a higher power can achieve a deeper etching effect.
[0086] By applying these laser printing parameters to the difference content features of the style image, multiple first images can be generated. These first images not only retain the features of the original style, but also enhance the details and layering through laser printing, thus achieving higher-quality image output. This method has wide practicability in image processing and laser printing applications and can meet the requirements of different design needs and material characteristics.
[0087] Further, referring to Figure 10 as shown, Figure 10 is a flowchart of step S120 provided by an embodiment of the present application. The ID card preparation method may include but is not limited to steps S1010 to S1030. Figure 1 Step S1010: Perform grayscale processing on each image to be printed to obtain multiple grayscale images.
[0088] Specifically, in order to meet the specific requirements of printing, it is necessary to perform grayscale processing on each image to be printed. In this processing process, the originally colorful image is converted into a grayscale image with only three tones of black, white, and gray. The principle of grayscale processing is based on the pixel points of different colors in the image. According to certain rules and ratios, they are converted into pixel points with corresponding grayscale values. In this way, the different visual effects presented due to color differences are transformed into the depth changes in grayscale, thus greatly simplifying the information composition of the image while keeping the image content basically unchanged. These grayscale images provide a more convenient and accurate material basis for subsequent printing and other operations, enabling the printing process to more accurately present the details and layers of the image.
[0089] Step S1020: Perform filtering processing on each grayscale image to obtain multiple filtered images.
[0090]
[0091] In a possible embodiment, by convolving an image with a Gaussian kernel, multiple filtered images are obtained, thereby smoothing the image and reducing noise. Among them, the values in the Gaussian kernel are arranged according to a Gaussian distribution, so that the pixels in the neighborhood around each pixel will be calculated in the weighted average, thereby achieving the effect of noise reduction.
[0092] Step S1030: Perform image enhancement processing on each filtered image to obtain multiple target images.
[0093] In a possible embodiment, first, the gray-scale distribution of each filtered image is adjusted through histogram equalization technology, so that the contrast of the image is improved, making the image look clearer. Then, contrast stretching is used to expand the gray-scale range of each filtered image to enhance the visual effect of the image. Finally, sharpening technology is used to enhance the edges and details of each filtered image, making each filtered image sharper. Finally, after these image enhancement processes, multiple target images are obtained. These target images not only retain the main features of the original image, but also are more prominent visually, with clearer details and higher contrast. Such a processing result makes the image more suitable for subsequent printing applications.
[0094] The embodiment of the present application also provides a card printing device, which includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the above-mentioned card preparation method is implemented.
[0095] Please refer to Figure 11 , Figure 11 which is a schematic diagram of the hardware structure of the card printing device provided by an embodiment of the present application. The card printing device includes: A processor 1101, which can be implemented in the form of a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, etc., and is used to execute relevant programs to implement the card preparation method provided by the embodiment of the present application; A memory 1102, which can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM), etc. The memory 1102 can store an operating system and other application programs. When implementing the technical solutions provided by the embodiments of this specification through software or firmware, the relevant program codes are stored in the memory 1102 and are called by the processor 1101 to execute the card preparation method provided by the embodiment of the present application; An input / output interface 1103 for implementing information input and output; A communication interface 1104 for implementing communication interaction between this device and other devices, which can achieve communication through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.); A bus 1105 for transmitting information between various components of the device (such as a processor 1101, a memory 1102, an input / output interface 1103, and a communication interface 1104); Among them, the processor 1101, the memory 1102, the input / output interface 1103, and the communication interface 1104 are communicatively connected to each other inside the device through the bus 1105.
[0096] The embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it is the card preparation method provided by the embodiment of the present application.
[0097] As a non-transitory computer-readable storage medium, the memory can be used to store non-transitory software programs and non-transitory computer-executable programs. In addition, the memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories can be connected to the processor through a network. Examples of the above networks include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.
[0098] The embodiments described in the embodiments of the present application are for more clearly illustrating the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art know that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems.
[0099] Those skilled in the art can understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than those shown in the figures, or combine certain steps, or different steps.
[0100] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0101] Those of ordinary skill in the art will understand that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or a suitable combination thereof.
[0102] As used in the specification of this application and the above-mentioned drawings, the terms "first", "second", "third", "fourth", etc. (if any) are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances so that the embodiments of this application described herein can be implemented in an order different from those illustrated or described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that comprises a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0103] It should be understood that in this application, "at least one (item)" means one or more, and "a plurality" means two or more. "And / or" is used to describe the association relationship of associated objects and indicates that three relationships may exist. For example, "A and / or B" may mean: only A exists, only B exists, and both A and B exist at the same time. Here, A and B can be singular or plural. The character " / " generally means that the associated objects before and after are in an "or" relationship. "At least one (one) of the following" or similar expressions refer to any combination of these items, including any combination of single items (ones) or plural items (ones). For example, at least one (one) of a, b, or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0104] In several embodiments provided in this application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For example, the above-mentioned unit division is only a logical function division, and there may be other division methods in actual implementation. 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 coupling, direct coupling, or communication connection to each other can be through some interfaces, and the indirect coupling or communication connection of devices or units can be in electrical, mechanical, or other forms.
[0105] The units described above as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed across 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.
[0106] In addition, in each embodiment of the present application, the functional units 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. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
[0107] If the integrated unit 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 application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes multiple instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present application. The aforementioned storage medium includes: USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks, or optical discs and other various media that can store programs.
[0108] The preferred embodiments of the embodiments of the present application have been described above with reference to the accompanying drawings. This does not limit the scope of the rights of the embodiments of the present application. Any modifications, equivalent replacements, and improvements made by those skilled in the art without departing from the scope and essence of the embodiments of the present application shall be within the scope of the rights of the embodiments of the present application.
Claims
1. A method for preparing an identification card, characterized in that, Applied to a laser printing device, the laser printing device being provided with a plurality of laser printing components, the method comprising: Obtaining a plurality of images to be printed, the plurality of images to be printed being a plurality of first images with the same style but different contents, or a plurality of third sub-images split from a second image; Performing image processing on each of the images to be printed to obtain a plurality of target images; Sending each of the target images to the corresponding one of the laser printing components; Controlling each of the laser printing components concurrently to print the corresponding target image on a card to be printed, thereby obtaining a target card.
2. The method for preparing an identification card according to claim 1, wherein When the plurality of images to be printed are a plurality of third sub-images split from a second image, the plurality of images to be printed are obtained through the following steps: Obtaining an image segmentation parameter for characterizing a segmentation mode; If the image segmentation parameter characterizes an automatic segmentation mode, then automatically performing image segmentation processing on the second image through a preset region segmentation method to obtain a plurality of the third sub-images; Or, if the image segmentation parameter characterizes a custom segmentation mode, then customarily performing image segmentation processing on the second image through a preset mask annotation method to obtain a plurality of the third sub-images.
3. The method for preparing an identification card according to claim 2, wherein, The automatically performing image segmentation processing on the second image through a preset region segmentation method to obtain a plurality of the third sub-images includes: Selecting one or more pixels from the second image as a seed region according to a preset printing style rule; According to a similarity criterion, correspondingly merging each pixel adjacent to the seed region and meeting the condition into the seed region to form a new seed region, and repeating this step until all pixels adjacent to the seed region and meeting the condition have been merged into the seed region, and the finally formed seed region is a segmentation region; Performing image segmentation processing on the second image according to the segmentation region to obtain a plurality of the third sub-images.
4. The method for preparing an identification card according to claim 3, wherein The correspondingly merging each pixel adjacent to the seed region and meeting the condition into the seed region according to a similarity criterion to form a new seed region, and repeating this step until all pixels adjacent to the seed region and meeting the condition have been merged into the seed region, and the finally formed seed region is a segmentation region includes: Regarding each region adjacent to the seed region as an adjacent region, and comparing the difference degree between each adjacent region and the seed region to obtain a plurality of adjacent similarity values; Among each of the adjacent regions, determining an adjacent region corresponding to an adjacent similarity value greater than or equal to a preset similarity value as a region to be merged, and merging the pixels of the region to be merged into the seed region to obtain a merged region; Regarding the merged region as the seed region again, and repeating the above two steps until the adjacent similarity values of all the adjacent regions are less than the preset similarity value, then stopping merging the pixels of the adjacent regions into the seed region, and the finally formed seed region is a segmentation region.
5. The method for preparing an identification card according to claim 4, wherein The multiple adjacent similarity values include at least one of the following: a first adjacent similarity value, a second adjacent similarity value, and a third adjacent similarity value; wherein, the comparing the difference degree between each of the adjacent regions and the seed region to obtain multiple adjacent similarity values includes one of the following steps: Calculating the grayscale value difference between each of the adjacent regions and the seed region to obtain multiple first adjacent similarity values; Or, Calculating the color space distance metric between the pixels corresponding to each of the adjacent regions and the pixels of the seed region to obtain multiple second adjacent similarity values; Or, Calculating the grayscale value difference between each of the adjacent regions and the seed region to obtain multiple first adjacent similarity values, and calculating the color space distance metric between the pixels of each of the adjacent regions and the pixels of the seed region to obtain multiple second adjacent similarity values, and respectively performing weighted operations on each of the first adjacent similarity values and the corresponding second adjacent similarity values to obtain multiple third adjacent similarity values.
6. The method for preparing an identification card according to claim 2, wherein The custom image segmentation processing of the second image by a preset mask annotation method to obtain multiple third sub-images includes: Determining the printing position and printing area of the second image on the to-be-printed card, and creating a mask image with an image area equal to the printing area according to the printing position; Dividing a custom region in the mask image, setting the pixel values of the custom region to a first mask value, and setting the pixel values of the remaining regions outside the custom region to a second mask value; Overlaying and applying the mask image to the second image, and extracting the region corresponding to the custom region from the second image according to the first mask value to obtain multiple third sub-images.
7. The method for preparing an identification card according to claim 1, wherein When the multiple to-be-printed images are multiple first images with the same style but different contents, the multiple to-be-printed images are obtained through the following steps: Initializing multiple style images with the same style, and determining the difference content features between each of the style images; Obtaining a preset template file, where the template file includes multiple field parameters and multiple laser printing parameters, and each of the field parameters corresponds to each of the laser printing parameters one by one; Respectively matching each of the field parameters with each of the difference content features one by one to obtain the difference content filling index corresponding to each of the style images; According to each of the difference content filling indexes, respectively filling each of the laser printing parameters into the difference content features of the corresponding style image to obtain multiple first images.
8. The method for preparing an identification card according to claim 1, characterized in that, The image processing of each of the to-be-printed images to obtain multiple target images includes: Performing grayscale processing on each of the to-be-printed images to obtain multiple grayscale images; Performing filtering processing on each of the grayscale images to obtain multiple filtered images; Performing image enhancement processing on each of the filtered images to obtain multiple target images.
9. A card printing device, characterized in that, Including: One or more processors; A memory storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the card preparation method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, The medium stores a computer program which, when executed by a processor, implements the card preparation method according to any one of claims 1 to 8.
Citation Information
Cited By
Square box cell edge printing method, device, equipment and medium
CN121268432A