AI-based half picture intelligent completion method and apparatus, and related medium

By identifying damaged areas and generating effective areas on the input pictures, combining the expansion direction and pixel expansion number, the problem of inability to intelligently complete pictures in the prior art is solved, and efficient and natural picture expansion effects are achieved.

CN120339056APending Publication Date: 2025-07-18AFIRSTSOFT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510403213.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-01
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

The prior art cannot automatically identify the effective areas of the input pictures and perform intelligent completion, resulting in inefficiency of personnel.

Method used

By identifying the damaged area of the input image, generating an effective picture area, judging the aspect ratio and performing segmentation processing or directly generating the object to be expanded, the distributed picture generation interface is called using the expansion direction and pixel expansion number to be expanded.

Benefits of technology

The automated image completion process is realized, processing efficiency is improved, manual intervention is reduced, and the naturalness and coherence of image expansion is ensured, and it is suitable for non-professional users.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120339056A_ABST
    Figure CN120339056A_ABST
Patent Text Reader

Abstract

The invention discloses an AI-based half picture intelligent completion method and apparatus, and a related medium. The method comprises the steps of identifying an input picture and generating an effective picture region; respectively generating an expansion direction and a pixel expansion number corresponding to the effective picture region by utilizing the picture features of the effective picture region; judging whether the aspect ratio of the effective picture area is greater than a preset ratio; if yes, segmenting the effective picture area, and generating a to-be-expanded segment set; if not, directly generating a to-be-expanded picture object; and calling a distributed picture generation interface based on the expansion direction and the pixel expansion number, and performing picture expansion on the to-be-expanded segment set or the to-be-expanded picture object to obtain a complete picture. According to the method, the effective picture area is generated through recognition, picture expansion is carried out through the expansion direction and the pixel expansion number, the complete picture can be obtained, in this way, complementation operation can be carried out on the input picture, and the working efficiency of personnel is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and particularly relates to an intelligent half-image completion method, device and related medium based on AI. Background Art

[0002] Currently, traditional image editing tools (such as Adobe Photoshop, etc.) are mainly used for image repair and extension. These tools usually rely on manual operations and require users to have certain professional skills. However, these tools cannot automatically understand the image content and cannot achieve intelligent completion. With the development of artificial intelligence-based image generation technologies (such as StableDiffusion, etc.), although breakthrough progress has been made in style conversion and simple extension, these technologies still have limitations when dealing with damaged or incomplete images. Specifically, in the prior art, it is still impossible to identify the effective area of the input image and perform a completion operation on the input image, resulting in low work efficiency of personnel. Summary of the Invention

[0003] Embodiments of the present invention provide an intelligent half-image completion method, device and related medium based on AI, aiming to solve the problem in the prior art that the effective area of the input image cannot be identified and the input image cannot be completed.

[0004] In a first aspect, embodiments of the present invention provide an intelligent half-image completion method based on AI, including:

[0005] Identifying damaged areas of the input image to divide the effective boundary of the input image and generating an effective image area;

[0006] Using the image features of the effective image area to generate the expansion direction and pixel expansion number corresponding to the effective image area respectively;

[0007] Judging whether the aspect ratio of the effective image area is greater than a preset ratio; if so, performing segmented processing on the effective image area and generating a set of segments to be expanded; if not, directly generating an image object to be expanded;

[0008] Invoking a distributed image generation interface based on the expansion direction and pixel expansion number to expand the set of segments to be expanded or the image object to be expanded to obtain a complete image.

[0009] In a second aspect, embodiments of the present invention provide an intelligent half-image completion device based on AI, including:

[0010] An image recognition unit, configured to identify damaged areas of the input image to divide the effective boundary of the input image and generate an effective image area;

[0011] A feature analysis unit, configured to generate an expansion direction and a pixel expansion number corresponding to the valid picture area respectively by using the picture features of the valid picture area;

[0012] A picture judgment unit, configured to judge whether the aspect ratio of the valid picture area is greater than a preset ratio; if so, perform segmentation processing on the valid picture area and generate a set of segments to be expanded; if not, directly generate a picture object to be expanded;

[0013] A picture generation unit, configured to call a distributed picture generation interface based on the expansion direction and the pixel expansion number, and perform picture expansion on the set of segments to be expanded or the picture object to be expanded to obtain a complete picture.

[0014] In a third aspect, an embodiment of the present invention provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the intelligent half - picture intelligent completion method based on AI in the first aspect is implemented.

