Artificial intelligence-based background image generation method and related device

By analyzing cloud image resources, dividing them into high-frequency and low-frequency regions, marking edge pixels and recording their coordinates, and extracting the main color tone from the low-frequency region to generate a background image, the problem of low efficiency and high manpower requirements in existing technologies is solved, achieving efficient and flexible background image generation.

CN115830168BActive Publication Date: 2026-06-05CHINA PING AN LIFE INSURANCE CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA PING AN LIFE INSURANCE CO LTD
Filing Date
2022-12-19
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing technologies require additional configuration of image color value data when generating background images, resulting in low efficiency, high manpower requirements, and low fault tolerance.

Method used

By analyzing cloud image resources, dividing them into high-frequency and low-frequency regions, marking edge pixels and recording their coordinates, extracting the main color tone from the low-frequency region, and setting the image generation code based on this information, the background image is automatically generated.

Benefits of technology

It improves the efficiency of background image generation, reduces manpower and the possibility of errors, and enhances the flexibility and accuracy of the generation process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115830168B_ABST
    Figure CN115830168B_ABST
Patent Text Reader

Abstract

The application provides an artificial intelligence-based background image generation method and related equipment. The related equipment includes an artificial intelligence-based background image generation device, an electronic device, and a storage medium. The artificial intelligence-based background image generation method includes the following steps: analyzing cloud picture resources to obtain a to-be-processed image, then positioning a high-frequency area and a low-frequency area in the to-be-processed image, further marking edge pixel points in the high-frequency area and recording the coordinates of the edge pixel points, extracting a main tone of the to-be-processed image from the low-frequency area, finally setting an image generation code based on the main tone and the coordinates of the edge pixel points, and running the image generation code to obtain a background image. The method can automatically generate a corresponding background image according to the tone and contour features of the cloud picture resources, thereby improving the generation efficiency of the background image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a background image generation method and related equipment based on artificial intelligence, wherein the related equipment includes an artificial intelligence-based background image generation device, electronic equipment and storage medium. Background Technology

[0002] Page elements may display images with different design effects, such as adding a bottom background or shadows around the elements. To better reflect the image's color tone, backgrounds or shadows related to the image's color tone are usually configured. However, when displaying images on a page, the image's color tone is often unknown beforehand, making it impossible to create effects that match the image's color tone "for different images".

[0003] Currently, to achieve a consistent overall page atmosphere, image color values ​​are typically configured along with the image data when sending it to the requester. This allows the requester to apply different effects based on the color values. However, this approach has several drawbacks: it lacks flexibility, requiring additional configuration of image color values; it is inefficient, as acquiring and configuring image color values, as well as developing configuration platform functionality, all require additional manpower; and it has a low fault tolerance rate, as manual configuration inherently carries the possibility of errors. Summary of the Invention

[0004] In view of the above, it is necessary to provide a background image generation method and related equipment based on artificial intelligence to solve the technical problem of how to improve the efficiency of background image generation. The related equipment includes an artificial intelligence-based background image generation device, electronic equipment and storage medium.

[0005] This application provides a background image generation method based on artificial intelligence, the method comprising:

[0006] Parse cloud image resources to obtain the image to be processed;

[0007] The image to be processed is analyzed, and the high-frequency and low-frequency regions in the image to be processed are divided.

[0008] Mark edge pixels in the high-frequency region and record the coordinates of the edge pixels;

[0009] Extract the main color tone of the image to be processed from the low-frequency region;

[0010] The image generation code is set based on the main color tone and the coordinates of the edge pixels, and the image generation code is run to obtain the background image.

[0011] In some embodiments, parsing cloud image resources to obtain the image to be processed specifically includes:

[0012] Obtain bytecode data of cloud image resources based on preset link addresses;

[0013] The bytecode data is converted into an image to be processed using a preset transcoding interface.

[0014] In some embodiments, the step of parsing the image to be processed to divide the image into high-frequency and low-frequency regions specifically includes:

[0015] Calculate the gray value of each pixel in the image to be processed, and calculate the average gray value of the image to be processed based on the gray value of each pixel;

[0016] For each pixel in the image to be processed, the gradient between the gray value of the pixel and the gray values ​​of its neighboring pixels is calculated, and the average gradient of the pixel is calculated based on the gradient.

