Simulation preview method and device, terminal, storage medium and computer program product
By acquiring and fusing the depth information of the background image and the image to be printed, and generating a simulated preview image, the problem of material waste when printing soft or uneven surfaces is solved, achieving a more efficient printing process.
Patent Information
- Application Number
- CN202411894336.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-04-11
AI Technical Summary
When printing on soft or uneven surfaces, it is difficult to evaluate the printing effect in advance, resulting in multiple attempts and adjustments required, resulting in wasted printing materials.
By obtaining the depth information of the background image and the image to be printed, the image to be printed is distorted to adapt to the surface shape of the background image, and the distorted image is fused with the background image to generate a simulated preview image.
Reduces the number of repeated modifications and reprints, saves time and resources, and avoids waste of printing materials.
Smart Images

Figure CN119810260A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of printing technology, and in particular to a simulation preview method, device, terminal, storage medium and computer program product. Background Art
[0002] In the traditional printing field, when it is necessary to print patterns on relatively soft or uneven surfaces, it is difficult to evaluate the printing effect. In actual operation, it is usually necessary to first perform field printing and then observe the pattern effect after printing. However, this method has obvious disadvantages. The main disadvantage is that it is impossible to determine the best printing parameters and effects in advance. Therefore, it takes many attempts and adjustments to obtain a satisfactory printing result, resulting in a large amount of waste of printing materials. Summary of the invention
[0003] The main purpose of the present application is to provide a simulation preview method, device, terminal, storage medium and computer program product, aiming to solve the technical problem that multiple attempts and adjustments are required to obtain a relatively satisfactory printing result, resulting in a large amount of waste of printing materials.
[0004] To achieve the above object, the present application provides a simulation preview method, which includes:
[0005] Get the background image and the image to be printed;
[0006] Acquiring depth information of the background image, and distorting the image to be printed according to the depth information of the background image to obtain a distorted image;
[0007] The distorted image and the background image are fused to generate a simulation preview image and display it.
[0008] In one embodiment, distorting the image to be printed according to the depth information of the background image to obtain a distorted image includes:
[0009] Acquire an overlapping area of the background image that overlaps the image to be printed;
[0010] Acquire depth information of the overlapping area in the background image;
[0011] The to-be-printed image is distorted based on the depth information of the overlapping area to obtain the distorted image.
[0012] In one embodiment, the step of distorting the image to be printed based on the depth information of the overlapping area to obtain the distorted image includes:
[0013] Determining the displacement of each pixel in the image to be printed based on the depth information of the overlapping area;
[0014] Distorting the image to be printed based on the displacement to obtain an intermediate image;
[0015] An interpolation process is performed on the intermediate image to obtain the distorted image.
[0016] In one embodiment, the step of distorting the image to be printed based on the displacement to obtain the intermediate image includes:
[0017] Obtaining material parameters of objects in the background image;
[0018] determining a correction factor based on the material parameters;
[0019] The image to be printed is distorted based on the displacement and the correction factor to obtain the intermediate image.
[0020] In one embodiment, the step of fusing the distorted image and the background image to generate and display a simulated preview image includes:
[0021] Merging the distorted image into the overlapping area of the background image to generate the simulation preview image;
[0022] The simulation preview image is displayed on the interactive interface.
[0023] In one embodiment, the step of fusing the distorted image into the overlapping area of the background image to generate the simulated preview image includes:
[0024] Adjusting the transparency of the distorted image to a preset transparency to obtain a transparent distorted image;
[0025] The distorted transparent image is merged into the overlapping area of the background image to generate the simulation preview image.
[0026] In one embodiment, the step of obtaining the depth information of the background image includes:
[0027] Obtaining an average grayscale value of the background image, and calculating depth information of the background image based on the average grayscale value, the grayscale value of each pixel point, and a depth coefficient;
[0028] Alternatively, a depth image corresponding to the background image is obtained, and depth information of the background image is determined based on the depth image.
[0029] In one embodiment, the step of distorting the image to be printed according to the depth information of the background image to obtain a distorted image includes:
[0030] If the location area of the image to be printed exceeds the boundary of the background image, outputting a prompt message;
[0031] If the position area of the image to be printed does not exceed the boundary of the background image, the image to be printed is distorted according to the depth information of the background image.
[0032] In addition, to achieve the above-mentioned purpose, the present application also provides a simulation preview device, the simulation preview device comprising:
[0033] An image acquisition module, used to acquire a background image and an image to be printed;
[0034] A depth information acquisition module, used to acquire the depth information of the background image;
[0035] An image processing module, used for distorting the image to be printed according to the depth information of the background image to obtain a distorted image; fusing the distorted image and the background image to generate a simulated preview image;
[0036] The display module is used to display an interactive interface, in which the simulation preview image is displayed.
[0037] In addition, to achieve the above-mentioned purpose, the present application also provides a terminal, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the simulation preview method as described above.
[0038] In addition, to achieve the above-mentioned purpose, the present application also provides a computer-readable storage medium, on which is stored a program for implementing the simulation preview method, and the program for implementing the simulation preview method is executed by a processor to implement the steps of the simulation preview method as described above.
[0039] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the simulation preview method described above are implemented.
[0040] The present application provides a simulation preview method, which first obtains a background image and an image to be printed; obtains depth information of the background image, and distorts the image to be printed according to the depth information of the background image to obtain a distorted image; fuses the distorted image and the background image to generate and display a simulation preview image, thereby solving the technical problem that a relatively satisfactory printing result can only be obtained after multiple attempts and adjustments, resulting in a large amount of waste of printing materials, and achieves the technical effect of reducing the number of repeated modifications and reprinting, thereby saving time and resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0042] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0043] Figure 1 This is a flowchart of steps S10-S30 in an embodiment of the simulation preview method of this application;
[0044] Figure 2 This is a flowchart of steps S231-S233 in an embodiment of the simulation preview method of this application;
[0045] Figure 3 This is a flowchart of steps S2321-S2323 in an embodiment of the simulation preview method of this application;
[0046] Figure 4 A brief flowchart provided in an embodiment of a simulation preview method of the present application;
[0047] Figure 5 This is an example diagram of the background image in the first embodiment of the simulation preview method of this application;
[0048] Figure 6 This is an example diagram of an image to be printed in an embodiment of a simulation preview method of this application;
[0049] Figure 7 This is an example diagram of a simulation preview image in an embodiment of a simulation preview method of the present application;
[0050] Figure 8 This is a schematic diagram of the hardware structure involved in the embodiment of the simulation preview device of this application;
[0051] Fig. 9 This is a schematic diagram of the hardware structure involved in the terminal embodiment of this application.
[0052] Description of Figure Numbers:
[0053] Simulation preview device 800 ; image acquisition module 801 ; depth information acquisition module 802 ; image processing module 803 ; display module 804 .
[0054] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0055] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0056] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0057] At present, the printing cycle of traditional technical solutions is long, mainly because it takes many attempts and repeated adjustments of parameters to obtain a relatively satisfactory printing result, which results in a waste of printing time and a waste of carriers.
[0058] The main solution of the present application is: obtaining a background image and an image to be printed; obtaining depth information of the background image, and distorting the image to be printed according to the depth information of the background image to obtain a distorted image; fusing the distorted image and the background image to generate and display a simulated preview image, thereby solving the technical problem that a relatively satisfactory printing result needs to be obtained after multiple attempts and adjustments, resulting in a large amount of waste of printing materials, and achieving the technical effect of reducing the number of repeated modifications and reprinting, thereby saving time and resources.
[0059] It should be noted that the execution subject of this embodiment can be a printing device, or a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or a host computer of the printing device, and this embodiment does not specifically limit this. The host computer interacts with the printing device for data, and then sends the generated simulation preview image to the printing device to print the image to be printed on a carrier material such as a PET film, and then transfers the image to be printed to an object such as clothing based on the carrier material. The following takes the host computer of the printing device as an example of the execution subject to explain this embodiment and the following embodiments.
[0060] Based on this, an embodiment of the present application proposes a simulation preview method, please refer to Figure 1 The simulation preview method includes steps S10 to S30:
[0061] Step S10, obtaining a background image and an image to be printed.
[0062] In this embodiment, the background image includes an image of a carrier that needs to carry the image to be printed, such as clothes, backpacks, mobile phone cases, etc., which is not limited in this embodiment. The image to be printed can be printed on the surface of a medium material such as a PET film, and then the image to be printed on the medium material is transferred to an object such as clothes, or the image to be printed is directly printed on the carrier. The image to be printed can be a picture, a designed pattern, text, a logo, etc. It can be an image file in various formats, such as jpg, png, etc., or it can be a vector graphic generated by design software. For example, the carrier is clothes, and the background image is a person wearing clothes. The carrier is aluminum, and the background image is an image of a bottle made of aluminum. In this embodiment, there is no specific limitation on the combination of the carrier and the background image. The simulated preview image is a preview image of the effect of simulating the image to be printed on the carrier in the background image.
[0063] As an optional implementation, a dedicated image acquisition device is used to scan the carrier to obtain image information of its surface as a background image. For example, a three-dimensional laser scanner is used to scan the carrier. For the image to be printed, it can be selected from a local storage device, or the corresponding image file can be obtained from the design terminal through network transmission. Alternatively, the background image can be obtained by capturing an image of the target object through a depth camera. Alternatively, the background image can be obtained by capturing an image of the target object through an RGB camera. Among them, the background image can be a two-dimensional image, such as an RGB image, or a three-dimensional image, such as an RGBD image.
[0064] Step S20, acquiring the depth information of the background image, and distorting the image to be printed according to the depth information of the background image to obtain a distorted image.
[0065] In this embodiment, the depth information can accurately indicate the concave-convex conditions (such as shape) of the surface of the object, and for clothes, it can indicate the wrinkles of the clothes. For example, when scanning a textured paper, the raised texture parts and the sunken parts on the paper have different depth values. Distortion is an image processing method that can perform geometric transformations on the image to be printed based on the depth information of the background image. The pixels of the image to be printed are rearranged according to the depth changes of the background image so that the image to be printed can adapt to the surface shape of the background image. For example, if the background image shows that a certain area is sunken, the pixels of the image to be printed in that area will be stretched and transformed accordingly.
[0066] As an optional implementation, the background image can be analyzed to extract the depth information therein. This can be based on the principle of stereoscopic vision, structured light method, etc. Then, each pixel of the image to be printed is matched with the depth information of the background image. For areas with larger depth values in the background image, the pixels of the image to be printed at the corresponding positions are compressed; for areas with smaller depth values, the pixels are stretched. This process can be implemented using a combination of spatial transformation algorithms, such as affine transformation, perspective transformation, etc., or the image to be printed can be distorted by interpolation, or a deep learning model can be used to distort the image to be printed to obtain a distorted image.
[0067] As another optional implementation, a depth image corresponding to the background image is collected by a depth information acquisition device (such as a depth camera, lidar, line laser profiler, etc.), and the depth image collected by the depth information acquisition device is obtained. After matching the depth image with the background image, the depth information of the pixel points on the background image can be obtained.
[0068] Step S30, fusing the distorted image and the background image to generate and display a simulation preview image.
[0069] In this embodiment, fusion is an operation of synthesizing the distorted image and the background image at the image level. Through fusion, the simulated effect of the image to be printed on the surface of the carrier can be intuitively seen. For example, the distorted image is fused with the textured cloth background image, as if the image to be printed has been printed on the cloth. The simulation preview image simulates the effect after actual printing, allowing the user to see the presentation of the image to be printed on the surface of a specific carrier before actually printing, including the deformation of the image, the degree of fit with the background, etc.
[0070] As an optional implementation, an image fusion algorithm is used to synthesize the distorted image and the background image. For example, a fusion method based on an alpha channel, a weighted average method, etc. can be used. For example, when using the weighted average method, the color values of the corresponding pixels of the distorted image and the background image are weighted according to the set weights to obtain new pixel values, thereby generating a simulated preview image. Finally, the simulated preview image is output to a display device, such as a computer monitor, a tablet screen, etc., so that the user can view it and present the printing effect more intuitively. Alternatively, layer fusion, cutout, etc. can also be used.
[0071] For example, a trademark pattern is printed on a handmade leather product with complex textures. A background image and an image to be printed are obtained. The surface of the leather product is scanned using a high-precision three-dimensional optical scanner. The light emitted by the scanner is reflected and refracted on the leather surface, and by receiving the information of these lights, a background image containing detailed information such as leather texture, wrinkles and bumps is generated. This background image is stored in the form of three-dimensional point cloud data and texture mapping, which can accurately reflect the actual situation of the leather surface. There are some concave marks and raised decorative textures on the leather product, and the depth values of these areas are different. For the trademark pattern to be printed, according to the depth information of the background image, a distortion algorithm based on a physical model is used to distort the trademark pattern to be printed. For example, when encountering a concave area on the leather, the lines and graphics at the corresponding position in the trademark pattern will be stretched to adapt to the shape of the concave; while in the raised texture part, the pattern will be appropriately compressed so that it looks like it fits the leather surface. After this process, a distorted image is obtained. The fused algorithm based on the alpha channel is used to fuse the distorted image and the background image. Set the alpha value of the trademark pattern to 0.8, indicating a transparency of 20%, so that the trademark pattern looks like it is printed on the leather surface, while also showing some of the leather's own texture. Finally, the generated simulation preview image is displayed on the display interface. Users can clearly see the printing effect of the trademark pattern on leather products, including the deformation of the pattern in different texture areas, the matching effect with the leather color, etc. If you are not satisfied, you can adjust the original trademark pattern and re-simulate the preview until the ideal effect is achieved, thus avoiding repeated printing tests on actual leather products and saving expensive leather carriers.
[0072] For example, an editing software is installed on the host computer, and the user can use the software to view the printing effect of the design pattern on the clothing. For example, the user uploads a background image, which is a photo of a model wearing a fashionable dress with a pleated design and a unique texture. At the same time, the user also uploads an image to be printed, which is a colorful and beautifully designed flower pattern, which will be printed on the dress worn by the model. On the operation interface of the software, the user uses the mouse to drag the flower pattern to be printed to the appropriate position of the dress in the background image, such as the center of the chest. Next, the image to be printed is distorted according to the depth information of the dress in the background image. The depth change of the area where the flower pattern is printed on the dress can be obtained. For example, for the deeper folds on the dress, the system will stretch the pixels of the flower pattern at that position accordingly to make it fit the shape of the folds; and for some parts with raised textures, the relevant parts of the flower pattern will be appropriately compressed to ensure that the pattern matches the three-dimensional effect of the dress, thereby obtaining a distorted image. Then, the distorted image is fused with the background image. During the fusion process, the color and transparency parameters of the distorted image will be adjusted according to the color and material characteristics of the dress. For example, if the dress is light-colored, the system will automatically fine-tune the color brightness of the flower pattern to make it more harmonious with the overall tone of the dress. After fusion, a simulated preview image is generated and displayed on the platform interface. Users can clearly see the printing effect of the flower pattern on the model's dress, including the deformation of the pattern at the folds and the degree of integration with the overall style of the dress. Users can decide whether to further modify the pattern or adjust the printing parameters based on this simulated preview image, thus avoiding multiple attempts and possible waste in the actual printing process.
[0073] The present application first obtains a background image and an image to be printed; then distorts the image to be printed according to the depth information of the background image to obtain a distorted image, so that the image to be printed is transformed into a distorted image that conforms to the surface information of the background image, and then fuses the distorted image and the background image to generate and output a display simulation preview image, thereby solving the technical problem that a relatively satisfactory printing result needs to be obtained after multiple attempts and adjustments, resulting in a large amount of waste of printing materials, and achieves the technical effect of reducing the number of repeated modifications and reprinting, thereby saving time and resources.
[0074] Based on the above embodiments, in a possible embodiment of the present application, before the step of obtaining the depth information of the background image and distorting the image to be printed according to the depth information of the background image to obtain the distorted image, the simulation preview method further includes the following steps A10-A20.
[0075] Step A10, obtaining target pixel points in the background image.
[0076] In this embodiment, the target pixel is the pixel in the background image that needs to be merged with the image to be printed. For example, all the pixels in the area overlapping with the image to be printed in the background image are the target pixel, or all the pixels in the area overlapping with the image to be printed and the peripheral preset area in the background image are the target pixel, or all the pixels in the selected area input by the user are the target pixel, or the area of the target object in the background image.
[0077] As an optional implementation, first, the area representing clothes in the background image is determined by an image recognition algorithm. Methods based on color thresholds, edge detection, etc. can be used. For example, a color threshold is set according to the approximate range of the color of the clothes, and the pixels within this color range are preliminarily determined to be pixels in the clothes area and used as target pixels.
[0078] Step A20, obtaining depth information of the target pixel.
[0079] In this embodiment, the gray value refers to the brightness value of a pixel in an image. In a color image, color pixels can be processed by converting them into gray values. In this scenario, the gray value of the target pixel is associated with the depth information, and the change in gray value can reflect the different features of the surface of the carrier, such as the light and shadow changes caused by wrinkles, textures, etc., thereby indirectly indicating the depth information. Depth information refers to a manifestation of three-dimensional information of the surface of clothing or a carrier in a two-dimensional image. The relative depth of different parts of the carrier is inferred by the change in the gray value of the target pixel. For example, the gray value of the pixel at the wrinkle may be different from that of the flat part. A darker gray value may indicate a depression, and a brighter gray value may indicate a protrusion. In this way, depth information can be obtained.
[0080] As an optional implementation, for each target pixel, its grayscale value is obtained. This can be achieved through the functions provided in the image programming library. Then, a mapping model between grayscale value and depth value is established. This mapping relationship can be determined by analyzing and training a variety of clothing images with known depth features in advance. According to this mapping model, the grayscale value of the target pixel is converted into a depth value, thereby determining the depth information of the clothing area in the entire background image. Afterwards, the image to be printed is distorted using this depth information.
[0081] Since all the pixels in the background image are used to determine the depth information, the completeness of the depth information is guaranteed, thereby providing a more realistic simulation effect.
[0082] In other optional implementations, the depth information of the pixel corresponding to the target pixel in the depth image may be directly obtained as the depth information of the target pixel. Alternatively, the depth information of each pixel in the background image is known.
[0083] Based on the above embodiments, in a possible embodiment of the present application, the step of acquiring the depth information of the background image, and distorting the image to be printed according to the depth information of the background image to obtain the distorted image includes the following steps S21 to S23.
[0084] Step S21, obtaining an overlapping area of the background image that overlaps with the image to be printed.
[0085] In this embodiment, the overlapping area refers to the intersection of the pixel edges of the background image and the image to be printed. In one embodiment, the overlapping area is the area where the target object in the background image overlaps with the image to be printed.
[0086] As an optional implementation manner, an overlapping image between the background image and the image to be printed is determined according to user input information, and then the overlapping area is determined according to the overlapping image.
[0087] User input information refers to the data related to the instructions conveyed to the system by the user through mouse operations such as clicking and dragging. In this scenario, the user drags the image to be printed with the mouse, and the system obtains the coordinates, trajectory and other information of these operations. The overlapping area is the area where the image to be printed overlaps with the carrier area in the background image. When simulating printing an image to be printed on a textured carrier, the user drags the pattern to a certain position on the fabric, and the part of the carrier covered by the pattern is the overlapping area.
[0088] As an optional implementation, the system monitors the user's mouse operation in real time. When the user drags the image to be printed, the mouse's starting position, moving trajectory, and final stop position are recorded. Based on this information, combined with the coordinate range of the carrier in the background image, the area where the image to be printed overlaps with the carrier, that is, the overlapping area, is determined. For example, if the coordinate range of the carrier area in the background image is (x1, y1) to (x2, y2), the user drags the image to be printed so that its upper left corner is located at (x3, y3) and its lower right corner is located at (x4, y4), the coordinate range of the overlapping area is determined by calculating the intersection of the coordinates.
[0089] Step S22: acquiring depth information of the overlapping area in the background image.
[0090] As an optional implementation, the depth information of the entire background image is first obtained, and then after the overlapping area is determined, the depth information of each pixel of the background image in the overlapping area is obtained.
[0091] As another optional implementation, after the overlapping area is obtained, the pixels in the overlapping area are determined to be target pixels, and then the depth information is determined according to the grayscale value of the target pixel to reduce the acquisition range of the depth information and reduce computing power overhead.
[0092] The target pixel is the pixel in the overlapping area. Traverse all the pixels in the overlapping area. Through the storage and indexing of pixels in the image data structure, access each pixel in the coordinate range of the overlapping area and mark it as a target pixel. For example, in a two-dimensional image array, read the information of each pixel in turn according to the row and column range of the overlapping area. For each target pixel, get its grayscale value. This can be achieved through the built-in functions in the image processing library, which can calculate the grayscale value based on the color information of the pixel. Then, determine the depth information based on the mapping relationship between grayscale value and depth value established in advance. This mapping relationship can be obtained by analyzing and modeling a large number of carrier images with known depth features. For example, if the grayscale value of a target pixel is 30, according to the mapping relationship, it can be known that the corresponding depth value is a certain value, indicating that the surface of the carrier at that position has a certain degree of depression. This depth value is assigned to the depth information of the position of the pixel, and so on, the depth information of the entire overlapping area is determined, and preparations are made for the subsequent distortion operation of the image to be printed.
[0093] Step S23: distorting the image to be printed based on the depth information of the overlapping area to obtain the distorted image.
[0094] In this embodiment, the image to be printed is distorted according to the depth information of each pixel of the background image in the overlapping area to obtain a distorted image.
[0095] As an optional implementation, the displacement of each pixel in the to-be-printed image is determined based on the depth information of the overlapping area, and then a new pixel distribution is obtained based on interpolation processing and displacement distortion, thereby obtaining a distorted image. Distortion processing can also be performed in other ways, which are not listed here one by one.
[0096] As another optional implementation, the image to be printed is triangulated and divided into multiple triangles. According to the depth information of the overlapping area in the background image, a depth mapping is performed on each triangle of the image to be printed. Specifically, for each triangle in the image to be printed, the depth values of these positions in the background image are obtained according to the corresponding positions of its three vertices in the background image. Then, according to the difference in depth values, the vertices of the triangle are displaced, thereby achieving the distortion of the triangle. The displacement of the vertex can be calculated using methods such as linear interpolation or cubic spline interpolation, thereby obtaining a distorted image.
[0097] Through the above steps, the image to be printed can be distorted according to the depth information of the background image to obtain a distorted image, thereby realizing a simulated preview of the printing effect on a soft or uneven surface carrier.
[0098] Based on any of the above embodiments, in a possible embodiment of the present application, referring to Figure 2 , distorting the image to be printed based on the depth information of the overlapping area to obtain the distorted image, including steps S231-S233:
[0099] Step S231, determining the displacement of each pixel in the image to be printed based on the depth information of the overlapping area.
[0100] In this embodiment, the displacement is the offset of each pixel in the image to be printed relative to its original position. The offset is calculated based on the depth information and the fusion position, and is used to adapt the image to be printed to the surface shape of the carrier in the background image.
[0101] As an optional implementation, for each pixel in the image to be printed, first determine its corresponding position in the overlapping area based on its position in the image to be printed and the fusion position. Then, calculate the displacement of the pixel based on the depth information of the overlapping area. This calculation can be achieved by establishing a mathematical model. For example, if the depth information is represented in the form of a depth value matrix, the larger the depth value, the more "convex" the position is in three-dimensional space. For the pixel located above the raised part, calculate its displacement in the horizontal and vertical directions based on the degree and direction of the raised part. Assuming that the depth value is positively correlated with the displacement, the depth value is converted into the displacement of the pixel through a predetermined proportional coefficient.
[0102] Step S232: distort the image to be printed based on the displacement to obtain an intermediate image.
[0103] In this embodiment, the intermediate image is an image obtained by distorting the pixels in the image to be printed by the displacement amount.
[0104] For each pixel in the image to be printed, the coordinates are transformed according to its displacement. Assume that the original coordinates of the pixel are (x, y) and the displacement is (dx, dy), then the transformed coordinates are (x+dx, y+dy). If the displacement is large, the pixel may exceed the boundary of the image to be printed. In this case, a boundary processing method can be used, such as setting the pixels beyond the boundary to a specific value, or using an image extrapolation method to estimate the pixel values beyond the boundary. Based on the transformed coordinates, copy the pixel values in the image to be printed to the corresponding positions in the intermediate image. If the transformed coordinates are not integers, an interpolation method can be used to determine the pixel values at the corresponding positions in the intermediate image.
[0105] Step S233: performing interpolation processing on the intermediate image to obtain the distorted image.
[0106] In the process of image distortion, it is used to determine the new pixel value according to the displacement of the pixel point and perform interpolation processing to ensure that the image still maintains visual continuity and rationality after deformation. Interpolation processing can use nearest neighbor interpolation, bilinear interpolation, bicubic interpolation, etc.
[0107] As an optional implementation, the image to be printed is distorted according to the calculated displacement of each pixel. In this process, the selected interpolation algorithm is used to calculate the pixel values of the intermediate change area from the original position to the new position. For example, if a bilinear interpolation algorithm is used, for the pixel that moves to the new position due to displacement, the color value of the intermediate change area is calculated according to a certain weight using the color values of the four original pixels around it. After all pixels are processed in this way, a distorted image is obtained. This distorted image visually looks like it has been fitted according to the surface shape of the carrier in the background image. For example, on the curved or concave-convex carrier surface represented by the background image, the pattern in the distorted image also presents a curved or undulating effect accordingly.
[0108] Exemplarily, in the editable software of the host computer, the user customizes the ceramic cup pattern, the background image is an image of a ceramic cup, and the image to be printed is a landscape pattern designed by the user. After the user drags and drops the landscape pattern onto the ceramic cup background image and determines the overlapping area, the system starts to calculate the impact of depth information on the pattern. For each pixel in the landscape pattern, such as a pixel of a flower, its corresponding position in the overlapping area on the surface of the ceramic cup is determined according to its position in the pattern and the positional relationship of the overlapping area. The system uses the depth information obtained by analyzing the overlapping area of the ceramic cup background image before, assuming that there is a raised decorative part on the cup, and the pixel above this raised area will calculate the displacement according to the height and shape of the protrusion. If the depth value of the raised part is large, the displacement of the pixel in the vertical direction will increase accordingly, so that the flower pattern moves upward at this position to adapt to the protrusion. Then, the landscape pattern is distorted. For the pixel whose position changes due to displacement, such as a pixel in the sky part of the pattern moves to a new position, the value of the changed pixel is calculated by interpolation. After processing all the pixels in the entire landscape pattern, a distorted image is obtained. In this distorted image, the landscape pattern on the ceramic cup appears to be consistent with the shape of the cup's surface. For example, the pattern on the curved part of the cup is also bent accordingly, and the pattern on the raised decorative part also has corresponding ups and downs, just like the effect of actually printing on the cup. Users can see and adjust it through preview.
[0109] Through the above steps, the image to be printed can be distorted based on the depth information of the overlapping area to obtain a distorted image, thereby providing a more accurate image representation for the simulation preview of the printing effect.
[0110] Based on any of the above embodiments, in a possible embodiment of the present application, referring to Figure 3 , the step of distorting the image to be printed based on the displacement amount to obtain the intermediate image includes the following steps S2321 to S2323.
[0111] Step S2321, obtaining material parameters of objects in the background image.
[0112] In this embodiment, material parameters are a set of parameters that describe the physical and material properties of the carrier. These parameters may include, but are not limited to, the material type of the carrier, such as plastic, ceramic, cloth, etc., and may also include elastic modulus, hardness, surface roughness, etc. They can be obtained from a pre-established carrier database, or the system can automatically identify and extract relevant parameter information when the user selects the carrier type.
[0113] As an optional implementation, first determine the type of carrier represented by the current background image. If it is a print preview system for customized products, the user may have selected a carrier in the previous operation, such as selecting a specific fabric as the carrier for printing. The system identifies the type of carrier based on the user's selection or from the metadata of the background image, and then searches for parameter information of this type of carrier from the carrier database. If it is a new unknown type of carrier, the user may need to manually enter some key parameters or further estimate the relevant parameters through image analysis technology.
[0114] Step S2322: determining a correction factor according to the material parameters.
[0115] In this embodiment, the physical property is the physical property of the carrier described by the material parameters, such as elasticity, hardness, etc. These properties will affect the presentation effect of the image to be printed on the surface of the carrier. The correction factor is a coefficient calculated based on the physical properties of the carrier for adjusting the pixel displacement. It can be a single value or a function value related to the pixel position, which is used to more accurately simulate the deformation of the image to be printed on the carrier with specific physical properties.
[0116] As an optional implementation, calculations are performed based on the physical properties of the acquired material parameters. For example, if the carrier is a material with high elasticity, when there is a depth change, the deformation of the image in this area may be affected by elasticity. The correction factor can be calculated through a preset mathematical model based on parameters such as the elastic modulus. If the elastic modulus is large, the correction factor may reduce the displacement of the pixel to a certain extent to simulate the stretching and recovery effect of the image on the elastic surface. For different physical properties such as hardness, roughness, etc., different calculation methods or models can be used to determine the correction factor.
[0117] Step S2323: distort the image to be printed based on the displacement and the correction factor to obtain the intermediate image.
[0118] In this embodiment, for each pixel in the image to be printed, its displacement is multiplied by the correction factor to obtain the adjusted displacement. Then, the pixel is moved to a new position according to the adjusted displacement, and an intermediate image is obtained. In this process, an interpolation algorithm is used to calculate the pixel value of the new position. For example, when a bilinear interpolation algorithm is used, for a pixel moved to a new position, the color value of the new position is calculated according to a certain weight by using the color values of the four original pixels around it. After all pixels are processed in this way, an intermediate image is obtained. The intermediate image is visually more consistent with the effect of printing on a carrier with specific physical properties. For example, on an elastic carrier, the deformation of the pattern is more natural, and there will be no unrealistic effect of excessive stretching or compression.
[0119] In an online preview system for customizing sports bracelet patterns, the background image is an image of a sports bracelet, and the image to be printed is a fashionable pattern designed by the user. The displacement of the pixels in the image to be printed is calculated based on the depth information of the background image. For example, there is a small raised area on the bracelet for displaying the heart rate. The corresponding pixel points in the pattern to be printed calculate the corresponding displacement based on the depth information of the raised area, so that the pixel points of the pattern in this area move upward to adapt to the raised area. Next, the material parameters corresponding to the background image are obtained. It is identified that the material of the bracelet is a silicone with a certain elasticity, and its elastic modulus, surface roughness and other related parameters are obtained. Then, the correction factor is determined based on the elastic properties of the silicone. Since silicone is elastic, when the pattern covers the raised area, the deformation of the pattern cannot be processed only according to the depth information of the rigid surface. According to factors such as the elastic modulus and the depth of the raised area, the correction factor is obtained through a specific calculation model. If the elastic modulus is high, the correction factor will appropriately reduce the displacement of the pixel points in the raised area to simulate the elastic deformation of the silicone when it is subjected to pattern pressure. Finally, the bilinear interpolation algorithm is used to distort the image to be printed, taking into account the displacement of the correction factor. For example, after distortion, the line part of the pattern can fit naturally on the raised and curved parts of the bracelet. The thickness and shape changes of the line conform to the physical properties of elastic materials such as silicone, and there will be no breakage due to excessive stretching or deformation and distortion due to excessive compression. The distorted image that the user sees during preview is like the pattern is actually printed on the sports bracelet, which can accurately evaluate the printing effect.
[0120] Based on any of the above embodiments, in a possible embodiment of the present application, the distorted image and the background image are fused to generate and display a simulated preview image, including steps S31 to S32.
[0121] Step S31, merging the distorted image into the overlapping area of the background image to generate the simulation preview image.
[0122] In this embodiment, the distorted image and the overlapping area are pixel-fused, and the boundary of the distorted image is aligned with the boundary of the overlapping area to generate a simulated preview image. The fusion can be performed by layer mask fusion, weighted fusion, replacement fusion, alpha channel mask fusion, etc., and deep learning model fusion can also be used.
[0123] Furthermore, during fusion, the transparency of the distorted image may be set to make part of the distorted image transparent so that information in part of the background image can be seen.
[0124] Optionally, step S31 includes the following steps S311 to S312.
[0125] Step S311, adjusting the transparency of the distorted image to a preset transparency to obtain a transparent distorted image.
[0126] In this embodiment, the preset transparency is a set transparency value. The transparent distorted image is a distorted image after the transparency is set so that part of the background image information can be seen. The transparent distorted image is not completely transparent. Transparency is used to indicate the visibility of the image. The higher the transparency value, the more transparent the distorted image; the lower the transparency value, the more opaque the distorted image. Adjusting the transparency of the distorted image allows more information of the background image to be visible, enhancing the fusion effect, and making it more realistic to simulate the effect after printing.
[0127] The preset transparency is any value between 10% and 95%, which is not specifically limited in this embodiment, such as 10%, 20%, 30%, 40%, 50%, 60%, 80%, 95% or more. Exemplarily, the preset transparency is 20%. Exemplarily, the preset transparency is 30%.
[0128] Step S312: Merge the transparent distorted image into the overlapping area of the background image to generate the simulation preview image.
[0129] In this embodiment, pixel fusion is to mix the pixels at corresponding positions in the distorted image and the background image according to certain rules, such as weighted averaging, layer fusion, etc., so that the distorted image looks like it is actually printed on the carrier represented by the background image.
[0130] As an optional implementation, first adjust the transparency of the distorted image to a preset transparency, such as adjusting the transparency of the distorted image to 20%. By adjusting the transparency value of each pixel of the distorted image, the distorted image and the background image are more realistically integrated, and part of the background image can be seen.
[0131] Then, pixel fusion is performed. The weighted average method can be used to set the weight of the background image pixel and the weight of the distorted image pixel for the pixel points at the same coordinate position of the distorted image and the background image. For example, the background image pixel weight is 0.7, and the distorted image pixel weight is 0.3. The color values of the two pixels, such as RGB values, are weighted and calculated according to this weight to obtain a new pixel value. After these operations, the generated image is the simulation preview result simulation preview image.
[0132] Step S32, displaying the simulation preview image on the interactive interface.
[0133] In this embodiment, the interactive interface is an interface for user interaction, such as a software interface on a computer screen, an application program interface on a mobile device, etc. It provides various buttons, menus, and display areas for user operations. The output display is to display the generated simulation preview image in a specific area of the interactive interface so that the user can see it intuitively.
[0134] As an optional implementation, the generated simulation preview image is loaded and displayed in the area of the interactive interface specifically used to display the preview effect. This process involves converting the image data into a format that can be displayed on the screen, such as adjusting the image size according to the screen resolution, setting the appropriate display mode, etc., and presenting it to the user through graphic display technology. For example, on an online platform for custom T-shirt pattern printing, after the user completes the pattern design and related parameter settings on the interactive interface, the system generates a simulation preview image and displays it in the central preview box of the interface, so that the user can see the printing effect of the pattern on the T-shirt.
[0135] Exemplarily, the background image is an image of a notebook cover, which has certain texture and color changes, such as a leather-like texture, brown in color, and some binding line details. The distorted image is a starry sky pattern designed by the user. After the previous steps, it has been distorted according to the depth information of the notebook cover and the notebook cover material, i.e., cardboard, taking into account its physical properties such as hardness. When adjusting the transparency, the transparency of the distorted image is set to a preset transparency, such as 30%, so that the starry sky pattern looks like it is printed on the notebook cover, and some leather-like texture and brown background can be seen, simulating the printing effect more realistically. Then, pixel fusion is performed, and a weighted average method is used for each pair of corresponding pixel points in the distorted image and the background image. For example, for a certain pixel point, the brown color of the background image, the RGB values are 139, 69, and 19 respectively, and the weight is 0.6. The color values of the pixel point at the position of the starry sky pattern in the distorted image are 0, 0, and 255 respectively, and the weight is 0.4. The weighted color value is calculated to obtain a new color value for the fused image, which is the generated simulation preview image. Finally, the simulation preview image is output and displayed through the interactive interface.
[0136] Based on the above embodiment, in a possible embodiment of the present application, the step of obtaining the depth information of the background image includes step B10 or step B20:
[0137] Step B10, obtaining an average grayscale value of the background image, and calculating depth information of the background image based on the average grayscale value, the grayscale value of each pixel point, and a depth coefficient.
[0138] In this embodiment, the average gray value is the average gray value of all pixels in the background image. By calculating the average gray value, the overall brightness of the area represented by the target pixel can be roughly understood, providing a basic reference value for the subsequent calculation of depth information. The depth coefficient is a predetermined parameter that is used to establish a quantitative relationship between gray value and depth information. This coefficient may be obtained by analyzing and experimenting with a large number of sample images with known depth and gray value relationships. Different image types or application scenarios may have different depth coefficients.
[0139] As an optional implementation, all pixels in the background image are traversed to determine the target pixels, and the grayscale value of each target pixel is obtained. This can be implemented using the functions in the image processing library. For example, in a two-dimensional array storing image pixel data, for the coordinate position of each target pixel, read its corresponding grayscale value. Then add the grayscale values of all target pixels and divide them by the total number of target pixels to obtain the average grayscale value. For each target pixel, subtract the average grayscale value from the grayscale value of the target pixel to obtain the grayscale difference. Then multiply the grayscale difference by the depth coefficient to obtain the depth value corresponding to the target pixel. For example, if the grayscale value of a target pixel is 150, the average grayscale value is 120, and the depth coefficient is 20, then the depth value of the target pixel is (150-120)×20=600. In this way, the depth value is calculated for each target pixel, thereby determining the depth information of the entire background image.
[0140] As another optional implementation, the overlapping area of the image to be printed and the background image is determined as the overlapping area according to the user input information, the pixel points in the overlapping area are determined as the target pixel points, and all the target pixel points in the overlapping area are traversed. Since the range of the overlapping area has been determined, each target pixel point can be obtained by traversing the pixel coordinates within the range. The grayscale value of each target pixel point is obtained using the relevant function in the image processing program, and then the grayscale values of all target pixels are added and divided by the total number of target pixels to obtain the average grayscale value. For each target pixel point in the overlapping area, the difference between its grayscale value and the average grayscale value is calculated. This difference is multiplied by the depth coefficient to obtain the depth value corresponding to the target pixel point. For example, if the grayscale value of a target pixel point is 200, the average grayscale value is 180, and the depth coefficient is 20, then the depth value of the target pixel point is (200-180)×20=400. Through this calculation, the depth value is determined for each target pixel point in the overlapping area, thereby determining the depth information of the entire overlapping area.
[0141] By determining the average grayscale value of the target pixel, and determining the depth information based on the average grayscale value, the grayscale value of each target pixel, and the depth coefficient, the detailed depth information of the background image is calculated, thereby improving the authenticity of the simulation preview image.
[0142] Step B20: Acquire a depth image corresponding to the background image, and determine depth information of the background image based on the depth image.
[0143] In this embodiment, the depth image may be acquired by a device such as a depth camera or a scanner, or may be calculated based on a background image.
[0144] As an optional implementation, a depth camera is used to directly obtain a depth image corresponding to the background image. The depth image is matched with the background image to determine the depth value of each pixel in the background image. The depth image and the background image can be matched using an image registration algorithm or manual marking.
[0145] As another optional implementation, image processing technology is used to estimate depth information from a two-dimensional image. A common method is to use stereo vision technology to extract feature points from the images by taking two or more images of the same object, and calculate the depth of the object based on the position difference of the feature points in different images. For the background image, a binocular camera or a multi-camera can be used to take images at different angles.
[0146] As another optional implementation, deep learning technology is used to train a depth estimation model to predict depth information from a single image. An existing depth estimation dataset can be used for model training, and then the trained model is applied to the background image to obtain depth information.
[0147] Whether the depth image is obtained using a depth sensor or image processing technology, it is necessary to extract the depth information. The grayscale value of each pixel in the depth image can be used as the depth value of the pixel. If the grayscale value range of the depth image does not match the range of the actual depth value, a linear or nonlinear mapping can be performed to convert the grayscale value to the actual depth value. Match the extracted depth information with the background image to ensure that the depth value of each pixel corresponds to the corresponding pixel in the background image.
[0148] Since the depth image corresponding to the background image is acquired and the depth information of the background image is determined based on the depth image, the depth information is more accurate.
[0149] Based on the above embodiment, in a possible embodiment of the present application, the step of distorting the image to be printed according to the depth information of the background image to obtain the distorted image includes:
[0150] Step C10: if the location area of the image to be printed exceeds the boundary of the background image, output a prompt message.
[0151] As an optional implementation, the movement information of the image to be printed is captured in real time. When the user starts to move the image to be printed toward the background image, the coordinate changes of each corner point of the image to be printed are recorded. When the image to be printed begins to overlap with the carrier part in the background image, the coordinate range of the overlapping area is determined by comparing the coordinate values of the image to be printed and the background image in the overlapping part. In this embodiment, the prompt information is a prompt issued to the user, informing the user that the current placement method will cause the image to be printed to be unable to be fully displayed on the carrier, that is, the position area of the image to be printed exceeds the boundary of the background image, and the position or size of the image to be printed needs to be readjusted.
[0152] As an optional implementation, the size of the area in the background image that overlaps with the image to be printed and the size of the image to be printed are used for judgment. If the length and width of the area are both smaller than the corresponding length and width of the image to be printed, it means that part of the image to be printed is outside the overlapping area, and a prompt message may be issued, such as "the image to be printed exceeds the range of the carrier, please re-adjust the position or size". The prompt message may be in text form, and some icons may be added to enhance the prompt effect, so that the user clearly knows that an adjustment operation is required.
[0153] Step C20: if the position area of the image to be printed does not exceed the boundary of the background image, distorting the image to be printed according to the depth information of the background image.
[0154] In this embodiment, if the position area of the image to be printed does not exceed the boundary of the background image, the step of distorting the image to be printed according to the depth information of the background image is performed. The specific execution content is as described in the above embodiment and will not be repeated in this embodiment.
[0155] As an optional implementation, when the length and width of the overlapping area are the same as the corresponding length and width of the image to be printed, it means that the image to be printed is completely within the boundary of the background image.
[0156] Optionally, as the first process, the process is to obtain a background image and an image to be printed, and when the background image is obtained, determine the pixel points in the background image as target pixels; determine the depth information according to the grayscale value of the target pixel points; then determine the overlapping area according to the user input information, and then distort the image to be printed at the position corresponding to the overlapping area based on the depth information of the background image.
[0157] As the second process, the background image and the image to be printed are obtained. At this time, the depth information is not calculated directly. Instead, the overlapping area is first determined according to the user input information, and then the depth information is calculated based on the pixel points of the overlapping area as the target pixel points to reduce computing power consumption.
[0158] Exemplarily, the background image includes an image of a person wearing a T-shirt, and the image to be printed is a picture. The user drags the image to be printed toward the background image on the interactive interface. The overlapping area between the image to be printed and the background image is monitored in real time, and it is confirmed whether the image to be printed is outside the background image area. If so, a prompt box will pop up on the interactive interface, prompting "Your pattern exceeds the background image range, please readjust the position or size of the image to be printed." The color of the prompt box can be eye-catching red, and the text is clear and concise. If it does not exceed the background image area, the overlapping area of the background image and the image to be printed is obtained. The subsequent system will determine the depth information of the T-shirt based on this overlapping area, and then distort the image to be printed, so that the user can see the simulation effect of the image being transferred to the T-shirt on the preview interface.
[0159] Pre-confirm whether the position area of the image to be printed exceeds the boundary of the background image; if it exceeds, output a prompt message for readjustment; if it does not exceed, perform the subsequent steps of image distortion and fusion. Automatically detect whether the image to be printed can fall completely on the carrier to reduce the waste rate of the carrier. At the same time, the need for physical sample production is reduced, thereby reducing material and production costs. Users can try different combinations of maps and materials more freely and explore more creative possibilities. Errors or inappropriateness of maps can be discovered and corrected at an early stage, avoiding the high cost of later modifications.
[0160] For example, to help understand the technical concept or technical principle of the combined simulation preview method of this embodiment, please refer to Figure 4 , Figure 4 A brief flow chart of a simulation preview method is provided, as follows: the user inputs a background image, and the background image is as follows: Figure 5 As shown; after receiving the background image, calculate or obtain the depth information of each pixel of the background image; the user inputs the simulation image (i.e., the image to be printed), and the simulation image is as shown Figure 6 As shown, after receiving the simulation image, the simulation image and the background image are displayed on the interactive interface, so that the user can operate the interactive interface to move the simulation image through the mouse, keyboard, touch, etc. In response to the user's input, the position of the simulation image on the interactive interface is adjusted. According to the adjusted position of the simulation image, it is determined whether the simulation image overlaps with the carrier in the background image. If not, the corresponding prompt information is output to remind the user to drag and scale the simulation image again until the simulation image overlaps with the main body of the carrier in the background image. The overlapping area between the simulation image and the background image is calculated, and the simulation image is distorted according to the pixel depth information of the background image. The distorted simulation image and the background image are deeply fused in the overlapping area, and the reference Figure 7 , then output the simulation preview image and display it on the interactive interface.
[0161] This application provides a simulation preview device, referring to Figure 8 ,include:
[0162] The image acquisition module 801 is used to acquire the background image and the image to be printed;
[0163] A depth information acquisition module 802, used to acquire the depth information of the background image;
[0164] The image processing module 803 is used to distort the image to be printed according to the depth information of the background image to obtain a distorted image; and fuse the distorted image and the background image to generate a simulated preview image;
[0165] The display module 804 is used to display an interactive interface, in which the simulation preview image is displayed.
[0166] Furthermore, the image processing module 803 is used to obtain the overlapping area of the background image and the image to be printed; obtain the depth information of the background image in the overlapping area; and distort the image to be printed based on the depth information of the overlapping area to obtain the distorted image.
[0167] The image processing module 803 is further used to merge the distorted image into the overlapping area of the background image to generate the simulation preview image;
[0168] The display module 804 is used to display the simulation preview image on an interactive interface.
[0169] The image processing module 803 is used to adjust the transparency of the distorted image to a preset transparency to obtain a transparent distorted image; and merge the transparent distorted image into the overlapping area of the background image to generate the simulation preview image.
[0170] The depth information acquisition module 802 is used to obtain the average grayscale value of the background image, and calculate the depth information of the background image based on the average grayscale value, the grayscale value of each pixel point and the depth coefficient; or, obtain the depth image corresponding to the background image, and determine the depth information of the background image based on the depth image.
[0171] The image acquisition module 801 is also used to output a prompt message if the position area of the image to be printed exceeds the boundary of the background image, so as to adjust the position of the image to be printed or the background image so that the position area of the image to be printed does not exceed the boundary of the background image; if the position area of the image to be printed does not exceed the boundary of the background image, the image to be printed is distorted according to the depth information of the background image.
[0172] The image processing module 803 is used to determine the displacement of each pixel in the image to be printed based on the depth information of the overlapping area; distort the image to be printed based on the displacement to obtain an intermediate image; and interpolate the intermediate image to obtain the distorted image.
[0173] The image processing module 803 is used to obtain material parameters of the objects in the background image; determine a correction factor according to the material parameters; and distort the image to be printed based on the displacement and the correction factor to obtain the intermediate image.
[0174] The simulation preview device 800 provided in the embodiment of the present application adopts the simulation preview method in the above embodiment, which can solve the technical problem that a satisfactory printing result can only be obtained after multiple attempts and adjustments, resulting in a large amount of waste of printing materials. Compared with the prior art, the beneficial effects of the simulation preview device provided in the embodiment of the present application are the same as the beneficial effects of the simulation preview method provided in the above embodiment, and other technical features in the simulation preview device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0175] The present application provides a terminal, which includes: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the simulation preview method in the above-mentioned embodiment 1.
[0176] Reference below Fig. 9 , which shows a schematic diagram of the structure of a terminal suitable for implementing the embodiment of the present application. The terminal in the embodiment of the present application may include but is not limited to a mobile terminal, a tablet computer, a laptop computer, and a desktop computer. Fig. 9 The terminal shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0177] like Fig. 9As shown, the terminal may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which may perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for terminal operation are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems may be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the terminal to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a terminal with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0178] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0179] The terminal provided by the present application adopts the simulation preview method in the above embodiment, which can solve the technical problem that a satisfactory printing result can only be obtained after multiple attempts and adjustments, resulting in a large amount of waste of printing materials. Compared with the prior art, the beneficial effects of the terminal provided by the present application are the same as the beneficial effects of the terminal provided by the above embodiment, and other technical features in the terminal are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0180] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0181] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0182] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the simulation preview method in the above-mentioned embodiment.
[0183] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0184] The computer-readable storage medium may be included in the terminal; or may exist independently without being installed in the terminal.
[0185] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the terminal, the terminal: obtains a background image and an image to be printed; obtains depth information of the background image, and distorts the image to be printed according to the depth information of the background image to obtain a distorted image; and fuses the distorted image and the background image to generate and display a simulated preview image.
[0186] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0187] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0188] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0189] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned simulation preview method, and can solve the technical problem that a satisfactory printing result can only be obtained after multiple attempts and adjustments, resulting in a large amount of waste of printing materials. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the simulation preview method provided by the above-mentioned embodiment, and will not be repeated here.
[0190] An embodiment of the present application provides a computer program product, including a computer program, which implements the steps of the simulation preview method as described above when executed by a processor.
[0191] The computer program product provided by the present application can solve the technical problem that a satisfactory printing result can only be obtained after multiple attempts and adjustments, resulting in a large amount of waste of printing materials. Compared with the prior art, the beneficial effects of the computer program product provided by the embodiment of the present application are the same as the beneficial effects of the simulation preview method provided by the above embodiment, which will not be repeated here.
[0192] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent processing scope of the present application.
Claims
1. A simulation preview method, characterized in that: The simulation preview method comprises: Get the background image and the image to be printed; Acquiring depth information of the background image, and distorting the image to be printed according to the depth information of the background image to obtain a distorted image; The distorted image and the background image are fused to generate a simulation preview image and display it.
2. The simulation preview method according to claim 1, characterized in that: The step of distorting the image to be printed according to the depth information of the background image to obtain a distorted image includes: Acquire an overlapping area of the background image that overlaps the image to be printed; Acquire depth information of the overlapping area in the background image; The to-be-printed image is distorted based on the depth information of the overlapping area to obtain the distorted image.
3. The simulation preview method according to claim 2, characterized in that: The step of distorting the image to be printed based on the depth information of the overlapping area to obtain the distorted image comprises: Determining the displacement of each pixel in the image to be printed based on the depth information of the overlapping area; Distorting the image to be printed based on the displacement to obtain an intermediate image; An interpolation process is performed on the intermediate image to obtain the distorted image.
4. The simulation preview method according to claim 3, characterized in that: The step of distorting the image to be printed based on the displacement to obtain the intermediate image comprises: Obtaining material parameters of objects in the background image; determining a correction factor based on the material parameters; The image to be printed is distorted based on the displacement and the correction factor to obtain the intermediate image.
5. The simulation preview method according to claim 2, characterized in that: The step of fusing the distorted image and the background image to generate and display a simulation preview image includes: Merging the distorted image into the overlapping area of the background image to generate the simulation preview image; The simulation preview image is displayed on the interactive interface.
6. The simulation preview method according to claim 5, characterized in that: The step of fusing the distorted image into the overlapping area of the background image to generate the simulation preview image includes: Adjusting the transparency of the distorted image to a preset transparency to obtain a transparent distorted image; The distorted transparent image is merged into the overlapping area of the background image to generate the simulation preview image.
7. The simulation preview method according to any one of claims 1 to 6, characterized in that: The step of obtaining the depth information of the background image comprises: Obtaining an average grayscale value of the background image, and calculating depth information of the background image based on the average grayscale value, the grayscale value of each pixel point, and a depth coefficient; Alternatively, a depth image corresponding to the background image is obtained, and depth information of the background image is determined based on the depth image.
8. The simulation preview method according to any one of claims 1 to 6, characterized in that: The step of distorting the image to be printed according to the depth information of the background image to obtain a distorted image comprises: If the location area of the image to be printed exceeds the boundary of the background image, outputting a prompt message; If the position area of the image to be printed does not exceed the boundary of the background image, the image to be printed is distorted according to the depth information of the background image.
9. A simulation preview device, characterized in that: The simulation preview device comprises: An image acquisition module, used to acquire a background image and an image to be printed; A depth information acquisition module, used to acquire the depth information of the background image; An image processing module, used for distorting the image to be printed according to the depth information of the background image to obtain a distorted image; fusing the distorted image and the background image to generate a simulation preview image; The display module is used to display the simulation preview image.
10. A terminal, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the simulation preview method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the simulation preview method according to any one of claims 1 to 8 are implemented.
12. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the simulation preview method according to any one of claims 1 to 8 are implemented.
Citation Information
Cited By
Automatic modeling method for finite element analysis of nuclear fuel assembly
CN120597359A