[0015] In a fourth aspect, an embodiment of the present invention provides a computer - readable storage medium, where a computer program is stored on the computer - readable storage medium, and when the computer program is executed by a processor, the intelligent half - picture intelligent completion method based on AI in the first aspect is implemented.

[0016] An embodiment of the present invention provides an intelligent half - picture intelligent completion method based on AI, including identifying a damaged area of an input picture to divide a valid boundary of the input picture and generating a valid picture area; generating an expansion direction and a pixel expansion number corresponding to the valid picture area respectively by using the picture features of the valid picture area; judging whether the aspect ratio of the valid picture area is greater than a preset ratio; if so, performing segmentation processing on the valid picture area and generating a set of segments to be expanded; if not, directly generating a picture object to be expanded; calling a distributed picture generation interface based on the expansion direction and the pixel expansion number, and performing picture expansion on the set of segments to be expanded or the picture object to be expanded to obtain a complete picture. By identifying and generating a valid picture area, and then performing picture expansion by using the expansion direction and the pixel expansion number, a complete picture can be obtained. In this way, the input picture can be completed, improving the work efficiency of personnel.

[0017] An embodiment of the present invention further provides an intelligent half - picture intelligent completion device, a computer device, and a storage medium based on AI, which also have the above - mentioned beneficial effects. Description of the Drawings

[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0019] Figure 1 It is a schematic flowchart of a method for intelligent completion of half pictures based on AI provided by an embodiment of the present invention;

[0020] Figure 2 It is a schematic block diagram of a device for intelligent completion of half pictures based on AI provided by an embodiment of the present invention. Detailed implementation manners

[0021] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the protection scope of the present invention.

[0022] It should be understood that when used in this specification and the appended claims, the terms "comprises" and "comprising" indicate the presence of the described features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.

[0023] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in this specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an", and "the" are intended to include the plural forms.

[0024] It should be further understood that the term "and / or" used in this specification of the present invention and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0025] Please refer to the following Figure 1 , Figure 1 It is a schematic flowchart of a method for intelligent completion of half pictures based on AI provided by an embodiment of the present invention, specifically including: steps S101 to S104.

[0026] S101. Identify the damaged area of the input picture to divide the effective boundary of the input picture and generate an effective picture area;

[0027] S102. Generate the expansion direction and pixel expansion number corresponding to the effective picture area respectively by using the picture features of the effective picture area;

[0028] S103. Determine whether the aspect ratio of the effective picture area is greater than a preset ratio; if so, perform segmentation processing on the effective picture area and generate a set of segments to be expanded; if not, directly generate an image object to be expanded;

[0029] S104. Call the distributed picture generation interface based on the expansion direction and pixel expansion number, and perform picture expansion on the set of segments to be expanded or the image object to be expanded to obtain a complete picture.

[0030] In step S101, identify the damaged area of the input picture to divide the effective boundary of the input picture, and then further generate the effective picture area according to the effective boundary, so as to remove the invalid part in the picture and ensure that subsequent processing is only based on the effective picture area.

[0031] In one embodiment, step S101 includes:

[0032] Perform reverse pixel traversal on the input picture to generate a pixel feature distribution sequence;

[0033] Calculate the RGB variance value of each row of pixels based on the pixel feature distribution sequence. When it is detected that the RGB variance values of consecutive N rows of pixels exceed the preset gray threshold, obtain the effective area boundary line; where N is the preset number of consecutive verification rows;

[0034] Generate an effective height parameter according to the effective area boundary line, and perform boundary cropping processing on the input picture by using the effective height parameter to obtain an effective pixel area;

[0035] Perform edge sharpening compensation on the effective pixel area to obtain the effective picture area.

[0036] In this embodiment, the input picture will perform reverse pixel traversal to generate a pixel feature distribution sequence. Reverse pixel traversal means scanning the picture pixels row by row from the bottom of the picture to obtain the color features of each row of pixels, and then generating a complete pixel feature distribution sequence. Through this pixel feature distribution sequence, the pixel distribution change situation of the picture can be analyzed, providing a basis for subsequent damaged area identification.