[0017] All pixels whose gradient mean is greater than the grayscale mean of the image to be processed are defined as high-frequency regions of the image to be processed, and all pixels whose gradient mean is not greater than the grayscale mean are defined as low-frequency regions.

[0018] In some embodiments, marking edge pixels in the high-frequency region and recording the coordinates of the edge pixels specifically includes:

[0019] The horizontal and vertical difference values ​​of each pixel in the high-frequency region are calculated using a preset edge detection operator.

[0020] The edge feature value of each pixel is calculated using the horizontal difference value and the vertical difference value, and the calculation method of the edge feature value satisfies the following relationship:

[0021]

[0022] Wherein, G represents the edge feature value of the pixel; G x G represents the lateral difference value of the pixel; y The vertical difference value representing the pixel;

[0023] For each pixel in the high-frequency region, if the edge feature value of the pixel is the maximum value in the neighborhood, then the pixel is marked as an edge pixel.

[0024] In some embodiments, each pixel in the image to be processed contains multiple channel values, and extracting the dominant color tone of the image to be processed from the low-frequency region specifically includes:

[0025] For each pixel in the low-frequency region, the channel corresponding to the highest channel value of the pixel is used as the hue label of the pixel;

[0026] The color tone tag with the largest number is used as the main color tone of the image to be processed.

[0027] In some embodiments, setting image generation code based on the main color tone and the coordinates of the edge pixels, and running the image generation code to obtain a background image specifically includes:

[0028] Based on the main color tone of the image to be processed, the color tone parameters in the preset code template are set, and based on the coordinates of the edge pixels, the contour parameters in the preset code template are set to obtain the image generation code;

[0029] Run the image generation code to obtain the background image.

[0030] In some embodiments, the method further includes:

[0031] The preset link address is used as the key, and the coordinates of the main color and the edge pixel are used as the value to construct a parameter mapping key-value pair, and the parameter mapping key-value pair is stored in the backup database.

[0032] This application embodiment also provides a background image generation device based on artificial intelligence, the device comprising:

[0033] The acquisition unit is used to parse cloud image resources and obtain the image to be processed;

[0034] A segmentation unit is used to parse the image to be processed and segment the high-frequency region and low-frequency region in the image to be processed;

[0035] A marking unit is used to mark edge pixels in the high-frequency region and record the coordinates of the edge pixels;

[0036] An extraction unit is used to extract the main color tone of the image to be processed from the low-frequency region;

[0037] The generation unit is used to set image generation code based on the main color tone and the coordinates of the edge pixels, and run the image generation code to obtain a background image.

[0038] This application embodiment also provides an electronic device, the electronic device comprising:

[0039] Memory, which stores computer-readable instructions; and

[0040] The processor executes computer-readable instructions stored in the memory to implement the artificial intelligence-based background image generation method.

[0041] This application also provides a computer-readable storage medium storing computer-readable instructions, which are executed by a processor in an electronic device to implement the artificial intelligence-based background image generation method.

[0042] The aforementioned AI-based background image generation method obtains the image to be processed by parsing cloud image resources, then locates the high-frequency and low-frequency regions in the image, marks edge pixels in the high-frequency regions and records their coordinates, extracts the main color tone of the image from the low-frequency regions, and finally sets image generation code based on the main color tone and the coordinates of the edge pixels, and runs the image generation code to obtain the background image. This method can automatically generate a matching background image based on the color tone and contour features of the cloud image resources, thereby improving the efficiency of background image generation. Attached Figure Description

[0043] Figure 1 This is a flowchart of a preferred embodiment of an artificial intelligence-based background image generation method involved in this application.

[0044] Figure 2 This is a functional block diagram of a preferred embodiment of the artificial intelligence-based background image generation device involved in this application.

[0045] Figure 3 This is a schematic diagram of the structure of an electronic device according to a preferred embodiment of the artificial intelligence-based background image generation method involved in this application. Detailed Implementation

[0046] To better understand the purpose, features, and advantages of this application, a detailed description of the application is provided below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the embodiments of this application can be combined with each other. Numerous specific details are set forth in the following description to provide a thorough understanding of this application; the described embodiments are only a part of the embodiments of this application, and not all of them.

