Background image generation method, device, storage medium and electronic device
By obtaining the first image preferred by the user and the second image in the preset image library and performing color tuning processing, the problem that background images in the prior art are difficult to meet the personalized needs of users. The generated background images are pure and have clear themes, meeting the personalized needs of users and reducing costs.
Patent Information
- Application Number
- CN202010963262.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-14
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2040-09-14
AI Technical Summary
In the prior art, background images are difficult to meet the personalized needs of users, and the system comes with limited types of background styles, and the pictures selected by users often have shooting defects.
By acquiring the first image, finding the second image matching thereto in the preset image library, and color-tuning the second image according to the first image to generate a background image.
The generated background images meet the characteristics of pure background content and distinct themes, can meet users' personalized needs, and at the same time reduce the time and hardware cost of obtaining background images.
Smart Images

Figure CN114187371B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to a background image generating method, a background image generating device, a computer-readable storage medium and an electronic device. Background Art
[0002] With the development of intelligent terminal devices, users have higher and higher requirements for the aesthetics of devices. Among them, the background of the device display interface has a greater impact on the aesthetics, and users' requirements for the background are becoming more and more personalized and differentiated.
[0003] In the related art, background images usually come from two sources: one is the system's built-in background style, which generally includes solid color background, gradient color background, and simple pattern dynamically changing background; the other is the user's self-selected picture, such as the user selecting a picture in the album and setting it as the background. However, background images from these two sources have certain limitations: the types of background styles that come with the system are very limited; and the pictures in the user's album are mostly taken in daily life, which inevitably have shooting defects and are not suitable for backgrounds.
[0004] It can be seen that how to obtain a background image that meets the personalized needs of users is a technical problem that needs to be solved urgently. Summary of the invention
[0005] The present disclosure provides a background image generation method, a background image generation device, a computer-readable storage medium and an electronic device, thereby at least to a certain extent improving the problem in the related art that background images are difficult to meet the personalized needs of users.
[0006] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0007] According to a first aspect of the present disclosure, a background image generation method is provided, comprising: acquiring a first image; searching a preset image library for a second image matching the first image; and performing color adjustment on the second image according to the first image to generate a background image.
[0008] According to a second aspect of the present disclosure, a background image generating device is provided, comprising: an image acquisition module for acquiring a first image; an image matching module for searching a second image matching the first image in a preset image library; and a color processing module for performing color processing on the second image according to the first image to generate a background image.
[0009] According to a third aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the background image generation method of the first aspect and possible implementation methods thereof are implemented.
[0010] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the background image generation method of the above-mentioned first aspect and its possible implementation method by executing the executable instructions.
[0011] The technical solution disclosed in this disclosure has the following beneficial effects:
[0012] Taking the first image as a reference, search for a matching second image from a preset image library, and then perform color adjustment on the second image based on the first image, and use the adjusted second image as the background image. On the one hand, this solution proposes a new background image generation method that combines the features of the first image and the second image. The first image contains the user's preferences for image content and image color, and the second image is a standardized image suitable as a background without defects such as jitter and noise in image shooting. The background image thus generated meets the characteristics of pure background content and clear theme, and can meet the personalized needs of users, while bringing fun to changing the background. On the other hand, the implementation process of this solution is simple, and does not require users to perform a lot of operations or complex image processing, which reduces the time and hardware cost of obtaining background images.
[0013] In some embodiments of the present disclosure, a local area image may be captured from an original image to generate a first image, thereby ensuring the purity of content and the unity of subject matter of the first image and facilitating the generation of a high-quality background image.
[0014] In some embodiments of the present disclosure, the user may manually capture a local area image from the original image to ensure that the first image meets the user's preferences and improve the matching degree between the final background image and the user's personalized needs.
[0015] In some embodiments of the present disclosure, the above-mentioned original image can be obtained according to preset operations performed by the user, and the preset operations include controlling the camera to capture the original image, selecting the original image in the local image library or application, etc., so as to ensure that the original image meets the user's preferences.
[0016] In some embodiments of the present disclosure, the first image can be obtained through further target detection based on the above-mentioned local area image, thereby further improving the content purity and theme unity of the first image.
[0017] In some embodiments of the present disclosure, when performing target detection, all candidate boxes for each target can be merged to obtain the bounding box of each target, and the first image can be captured, thereby reducing the error of target detection, especially the impact of errors in target edge recognition, and improving the accuracy of the captured first image.
[0018] In some embodiments of the present disclosure, when performing target detection, the image of the largest bounding box portion can be captured as the first image, thereby ensuring that the first image represents the most important content in the above-mentioned local area image to more accurately match the user's preferences.
[0019] In some embodiments of the present disclosure, a second image matching the first image may be searched for based on the label of the first image, thereby improving the accuracy of the searched second image and simplifying the search process.
[0020] In some embodiments of the present disclosure, the primary tag of the first image can be identified, the secondary tag can be further identified under the primary tag, and the second image can be searched based on the secondary tag, thereby improving the accuracy of identifying the secondary tag and the matching degree between the first image and the second image.
[0021] In some embodiments of the present disclosure, the main color of the first image replaces the color of the target layer in the second image to achieve color adjustment, thereby obtaining an image with a color style very similar to that of the first image as the final background image, which is equivalent to combining the color of the first image with the content of the second image, and is more in line with user preferences.
[0022] In some embodiments of the present disclosure, the preset image library used to search for the second image may be a vector image library. Since vector graphics may present a style of flat illustrations, they are suitable for forming a flat background image.
[0023] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0025] Figure 1 A schematic diagram showing a system architecture in this exemplary embodiment;
[0026] Figure 2A structural diagram of an electronic device according to the exemplary embodiment is shown;
[0027] Figure 3 A flowchart of a background image generating method in this exemplary embodiment is shown;
[0028] Figure 4 A flowchart showing generation of a first image in this exemplary embodiment is shown;
[0029] Figure 5 A flowchart of capturing a first image in this exemplary embodiment is shown;
[0030] Figure 6 A schematic diagram showing the generation of a first image in this exemplary embodiment;
[0031] Figure 7 A flowchart for searching for a second image in this exemplary embodiment is shown;
[0032] Figure 8 A schematic diagram showing image recognition processing performed in this exemplary embodiment;
[0033] Fig. 9 A structural block diagram of a background image generating device in this exemplary embodiment is shown. DETAILED DESCRIPTION
[0034] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0035] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0036] The background image of a mobile phone generally includes the lock screen background and the desktop background, which is one of the most common contents that users see when using their mobile phones on a daily basis; various background images also appear on smart wearable devices, such as the dial image of a smart watch, which can even remain always on, making the smart watch a decoration. It can be seen that the background image has a great impact on the user's perception of beauty.
[0037] An exemplary embodiment of the present disclosure provides a background image generation method, and the generated background image can be applied to: a lock screen background or desktop background of a mobile phone or tablet computer, a dial image of a smart watch, a background used for a device screen saver, and the like.
[0038] Figure 1 FIG. 1 is a schematic diagram showing a system architecture of an exemplary embodiment of the present disclosure. Figure 1 As shown, the system architecture 100 may include: a terminal device 110 and a server 120. The terminal device 110 may be a mobile phone, a tablet computer, a digital camera, a personal computer, a smart wearable device, etc. The method provided in the embodiment of the present disclosure may be executed by the terminal device 110 alone, for example, after the terminal device 110 captures an image, a background image is generated by executing a background image generation method; the method provided in the embodiment of the present disclosure may also be executed by the server 120, for example, after the terminal device 110 captures an image, the image is transmitted to the server 120, and the server 120 generates a background image by executing a background image generation method, and returns the background image to the terminal device 110 for display. The present disclosure does not limit this.
[0039] The exemplary embodiment of the present disclosure also provides an electronic device for implementing the above-mentioned background image generation method. The electronic device may be Figure 1 The terminal device 110 or the server 120 in the embodiment of the present invention comprises at least a processor and a memory, wherein the memory is used to store executable instructions of the processor and application data such as image data, etc. The processor is configured to execute the background image generation method by executing the executable instructions.
[0040] Below Figure 2 Taking the mobile terminal 200 in the example, the structure of the above electronic device is exemplarily described. It should be understood by those skilled in the art that, in addition to the components specifically used for mobile purposes, Figure 2 The construction in can also be applied to fixed type equipment.
[0041] like Figure 2As shown, the mobile terminal 200 may specifically include: a processor 210, an internal memory 221, an external memory interface 222, a USB (Universal Serial Bus) interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 250, a wireless communication module 260, an audio module 270, a speaker 271, a receiver 272, a microphone 273, an earphone interface 274, a sensor module 280, a display screen 290, a camera module 291, an indicator 292, a motor 293, a button 294 and a subscriber identification module (Subscriber Identification Module, SIM) card interface 295, etc.
[0042] The processor 210 may include one or more processing units, for example, the processor 210 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, an encoder, a decoder, a digital signal processor (DSP), a baseband processor and / or a neural network processor (NPU), etc. Among them, the AP, GPU, etc. can perform processing on image data, such as target detection and recognition processing on the image.
[0043] The encoder can encode (i.e. compress) the image or video data. For example, the mobile terminal 200 compresses the captured image and transmits the compressed data to the server to reduce the bandwidth occupied by the data transmission. The decoder can decode (i.e. decompress) the encoded image or video data to restore the image or video. The mobile terminal 200 can support one or more encoders and decoders. In this way, the mobile terminal 200 can process images or videos in a variety of encoding formats, such as: JPEG (Joint Photographic Experts Group), PNG (Portable Network Graphics), BMP (Bitmap) and other image formats, MPEG (Moving Picture Experts Group) 1, MPEG2, H.263, H.264, HEVC (High Efficiency Video Coding) and other video formats.
[0044] In some implementations, the processor 210 may include one or more interfaces, and may be connected to other components of the mobile terminal 200 via different interfaces.
[0045] The external memory interface 222 can be used to connect an external memory card. The internal memory 221 can be used to store computer executable program codes, and can also store data (such as images, videos) created during the use of the mobile terminal 200.
[0046] The USB interface 230 is an interface that complies with USB standard specifications and can be used to connect a charger to charge the mobile terminal 200, or to connect headphones or other electronic devices.
[0047] The charging management module 240 is used to receive charging input from a charger. While the charging management module 240 is charging the battery 242, it can also power the device through the power management module 241; the power management module 241 can also monitor the status of the battery.
[0048] The wireless communication function of the mobile terminal 200 can be implemented by antenna 1, antenna 2, mobile communication module 250, wireless communication module 260, modulation and demodulation processor and baseband processor. Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. The mobile communication module 250 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the mobile terminal 200. The wireless communication module 260 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (BT), Global Navigation Satellite System (GNSS), Frequency Modulation (FM), Near Field Communication (NFC), infrared technology (IR) and the like applied to the mobile terminal 200.
[0049] The mobile terminal 200 can realize the display function through the GPU, the display screen 290 and the application processor, and can realize the shooting function through the ISP, the camera module 291, the encoder, the decoder, the GPU, the display screen 290 and the application processor, and can also realize the audio function through the audio module 270, the speaker 271, the receiver 272, the microphone 273, the headphone jack 274 and the application processor.
[0050] The sensor module 280 may include a depth sensor 2801 , a pressure sensor 2802 , a gyro sensor 2803 , an air pressure sensor 2804 , and the like.
[0051] Indicator 292 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc. Motor 293 may generate vibration prompts, and may also be used for touch vibration feedback, etc. Buttons 294 include a power button, a volume button, etc.
[0052] The mobile terminal 200 may support one or more SIM card interfaces 295 for connecting to SIM cards.
[0053] Figure 3 An exemplary process of a background image generation method is shown, which may include the following steps S310 to S330:
[0054] Step S310, acquiring a first image;
[0055] Step S320, searching a preset image library for a second image that matches the first image;
[0056] Step S330, performing color adjustment on the second image according to the first image to generate a background image.
[0057] Through the above method, taking the first image as a reference, searching for a matching second image from a preset image library, and then coloring the second image according to the first image, and using the toned second image as the background image. On the one hand, this exemplary embodiment proposes a new background image generation method, which combines the features of the first image and the second image. The first image contains the user's preferences for image content and image color, and the second image is a standardized image suitable as a background, without defects such as jitter and noise in image shooting. The background image thus generated meets the characteristics of pure background content and clear theme, and can meet the personalized needs of users, while bringing fun to changing the background. On the other hand, the implementation process of this solution is simple, does not require the user to perform a lot of operations, and does not require complex image processing, which reduces the time and hardware cost of obtaining the background image.
[0058] Below Figure 3 Provide detailed instructions for each step.
[0059] In step S310, a first image is acquired.
[0060] The first image refers to a reference image used to generate a background image, which is usually an image subjectively specified by the user, reflecting the user's preferences for image content and image color. The first image includes but is not limited to: images taken by the user; images selected by the user in the terminal device, such as images downloaded from the Internet, images in the album, etc.; images obtained after certain processing of the images taken or selected by the user. The first image can be any type of image, such as a person image, a landscape image, a building image, etc.
[0061] In an optional embodiment, reference Figure 4 As shown, step S310 may include the following steps S410 and S420:
[0062] Step S410, determining at least one local area image from the original image;
[0063] Step S420: generating a first image according to the local area image.
[0064] The original image is the initial image used to generate the first image. It can be an image taken or selected by the user, or an image automatically specified by the system, for example:
[0065] In response to the user's preset operation, the original image is obtained. The preset operation may include: controlling the camera to capture the original image, such as the user opens the photo taking interface, using the preview image captured by the camera as the original image, or taking an image as the original image; selecting the original image in the local image library or application, the local image library is another image library different from the above preset image library, such as the album on the mobile phone, specifically, the user can select an image in the local album of the mobile phone as the original image, or select an image in the application (images sent by other users, images in the program page, etc.) as the original image, etc. In this way, it is ensured that the original image meets the user's preferences.
[0066] The user can set the theme switching rules for the background image, such as switching according to time, weather, etc. In this way, the system can obtain a matching original image according to the current time, weather, etc. For example, if it is August 20, 2020, the image taken on August 20, 2019 can be used as the original image; if it is a rainy day, you can search for rain-themed images on the Internet or rain-related images in the album as the original image, etc. In this way, the original image can be automatically selected, simplifying the user operation.
[0067] Figure 4In fact, the original image is captured, and the first image is generated according to the captured local area image. Since the original image usually contains more image content, by capturing the local area image from the original image, an image with relatively pure content and a single theme can be obtained.
[0068] In an optional implementation, at least one local area image may be determined in response to a region selection operation performed by a user in the original image. The region selection operation refers to the user selecting (generally a rectangular frame) a local area in the original image, that is, allowing the user to manually take a screenshot in the original image, and supporting the user to capture multiple local area images at the same time, so that the user can capture the local area image he likes as a reference for the subsequent generation of the background image.
[0069] In an optional implementation, the original image may be subjected to content recognition to segment the local region image, for example, the foreground portion may be identified from the original image and the local region image where the foreground portion is located may be captured.
[0070] After the local area image is obtained, it can be directly used as the first image, or it can be further processed to obtain the first image.
[0071] In an optional embodiment, reference Figure 5 As shown, step S420 may include the following steps S510 and S520:
[0072] Step S510, performing target detection on the local area image to obtain a bounding box of each target in the local area image;
[0073] Step S520: capturing an image of the bounding box as a first image.
[0074] The target can be any identifiable object in the image, such as plants, buildings, vehicles, etc. Generally, when users manually capture local area images, there may be errors, causing the local area images to contain irrelevant elements other than the target. Figure 5After processing the local area image by the method, a pure image of the target can be obtained. Target detection can be achieved through algorithm models such as YOLO (YouOnly Look Once, a real-time target detection algorithm, including versions such as v1, v2, and v3, and the present disclosure can use any version), SSD (Single Shot MultiBox Detector, single-step multi-box target detection), etc., and the bounding box (Bounding Box, or bounding box) of the target is output in the local area image. The image in the bounding box is intercepted to obtain the first image, which is equivalent to taking a more detailed screenshot based on the local area image to obtain the first image with the target as the main content, thereby improving the accuracy of the first image and reducing the interference caused by irrelevant content to subsequent processing.
[0075] It should be noted that when the local area image contains multiple targets, the bounding box of each target can be output separately. On this basis, each bounding box can be screenshotted separately, so as to obtain multiple first images; these bounding boxes can also be screened, for example: only the image of the bounding box with the largest area is intercepted as the first image, that is, only one first image is generated; the bounding boxes with an area greater than a certain threshold are retained, and their images are intercepted as the first image; the user is allowed to manually select one or more bounding boxes from all bounding boxes, and their images are intercepted as the first image, etc. This disclosure does not limit this.
[0076] In an optional implementation, step S510 may be implemented in the following manner:
[0077] Performing target detection on the local area image and generating candidate boxes for each target in the local area image;
[0078] The candidate boxes of the same target are merged to obtain the bounding boxes of each target in the local area image.
[0079] When detecting objects in an image, algorithms such as NMS (Non-Maximum Suppression) can be used to make the detection frame traverse the entire image and select the optimal or locally optimal detection frame in the image, i.e., the candidate frame. For the same object, more than one candidate frame may be obtained, which is usually caused by errors in the recognition of the object edge. In particular, for objects with unobtrusive edge features, the number of candidate frames is generally large.
[0080] Based on this, the candidate boxes of the same target can be merged to obtain the final bounding box, thereby improving the accuracy of the bounding box and the first image. The present disclosure does not limit the specific merging method of the candidate boxes. For example, the maximum merge can be used, that is, among the corner points of each candidate box, the smallest horizontal coordinate and the smallest vertical coordinate are selected to form the lower left corner point, and the largest horizontal coordinate and the largest vertical coordinate are selected to form the upper right corner point. The line connecting the lower left corner point and the upper right corner point is used as the diagonal line to determine the rectangular area, that is, the bounding box of the target; the average merge can also be used, that is, the lower left corner point of each candidate box is averaged, and the upper right corner point of each candidate box is averaged, and the line connecting the two average points is used as the diagonal line to determine the rectangular area, that is, the bounding box of the target.
[0081] Figure 6 The process of target detection using the MobileNet-SSD network (a lightweight SSD network model for mobile terminals) as an example is shown, including:
[0082] Input the local area image into the MobileNet-SSD network to generate multiple candidate boxes of different sizes;
[0083] The network extracts features from the image. Specifically, it extracts features from each candidate frame image and identifies them, excludes candidate frames in the background, and optimizes the position and size of the candidate frames containing the target.
[0084] Determine the candidate box containing the target. Usually, one target may correspond to multiple candidate boxes.
[0085] Merge the candidate boxes of the same target to obtain the bounding box corresponding to each target;
[0086] The image of the bounding box is intercepted to obtain a first image.
[0087] Continue to refer Figure 3 In step S320, a second image matching the first image is searched in a preset image library.
[0088] Among them, the preset image library is a pre-established standardized image library. The standardization here mainly refers to the image content being pure, the theme being single, the style being distinct, and the absence of defects such as jitter and noise in daily photographed images, which is suitable as a background image. In this exemplary embodiment, preset image libraries of different styles may be established, such as an illustration-style image library, an animation-style image library, a real-shot landscape image library, and the like. In an optional embodiment, the preset image library may include a vector image library, such as an image library formed by images in SVG (Scalable Vector Graphics) format, and the vector graphics may present the style of a flat illustration, which is particularly suitable for forming a flat background image.
[0089] Since the first image may have various defects, such as noise, impure content, unclear image, etc., searching for a matching second image in the preset image library is equivalent to replacing the first image with a "defect-free" standardized image.
[0090] In an optional implementation, the similarity between the first image and the images in the preset image library can be calculated, and the image with the highest similarity can be determined as the second image matching the first image. For example, the SSIM (Structural SIMilarity) between the first image and the images in the preset image library can be calculated; or features can be extracted from the first image and the images in the preset image library respectively, and then the cosine similarity or Euclidean distance of the two feature vectors can be calculated.
[0091] In an optional embodiment, reference Figure 7 As shown, step S320 may include the following steps S710 and S720:
[0092] Step S710, performing recognition processing on the first image to obtain a label of the first image;
[0093] Step S720: Search a preset image library for at least one image corresponding to the label of the first image as the second image.
[0094] The image recognition process can be implemented by an image classification algorithm, such as a MobileNet classifier, and the obtained label is the category label for classifying the first image. Thus, images with the same label are screened out in the preset image library, and the second image is searched therein (such as by searching based on image similarity), that is, the second image should belong to the same category as the first image. This can narrow the scope of searching for the second image in the preset image library and improve the accuracy of the search result.
[0095] In an optional implementation, in order to achieve more accurate search, multiple levels of labels can be set for the image, from coarse classification to fine classification. For example, the first image can include a primary label and a secondary label. When performing recognition processing, the first image can be subjected to a first-level recognition processing to obtain a primary label of the first image; then, under the primary label, the first image can be subjected to a second-level recognition processing to obtain a secondary label of the first image.
[0096] by Figure 8For example, the local area image is input into MobileNet-SSD, the bounding box of the target is determined, and a screenshot is taken to obtain two first images; the first images are respectively input into MobileNet-Classfication (image classifier based on MobileNet structure), and the first level recognition processing is first performed to obtain the first level labels, such as "container" and "plant", and then the second level recognition processing is performed under the first level labels to obtain the second level labels, such as "flower pot" and "green radish". It should be noted that when performing the second level recognition processing, the first level label is equivalent to prior information, which helps to improve the accuracy of the second level recognition processing. Alternatively, different sub-networks are used for the second level recognition processing, and each sub-network corresponds to a first level label. When the first level labels are different, the sub-networks used are also different, thereby achieving more targeted recognition processing.
[0097] Based on the above division and identification of the multi-level labels, the last level label of the first image is obtained, such as the second level label. When searching for the second image, at least one image corresponding to the last level label of the first image can be searched in the preset image library. Figure 8 Taking the “green radish” image in the video as an example, after identifying its secondary label “green radish”, images with the label “green radish” can be filtered out in the preset image library to further obtain the second image.
[0098] Continue to refer Figure 3 In step S330, the second image is toned according to the first image to generate a background image.
[0099] In short, the hue of the first image is applied to the second image. For example, the green color of the green radish in the first image is different from the green leaves in the second image, and the green in the second image can be replaced by the green in the first image, which is more in line with the user's preferences.
[0100] In an optional implementation, step S330 may include:
[0101] According to the number of main colors of the first image, determining the same number of layers in the second image as target layers in the second image;
[0102] Replaces the color of the target layer in the second image with the dominant color of the first image.
[0103] The main color of the first image may be one or more colors with the highest proportion (referring to the pixel ratio) in the first image. For example, one color with the highest proportion is selected as the main color; or three colors with the highest proportion are selected as the main colors; or multiple colors with a proportion of more than 20% are selected as the main colors, etc., which are not limited in the present disclosure.
[0104] The target layer in the second image can be a main layer in the second image, such as a layer in the foreground. In vector graphics, an image is generally formed by superimposing multiple layers, and different layers are arranged in order from foreground to background. One or more layers arranged in the front can be selected as the target layer.
[0105] After determining the main color of the first image and the target layer of the second image, the main color may be filled into the target layer to replace the original color of the target layer.
[0106] In an optional implementation, the color adjustment process may include:
[0107] sorting the main colors according to the proportions of the main colors of the first image in the first image;
[0108] determining the order of the target layer in the second image;
[0109] The corresponding relationship between the primary colors and the target layer is determined according to the order of the primary colors and the order of the target layer, and each primary color is used to replace the color of the corresponding target layer.
[0110] For example, three main colors are extracted from the first image, and recorded as main color 1, main color 2, and main color 3 in descending order of the proportion of the main colors; in the second image, the three layers in the front row are selected as target layers, and recorded as layer 1, layer 2, and layer 3 in order; then all the colors in layer 1 are replaced with main color 1, all the colors in layer 2 are replaced with main color 2, and all the colors in layer 3 are replaced with main color 3. In this way, an image with a color style very similar to that of the first image is obtained as the final background image, which is equivalent to combining the color of the first image with the content of the second image, and is more in line with user preferences.
[0111] The exemplary embodiment of the present disclosure also provides a background image generating device. Fig. 9 As shown, the background image generating device 900 may include:
[0112] An image acquisition module 910, configured to acquire a first image;
[0113] An image matching module 920 is used to search a preset image library for a second image that matches the first image;
[0114] The color adjustment processing module 930 is used to perform color adjustment on the second image according to the first image to generate a background image.
[0115] In an optional implementation, the image acquisition module 910 is configured to:
[0116] determining at least one local region image from the original image;
[0117] A first image is generated according to the local area image.
[0118] In an optional implementation, the image acquisition module 910 is configured to:
[0119] In response to a preset operation of the user, the original image is acquired.
[0120] In an optional implementation, the preset operation includes: controlling a camera to capture an original image, or selecting an original image in a local image library or an application.
[0121] In an optional implementation, the image acquisition module 910 is configured to:
[0122] In response to a region selection operation performed by a user in an original image, at least one local region image is determined.
[0123] In an optional implementation, the image acquisition module 910 is configured to:
[0124] Performing target detection on the local area image to obtain the bounding box of each target in the local area image;
[0125] An image of the bounding box is captured as the first image.
[0126] In an optional implementation, the image acquisition module 910 is configured to:
[0127] Performing target detection on the local area image and generating candidate boxes for each target in the local area image;
[0128] The candidate boxes of the same target are merged to obtain the bounding boxes of each target in the local area image.
[0129] In an optional implementation, the image acquisition module 910 is configured to:
[0130] The image of the bounding box with the largest area is intercepted and used as the first image.
[0131] In an optional implementation, the image matching module 920 is configured to:
[0132] Performing recognition processing on the first image to obtain a label of the first image;
[0133] At least one image corresponding to the label of the first image is searched in a preset image library as the second image.
[0134] In an optional implementation, the label of the first image includes a primary label and a secondary label. The image matching module 920 is configured to:
[0135] Performing a first-level recognition process on the first image to obtain a first-level label of the first image;
[0136] Under the primary label, the second level recognition processing is performed on the first image to obtain the secondary label of the first image.
[0137] In an optional implementation, the image matching module 920 is configured to:
[0138] At least one image corresponding to the secondary tag of the first image is searched in a preset image library.
[0139] In an optional implementation, the color adjustment processing module 930 is configured to:
[0140] According to the number of main colors of the first image, determining the same number of layers in the second image as target layers in the second image;
[0141] Replaces the color of the target layer in the second image with the dominant color of the first image.
[0142] In an optional implementation, the color adjustment processing module 930 is configured to:
[0143] sorting the main colors according to the proportions of the main colors of the first image in the first image;
[0144] determining the order of the target layers in the second image;
[0145] The corresponding relationship between the primary colors and the target layer is determined according to the order of the primary colors and the order of the target layer, and each primary color is used to replace the color of the corresponding target layer.
[0146] In an optional implementation, the preset image library includes a vector image library.
[0147] The specific details of each part of the above device have been described in detail in the implementation method part, so they will not be repeated here.
[0148] The exemplary embodiments of the present disclosure further provide a computer-readable storage medium, which can be implemented in the form of a program product, including program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present disclosure described in the above “Exemplary Method” section of this specification, for example, to execute Figure 3 , Figure 4 , Figure 5 or Figure 7The program product may be in the form of a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto, and in this document, a readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.
[0149] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0150] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0151] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0152] Program codes for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as an independent software package, partially on the user computing device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet). It will be appreciated by those skilled in the art that various aspects of the present disclosure may be implemented as a system, method, or program product. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or an implementation combining hardware and software aspects, which may be collectively referred to as a "circuit", "module", or "system" herein.
[0153] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and embodiments are to be regarded as exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
[0154] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A background image generation method, characterized in that: include: acquiring a first image; Searching for a second image matching the first image in a preset image library; Performing color adjustment on the second image according to the first image to generate a background image; Generating the background image includes: using the toned second image as the background image; The color adjustment process of the second image according to the first image includes: According to the number of main colors of the first image, determining the same number of layers in the second image as target layers in the second image; Using the main color of the first image, replacing the color of the target layer in the second image; The using the main color of the first image to replace the color of the target layer in the second image includes: sorting the main colors according to the proportions of the main colors of the first image in the first image; Determining the order of the target layer in the second image; The correspondence between the primary colors and the target layer is determined according to the order of the primary colors and the order of the target layer, and each primary color is used to replace the corresponding color of the target layer.
2. The method according to claim 1, characterized in that: The acquiring of the first image comprises: determining at least one local region image from the original image; The first image is generated according to the local area image.
3. The method according to claim 2, characterized in that The method further comprises: In response to a preset operation of the user, the original image is acquired.
4. The method according to claim 3, characterized in that The preset operation includes: controlling a camera to acquire the original image, or selecting the original image in a local image library or an application.
5. The method according to claim 2, characterized in that: The step of determining at least one local area image from the original image comprises: In response to a region selection operation performed by a user in an original image, at least one local region image is determined.
6. The method according to claim 2, characterized in that The step of generating the first image according to the local area image comprises: Performing target detection on the local area image to obtain a bounding box of each target in the local area image; An image of the bounding box is captured as the first image.
7. The method according to claim 6, characterized in that The performing target detection on the local area image to obtain a bounding box of each target in the local area image includes: Performing target detection on the local area image to generate candidate frames for each target in the local area image; The candidate boxes of the same object are merged to obtain the bounding boxes of each object in the local area image.
8. The method according to claim 6, characterized in that The capturing of the image of the bounding box as the first image includes: An image of a bounding box with the largest area is intercepted and used as the first image.
9. The method according to claim 1, characterized in that: The step of searching a preset image library for a second image matching the first image includes: Performing recognition processing on the first image to obtain a label of the first image; At least one image corresponding to the label of the first image is searched in a preset image library as the second image.
10. The method according to claim 9, characterized in that The label of the first image includes a primary label and a secondary label; The performing recognition processing on the first image to obtain a label of the first image includes: Performing a first-level recognition process on the first image to obtain a first-level label of the first image; Under the primary label, a second level recognition process is performed on the first image to obtain a secondary label of the first image.
11. The method according to claim 10, characterized in that The searching a preset image library for at least one image corresponding to the label of the first image includes: At least one image corresponding to the secondary tag of the first image is searched in a preset image library.
12. The method according to any one of claims 1 to 11, characterized in that: The preset image library includes a vector image library.
13. A background image generating device, characterized in that: include: An image acquisition module, used for acquiring a first image; An image matching module, used for searching a preset image library for a second image matching the first image; A color adjustment processing module, used for performing color adjustment on the second image according to the first image to generate a background image; the generating of the background image is configured to: use the color adjusted second image as the background image; The color adjustment process of the second image according to the first image is configured as follows: According to the number of main colors of the first image, determining the same number of layers in the second image as target layers in the second image; Using the main color of the first image, replacing the color of the target layer in the second image; The method of replacing the color of the target layer in the second image with the main color of the first image is configured as follows: sorting the main colors according to the proportions of the main colors of the first image in the first image; Determining the order of the target layer in the second image; The correspondence between the primary colors and the target layer is determined according to the order of the primary colors and the order of the target layer, and each primary color is used to replace the corresponding color of the target layer.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 12 is implemented.
15. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 12 by executing the executable instructions.
Citation Information
Patent Citations
Character picture color style converting method based on face semantic analysis
CN104732506A
Sky Editing Based On Image Composition
US20180374199A1