[0037] Further, based on the generated sequence of pixel feature distributions, the RGB variance value of each row of pixels can be calculated. The RGB variance value represents the degree of color change of each row of pixels in the red, green, and blue channels. By calculating the RGB variance of each row, it can be determined whether there is a significant color change in that row, and further whether that row belongs to the valid region. Specifically, when the RGB variance values of N consecutive rows of pixels exceed a preset gray threshold, the boundary of the valid region, i.e., the valid region demarcation line, can be determined. N is the preset number of consecutive verification rows, which is used to ensure the accuracy of the demarcation line and reduce the misidentification caused by accidental pixel fluctuations. After determining the valid region demarcation line, a valid height parameter is generated according to the valid region demarcation line. The valid height parameter represents the height from the bottom of the picture to the boundary of the valid region and serves as a reference for subsequent cropping processing. Through this valid height parameter, the input picture is subjected to boundary cropping processing to remove the invalid region and only retain the valid pixel region. This cropping processing ensures the effectiveness of picture processing and reduces the interference of the invalid region on subsequent expansion and completion.

[0038] Finally, edge sharpening compensation is performed on the obtained valid pixel region. The purpose of edge sharpening compensation is to improve the edge sharpness of the valid region, enabling better transition with the original picture edge during the expansion process and ensuring that the generated picture is natural and consistent. After edge sharpening compensation, the final valid picture region to be processed is formed, providing input for subsequent picture completion and expansion.

[0039] In step S102, using the picture features of the valid picture region, the corresponding expansion direction and the number of pixel expansions (by default, 50% of the height of the input picture) can be generated. The generation of the expansion direction and the number of pixels can ensure a natural transition between the expanded region and the input picture.

[0040] In one embodiment, before the step S102, it includes:

[0041] Obtain the color space features of the valid picture region;

[0042] When there is alpha channel data in the valid picture region, activate the lossless compression mode and encapsulate the valid picture region using the PNG format;

[0043] When there is no alpha channel data in the valid picture region, convert it to the standard RGB mode, and then encapsulate the valid picture region using the JPEG format.

[0044] In this embodiment, the color space features of the valid picture area are obtained. The color space features refer to the color information in the picture, such as the color distribution, hue, saturation, etc. By analyzing the color space features of the valid picture area, the color structure of the picture can be identified, and an important reference basis can be provided for subsequent picture expansion. Based on the color space features of the valid picture area, it can be determined whether there is alpha channel data in the valid picture area. The alpha channel data is used to represent the part of the picture with transparent or semi-transparent areas. If the valid picture area contains alpha channel data, the lossless compression mode is activated, and the valid picture area is encapsulated using the PNG format. The PNG format supports the alpha channel, so it can effectively preserve the transparent information in the picture, and at the same time, the lossless compression mode is adopted to avoid losing the details and quality of the picture during the compression process. If the valid picture area does not contain alpha channel data, the valid picture area is converted to the standard RGB mode. The RGB mode is a common color mode, and it represents the colors in the picture by different combinations of the three primary colors of red, green, and blue. After being converted to the standard RGB mode, the JPEG format is used to encapsulate the valid picture area. The JPEG format is a lossy compression format, which is suitable for pictures without transparent information and can reduce the size of the picture file while ensuring the picture quality.

[0045] This embodiment can select the appropriate picture encapsulation format (PNG or JPEG) according to the characteristics of the valid picture area (whether it contains alpha channel data), ensuring that key information will not be lost during the picture expansion process, and at the same time improving the efficiency and effect of picture processing.

[0046] In one embodiment, step S102 includes:

[0047] Detect whether there is a truncation feature at the bottom of the valid picture area through a convolutional neural network. If there is no truncation feature, directly generate the expansion direction and the number of pixel expansions; if there is a truncation feature, trigger the downward expansion mode;

[0048] Based on the downward expansion mode, calculate the initial number of pixel expansions of the valid picture area through a proportional mapping algorithm;

[0049] Reduce the initial number of pixel expansions to within the API limit range through an equi-ratio scaling algorithm to obtain the expansion direction and the number of pixel expansions.

[0050] In this embodiment, the bottom of the effective picture area is analyzed by a convolutional neural network to detect whether there is a truncation feature. The convolutional neural network can automatically identify whether there is a loss of picture content due to truncation or missing at the bottom of the picture by learning the patterns in the picture. If it is detected that there is no truncation feature at the bottom of the effective picture area, the expansion direction and the number of pixel expansions are directly generated, and the subsequent picture expansion process continues. If the convolutional neural network detects that there is a truncation feature at the bottom of the effective picture area, the downward expansion mode is triggered. In the downward expansion mode, the bottom of the picture needs to be supplemented and expanded, so this part of the area is processed to restore or supplement the missing content. Further, based on the downward expansion mode, a proportional mapping algorithm is used to calculate the initial number of pixel expansions of the effective picture area. The proportional mapping algorithm calculates an initial number of pixel expansions by analyzing the height ratio of the effective area and the truncated part of the input picture. After obtaining the initial number of pixel expansions, the initial number of pixel expansions is scaled by a geometric scaling algorithm to ensure that the number of expanded pixels does not exceed the limit range of the API (for example, the limit range is 2.5:1). The geometric scaling algorithm adjusts the initial number of pixel expansions to an appropriate range according to the limit parameters of the API, so as to ensure that the calculation in the picture expansion process does not exceed the processing capacity of the technical interface and avoid expansion failure or picture generation error caused by exceeding the limit.