[0047] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the stated features. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.

[0048] 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 particular embodiments only and is not intended to be limiting of the application. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.

[0049] This application provides a background image generation method based on artificial intelligence, which can be applied to one or more electronic devices. The electronic device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.

[0050] The electronic device can be any electronic product that can interact with the user, such as a personal computer, tablet computer, smartphone, personal digital assistant (PDA), game console, interactive network television (IPTV), smart wearable device, etc.

[0051] The electronic device may also include network devices and / or user devices. The network devices include, but are not limited to, a single network server, a server group consisting of multiple network servers, or a cloud based on cloud computing consisting of a large number of hosts or network servers.

[0052] The networks in which the electronic devices are located include, but are not limited to, the Internet, wide area networks, metropolitan area networks, local area networks, and virtual private networks (VPNs).

[0053] like Figure 1 The diagram shown is a flowchart of a preferred embodiment of the artificial intelligence-based background image generation method of this application. Depending on different needs, the order of the steps in this flowchart can be changed, and some steps can be omitted.

[0054] S10 parses cloud image resources to obtain images to be processed.

[0055] In an optional embodiment, parsing the cloud image resources to obtain the image to be processed specifically includes:

[0056] Obtain bytecode data of cloud image resources based on preset link addresses;

[0057] The bytecode data is converted into an image to be processed using a preset transcoding interface.

[0058] In this optional embodiment, the preset link address refers to the storage address of the cloud image resource on the Internet. The preset resource address can be input into a pre-written resource retrieval interface to obtain the bytecode data of the cloud image resource. The resource interface can be a program with data transmission capabilities written in any programming language; this application does not limit the programming language of the resource interface. The bytecode data refers to the binary data corresponding to the cloud image resource.

[0059] In this optional embodiment, the bytecode data can be converted into an image to be processed using a pre-written transcoding interface. The transcoding interface can be a program with data transcoding capabilities written in any programming language. For example, the transcoding interface could be the BitmapFactory.decodeByteArray() interface written in Java.

[0060] In this optional embodiment, the format of the image to be processed can be an existing digital image format such as BMP format, Lab format, RGB format, etc., and this application does not limit it.

[0061] In this way, images to be processed can be obtained directly from the remote location by accessing the cloud image resource storage address, thus saving local storage space.

[0062] S11, parse the image to be processed and divide the high-frequency region and low-frequency region in the image to be processed.

[0063] In an optional embodiment, the step of parsing the image to be processed and dividing the image into high-frequency and low-frequency regions specifically includes:

[0064] Calculate the gray value of each pixel in the image to be processed, and calculate the average gray value of the image to be processed based on the gray value of each pixel;

[0065] For each pixel in the image to be processed, the gradient between the gray value of the pixel and the gray values ​​of its neighboring pixels is calculated, and the average gradient of the pixel is calculated based on the gradient.

[0066] All pixels whose gradient mean is greater than the grayscale mean are designated as high-frequency regions of the image to be processed, and all pixels whose gradient mean is not greater than the grayscale mean are designated as low-frequency regions.

[0067] In this optional embodiment, taking the RGB format image as an example, the grayscale value of each pixel in the image to be processed is calculated in a way that satisfies the following relationship:

[0068] Gray = R×a + G×b + B×c

[0069] Wherein, Gray represents the grayscale value of the pixel; R represents the R channel value of the pixel; G represents the G channel value of the pixel; B represents the B channel value of the pixel; a represents the R channel ratio; b represents the G channel ratio; c represents the B channel ratio; and a, b, and c are all preset constants, and the sum of a, b, and c is 1.

[0070] Preferably, the R channel ratio 'a' can be 0.299, the G channel ratio 'b' can be 0.587, and the B channel ratio 'c' can be 0.114. For example, when the R channel value of a pixel in the image to be processed is 100, the G channel value is 50, and the B channel value is 150, then the grayscale value of that pixel is:

[0071] 100×0.299+50×0.587+150×0.114=76.53

