Image processing method and device, storage medium and computer program product
By recognizing and applying the original text style in the image editing interface, a new text image with the same style as the original text is generated, which solves the problems of low efficiency and poor visual effect in existing text design technology, and achieves efficient image updating and visual effect improvement.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- MIGU CO LTD
- Filing Date
- 2025-12-11
- Publication Date
- 2026-04-17
AI Technical Summary
Existing image generation technologies are inefficient in handling diverse text designs, and the new images have poor visual effects and cannot effectively inherit the visual style of the original text.
By identifying text regions in the image editing interface, the style of the original text is obtained and applied to new text to generate new text images with the same style. By combining deep learning models and image processing techniques, the visual consistency between the new text and the original text is ensured.
It improves text design efficiency, and the generated new images have the same visual effect as the original images, enhancing the overall aesthetics and design flexibility of the new images.
Smart Images

Figure CN121883642A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing, and more particularly to an image processing method and apparatus, storage medium, and computer program product. Background Technology
[0002] Current image generation technology utilizes Optical Character Recognition (OCR) to identify text in images and convert it into an editable text format. The text is then edited or replaced and recombined into the original image to obtain a new image. However, the diverse text designs available today result in a wide variety of text styles in images, leading to inefficiencies in text design and poor visual quality of the new image during subsequent text updates. Summary of the Invention
[0003] This application provides an image processing method and apparatus, a storage medium, and a computer program product. These can improve text design efficiency and the visual effect of updated images.
[0004] The technical solution of this application is implemented as follows: In a first aspect, this application proposes an image processing method, the method comprising: Obtain the text region selected in the image to be edited in the image editing interface; and identify the first text style of the original text image in the text region; Get the new text entered in the text input box of the image editing interface; and apply the first text style to the new text to generate a new text image with the first text style; The image editing interface displays a new image obtained by replacing the original text image with the new text image.
[0005] Secondly, this application proposes an image processing apparatus, the apparatus comprising: The acquisition unit is used to acquire the text region selected in the image to be edited in the image editing interface; and to acquire the new text entered in the text input box of the image editing interface. The recognition unit is used to recognize the first text style of the original text image in the text region; An application unit is configured to apply the first text style to the new text to generate a new text image with the first text style. The display unit is used to display a new image obtained by replacing the original text image with the new text image in the image editing interface.
[0006] Thirdly, this application proposes an image processing apparatus, the apparatus comprising: a processor, a memory, and a communication bus; the communication bus is used to realize the connection and communication between the processor and the memory; the processor implements the above-mentioned image processing method when executing the running program stored in the memory.
[0007] Fourthly, this application provides a storage medium storing a computer program thereon, which, when executed by a processor, implements the above-described image processing method.
[0008] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the above-described image processing method.
[0009] This application provides an image processing method, apparatus, storage medium, and computer program product. The method includes: acquiring a text region selected in an image to be edited within an image editing interface; identifying a first text style of the original text image in the text region; acquiring new text entered in a text input box within the image editing interface; applying the first text style to the new text to generate a new text image with the first text style; and displaying the new image obtained by replacing the original text image with the new text image in the image editing interface. Using the above implementation, when a user selects a text region in an image to be edited on the image editing interface, the first text style of the original text image in that text region is identified. When the user enters new text in the text input box of the image editing interface, the first text style is directly applied to the new text. This allows the final generated new image to directly inherit the first text style of the original text image, improving the efficiency of text design during subsequent text updates, ensuring that the visual effect of the new image is consistent with the visual effect of the image to be edited, thereby enhancing the visual effect of the new image. Attached Figure Description
[0010] Figure 1 A flowchart illustrating an image processing method provided in an embodiment of this application; Figure 2 This is a schematic diagram of an exemplary display interface for uploading an image to be edited, provided as an embodiment of this application. Figure 3 A schematic diagram of an exemplary image editing interface provided in this application embodiment. Figure 1 ; Figure 4 A schematic diagram of an exemplary image editing interface provided in this application embodiment. Figure 2 ; Figure 5 An exemplary text deformation restoration diagram provided for an embodiment of this application; Figure 6A schematic diagram illustrating an exemplary process for extracting local features of a secondary modification, provided for an embodiment of this application; Figure 7 This application provides an exemplary schematic diagram of a new image display interface. Figure 8 A schematic diagram of an exemplary image editing interface provided in this application embodiment. Figure 3 ; Figure 9 A schematic diagram of the structure of an image processing apparatus provided in this application embodiment. Figure 1 ; Figure 10 A schematic diagram of the structure of an image processing apparatus provided in this application embodiment. Figure 2 .
[0011] It should be noted that the terms "first" and "second" mentioned above are only used to distinguish between different options and do not represent the degree of superiority or inferiority of the options or their priority in the implementation process. Detailed Implementation
[0012] In order to gain a more detailed understanding of the features and technical content of the embodiments of this application, the implementation of the embodiments of this application will be described in detail below with reference to the accompanying drawings. The accompanying drawings are for reference and illustration only and are not intended to limit the embodiments of this application.
[0013] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0014] In the following description, references to "some embodiments" refer to a subset of all possible embodiments. It is understood that "some embodiments" may be the same or different subsets of all possible embodiments and may be combined with each other without conflict. It should also be noted that the terms "first, second, third" used in the embodiments of this application are merely for distinguishing similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0015] Existing technologies use Artificial Intelligence Generated Content (AIGC) to intelligently generate / replace partial text in the original image during text generation / replacement. However, in practice, the replaced text is often blurry or even unrecognizable, resembling gibberish. Furthermore, the newly generated text does not inherit the visual style of the original image, such as typography, shadow effects, and colors. Moreover, existing systems offer limited and inflexible options for fonts, styles, and layouts. This means that users often face numerous restrictions when attempting personalized designs, making it difficult to meet diverse needs.
[0016] This application provides an image processing method, such as... Figure 1 As shown, the method may include: S101. Obtain the text region selected in the image to be edited in the image editing interface; and identify the first text style of the original text image in the text region.
[0017] In this embodiment, after a user uploads an image to be edited, the system presents a corresponding image editing interface, which includes the image to be edited, a text selection tool, and a text input box. The user can use the text selection tool to select a text area from the image to be edited.
[0018] In this embodiment, the text selection tool can be a brush or similar tool. The specific tool can be selected based on the actual situation, and this embodiment does not impose any specific limitations.
[0019] For example, a user can use a brush to select a text area by painting on the image to be edited.
[0020] For example, the image editing interface may also include an eraser button, a back button, and a forward button, allowing the user to adjust the area to be erased on the image to be edited.
[0021] For example, see Figure 2 Users upload the image to be edited and click the "AI Image Editing" button below to enter... Figure 3 The image editing interface for the image to be edited is shown below. Figure 3 The image editing interface displays the image to be edited, a brush, a text input box, a brush button, an eraser button, a back button, a forward button, a reset button, and a generate button. For example... Figure 3 As shown, select brush 1 and paint over the text area "Break Free from Shackles and Step into the Future" in the image to be edited.
[0022] Optionally, the number of brushes can be one or more, and the specific number can be selected according to the actual situation. This application embodiment does not impose a specific limitation. Accordingly, users can use different brushes to paint different text areas on the image to be edited. That is, the number of text areas in this application is one or more, and the specific number can be selected according to the actual situation. This application embodiment does not impose a specific limitation.
[0023] For example, see Figure 4 Select brush 1 and paint over the text area 1 of the image to be edited. Select brush 2 and paint over the text area "Enjoy a dreamlike sea of clouds and experience the wireless charm of VR technology!". Note that brush 1 and brush 2 use different colors to distinguish between the two brushes.
[0024] In this embodiment of the application, the original text is identified from the original text image; visual attribute information, text deformation information and / or local feature enhancement information of the original text are obtained; and the visual attribute information, text deformation information and / or local feature enhancement information are determined as the first text style.
[0025] In this embodiment, image segmentation techniques can be used to separate the text region from other image elements (such as background, image, etc.) in the original image. These image segmentation techniques can be implemented using deep learning models (such as U-Net, Mask Region-based Convolutional Neural Network (Mask R-CNN), etc.). The specific model chosen can be selected based on the actual situation, and this embodiment does not impose any specific limitations.
[0026] In the embodiments of this application, OCR technology can be used to extract the position information and content of the original text in the original text image.
[0027] In one embodiment, if the font of the original text is not distorted, the visual attribute information of the original text can be directly obtained. This visual attribute information may include the font, size, color, shadow, projection, etc., and the specific details can be selected according to the actual situation. This application embodiment does not impose specific limitations. In one embodiment, if the font of the original text is deformed, the recognition process for the original text can be carried out by the character recognition model trained by AIGC to restore the deformed font and / or adjust the local text features of the modified font to accurately recognize the original text.
[0028] It should be noted that the secondary modification involves making modifications such as adding stroke decorations, splitting / misplacing strokes, integrating font styles (i.e., cross-font modification), and character replacement-based modification (i.e., locally replacing strokes) to the local text features of the original text, in order to enhance the display diversity of the original text. Among them, adding stroke decorations can be adding curves, patterns, geometric figures outside the original strokes (such as adding wavy lines to the slashes of "人" and adding serrations to the semi-circle of "B", etc., which do not affect the core stroke direction); splitting / misplacing strokes can be that the core strokes are divided into multiple segments, or misaligned up / down or left / right (such as splitting the horizontal stroke of "木" into two segments, misaligning the horizontal line and the triangular part of "A", etc., where the split parts still retain the original relative positions for splitting and / or misplacement); integrating font styles can be integrating the original font (such as Song typeface) with other styles (such as the thick strokes of boldface and the connected strokes of calligraphy style), making the stroke thickness uneven and the outline blurred; character replacement-based modification can be replacing the original strokes with strokes of similar shapes (such as replacing "一" with "丶", replacing "straight line" with "curve", such as replacing the horizontal stroke of "大" with an arc).
[0029] It should be noted that, first of all, AIGC will collect a large number of character samples containing deformed font images. These samples cover various possible deformation situations, including scaling, rotation, distortion, stretching, breakage and mutilation, perspective, stylization, etc. Then, preprocess the samples, adjust the pictures to a unified size, and perform operations such as normalization, denoising, and binarization for subsequent feature extraction and model training. After that, the AIGC deep learning model will use algorithms such as Convolutional Neural Network (CNN) to extract features from the text boxed on the picture. The features include capturing the edge, stroke, texture, and shape information of the text, which helps to detect the tilt angle of the text and perform rotation correction, and give the parameters to the character recognition model for training. The trained character recognition model can restore the deformed font.
[0030] Exemplarily, refer to Figure 5 , perform text preprocessing on the original text image, and obtain its deformation features as: W: 90%, H: 90%, rotation angle: -20°, horizontal skew angle (H): -29°, vertical skew angle (V): -3°. Perform rotation correction on it, and obtain its features as W: 100%, H: 100%, rotation angle: 0°, horizontal skew angle (H): 0°, vertical skew angle (V): 0°.
[0031] It can be understood that this application has optimized the construction and processing of the training dataset, adopted diverse and high-quality font data, and carried out sufficient data preprocessing work to ensure the effectiveness and accuracy of the model.
[0032] It should be noted that secondary modifications to local features can improve the recognition rate by enhancing the features of these regions. First, these samples are preprocessed, such as size normalization and grayscale conversion. Next, a CNN is used as a feature extractor to extract useful features from the preprocessed original text image. During the character recognition model training phase, the training process involves using the cross-entropy loss function to measure the difference between the model's predictions and the actual labels, and using the Adam optimization algorithm to update the model's parameters.
[0033] Specifically, the cross-entropy function is given in formula (1).
[0034] (1) in, It represents the number of categories. It is an indicator, if the first The true class of each sample is ,but =1, otherwise =0. The model predicts the first The sample belongs to the first The probability of each category.
[0035] Specifically, the basic steps of the Adam optimization algorithm are as follows: 1. Initialize parameters (such as weights and biases), usually set to 0 or small random numbers.
[0036] 2. Initialize the variables for the first moment (momentum) and the second moment (square gradient), usually set to 0.
[0037] 3. In each training iteration, the following steps are executed sequentially: calculate the gradient (the derivative of the loss function with respect to the current parameters), update the first moment estimate (i.e., the exponential moving average of the gradient), update the second moment estimate (i.e., the exponential moving average of the squared gradient), calculate the step size (learning rate) for parameter updates based on the estimates of the first and second moments, and update the parameters (by subtracting the step size multiplied by the gradient from the current value).
[0038] 4. Repeat step 3 until the stopping condition is met (e.g., the maximum number of iterations is reached or the loss function converges).
[0039] It should be noted that, in order to enhance the model's generalization ability, data augmentation techniques are also needed, such as randomly rotating, scaling, and translating the text, to expand the training samples. Finally, in the model optimization stage, we can adjust parameters such as the number of CNN layers and the convolutional kernel size to find the optimal text model structure.
[0040] It should be noted that for the text area after deformation processing, the character recognition algorithm in OCR can be used to convert the text in the picture into editable text content.
[0041] Exemplarily, for the extraction process of the local features of the secondary modification, reference can be made to Figure 6 . Feature extraction is performed on the extracted text "Break through the shackles and step into the future", and finally the text content is recognized.
[0042] Based on the above embodiments, the visual attribute information, text deformation information, and / or local feature enhancement information of the original text can be obtained; and the visual attribute information, text deformation information, and / or local feature enhancement information are determined as the first text style. Among them, for the original text with non-deformed fonts, its first text style is only visual attribute information, while for the original text with deformed fonts, its first text style can be at least one of visual attribute information, text deformation information, and local feature enhancement information.
[0043] It should be noted that for the acquisition of text deformation information and / or local feature enhancement information, it can be inversely obtained based on the recognition process of recognizing the original text from the original text image. For example, Figure 5 the deformation feature in is text deformation information, and obtaining Figure 6 the modification information of the local features in can obtain the local feature enhancement information. Specifically, it can be selected according to the actual situation, and the embodiments of this application do not make specific limitations.
[0044] In one embodiment, obtaining the local feature enhancement information of the original text includes: obtaining the text features of the original text that have been secondarily modified; obtaining the local feature enhancement information corresponding to the text features.
[0045] Optionally, the local feature enhancement information can be the modification method of the secondary modification of the radicals of the characters, such as Figure 6 extending a diagonal line from the lower left corner of the "阝" of the character "除" in.
[0046] In one embodiment, a deep learning model specialized for font generation tasks (such as CNN, ResNet, etc.) can be used to obtain the first style feature. The design and optimization of the model can better capture the features and styles of the fonts.
[0047] It can be understood that the proposal of this application adopts the font generation method of AIGC technology. Compared with the traditional manual design or computer-aided design methods, it has a higher level of intelligence and automation, and can generate diverse and innovative fonts more quickly and intelligently. By using high-precision text recognition algorithms and image processing technologies, the accuracy of text recognition and replacement is improved, and precise matching and automatic correction are achieved.
[0048] In this embodiment, the extracted first text style can be encoded into a representation suitable for subsequent processing. This can be achieved using encoder networks (such as autoencoders, variational encoders, etc.), which can compress high-dimensional feature data into low-dimensional vectors or feature maps.
[0049] In this embodiment, the encoded first text style can be saved for use when generating new text. When it is necessary to replace the original text in the image to be edited, the corresponding first text style can be extracted from these saved features and applied to the new text to ensure that the new text can inherit the visual style of the original text.
[0050] S102. Obtain the new text entered in the text input box of the image editing interface; and apply the first text style to the new text to generate a new text image with the first text style.
[0051] In this embodiment, the text input box of the image editing interface can display prompts to indicate the location for new text input and / or to suggest entering new text and / or a new text example after selecting a text area. The specific selection can be made according to the actual situation, and this embodiment does not impose any specific limitations.
[0052] In this embodiment of the application, the user can enter new text in the text input box of the image editing interface.
[0053] In this embodiment of the application, after obtaining new text, text encoding technology is first used to convert the new text into a vector representation.
[0054] In this embodiment of the application, the process of applying a first text style to new text to generate a new text image with the first text style specifically includes: based on the font of the original text, searching for a first font in the font library or regenerating a first font; using the first font to generate a first text image corresponding to the new text; using the text position in the original text image as a reference, aligning the text position of the first text image to obtain a second text image; and using the first text style to render the second text image to obtain a new text image.
[0055] In one embodiment, the first text style is analyzed to determine the font, weight, slant, and other attributes of the text in the original text.
[0056] It should be noted that if a matching first font exists in the font library, that first font will be selected directly; otherwise, font generation techniques (such as GANs) can be used to generate a first font that is similar in style to the first text.
[0057] In one embodiment, a text-to-image generation model (such as the AIGC model) can be used to convert new text into a first text image in an image format according to a first font.
[0058] It should be noted that the first text image should contain only text and no background.
[0059] In one embodiment, the first text image can be aligned with the original text image to ensure that the position of the new text is the same as the position of the original text.
[0060] In one embodiment, using a first text style, image rendering of a second text image may include at least one of the following aspects: adjusting the text color to match the text color of the original text; adding shadows, projections, and outlines to simulate the lighting conditions in the image to be edited; adjusting the font size and spacing to match the text layout in the image to be edited; and performing text deformation and local feature enhancement on the second text image to match the text style of the original text.
[0061] Understandably, by applying image compositing and rendering techniques to simulate realistic lighting and shadow effects, the generated image content can appear realistic and natural.
[0062] It should be noted that the above execution steps can be implemented using a style transfer model. That is, by inputting the first text style and the new text into the style transfer model, a new text image with the first text style can be directly obtained.
[0063] Understandably, this application enhances the ability to inherit the original text's primary text style during the text replacement process, ensuring that the new text after replacement is visually consistent with the image to be edited (including text layout, outlines, shadows, colors, etc.), maintaining overall aesthetic appeal.
[0064] For example, if the original text is "Break free from constraints and step into the future" and the new text is "Two-month card 50% off for watching movies and sports", then the new text image "Two-month card 50% off for watching movies and sports" needs to be generated according to the first text style of the original text "Break free from constraints and step into the future".
[0065] S103. Display the new image obtained by replacing the original text image with the new text image in the image editing interface.
[0066] In this embodiment, the original text image is removed from the image to be edited to obtain a first image; the new text image is combined with the first image to obtain a second image; the text edge enhancement and detail enhancement of the new text image in the second image are performed to obtain a third image; the style consistency adjustment of the third image is performed to obtain a new image.
[0067] In one embodiment, the original text image in the image to be edited is replaced with a new text image to obtain a second image. Subsequently, image fusion techniques (such as Poisson fusion, Laplacian pyramid fusion, etc.) can be used to enhance the text edges of the new text image in the second image to ensure a natural and seamless transition between the new text image and the image to be edited.
[0068] In one embodiment, the new text image in the second image can also be enhanced in detail to improve the clarity and sharpness of the new text. This can be achieved using techniques such as edge enhancement filters and sharpening filters.
[0069] Image quality enhancement includes: Super-resolution processing: If the generated image resolution is low, the system will use super-resolution techniques (such as Super-Resolution Convolutional Neural Network (SRCNN) and Enhanced Super-Resolution Generative Adversarial Network (ESRGAN)) to enlarge the image while maintaining its details and sharpness. Image enhancement: To better match the style of the current image, the system may use image enhancement techniques, such as contrast enhancement and color saturation adjustment, to enhance the visual effect of the image. Denoising and smoothing: To remove noise and artifacts that may be generated during style transfer, the system will use denoising algorithms (such as Block-Matching and 3D Filtering (BM3D) and Non-Local Means (NL-Means)) for denoising processing and use smoothing techniques (such as bilateral filtering and Gaussian filtering) to reduce jagged edges.
[0070] Understandably, the above technical solutions and steps can effectively generate and render new text, ensuring that the new text visually matches the image to be edited, and improving the clarity and accuracy of text replacement, ensuring that the replaced text is clearly legible. This not only solves the problem of blurry and unrecognizable text after replacement in existing technologies, but also improves the system's flexibility and meets diverse needs.
[0071] In one embodiment, the third image can be adjusted for style consistency to ensure that the new text and the image to be edited are consistent in terms of color, brightness, and contrast. By adjusting the image's color balance, histogram matching, and other techniques, the new text and the image to be edited can be made more visually harmonious and unified.
[0072] Style consistency optimization includes: Style enhancement: The system analyzes the differences between the generated image and Picasso's Cubist style, and enhances the stylistic features in the image through optimization algorithms to make it closer to the reference style. Diversity preservation: To avoid the generated images being too monotonous or similar, the system introduces some randomness to ensure that each generated image has a certain degree of diversity.
[0073] In one embodiment, the system can generate new images with various display effects based on the above implementation method and display them on the image editing interface for users to view and select.
[0074] For example, when the user clicks the generate button, see Figure 7 The system displays the original image and the replacement result (new image) using Artificial Intelligence (AI). The AI replacement result includes four new images, "Result 1", "Result 2", "Result 3" and "Result 4", for users to view and select.
[0075] Understandably, in order to address the limited selection of fonts, text styles, and typography options in the existing system, this proposal will introduce a wider variety of font, style, and typography options, providing greater flexibility to meet users' personalized design needs.
[0076] Furthermore, after displaying a new image in the image editing interface, the new image can be adjusted based on the second font and / or second text style selected from the font list and / or text style list in the image editing interface in response to a touch operation; the adjusted new image can then be displayed in the image editing interface.
[0077] It should be noted that this application embodiment also provides a user feedback mechanism, allowing users to evaluate and modify the generated results. Users can fine-tune the size, color, position, etc. of the text according to their personal preferences and needs.
[0078] For example, see Figure 8 The image editing interface displays a list of fonts and text styles, from which users can select "Title" and "Style 2". The adjusted new image is then displayed in the image editing interface.
[0079] It should be noted that during the style transfer and optimization process, the system will display the generated images in real time, and users can view the effects and make adjustments at any time.
[0080] It should be noted that the fonts in the font list and / or the text styles in the text style list can be pre-configured by the system or uploaded and / or customized by the user. The specific selection can be made according to the actual situation, and this application embodiment does not make specific limitations.
[0081] Understandably, the system offers a wide selection of fonts and styles, and supports user customization to meet individual needs.
[0082] Furthermore, after displaying a new image in the image editing interface, in response to a touch operation that selects a second font from the font list and / or a second text style from the text style list in the image editing interface, user preference information can be generated based on the second font and / or the second text style; the style transfer model can be optimized using the user preference information; the style transfer model is used to apply the first text style to the new text to generate a new text image with the first text style.
[0083] Optionally, the second text style can be Picasso's Cubism, Technological style, etc. The specific style can be selected according to the actual situation, and this application embodiment does not make specific limitations.
[0084] It should be noted that the system can also collect user feedback on the generated images, including satisfaction levels and areas for improvement. This feedback will be used for subsequent model optimization and improvement. Specifically, based on the user's touch interactions regarding the selection of a second font and a second text style, the style transfer model can be iteratively optimized and improved. By adjusting model parameters and optimizing algorithms, the quality and personalization of new text generation and replacement can be further improved.
[0085] Understandably, user-guided generation methods and optimization adjustments to the generated results can ensure that the generated fonts meet user needs, improve the accurate understanding of user requirements, and have high usability and adaptability.
[0086] Furthermore, after the above processing, the final generated image is output. The output image should meet the user's needs and be visually consistent with the image to be edited.
[0087] It should be noted that the output format for new images can be selected. Specifically, users can choose common image formats such as Joint Photographic Experts Group (JPEG) and Portable Network Graphics (PNG). Considering the preservation needs of artworks, the system also supports lossless compression formats, such as Tagged Image File Format (TIFF).
[0088] Furthermore, if users need to process multiple images in batches, the system supports batch upload and batch output functions. Users can upload multiple images to the system at once, specifying a unified style reference and output parameters. The system will process these images in parallel and output all results at once.
[0089] It should be noted that the AIGC-based system proposed in this application, in addition to text replacement, places greater emphasis on harmony with the original image and the overall visual effect. It offers a rich selection of preset styles and font options to meet users' personalized needs. Through advanced deep learning and image processing technologies, it can generate more natural and realistic image effects, improving design efficiency and creativity.
[0090] Understandably, when a user selects a text area of the image to be edited in the image editing interface, the first text style of the original text image in that text area is identified. When the user enters new text in the text input box of the image editing interface, the first text style is directly applied to the new text. This allows the final generated new image to directly inherit the first text style of the original text image, improving the efficiency of text design when updating text later. It also ensures that the visual effect of the new image is consistent with the visual effect of the image to be edited, thereby enhancing the visual effect of the new image.
[0091] This application provides an image processing apparatus. For example... Figure 9 As shown, the image processing apparatus 1 includes: The acquisition unit 10 is used to acquire the text region selected in the image to be edited in the image editing interface; and to acquire the new text entered in the text input box of the image editing interface. Recognition unit 11 is used to recognize the first text style of the original text image in the text region; Application unit 12 is used to apply the first text style to the new text to generate a new text image with the first text style; Display unit 13 is used to display a new image obtained by replacing the original text image with the new text image in the image editing interface.
[0092] Optionally, the recognition unit 11 is further configured to recognize the original text from the original text image; The acquisition unit 10 is further configured to acquire visual attribute information, text deformation information, and / or local feature enhancement information of the original text; and to determine the visual attribute information, the text deformation information, and / or the local feature enhancement information as the first text style.
[0093] Optionally, the acquisition unit 10 is further configured to acquire the text features that have been modified twice in the original text; and acquire the local feature enhancement information corresponding to the text features.
[0094] Optionally, the image processing apparatus further includes: a font selection unit, a generation unit, an alignment unit, and a rendering unit; The font selection unit is used to search for a first font from the font library or regenerate a first font based on the font of the original text. The generation unit is used to generate a first text image corresponding to the new text using the first font; The alignment unit is used to align the text position of the first text image with the text position in the original text image as a reference to obtain the second text image. The rendering unit is used to render the second text image using the first text style to obtain the new text image.
[0095] Optionally, the image processing device further includes: a removal unit, a compositing unit, an enhancement unit, and an adjustment unit; The removal unit is used to remove the original text image from the image to be edited to obtain a first image; The synthesis unit is used to synthesize the new text image with the first image to obtain a second image; The enhancement unit is used to enhance the text edges and details of the new text image in the second image to obtain a third image; The adjustment unit is used to adjust the style consistency of the third image to obtain the new image; The display unit 13 is also used to display the new image on the image editing interface.
[0096] Optionally, the adjustment unit is further configured to adjust the new image based on the second font and / or the second text style in the font list and / or text style list in response to a touch operation that selects a second font in the font list and / or a second text style in the text style list for the image editing interface. The display unit 13 is also used to display the adjusted new image on the image editing interface.
[0097] Optionally, the image processing apparatus further includes: an optimization unit; The generation unit is further configured to generate user preference information based on the second font and / or the second text style in the font list and / or text style list of the image editing interface in response to a touch operation that selects a second font in the font list and / or a second text style in the text style list of the image editing interface. The optimization unit is used to optimize the style transfer model using the user preference information; the style transfer model is used to apply the first text style to the new text to generate a new text image with the first text style.
[0098] This application provides an image processing apparatus that acquires a text region selected in an image to be edited within an image editing interface; identifies a first text style of the original text image within the text region; acquires new text entered in a text input box within the image editing interface; applies the first text style to the new text, generating a new text image with the first text style; and displays a new image obtained by replacing the original text image with the new text image in the image editing interface. Therefore, the image processing apparatus proposed in this embodiment, when a user selects a text region in an image to be edited within the image editing interface, identifies the first text style of the original text image within that text region, and when the user enters new text in the text input box within the image editing interface, directly applies the first text style to the new text. This allows the final generated new image to directly inherit the first text style of the original text image, improving the efficiency of text design during subsequent text updates, ensuring that the visual effect of the new image is consistent with the visual effect of the image to be edited, thereby enhancing the visual effect of the new image.
[0099] Figure 10 A schematic diagram of the composition structure of an image processing apparatus 1 provided in this application embodiment. Figure 2 In practical applications, based on the same disclosed concept of the above embodiments, such as Figure 10 As shown, the image processing device 1 in this embodiment includes a processor 14, a memory 15, and a communication bus 16.
[0100] The processor 14 described above can be at least one of the following: Application Specific Integrated Circuit (ASIC), Digital Signal Processor (DSP), Digital Signal Processing Device (DSPD), Programmable Logic Device (PLD), Field Programmable Gate Array (FPGA), CPU, controller, microcontroller, and microprocessor. It is understood that, for different devices, the electronic device used to implement the above processor function can also be other types, and this embodiment does not impose specific limitations.
[0101] In this embodiment, the communication bus 16 is used to establish a connection between the processor 14 and the memory 15; when the processor 14 executes the running program stored in the memory 15, it implements the following image processing method: The system retrieves a text region selected in the image to be edited within the image editing interface; identifies a first text style of the original text image within the text region; retrieves new text entered in the text input box of the image editing interface; applies the first text style to the new text to generate a new text image with the first text style; and displays a new image obtained by replacing the original text image with the new text image in the image editing interface.
[0102] Furthermore, the processor 14 is also configured to identify the original text from the original text image; obtain visual attribute information, text deformation information and / or local feature enhancement information of the original text; and determine the visual attribute information, the text deformation information and / or the local feature enhancement information as the first text style.
[0103] Furthermore, the processor 14 is also used to obtain the text features that have been modified twice in the original text; and to obtain the local feature enhancement information corresponding to the text features.
[0104] Furthermore, the processor 14 is also configured to: search for a first font in a font library or regenerate a first font based on the font of the original text; generate a first text image corresponding to the new text using the first font; align the text position of the first text image with the text position in the original text image as a reference to obtain a second text image; and render the second text image using the first text style to obtain the new text image.
[0105] Furthermore, the processor 14 is also configured to: remove the original text image from the image to be edited to obtain a first image; combine the new text image with the first image to obtain a second image; enhance the text edges and details of the new text image in the second image to obtain a third image; adjust the style consistency of the third image to obtain the new image; and display the new image in the image editing interface.
[0106] Furthermore, the processor 14 is also configured to, in response to a touch operation that selects a second font from the font list and / or a second text style from the text style list in the image editing interface, adjust the new image based on the second font and / or the second text style; and display the adjusted new image in the image editing interface.
[0107] Furthermore, the processor 14 is also configured to, in response to a touch operation that selects a second font in the font list and / or a second text style in the text style list of the image editing interface, generate user preference information based on the second font and / or the second text style; optimize a style transfer model using the user preference information; and apply the first text style to the new text to generate a new text image with the first text style.
[0108] This application provides a storage medium storing a computer program thereon. The computer-readable storage medium stores one or more programs, which can be executed by one or more processors and applied in an image processing device. The computer program implements the image processing method described above.
[0109] Based on the above embodiments, this application provides a computer program product, including a computer program that can be executed by one or more processors, and the computer program implements the image processing method described above.
[0110] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0111] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the related technology, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause an image display device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this disclosure.
[0112] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application.
Claims
1. An image processing method, characterized in that, The method includes: Obtain the text region selected in the image to be edited in the image editing interface; and identify the first text style of the original text image in the text region; Get the new text entered in the text input box of the image editing interface; and apply the first text style to the new text to generate a new text image with the first text style; The image editing interface displays a new image obtained by replacing the original text image with the new text image.
2. The method according to claim 1, characterized in that, The first text style of the original text image in the text region is identified, including: Identify the original text from the original text image; Obtain the visual attribute information, text deformation information, and / or local feature enhancement information of the original text; and determine the visual attribute information, text deformation information, and / or local feature enhancement information as the first text style.
3. The method according to claim 2, characterized in that, The step of obtaining the local feature enhancement information of the original text includes: Obtain the text features that have been modified twice in the original text; Obtain the local feature enhancement information corresponding to the text features.
4. The method according to claim 1, characterized in that, The step of applying the first text style to the new text to generate a new text image with the first text style includes: Based on the font of the original text, search for the first font in the font library or regenerate the first font; Using the first font, generate a first text image corresponding to the new text; Using the text positions in the original text image as a reference, the text positions in the first text image are aligned to obtain the second text image; Using the first text style, the second text image is rendered to obtain the new text image.
5. The method according to claim 1, characterized in that, The step of displaying a new image obtained by replacing the original text image with the new text image in the image editing interface includes: The original text image is extracted from the image to be edited to obtain the first image; The new text image is combined with the first image to obtain the second image; The new text image in the second image is subjected to text edge enhancement and detail enhancement to obtain the third image; The third image is styled to maintain consistency, resulting in the new image. The new image is displayed in the image editing interface.
6. The method according to claim 1, characterized in that, After displaying the new image obtained by replacing the original text image with the new text image in the image editing interface, the method further includes: In response to a touch operation that selects a second font from the font list and / or a second text style from the text style list for the image editing interface, the new image is adjusted based on the second font and / or the second text style; The adjusted new image is displayed in the image editing interface.
7. The method according to claim 1, characterized in that, After displaying the new image obtained by replacing the original text image with the new text image in the image editing interface, the method further includes: In response to a touch operation that selects a second font from the font list and / or a second text style from the text style list for the image editing interface, user preference information is generated based on the second font and / or the second text style. The style transfer model is optimized using the user preference information; the style transfer model is used to apply the first text style to the new text to generate a new text image with the first text style.
8. An image processing apparatus, characterized in that, The device includes: a processor, a memory, and a communication bus; the communication bus is used to enable communication between the processor and the memory; when the processor executes the running program stored in the memory, it implements the method as described in any one of claims 1-7.
9. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-7.
10. A computer program product, comprising a computer program, characterized in that, The computer program, when executed by a processor, implements the method as described in any one of claims 1 to 7.