[0051] In step S103, it is judged whether the aspect ratio of the effective picture area is greater than a preset ratio. If the aspect ratio of the effective picture area is greater than the preset ratio (for example, the preset ratio is 2.5), segmentation processing is performed. At this time, the effective picture area is divided into several segments, and a set of segments to be expanded is generated. The segmentation processing helps to better control the quality of the picture expansion and reduce the generation of unnatural transition areas. If the aspect ratio of the effective picture area is less than or equal to the preset ratio, no segmentation processing is performed, and a picture object to be expanded is directly generated, simplifying the expansion process.

[0052] In one embodiment, step S103 includes:

[0053] Calculating the optimal number of segmented pictures according to the aspect ratio of the effective picture area;

[0054] Based on the optimal number of segmented pictures, performing a segmentation operation on the effective picture area to generate an overlapping area between the segmented pictures and multiple segmented pictures;

[0055] Allocating the number of pixel expansions to each segmented picture according to the length ratio of the segmented pictures to obtain the set of segments to be expanded.

[0056] In this embodiment, the optimal number of segmented pictures can be calculated according to the aspect ratio of the effective picture area. The aspect ratio refers to the proportional relationship between the width and height of the picture. By analyzing the aspect ratio of the effective picture area, it can be determined whether the picture needs to be segmented. When the aspect ratio exceeds a preset threshold, it is considered that the effective picture area may be too wide and needs to be divided into multiple parts for processing. After calculating the optimal number of segmented pictures, the effective picture area is segmented based on the optimal number of segmented pictures. The segmentation operation divides the effective picture area into multiple smaller segmented pictures according to the calculated number of segments. To ensure smooth splicing between adjacent segmented pictures, an overlapping area is added between every two adjacent segmented pictures. The overlapping area can be set to a fixed pixel value (e.g., 100 pixels) to achieve a smooth transition in the subsequent splicing process and reduce obvious boundaries or seams at the splicing points.

[0057] Further, the pixel expansion number is distributed according to the length ratio of the segmented pictures. It is distributed to each segmented picture according to the length of each segmented picture (i.e., its proportion of the total length of the effective picture area). In this way, longer segments will receive more expanded pixel numbers to ensure consistent expansion effects for each segment, thereby maintaining a natural transition of the picture after expansion. After segmentation and distribution of the pixel expansion number, a set of segmented pictures to be expanded is generated. The set of segmented pictures to be expanded includes multiple segmented pictures, and each segmented picture has a corresponding expansion direction and pixel expansion number.

[0058] In step S104, based on the expansion direction and pixel expansion number, the set of segmented pictures to be expanded or the object of the picture to be expanded is expanded through calling a distributed picture generation interface to obtain a complete picture. The system expands the picture by calling a distributed picture generation interface (such as the outpaint API of StabilityAI, etc.). According to the pre-determined expansion direction and pixel expansion number, a complete picture is generated. Of course, for the case where segmentation has been performed, each segment will be independently expanded, and finally, the individual segments can be synthesized into a complete picture through seamless splicing technology.

[0059] In one embodiment, before the step S104, it includes:

[0060] Obtain the basic prompt word text input by the user to generate an initial set of prompt words;

[0061] Randomly select supplementary keywords from a predefined seamless transition keyword library;

[0062] Append the supplementary keywords to the end of the initial set of prompt words in the preset priority order and generate an enhanced sequence of prompt words through semantic fusion operation;

[0063] Bind the enhanced prompt sequence with the expansion direction and the number of pixel expansions as parameters to generate a prompt data packet for the distributed image generation interface to call.