[0072] In this optional embodiment, the neighboring pixels refer to the eight pixels surrounding a given pixel. The difference between the gray value of the given pixel and the gray values ​​of its neighboring pixels is calculated. For example, if the gray value of a given pixel is 76.53, and the gray values ​​of its neighboring pixels are 30, 35, 40, 45, 50, 55, 60, and 65, then the gradients of the gray values ​​between the given pixel and its neighboring pixels are 46.53, 41.53, 36.53, 31.53, 26.53, 21.53, 16.53, and 11.53, respectively. The average gradient of the given pixel is 29.03.

[0073] In this optional embodiment, the gradient mean of each pixel can be compared with the gray mean of the image to be processed. If the gradient mean is greater than the gray mean, it indicates that the gray change at the pixel is relatively drastic, and the pixel can be regarded as a high-frequency region of the image to be processed. If the gradient mean is not greater than the gray mean, it indicates that the gray change at the pixel is not drastic, and the pixel can be regarded as a low-frequency region.

[0074] For example, if the average grayscale value of the image to be processed is 50 and the average gradient value of a certain pixel is 29.03, then the pixel belongs to the low frequency region.

[0075] In this way, by comparing the grayscale gradient of each pixel with the grayscale mean of the image to be processed, high-frequency and low-frequency regions are divided, which narrows down the range for subsequent selection of edge pixels and the main color tone of the image to be processed, thus improving the efficiency of image processing.

[0076] S12, mark edge pixels in the high-frequency region and record the coordinates of the edge pixels.

[0077] In an optional embodiment, marking edge pixels from the high-frequency region and recording the coordinates of the edge pixels specifically includes:

[0078] The horizontal and vertical difference values ​​of each pixel in the high-frequency region are calculated using a preset edge detection operator.

[0079] The edge feature value of each pixel is calculated using the horizontal difference value and the vertical difference value, and the calculation method of the edge feature value satisfies the following relationship:

[0080]

[0081] Wherein, G represents the edge feature value of the pixel; G x G represents the lateral difference value of the pixel; y The vertical difference value representing the pixel;

[0082] For each pixel in the high-frequency region, if the edge feature value of the pixel is the maximum value in the neighborhood, then the pixel is marked as an edge pixel.

[0083] In this optional embodiment, the preset edge detection operator includes a horizontal detector and a vertical detector. For each pixel in the high-frequency region, the gray value of the pixel and the gray values ​​of its eight surrounding pixels can be unified as the pixel's neighborhood matrix. The dot product of the pixel's neighborhood matrix and the horizontal detector can be calculated as the pixel's horizontal difference value, and the dot product of the pixel's neighborhood matrix and the vertical detector can be calculated as the pixel's vertical difference value. For example, when the pixel's neighborhood matrix is... When the lateral detector is The calculation method for the lateral difference value is as follows:

[0084] G x =10*(-1)+20*0+30*1+40*(-2)+50*0+60*2+70*(-1)+80*0+90*1=80

[0085] When the longitudinal detector is The calculation method for the longitudinal difference value is as follows:

[0086] G y =10*(-1)+20*(-2)+30*(-1)+40*0+50*0+60*0+70*1+80*2+90*1=210

[0087] In this optional embodiment, the edge feature value of the pixel can be calculated based on the horizontal difference value and the vertical difference value. For example, when the horizontal difference value is 80 and the vertical difference value is 210, the edge feature value is calculated as follows:

[0088]

[0089] In this optional embodiment, for each pixel in the high-frequency region, if the edge feature value of the pixel is the maximum value in its neighborhood, the pixel is marked as an edge pixel, and the coordinates of each edge pixel are recorded. The coordinates include an abscissa and a ordinate. The abscissa is used to characterize the column position of the edge pixel in the image to be processed, and the ordinate is used to characterize the row position of the edge pixel in the image to be processed.

[0090] In this way, by calculating the edge feature value of each pixel in the high-frequency region through the preset edge detection operator, the edge pixels can be located, which can provide data support for the subsequent generation of background images.

[0091] S13, extract the main color tone of the image to be processed from the low-frequency region.

[0092] In an optional embodiment, each pixel in the image to be processed contains multiple channel values, and extracting the dominant color tone of the image to be processed from the low-frequency region specifically includes:

[0093] For each pixel in the low-frequency region, the channel corresponding to the highest channel value of the pixel is used as the hue label of the pixel;

[0094] The color tone tag with the largest number is used as the main color tone of the image to be processed.