[0064] In this embodiment, the basic prompt text input by the user is obtained. The basic prompt text can describe specific requirements and characteristics that the user hopes to apply during the image expansion process. For example, the user can input basic prompts such as "beach" and "sunset" to guide the image generation model to maintain a specific image style or content during expansion. Further, supplementary keywords are randomly selected from a predefined seamless transition keyword library. The seamless transition keyword library includes keywords that can effectively enhance the naturalness of the expansion result, such as "seamless transition" and "continuous texture". Randomly selecting supplementary keywords can increase the diversity of the expansion effect and enhance the continuity and consistency of the generated images. The selected supplementary keywords are appended to the end of the initial prompt set in the preset priority order. The priority order is determined based on factors such as the relevance of the supplementary keywords to the user's needs and the degree of influence on the expansion effect. For example, "seamless transition" may be added first, and "continuous texture" is added according to its order of influence on the final image effect.

[0065] Further, a semantic fusion operation is performed to semantically fuse the supplementary keywords with the initial prompt set (i.e., the integrated basic prompt text). Through this operation, it is ensured that the generated enhanced prompt sequence is semantically coherent and consistent, and can accurately express the user's image expansion requirements. The semantic fusion operation can be based on natural language processing technology to organically combine the semantic structures of the supplementary keywords and the basic prompts, optimizing the expression effect of the prompts. Bind the generated enhanced prompt sequence with the expansion direction and the number of pixel expansions as parameters to form a complete prompt data packet. This prompt data packet includes all the information required for image expansion, including the expansion direction, the number of pixel expansions, and the prompts related to the expansion effect. The prompt data packet will be passed as a parameter to the distributed image generation interface for actual image expansion processing.

[0066] In one embodiment, step S104 includes:

[0067] Package the expansion direction and the number of pixel expansions into an API request parameter set;

[0068] Based on the API request parameter set, call the distributed image generation interface to perform image expansion on the set of segments to be expanded, obtaining an initial generated image. At the same time, receive the creativity parameter and adjust the feature similarity weight between the initial generated image and the set of segments to be expanded based on the creativity parameter to obtain the complete image;

[0069] Alternatively, call the distributed image generation interface based on the API request parameter set to perform image expansion on the to-be-expanded image object, obtaining an initially generated image. Meanwhile, receive a creativity parameter and adjust the feature similarity weight between the initially generated image and the to-be-expanded segment set based on the creativity parameter to obtain the complete image.

[0070] In this embodiment, the expansion direction and the pixel expansion number are encapsulated into an API request parameter set, including the expansion direction of the image (such as up, down, left, right, etc.) and the pixel expansion number to be expanded. Based on the above API request parameter set, call the distributed image generation interface to perform image expansion on the to-be-expanded segment set and generate an initial generated image. The distributed image generation interface uses AI technology (such as the outpaint API of Stability AI) to expand each segmented image according to the provided expansion direction and pixel expansion number, initially obtaining the expanded image. After generating the initial image, a creativity parameter can also be received. The creativity parameter is used to control the balance between the similarity and creativity between the original image content and the expanded content during the image generation process. The role of the creativity parameter is to adjust the feature similarity weight between the generated image and the original image according to user requirements. When the creativity is low, it tends to generate expanded content highly consistent with the original image; when the creativity is high, it allows generating more creative content with a large difference from the original image. Based on the received creativity parameter, adjust the feature similarity weight between the initially generated image and the to-be-expanded segment set. By adjusting the similarity weight, the consistency of the style, details, and content between the expanded part and the original image can be controlled, and finally, the complete image is obtained. This process ensures that the generated image not only meets user requirements but also maintains a natural transition and consistency in the expanded part.

[0071] Similarly, the distributed image generation interface can be called according to the API request parameter set to perform image expansion on the to-be-expanded image object, generate an initial generated image, and perform similarity adjustment according to the creativity parameter, finally obtaining the complete image. The generation and adjustment method can be carried out by referring to the method of the to-be-expanded segment set.

[0072] The present invention can automatically identify and crop damaged or invalid areas in pictures, avoiding the tediousness of manual operations by users and greatly improving the processing efficiency. Through automated damaged area detection and effective area cropping, the processing process becomes more efficient and accurate, reducing the need for manual intervention and enhancing the convenience of picture processing. Secondly, the present invention, through an intelligent parameter recommendation mechanism, automatically sets the optimal expansion direction and the number of pixel expansions based on picture features. Even non-professional users can easily achieve an ideal picture expansion effect. Users do not need to master complex picture editing skills to obtain high-quality picture expansion results. For ultra-wide pictures, the present invention adopts a segmented processing and seamless splicing technology to solve the problems of splicing marks and unnatural transitions that may occur when processing large-sized pictures under API limitations (such as 2000 pixels). In addition, the present invention also introduces a prompt word enhancement mechanism, which can automatically add keywords related to seamless transition to the basic prompt words provided by users, enhancing the coherence and natural transition effect of the expanded part of the picture. By optimizing the semantic relevance of the prompt words, the generated pictures can maintain the consistency of the style with the original picture in the expanded part while achieving a natural transition effect.

[0073] In terms of the system architecture, the present invention adopts a multi-threaded architecture to ensure smooth interface response and avoid the jamming phenomenon that occurs during picture processing. The multi-threaded processing architecture includes a main thread responsible for user interface response and interaction, a working thread responsible for image processing tasks, a signal mechanism for the working thread to send progress and result information to the main thread, and a thread-safe stop mechanism to ensure that the application can exit safely. Through real-time progress feedback, users can understand the processing progress at any time, enhancing the operation experience and the usability of the system.

[0074] Finally, the present invention provides an intuitive graphical user interface and an automated processing process, enabling non-professional users to easily obtain professional-level picture expansion effects. The system simplifies the operation steps, making picture expansion more convenient and efficient and reducing the operation complexity of users.

[0075] In summary, the technical solution provided by the present invention not only improves the efficiency of picture processing and the user experience but also ensures the naturalness and coherence during the picture expansion process, providing users with an efficient, easy-to-use, and high-quality picture completion and expansion solution.

[0076] Combined with Figure 2 as shown in Figure 2 FIG. 200 is a schematic block diagram of an AI-based intelligent half-picture completion device provided by an embodiment of the present invention. The AI-based intelligent half-picture completion device 200 includes:

[0077] A picture recognition unit 201 for identifying damaged areas in the input picture to demarcate the effective boundary of the input picture and generate an effective picture area;

[0078] A feature analysis unit 202, configured to respectively generate an expansion direction and a pixel expansion number corresponding to the valid picture area by using the picture features of the valid picture area;

[0079] A picture judgment unit 203, configured to judge whether the aspect ratio of the valid picture area is greater than a preset ratio; if so, perform segmentation processing on the valid picture area and generate a set of segments to be expanded; if not, directly generate a picture object to be expanded;

[0080] A picture generation unit 204, configured to call a distributed picture generation interface based on the expansion direction and the pixel expansion number, and perform picture expansion on the set of segments to be expanded or the picture object to be expanded to obtain a complete picture.

[0081] In this embodiment, the picture recognition unit 201 performs damaged area recognition on the input picture to divide the valid boundary of the input picture and generate a valid picture area; the feature analysis unit 202 respectively generates an expansion direction and a pixel expansion number corresponding to the valid picture area by using the picture features of the valid picture area; the picture judgment unit 203 judges whether the aspect ratio of the valid picture area is greater than a preset ratio; if so, perform segmentation processing on the valid picture area and generate a set of segments to be expanded; if not, directly generate a picture object to be expanded; the picture generation unit 204 calls a distributed picture generation interface based on the expansion direction and the pixel expansion number, and performs picture expansion on the set of segments to be expanded or the picture object to be expanded to obtain a complete picture.

[0082] In one embodiment, the picture recognition unit 201 includes:

[0083] A picture traversal unit, configured to perform reverse pixel traversal on the input picture to generate a pixel feature distribution sequence;

[0084] A pixel calculation unit, configured to calculate the RGB variance value of each row of pixels based on the pixel feature distribution sequence, and obtain a valid area boundary line when it is detected that the RGB variance values of consecutive N rows of pixels exceed a preset gray threshold; where N is a preset number of consecutive verification rows;

[0085] A picture cropping unit, configured to generate a valid height parameter according to the valid area boundary line, and perform boundary cropping processing on the input picture by using the valid height parameter to obtain a valid pixel area;

[0086] A picture compensation unit, configured to perform edge sharpening compensation on the valid pixel area to obtain the valid picture area.

[0087] In one embodiment, the AI-based half picture intelligent completion device 200 further includes:

[0088] A color feature unit for obtaining the color space features of the effective picture area;

[0089] A first encapsulation unit for activating the lossless compression mode and encapsulating the effective picture area in PNG format when there is transparent channel data in the effective picture area;

[0090] A second encapsulation unit for converting to the standard RGB mode and then encapsulating the effective picture area in JPEG format when there is no transparent channel data in the effective picture area.

[0091] In one embodiment, the feature analysis unit 202 includes:

[0092] A bottom detection unit for detecting whether there is a truncation feature at the bottom of the effective picture area through a convolutional neural network. If there is no truncation feature, directly generate the expansion direction and the number of pixel expansions; if there is a truncation feature, trigger the downward expansion mode;

[0093] An expansion calculation unit for calculating the initial number of pixel expansions of the effective picture area through a proportional mapping algorithm based on the downward expansion mode;

[0094] A range adjustment unit for reducing the initial number of pixel expansions to within the API limit range through an equi-ratio scaling algorithm to obtain the expansion direction and the number of pixel expansions.

[0095] In one embodiment, the picture judgment unit 203 includes:

[0096] A width-height calculation unit for calculating the optimal number of segmented pictures according to the width-height ratio of the effective picture area;

[0097] A picture segmentation unit for performing a segmentation operation on the effective picture area based on the optimal number of segmented pictures to generate an overlapping area between the segmented pictures and multiple segmented pictures;

[0098] A ratio configuration unit for allocating the number of pixel expansions to each segmented picture according to the length ratio of the segmented pictures to obtain the set of segmented pictures to be expanded.

[0099] In one embodiment, the AI-based intelligent half-picture completion device 200 further includes:

[0100] A word acquisition unit for acquiring the basic prompt word text input by the user to generate an initial prompt word set;

[0101] A word supplement unit for randomly selecting supplementary keywords from a predefined seamless transition keyword library;

[0102] A word appending unit, configured to append the supplementary keywords to the end of the initial prompt word set in a preset priority order, and generate an enhanced prompt word sequence through semantic fusion operation;

[0103] A word binding unit, configured to perform parameter binding on the enhanced prompt word sequence, the expansion direction and the number of pixel expansions to generate a prompt data packet for the distributed image generation interface to call.

[0104] In one embodiment, the image generation unit 204 includes:

[0105] A parameter request unit, configured to encapsulate the expansion direction and the number of pixel expansions into an API request parameter set;

[0106] A first expansion unit, configured to call the distributed image generation interface based on the API request parameter set to perform image expansion on the set of segments to be expanded, obtain an initial generated image, and at the same time, receive a creativity parameter and adjust the feature similarity weight between the initial generated image and the set of segments to be expanded based on the creativity parameter to obtain the complete image;

[0107] A second expansion unit, configured to call the distributed image generation interface based on the API request parameter set to perform image expansion on the image object to be expanded, obtain an initial generated image, and at the same time, receive a creativity parameter and adjust the feature similarity weight between the initial generated image and the set of segments to be expanded based on the creativity parameter to obtain the complete image.

[0108] Since the embodiments of the apparatus part correspond to the embodiments of the method part, for the embodiments of the apparatus part, please refer to the description of the embodiments of the method part, which will not be elaborated here.

[0109] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed, the steps provided in the above embodiments can be implemented. The storage medium may include: various media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc that can store program codes.

[0110] An embodiment of the present invention further provides a computer device, which may include a memory and a processor. When the processor calls the computer program in the memory, the steps provided in the above embodiments can be implemented. Of course, the computer device may further include various network interfaces, power supplies and other components.

[0111] The various embodiments in the specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments, and the same or similar parts among the embodiments can be referred to each other. For the system disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description in the method section. It should be noted that for those of ordinary skill in the art in this technical field, without departing from the principle of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.

[0112] It should also be noted that in this specification, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of another identical element in the process, method, article or device including the said element.

Claims

1. An AI-based intelligent half-picture completion method, characterized in that, Including: Identifying damaged areas in the input image to divide the effective boundaries of the input image and generating an effective image area; Generating an expansion direction and a pixel expansion number corresponding to the effective image area respectively by using the image features of the effective image area; Judging whether the aspect ratio of the effective image area is greater than a preset ratio; if so, performing segmentation processing on the effective image area and generating a set of segments to be expanded; if not, directly generating an image object to be expanded; Invoking a distributed image generation interface based on the expansion direction and the pixel expansion number to expand the set of segments to be expanded or the image object to be expanded, and obtaining a complete image.

2. The AI-based intelligent half-picture completion method according to claim 1, wherein The identifying damaged areas in the input image to divide the effective boundaries of the input image and generating an effective image area includes: Performing reverse pixel traversal on the input image to generate a pixel feature distribution sequence; Calculating the RGB variance value of each row of pixels based on the pixel feature distribution sequence, and obtaining an effective area boundary line when it is detected that the RGB variance values of consecutive N rows of pixels exceed a preset gray threshold; where N is a preset number of consecutive verification rows; Generating an effective height parameter according to the effective area boundary line, and performing boundary cropping processing on the input image by using the effective height parameter to obtain an effective pixel area; Performing edge sharpening compensation on the effective pixel area to obtain the effective image area.