[0095] In this optional embodiment, for each pixel in the low-frequency region, the value of each channel in each pixel can be queried, and the highest channel value is used as the hue label of that pixel. For example, when the image to be processed is an RGB format image, and the R channel value of a certain pixel is 100, the G channel value is 50, and the B channel value is 150, then the hue label of that pixel is the B channel, i.e., blue.

[0096] In this optional embodiment, the hue tags of all pixels in the image to be processed can be queried, and the hue tag with the highest proportion can be taken as the dominant hue of the image to be processed. For example, when the image to be processed is an RGB image and contains 360,000 pixels, if there are 100,000 pixels with the dominant hue of the R channel, 100,000 pixels with the dominant hue of the G channel, and 160,000 pixels with the dominant hue of the B channel, then the dominant hue of the image to be processed is the B channel, i.e., blue.

[0097] Thus, by analyzing the dominant color tone of each pixel in the low-frequency region, the dominant color tone of the image to be processed can be determined, providing color information support for the subsequent generation of a background image that conforms to the style of the image to be processed.

[0098] S14, set the image generation code based on the main color tone and the coordinates of the edge pixels, and run the image generation code to obtain the background image.

[0099] In an optional embodiment, setting the image generation code based on the main color tone and the coordinates of the edge pixels, and running the image generation code to obtain the background image specifically includes:

[0100] Based on the main color tone of the image to be processed, the color tone parameters in the preset code template are set, and based on the coordinates of the edge pixels, the contour parameters in the preset code template are set to obtain the image generation code;

[0101] Run the image generation code to obtain the background image.

[0102] In this optional embodiment, the preset code template refers to code with image generation function. The preset code template includes at least tone parameters and outline parameters. For example, the preset code template may be Drawable code in the Android system.

[0103] In this optional embodiment, the hue parameter in the preset code template can be set to the main color, and the contour parameter in the preset code template can be set to the coordinates of the edge pixels to obtain the image generation code. For example, when the preset code template is Drawable code in the Android system and the main color is blue, the hue parameter can be: Drawable.setColor(blue); when the coordinates of a certain edge pixel are (10,20), the contour parameter can be Drawable.setShape((10,20)).

[0104] In an optional embodiment, the method further includes:

[0105] The preset link address is used as the key, and the coordinates of the main color and the edge pixel are used as the value to construct a parameter mapping key-value pair, and the parameter mapping key-value pair is stored in the backup database.

[0106] In this optional embodiment, the parameter mapping key-value pairs are stored as a backup database. When performing background image generation tasks in the future, the coordinates of the main color and edge pixels corresponding to the preset link address can be directly queried from the backup database, thereby improving the reuse rate of parameters and thus improving the efficiency of background image generation.

[0107] The aforementioned AI-based background image generation method obtains the image to be processed by parsing cloud image resources, then locates the high-frequency and low-frequency regions in the image, marks edge pixels in the high-frequency regions and records their coordinates, extracts the main color tone of the image from the low-frequency regions, and finally sets image generation code based on the main color tone and the coordinates of the edge pixels, and runs the image generation code to obtain the background image. This method can automatically generate a matching background image based on the color tone and contour features of the cloud image resources, thereby improving the efficiency of background image generation.

[0108] like Figure 2 The diagram shown is a functional block diagram of a preferred embodiment of the AI-based background image generation device provided in this application. The AI-based background image generation device 11 includes an acquisition unit 110, a segmentation unit 111, a marking unit 112, an extraction unit 113, and a generation unit 114. The module / unit referred to in this application refers to a series of computer program segments that can be executed by the processor 13 and perform a fixed function, and are stored in the memory 12. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.

[0109] The acquisition unit 110 is used to parse cloud image resources to obtain the image to be processed.

[0110] The segmentation unit 111 is used to parse the image to be processed and segment the high-frequency region and low-frequency region in the image to be processed.

[0111] The marking unit 112 is used to mark edge pixels in the high-frequency region and record the coordinates of the edge pixels.

[0112] The extraction unit 113 is used to extract the main color tone of the image to be processed from the low-frequency region.

[0113] The generation unit 114 is used to set image generation code based on the main color tone and the coordinates of the edge pixels, and run the image generation code to obtain a background image.

[0114] In some optional embodiments, the acquisition unit 110 parses cloud image resources to obtain the image to be processed, specifically including:

[0115] Obtain bytecode data of cloud image resources based on preset link addresses;

[0116] The bytecode data is converted into an image to be processed using a preset transcoding interface.

[0117] In some optional embodiments, the segmentation unit 111 parses the image to be processed to segment high-frequency regions and low-frequency regions in the image to be processed, specifically including:

[0118] Calculate the gray value of each pixel in the image to be processed, and calculate the average gray value of the image to be processed based on the gray value of each pixel;

[0119] For each pixel in the image to be processed, the gradient between the gray value of the pixel and the gray values ​​of its neighboring pixels is calculated, and the average gradient of the pixel is calculated based on the gradient.

[0120] All pixels whose gradient mean is greater than the grayscale mean of the image to be processed are defined as high-frequency regions of the image to be processed, and all pixels whose gradient mean is not greater than the grayscale mean are defined as low-frequency regions.

[0121] In some optional embodiments, the marking unit 112 marks edge pixels from the high-frequency region and records the coordinates of the edge pixels, specifically including:

[0122] The horizontal and vertical difference values ​​of each pixel in the high-frequency region are calculated using a preset edge detection operator.

[0123] The edge feature value of each pixel is calculated using the horizontal difference value and the vertical difference value, and the calculation method of the edge feature value satisfies the following relationship:

[0124]

[0125] Wherein, G represents the edge feature value of the pixel; G x G represents the lateral difference value of the pixel; y The vertical difference value representing the pixel;

[0126] For each pixel in the high-frequency region, if the edge feature value of the pixel is the maximum value in the neighborhood, then the pixel is marked as an edge pixel.

[0127] In some optional embodiments, each pixel in the image to be processed contains multiple channel values, and the extraction unit 113 extracts the dominant color tone of the image to be processed from the low-frequency region, specifically including:

[0128] For each pixel in the low-frequency region, the channel corresponding to the highest channel value of the pixel is used as the hue label of the pixel;

[0129] The color tone tag with the largest number is used as the main color tone of the image to be processed.

[0130] In some optional embodiments, the generation unit 114 sets image generation code based on the main color tone and the coordinates of the edge pixels, and runs the image generation code to obtain a background image, specifically including:

[0131] Based on the main color tone of the image to be processed, the color tone parameters in the preset code template are set, and based on the coordinates of the edge pixels, the contour parameters in the preset code template are set to obtain the image generation code;

[0132] Run the image generation code to obtain the background image.

[0133] In some optional embodiments, the generation unit 114 is further configured to:

[0134] The preset link address is used as the key, and the coordinates of the main color and the edge pixel are used as the value to construct a parameter mapping key-value pair, and the parameter mapping key-value pair is stored in the backup database.

[0135] like Figure 3 The diagram shown is a structural schematic of an electronic device provided in an embodiment of this application. The electronic device 1 includes a memory 12 and a processor 13. The memory 12 stores computer-readable instructions, and the processor 13 executes the computer-readable instructions stored in the memory to implement the artificial intelligence-based background image generation method of any of the above embodiments.

[0136] In an alternative embodiment, the electronic device 1 further includes a bus and a computer program stored in memory 12 and executable on processor 13, such as an AI-based background image generation program.

[0137] Figure 3 Only electronic device 1 with memory 12 and processor 13 is shown. It will be understood by those skilled in the art that... Figure 3 The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown, or combine certain components, or have different component arrangements.

[0138] Combination Figure 1The memory 12 in the electronic device 1 stores multiple computer-readable instructions to implement an artificial intelligence-based background image generation method, and the processor 13 can execute multiple instructions to achieve the following:

[0139] Parse cloud image resources to obtain the image to be processed;

[0140] The image to be processed is analyzed, and the high-frequency and low-frequency regions in the image to be processed are divided.

[0141] Mark edge pixels in the high-frequency region and record the coordinates of the edge pixels;

[0142] Extract the main color tone of the image to be processed from the low-frequency region;

[0143] The image generation code is set based on the main color tone and the coordinates of the edge pixels, and the image generation code is run to obtain the background image.

[0144] Specifically, the processor 13's implementation method for the above instructions can be found in [reference needed]. Figure 1 The descriptions of the relevant steps in the corresponding embodiments are not repeated here.