3. The AI-based intelligent half-picture completion method according to claim 1, wherein Before generating an expansion direction and a pixel expansion number corresponding to the effective image area respectively by using the image features of the effective image area, it includes: Obtaining the color space features of the effective image area; When there is transparent channel data in the effective image area, activating the lossless compression mode and encapsulating the effective image area by using the PNG format; When there is no transparent channel data in the effective image area, converting it to the standard RGB mode and then encapsulating the effective image area by using the JPEG format.

4. The AI-based intelligent half-picture completion method according to claim 1, wherein, The generating an expansion direction and a pixel expansion number corresponding to the effective image area respectively by using the image features of the effective image area includes: Detecting whether there is a truncation feature at the bottom of the effective image area through a convolutional neural network. If there is no truncation feature, directly generating the expansion direction and the pixel expansion number; if there is a truncation feature, triggering the downward expansion mode; Calculating an initial pixel expansion number of the effective image area through a proportional mapping algorithm based on the downward expansion mode; Reducing the initial pixel expansion number to within the API limit range through an equi-ratio scaling algorithm to obtain the expansion direction and the pixel expansion number.

5. The AI-based intelligent half-picture completion method according to claim 1, characterized in that, The performing segmentation processing on the effective image area and generating a set of segments to be expanded includes: Calculating the optimal number of segmented images according to the aspect ratio of the effective image area; Performing a segmentation operation on the effective image area based on the optimal number of segmented images to generate an overlapping area between segmented images and multiple segmented images; Allocating the pixel expansion number to each segmented image according to the length ratio of the segmented images to obtain the set of segments to be expanded.

6. The AI-based intelligent half-picture intelligent completion method according to claim 1, characterized in that Invoking a distributed image generation interface based on the extension direction and the number of pixel extensions to perform image expansion on the set of segments to be expanded or the image object to be expanded, and obtaining a complete image, including: Encapsulating the extension direction and the number of pixel extensions into an API request parameter set; Invoking the distributed image generation interface based on the API request parameter set to perform image expansion on the set of segments to be expanded, obtaining an initially generated image. Meanwhile, receiving a creativity parameter and adjusting the feature similarity weight between the initially generated image and the set of segments to be expanded based on the creativity parameter to obtain the complete image; Alternatively, invoking the distributed image generation interface based on the API request parameter set to perform image expansion on the image object to be expanded, obtaining an initially generated image. Meanwhile, receiving a creativity parameter and adjusting the feature similarity weight between the initially generated image and the set of segments to be expanded based on the creativity parameter to obtain the complete image.

7. The AI-based intelligent half-picture completion method according to claim 1, wherein, Before invoking the distributed image generation interface based on the extension direction and the number of pixel extensions to perform image expansion on the set of segments to be expanded or the image object to be expanded and obtaining a complete image, it includes: Obtaining a basic prompt text input by a user to generate an initial prompt set; Randomly selecting supplementary keywords from a predefined seamless transition keyword library; Appending the supplementary keywords to the end of the initial prompt set in a preset priority order and generating an enhanced prompt sequence through semantic fusion operations; Binding the enhanced prompt sequence with the extension direction and the number of pixel extensions to generate a prompt data packet for the distributed image generation interface to invoke.

8. An AI-based intelligent half-picture completion device, characterized in that, Including: An image recognition unit for identifying damaged areas of an input image to divide valid boundaries of the input image and generating a valid image area; A feature analysis unit for respectively generating an extension direction and the number of pixel extensions corresponding to the valid image area by using image features of the valid image area; An image judgment unit for judging whether an aspect ratio of the valid image area is greater than a preset ratio; if so, performing segmentation processing on the valid image area and generating a set of segments to be expanded; if not, directly generating an image object to be expanded; An image generation unit for invoking a distributed image generation interface based on the extension direction and the number of pixel extensions to perform image expansion on the set of segments to be expanded or the image object to be expanded and obtaining a complete image.

9. A computer device, characterized in that, Including a memory, a processor, and a computer program stored on the memory and executable on the processor, where when the processor executes the computer program, it implements the AI-based intelligent half-image completion method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, it implements the AI-based intelligent half-image completion method according to any one of claims 1 to 7.