[0145] Those skilled in the art will understand that the schematic diagram is merely an example of electronic device 1 and does not constitute a limitation on electronic device 1. Electronic device 1 can be either a bus topology or a star topology. Electronic device 1 may also include more or fewer other hardware or software than shown in the diagram, or different component arrangements. For example, electronic device 1 may also include input / output devices, network access devices, etc.

[0146] It should be noted that electronic device 1 is only an example. Other existing or future electronic products that are suitable for this application should also be included within the scope of protection of this application and are incorporated herein by reference.

[0147] The memory 12 includes at least one type of readable storage medium, which can be non-volatile or volatile. The readable storage medium includes flash memory, portable hard drives, multimedia cards, card-type memory (e.g., SD or DX memory), magnetic storage, magnetic disks, optical disks, etc. In some embodiments, the memory 12 can be an internal storage unit of the electronic device 1, such as a portable hard drive of the electronic device 1. In other embodiments, the memory 12 can be an external storage device of the electronic device 1, such as a plug-in portable hard drive, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc., equipped on the electronic device 1. Furthermore, the memory 12 can include both internal storage units and external storage devices of the electronic device 1. The memory 12 can be used not only to store application software and various types of data installed on the electronic device 1, such as the code of an AI-based background image generation program, but also to temporarily store data that has been output or will be output.

[0148] In some embodiments, the processor 13 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 13 is the control unit of the electronic device 1, connecting various components of the electronic device 1 through various interfaces and lines. It executes programs or modules stored in the memory 12 (e.g., executing an AI-based background image generation program) and calls data stored in the memory 12 to perform various functions and process data in the electronic device 1.

[0149] The processor 13 executes the operating system of the electronic device 1 and various installed applications. The processor 13 executes these applications to implement the steps in the various embodiments of the artificial intelligence-based background image generation method described above, for example... Figure 1 The steps are shown.

[0150] For example, the computer program may be divided into one or more modules / units, which are stored in memory 12 and executed by processor 13 to complete this application. The one or more modules / units may be a series of computer-readable instruction segments capable of performing a specific function, which describe the execution process of the computer program in electronic device 1. For example, the computer program may be divided into an acquisition unit 110, a partitioning unit 111, a tagging unit 112, an extraction unit 113, and a generation unit 114.

[0151] The integrated unit implemented as a software functional module described above can be stored in a computer-readable storage medium. This software functional module, stored in a storage medium, includes several instructions to cause a computer device (which may be a personal computer, computer equipment, or network device, etc.) or processor to execute portions of the artificial intelligence-based background image generation method described in the various embodiments of this application.

[0152] If the modules / units integrated in electronic device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware devices. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above.

[0153] The computer program includes computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory, and other memory.

[0154] Furthermore, the computer-readable storage medium may primarily include a stored program area and a stored data area, wherein the stored program area may store the operating system, an application program required for at least one function, etc.; and the stored data area may store data created based on the use of blockchain nodes, etc.

[0155] The bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, in... Figure 3 The symbol is represented by only one arrow, but this does not indicate that there is only one bus or one type of bus. The bus is configured to enable communication between the memory 12 and at least one processor 13, etc.

[0156] This application also provides a computer-readable storage medium (not shown), which stores computer-readable instructions that are executed by a processor in an electronic device to implement the artificial intelligence-based background image generation method described in any of the above embodiments.

[0157] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices described in the specification may also be implemented by a single unit or device through software or hardware. Terms such as "first," "second," etc., are used to indicate names and do not indicate any specific order.

[0158] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application and are not intended to limit it. Although this application has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of this application without departing from the spirit and scope of the technical solutions of this application.

Claims

1. A background image generation method based on artificial intelligence, characterized in that, The method includes: Parse cloud image resources to obtain the image to be processed; The image to be processed is analyzed, and the high-frequency and low-frequency regions in the image to be processed are divided. Mark edge pixels in the high-frequency region and record the coordinates of the edge pixels; Extracting the dominant color tone of the image to be processed from the low-frequency region; wherein each pixel in the image to be processed contains multiple channel values, and extracting the dominant color tone of the image to be processed from the low-frequency region includes: determining the dominant color tone of the image to be processed based on the multiple channel values ​​of each pixel in the low-frequency region; Setting image generation code based on the main color tone and the coordinates of the edge pixels, and running the image generation code to obtain a background image, includes: setting a hue parameter in a preset code template based on the main color tone of the image to be processed, and setting a contour parameter in the preset code template based on the coordinates of the edge pixels to obtain image generation code; running the image generation code to obtain a background image; the hue parameter indicates information about the low-frequency region, and the contour parameter indicates information about the low-frequency region.

2. The background image generation method based on artificial intelligence as described in claim 1, characterized in that, The process of parsing cloud image resources to obtain the image to be processed specifically includes: Obtain bytecode data of cloud image resources based on preset link addresses; The bytecode data is converted into an image to be processed using a preset transcoding interface.

3. The background image generation method based on artificial intelligence as described in claim 1, characterized in that, The step of analyzing the image to be processed to divide the image into high-frequency and low-frequency regions specifically includes: Calculate the gray value of each pixel in the image to be processed, and calculate the average gray value of the image to be processed based on the gray value of each pixel; For each pixel in the image to be processed, the gradient between the gray value of the pixel and the gray values ​​of its neighboring pixels is calculated, and the average gradient of the pixel is calculated based on the gradient. All pixels whose gradient mean is greater than the grayscale mean of the image to be processed are defined as high-frequency regions of the image to be processed, and all pixels whose gradient mean is not greater than the grayscale mean are defined as low-frequency regions.

4. The background image generation method based on artificial intelligence as described in claim 1, characterized in that, The step of marking edge pixels in the high-frequency region and recording the coordinates of the edge pixels specifically includes: The horizontal and vertical difference values ​​of each pixel in the high-frequency region are calculated using a preset edge detection operator. The edge feature value of each pixel is calculated using the horizontal difference value and the vertical difference value, and the calculation method of the edge feature value satisfies the following relationship: Wherein, G represents the edge feature value of the pixel; The lateral difference value representing the pixel; The vertical difference value representing the pixel; For each pixel in the high-frequency region, if the edge feature value of the pixel is the maximum value in the neighborhood, then the pixel is marked as an edge pixel.

5. The background image generation method based on artificial intelligence as described in claim 1, characterized in that, Extracting the dominant color tone of the image to be processed from the low-frequency region specifically includes: For each pixel in the low-frequency region, the channel corresponding to the highest channel value of the pixel is used as the hue label of the pixel; The color tone tag with the largest number is used as the main color tone of the image to be processed.

6. The background image generation method based on artificial intelligence as described in claim 2, characterized in that, The method further includes: The preset link address is used as the key, and the coordinates of the main color and the edge pixel are used as the value to construct a parameter mapping key-value pair, and the parameter mapping key-value pair is stored in the backup database.

7. A background image generation device based on artificial intelligence, characterized in that, The device includes: The acquisition unit is used to parse cloud image resources and obtain the image to be processed; A segmentation unit is used to parse the image to be processed and segment the high-frequency region and low-frequency region in the image to be processed; A marking unit is used to mark edge pixels in the high-frequency region and record the coordinates of the edge pixels; An extraction unit is configured to extract the dominant color tone of the image to be processed from the low-frequency region; wherein each pixel in the image to be processed contains multiple channel values, and the extraction of the dominant color tone of the image to be processed from the low-frequency region includes: determining the dominant color tone of the image to be processed based on the channel values ​​of the pixels in the low-frequency region; The generation unit is configured to set image generation code based on the main color tone and the coordinates of the edge pixels, and run the image generation code to obtain a background image. The unit includes: setting a hue parameter in a preset code template based on the main color tone of the image to be processed, and setting a contour parameter in the preset code template based on the coordinates of the edge pixels to obtain image generation code; running the image generation code to obtain a background image; wherein the hue parameter indicates information about the low-frequency region, and the contour parameter indicates information about the low-frequency region.

8. An electronic device, characterized in that, The electronic device includes: Memory, which stores computer-readable instructions; and The processor executes computer-readable instructions stored in the memory to implement the artificial intelligence-based background image generation method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, which are executed by a processor in an electronic device to implement the artificial intelligence-based background image generation method as described in any one of claims 1 to 6.