Image processing method and device, computer equipment and computer readable storage medium
By performing portrait segmentation and fusion processing on multiple exposure images, the problem of image background superposition is solved and the fusion effect of multiple exposure images is improved.
Patent Information
- Application Number
- CN202410943899.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2024-11-08
AI Technical Summary
When existing terminal devices take photos with multiple exposures, the background part of the image is superimposed many times, resulting in poor fusion effect.
By acquiring two images with different exposures, performing portrait segmentation processing, and fusing the segmented image with the original image, determining the fusion area for pixel value weighting, and generating a target image.
It avoids multiple superposition of the background part of the image and improves the fusion effect of multiple exposure images.
Smart Images

Figure CN118921566A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image processing method, apparatus, computer equipment and computer-readable storage medium. Background Art
[0002] Multiple exposure is a photography technique that uses two or more independent exposures and then overlaps them to form a single photo. Many existing terminal devices have multiple exposure photography functions. However, after existing terminal devices obtain multiple independently exposed images, they directly overlap the multiple images, resulting in multiple overlaps of the background parts of the multiple images, and the fusion effect of the multiple exposure images is poor. Summary of the invention
[0003] The embodiments of the present application provide an image processing method, an apparatus, a computer device, and a computer-readable storage medium, which can improve the fusion effect of multiple exposure images.
[0004] The technical solution adopted by the present invention to solve the problem is as follows:
[0005] In one aspect, the present application provides an image processing method, comprising:
[0006] Acquire a first image and a second image; the exposure amount of the first image is less than the exposure amount of the second image;
[0007] Performing portrait segmentation processing on the second image to obtain a portrait segmentation image;
[0008] The portrait segmentation image and the first image are fused to obtain a target image.
[0009] In some embodiments of the present application, the first image is obtained by the following steps:
[0010] Acquiring a first preview image including the photographed object through an imaging module;
[0011] receiving a first adjustment instruction for a first preview image, and determining a first shooting parameter based on the first adjustment instruction; the first shooting parameter includes a first focal distance, and the first focal distance is less than a preset distance threshold;
[0012] Adjust the first preview image based on the first shooting parameter to obtain a second preview image;
[0013] In response to the first shooting instruction, a first image is generated based on the second preview image.
[0014] In some embodiments of the present application, the second image is obtained by the following steps:
[0015] receiving a second adjustment instruction for the second preview image, and determining a second shooting parameter based on the second adjustment instruction; the second shooting parameter includes a second focal length, and the second focal length is greater than the first focal length;
[0016] Adjust the second preview image based on the second shooting parameter to obtain a third preview image;
[0017] In response to the second shooting instruction, a second image is generated based on the third preview image.
[0018] In some embodiments of the present application, the first shooting parameter also includes a first preview magnification and a first exposure, and the second shooting parameter also includes a second preview magnification and a second exposure; wherein the first preview magnification is greater than the second preview magnification, and the first exposure is less than the second exposure.
[0019] In some embodiments of the present application, performing portrait segmentation processing on the second image to obtain a portrait segmentation image includes:
[0020] Inputting the second image into the portrait segmentation model to perform portrait segmentation processing to obtain a portrait mask image of the second image;
[0021] The second image is segmented based on the portrait mask image to obtain a portrait segmentation image.
[0022] In some embodiments of the present application, the portrait segmentation image and the first image are fused to obtain a target image, including:
[0023] Determine a fusion area of the first image; the fusion area includes a plurality of first pixel points, the portrait segmentation image includes a plurality of second pixel points, and the plurality of second pixel points correspond to the plurality of first pixel points respectively;
[0024] Performing weighted processing on the pixel value of each first pixel point and the pixel value of the second pixel point corresponding to each first pixel point to obtain a target pixel value corresponding to each first pixel point;
[0025] Adjusting the pixel values of the plurality of first pixel points based on the target pixel value to obtain an adjusted first image;
[0026] The adjusted first image is determined as the target image.
[0027] In some embodiments of the present application, determining the fusion area of the first image includes:
[0028] Determining pixel position information of the portrait segmentation image in the second image based on the portrait mask image of the second image;
[0029] Based on the pixel position information and the position mapping information, a fusion area of the first image is determined; the position mapping information represents a position mapping relationship between pixel points in the first image and pixel points in the second image.
[0030] In a second aspect, an embodiment of the present invention further provides an image processing device, including:
[0031] An image acquisition module, used to acquire a first image and a second image; the exposure amount of the first image is less than the exposure amount of the second image;
[0032] An image segmentation module, used for performing portrait segmentation processing on the second image to obtain a portrait segmentation image;
[0033] The image fusion module is used to fuse the portrait segmentation image and the first image to obtain a target image.
[0034] In a third aspect, the present application further provides a computer device, the computer device comprising:
[0035] one or more processors;
[0036] Memory; and
[0037] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement any image processing method in the first aspect.
[0038] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and the computer program is loaded by a processor to execute the steps in any one of the image processing methods in the first aspect.
[0039] The beneficial effects of the present invention are as follows: by performing portrait segmentation processing on the second image to obtain a portrait segmentation image, and performing fusion processing on the portrait segmentation image and the first image to obtain a target image, multiple superpositions of the background parts of the first image and the second image can be avoided, thereby improving the fusion effect of multiple exposure images. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0041] Figure 1 is a schematic diagram of a scene of an image processing system provided by an embodiment of the present invention;
[0042] Figure 2is a flowchart of an image processing method provided by an embodiment of the present invention;
[0043] Figure 3 is a schematic diagram of a target image obtained by using the image processing method provided by an embodiment of the present invention;
[0044] Figure 4 is a schematic diagram of a specific embodiment flow of performing portrait segmentation processing on the second image provided by an embodiment of the present invention;
[0045] Figure 5 It is a schematic diagram of a specific embodiment flow of fusing a portrait segmentation image and a first image provided by an embodiment of the present invention;
[0046] Figure 6 is a principle block diagram of an image processing device provided by an embodiment of the present invention;
[0047] Figure 7 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0049] In the description of the present application, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, which are only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present application. In addition, the terms "first", "second", "third" and the like are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first", "second", "third" and the like may explicitly or implicitly include one or more of the features. In the description of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0050] In this application, the word "exemplary" is used to mean "used as an example, illustration, or description." Any embodiment described in this application as "exemplary" is not necessarily to be construed as being preferred or advantageous over other embodiments. The following description is given to enable any technician in the field to implement and use the present application. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the present application can be implemented without using these specific details. In other instances, well-known structures and processes will not be elaborated in detail to avoid obscuring the description of the present application with unnecessary details. Therefore, the present application is not intended to be limited to the embodiments shown, but is consistent with the widest scope consistent with the principles and features disclosed in the present application.
[0051] The embodiments of the present application provide an image processing method, apparatus, computer device, and computer-readable storage medium, which are described in detail below.
[0052] See also Figure 1 , Figure 1 Schematic diagram of a scene of an image processing system provided in an embodiment of the present application. The image processing system may include a computer device 100, in which an image processing device is integrated, such as Figure 1 Computer equipment in.
[0053] In the embodiment of the present application, the computer device 100 is mainly used to obtain a first image and a second image; the exposure of the first image is less than the exposure of the second image; the second image is subjected to portrait segmentation processing to obtain a portrait segmentation image; the portrait segmentation image and the first image are fused to obtain a target image, which can improve the fusion effect of multiple exposure images.
[0054] In the embodiment of the present application, the computer device 100 may be an independent server, or a server network or server cluster composed of servers. For example, the computer device 100 described in the embodiment of the present application includes but is not limited to a computer, a network host, a single network server, a plurality of network server sets or a cloud server composed of a plurality of servers. The cloud server is composed of a large number of computers or network servers based on cloud computing.
[0055] It is understandable that the computer device 100 used in the embodiments of the present application may be a device including both receiving and transmitting hardware, that is, a device having receiving and transmitting hardware capable of performing two-way communication on a two-way communication link. Such a device may include: a cellular or other communication device having a single-line display or a multi-line display or a cellular or other communication device without a multi-line display. The specific computer device 100 may be a desktop terminal or a mobile terminal, and the computer device 100 may also be one of a smart TV, a mobile phone, a tablet computer, a laptop computer, etc.
[0056] Those skilled in the art will understand that Figure 1 The application environment shown in the figure is only one application scenario of the present application solution and does not constitute a limitation on the application scenario of the present application solution. Other application environments may also include Figure 1 More or less computer equipment as shown in Figure 1 Only one computer device is shown in the figure. It can be understood that the image processing system can also include one or more other services, which are not specifically limited here.
[0057] In addition, if Figure 1 As shown, the image processing system may further include a memory 200 for storing data, such as shooting parameters, such as first shooting parameters, second shooting parameters, etc., such as image data, such as first image, second image, portrait segmentation image, etc.
[0058] It should be noted that Figure 1 The scene diagram of the image processing system shown is only an example. The image processing system and scene described in the embodiment of the present application are intended to more clearly illustrate the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided in the embodiment of the present application. Ordinary technicians in this field can know that with the evolution of the image processing system and the emergence of new business scenarios, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.
[0059] like Figure 2 FIG. 2 is a flow chart of an embodiment of an image processing method in an embodiment of the present application. The image processing method may include the following steps S201 to S203, which are as follows:
[0060] Step S201, acquiring a first image and a second image; the exposure amount of the first image is less than the exposure amount of the second image.
[0061] In a specific embodiment, the first image and the second image may be images acquired by an imaging module configured by the computer device itself, or may be images acquired by an imaging module of other electronic devices through a network, Bluetooth, infrared, etc., and this embodiment does not limit this. For example, when the image processing method of the present application is applied to a smart phone, the smart phone can directly acquire the first image and the second image through the imaging module configured by itself. When the image processing method of the present application is applied to a server, the server can acquire the first image and the second image through the imaging module of the smart phone, and acquire the first image and the second image from the smart phone through a network, Bluetooth, infrared, etc.
[0062] Furthermore, the first image and the second image may be images captured by the same imaging module, or may be images captured by two imaging modules respectively. For example, two imaging modules are configured on a computer device, and the first image is captured by one imaging module, and the second image is captured by another imaging module. The exposure of the first image is less than the exposure of the second image. The exposure refers to the amount of light required to obtain an image with proper exposure on an image sensor or film. The exposure is used to adjust the light sensitivity of the image. The larger the value, the brighter the image.
[0063] In a specific implementation, the first image in the above step S201 is obtained through the following steps: capturing a first preview image including a photographed object through an imaging module; receiving a first adjustment instruction for the first preview image, and determining a first shooting parameter based on the first adjustment instruction; the first shooting parameter includes a first focal distance, and the first focal distance is less than a preset distance threshold; adjusting the first preview image based on the first shooting parameter to obtain a second preview image; and generating a first image based on the second preview image in response to the first shooting instruction.
[0064] Optionally, when the computer device detects that the shooting function is activated, the computer device can collect a first preview image containing the shooting object through the imaging module configured by itself. Alternatively, when other terminals detect that the shooting function is activated, the imaging modules of other terminals can collect the first preview image containing the shooting object, and the other terminals then send the first preview image to the computer device, thereby the computer device obtains the first preview image.
[0065] In a specific embodiment, the first adjustment instruction is an adjustment instruction for the first preview image issued by the user to the computer device, and the first adjustment instruction includes but is not limited to a touch instruction, a mouse instruction, a remote control instruction, a voice instruction, a gesture instruction, etc. For example, the user can adjust the preview magnification of the first preview image by clicking the preview magnification control on the display interface, or the user issues a voice instruction of "adjust the preview magnification to 2 times".
[0066] After receiving the first adjustment instruction from the user for the first preview image, the computer device determines the first shooting parameter based on the first adjustment instruction. The first shooting parameter includes a first focal distance, and the first focal distance is less than a preset distance threshold. In this embodiment, by making the first focal distance less than the preset distance threshold, the entire preview image can be defocused so as to obtain a hazy and blurred first image.
[0067] It should be noted that the preset distance threshold can be set according to actual needs. For example, the preset distance threshold can be set to a distance threshold close to the minimum focusing distance of the imaging module. The minimum focusing distance refers to the shortest distance at which the imaging module can capture the subject in a clear state. When the first focus distance is close to the minimum focusing distance, the entire preview screen will appear out of focus.
[0068] In a specific embodiment, the first shooting instruction is a shooting instruction issued by the user to the computer device for the second preview image, and the first shooting instruction includes but is not limited to a touch instruction, a mouse instruction, a remote control instruction, a voice instruction, a gesture instruction, etc. For example, the user can control the computer device to generate the first image based on the second preview image by clicking a shooting control on the display interface, or the user can issue a voice instruction of "take a photo".
[0069] In a specific implementation, the second image in the above step S201 is obtained through the following steps: receiving a second adjustment instruction for the second preview image, and determining a second shooting parameter based on the second adjustment instruction; adjusting the second preview image based on the second shooting parameter to obtain a third preview image; and generating a second image based on the third preview image in response to the second shooting instruction.
[0070] In a specific embodiment, the second adjustment instruction is an adjustment instruction of the second preview image issued by the user to the computer device, and the second adjustment instruction includes but is not limited to a touch instruction, a mouse instruction, a remote control instruction, a voice instruction, a gesture instruction, etc. For example, the user can adjust the preview magnification of the second preview image by clicking the preview magnification control on the display interface, or the user issues a voice instruction of "reducing the preview magnification to 1".
[0071] After receiving the second adjustment instruction from the user for the second preview image, the computer device determines the second shooting parameter based on the second adjustment instruction. The second shooting parameter includes a second focal length, which is greater than the first focal length. By acquiring the first image and the second image at the first focal length and the second focal length, respectively, different details can be captured at different focal lengths, thereby improving the fusion effect of multiple exposure images.
[0072] In a specific embodiment, the second shooting parameter also includes a focus position, and the focus position is located at the face or body of the shooting object. By focusing on the face or body to obtain the second image, the shooting effect of the shooting object in the second image can be improved, thereby improving the fusion effect of multiple exposure images.
[0073] In a specific embodiment, the second shooting instruction is a shooting instruction issued by the user to the computer device for the third preview image, and the second shooting instruction includes but is not limited to a touch instruction, a mouse instruction, a remote control instruction, a voice instruction, a gesture instruction, etc. For example, the user can control the computer device to generate the second image based on the third preview image by clicking a shooting control on the display interface, or the user can issue a voice instruction of "take a photo".
[0074] In a specific embodiment, the first shooting parameter further includes a first preview magnification, the second shooting parameter further includes a second preview magnification, and the first preview magnification is greater than the second preview magnification, for example, the first preview magnification is 2 times, and the second preview magnification is 1 times.
[0075] In a specific embodiment, the first shooting parameter also includes a first exposure, the second shooting parameter also includes a second exposure, and the first exposure is less than the second exposure. By setting the first exposure to be less than the second exposure, a slightly darker first image and a slightly brighter portrait segmentation image can be obtained, thereby improving the fusion effect of multiple exposure images.
[0076] Step S202: performing portrait segmentation processing on the second image to obtain a portrait segmentation image.
[0077] Optionally, the second image includes a photographed object, and the portrait segmentation image is an image of a region in the second image where the photographed object is located, obtained by performing portrait segmentation processing on the second image. In a specific embodiment, the step of performing portrait segmentation processing on the second image to obtain the portrait segmentation image specifically includes: inputting the second image into a portrait segmentation model, performing portrait segmentation processing on the second image through the portrait segmentation model to obtain a portrait mask image of the second image; and performing segmentation processing on the second image based on the portrait mask image to obtain the portrait segmentation image.
[0078] In another specific embodiment, the step of performing portrait segmentation processing on the second image to obtain a portrait segmentation image specifically includes: inputting the second image into an object recognition model, identifying the photographed object in the second image through the object recognition model, and obtaining the position information of the photographed object in the second image; and performing segmentation processing on the second image based on the position information of the photographed object in the second image to obtain a portrait segmentation image.
[0079] Step S203: fusing the portrait segmentation image and the first image to obtain a target image.
[0080] Optionally, the target image is a fused image of the portrait segmentation image and the first image. In this embodiment, the portrait segmentation image and the first image are fused to obtain a target image with the first image with a lower exposure as the background and the portrait segmentation image with a higher exposure as the foreground, thereby avoiding multiple superposition of the background parts of the first image and the second image, and improving the fusion effect of the multiple exposure images. Figure 3 As shown, the target image is obtained by using the image processing method provided in the embodiment of the present application. Figure 3 It can be seen that the target image obtained by the image processing method provided in the embodiment of the present application has a better fusion effect.
[0081] In a specific implementation, referring to Figure 4 As shown, in the above step S202, the second image is subjected to portrait segmentation processing to obtain a portrait segmentation image, which may include steps S301 to S302, which are specifically as follows:
[0082] Step S301: input the second image into a portrait segmentation model to perform portrait segmentation processing to obtain a portrait mask image of the second image.
[0083] In a specific embodiment, the pixel values of the pixels in the portrait area in the portrait mask image are different from the pixel values of the pixels in the background area, so the portrait area and the background area in the second image can be distinguished based on the pixel values of each pixel in the portrait mask image. For example, the pixel value of the pixel in the portrait area in the portrait mask image is 1, and the pixel value of the pixel in the background area is 0.
[0084] In this embodiment, the portrait segmentation model is a pre-trained network model for performing portrait segmentation processing on the second image, and the portrait segmentation model is obtained by training a preset network model based on a training sample set. The portrait segmentation model can use a UNet network, a SINet network, or a FCN network, which is not limited in this embodiment.
[0085] In a specific embodiment, the training sample set includes a training sample image and a real mask image corresponding to the training sample image, and the portrait segmentation model is obtained by the following steps: inputting the training sample image into a preset network model, and outputting a predicted mask image of the training sample image through the preset network model; determining a loss value based on the loss function of the real mask image, the predicted mask image and the preset network model; when the loss value does not meet the preset conditions, correcting the model parameters of the preset network model based on the preset parameter learning rate, and continuing to perform the steps of inputting the training sample image into the preset network model and outputting the predicted mask image of the training sample image through the preset network model until the loss value meets the preset conditions. Wherein, the loss value meeting the preset conditions may be that the loss value is less than a preset first threshold value or the difference between the loss values obtained twice before and after is less than a preset second threshold value.
[0086] Step S302: Segment the second image based on the portrait mask image to obtain a portrait segmentation image.
[0087] In a specific embodiment, the portrait segmentation image is a portrait area image segmented from the second image. After obtaining the portrait segmentation image, the position information of the portrait area and the background area in the second image can be determined based on the pixel value of each pixel point in the portrait mask image. The second image is segmented based on the position information of the portrait area in the second image to obtain the portrait segmentation image.
[0088] In a specific implementation, referring to Figure 5 As shown, in the above step S203, the portrait segmentation image and the first image are fused to obtain the target image, which may include steps S401 to S404, which are specifically as follows:
[0089] Step S401, determining a fusion area of the first image; the fusion area includes a plurality of first pixel points, the portrait segmentation image includes a plurality of second pixel points, and the plurality of second pixel points correspond to the plurality of first pixel points respectively.
[0090] In a specific embodiment, the fusion area is an area corresponding to the portrait segmentation image in the first image, the fusion area includes a plurality of first pixels, the portrait segmentation image includes a plurality of second pixels, and the plurality of second pixels correspond to the plurality of first pixels respectively. For example, the fusion area includes the first pixel 1, the first pixel 2, ..., the first pixel n, the portrait segmentation image includes the second pixel 1, the second pixel 2, ..., the second pixel n, and the first pixel 1, the first pixel 2, ..., the first pixel n correspond to the second pixel 1, the second pixel 2, ..., the second pixel n respectively.
[0091] In a specific embodiment, the step of determining the fusion area of the first image specifically includes: determining the pixel position information of the portrait segmentation image in the second image based on the portrait mask image of the second image; determining the fusion area of the first image based on the pixel position information and position mapping information; the position mapping information represents the position mapping relationship between the pixel points in the first image and the pixel points in the second image.
[0092] In this embodiment, the portrait segmentation image is a portrait image segmented from the second image, so each pixel in the portrait segmentation image has corresponding position information in the second image, and the pixel position information is the pixel position of each pixel in the portrait segmentation image in the second image. The position mapping information represents the position mapping relationship between the pixel in the first image and the pixel in the second image. After determining the pixel position information, the corresponding position information of each pixel in the portrait segmentation image in the first image can be determined based on the pixel position information and the position mapping information, thereby determining the fusion area of the first image.
[0093] Step S402: weighting the pixel value of each first pixel and the pixel value of the second pixel corresponding to each first pixel to obtain a target pixel value corresponding to each first pixel.
[0094] Optionally, weighted processing is performed on the pixel value of each first pixel point and the pixel value of the second pixel point corresponding to each first pixel point to obtain the target pixel value corresponding to each first pixel point, which specifically includes: obtaining a first weight value corresponding to each first pixel point and a second weight value corresponding to each second pixel point; based on the first weight value and the second weight value, weighted processing is performed on the pixel value of each first pixel point and the pixel value of the second pixel point corresponding to each first pixel point to obtain the target pixel value corresponding to each first pixel point.
[0095] The process of determining the target pixel value can be expressed as: i =λ1M i +λ2R i , S i represents the target pixel value corresponding to the i-th first pixel point, M i Represents the pixel value of the i-th first pixel, R i represents the pixel value of the second pixel corresponding to the i-th first pixel, λ1 represents the first weight value, and λ2 represents the second weight value. The first weight value and the second weight value can be set according to actual needs. The first weight values corresponding to multiple first pixels can be set to be the same or different, and the second weight values corresponding to multiple second pixels can be set to be the same or different. For example, the first weight values corresponding to multiple first pixels can be set to 0, and the second weight values corresponding to multiple second pixels can be set to 1.
[0096] Step S403: adjusting the pixel values of the plurality of first pixel points based on the target pixel value to obtain an adjusted first image.
[0097] Step S404: determine the adjusted first image as the target image.
[0098] In a specific embodiment, after obtaining the target pixel value corresponding to each first pixel point, the pixel value of each first pixel point in the first image is adjusted to its corresponding target pixel value, thereby obtaining an updated first image, which is the target image.
[0099] In order to better implement the image processing method in the embodiment of the present application, based on the image processing method, an image processing device is also provided in the embodiment of the present application, such as Figure 6 As shown, the image processing device 700 includes:
[0100] The image acquisition module 710 is used to acquire a first image and a second image; the exposure amount of the first image is less than the exposure amount of the second image;
[0101] The image segmentation module 720 is used to perform portrait segmentation processing on the second image to obtain a portrait segmentation image;
[0102] The image fusion module 730 is used to fuse the portrait segmentation image and the first image to obtain a target image.
[0103] In the embodiment of the present application, by performing portrait segmentation processing on the second image to obtain a portrait segmentation image, and performing fusion processing on the portrait segmentation image and the first image to obtain a target image, it is possible to avoid multiple superpositions of the background parts of the first image and the second image, thereby improving the fusion effect of multiple exposure images.
[0104] In some embodiments of the present application, the first image is obtained by the image acquisition module 710 performing the following steps:
[0105] Acquiring a first preview image including the photographed object through an imaging module;
[0106] receiving a first adjustment instruction for a first preview image, and determining a first shooting parameter based on the first adjustment instruction; the first shooting parameter includes a first focal distance, and the first focal distance is less than a preset distance threshold;
[0107] Adjust the first preview image based on the first shooting parameter to obtain a second preview image;
[0108] In response to the first shooting instruction, a first image is generated based on the second preview image.
[0109] In some embodiments of the present application, the second image is obtained by the image acquisition module 710 executing the following steps:
[0110] receiving a second adjustment instruction for the second preview image, and determining a second shooting parameter based on the second adjustment instruction; the second shooting parameter includes a second focal length, and the second focal length is greater than the first focal length;
[0111] Adjust the second preview image based on the second shooting parameter to obtain a third preview image;
[0112] In response to the second shooting instruction, a second image is generated based on the third preview image.
[0113] In some embodiments of the present application, the first shooting parameter also includes a first preview magnification and a first exposure, and the second shooting parameter also includes a second preview magnification and a second exposure; wherein the first preview magnification is greater than the second preview magnification, and the first exposure is less than the second exposure.
[0114] In some embodiments of the present application, the image segmentation module 720 is specifically used for:
[0115] Inputting the second image into the portrait segmentation model to perform portrait segmentation processing to obtain a portrait mask image of the second image;
[0116] The second image is segmented based on the portrait mask image to obtain a portrait segmentation image.
[0117] In some embodiments of the present application, the image fusion module 730 is specifically used for:
[0118] Determine a fusion area of the first image; the fusion area includes a plurality of first pixel points, the portrait segmentation image includes a plurality of second pixel points, and the plurality of second pixel points correspond to the plurality of first pixel points respectively;
[0119] Performing weighted processing on the pixel value of each first pixel point and the pixel value of the second pixel point corresponding to each first pixel point to obtain a target pixel value corresponding to each first pixel point;
[0120] Adjusting the pixel values of the plurality of first pixel points based on the target pixel value to obtain an adjusted first image;
[0121] The adjusted first image is determined as the target image.
[0122] In some embodiments of the present application, the image fusion module 730 is further used to:
[0123] Determining pixel position information of the portrait segmentation image in the second image based on the portrait mask image of the second image;
[0124] Based on the pixel position information and the position mapping information, a fusion area of the first image is determined; the position mapping information represents a position mapping relationship between pixel points in the first image and pixel points in the second image.
[0125] The embodiment of the present application further provides a computer device, which integrates any one of the image processing devices provided in the embodiment of the present application, and the computer device includes:
[0126] one or more processors;
[0127] Memory; and
[0128] One or more applications, wherein the one or more applications are stored in the memory and are configured to execute, by the processor, the steps of the image processing method in any of the above-mentioned image processing method embodiments.
[0129] The present application also provides a computer device that integrates any image processing device provided in the present application. Figure 7 As shown, it shows a schematic diagram of the structure of the computer device involved in the embodiment of the present application, specifically:
[0130] The computer device may include one or more processing core processors 801, one or more computer-readable storage media memories 802, a power supply 803, an input unit 804 and other components. Those skilled in the art will appreciate that Figure 7 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. Among them:
[0131] The processor 801 is the control center of the computer device. It uses various interfaces and lines to connect various parts of the entire computer device. By running or executing software programs and / or modules stored in the memory 802 and calling data stored in the memory 802, it executes various functions of the computer device and processes data, thereby monitoring the computer device as a whole. Optionally, the processor 801 may include one or more processing cores; preferably, the processor 801 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 801.
[0132] The memory 802 can be used to store software programs and modules. The processor 801 executes various functional applications and data processing by running the software programs and modules stored in the memory 802. The memory 802 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 802 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 802 may also include a memory controller to provide the processor 801 with access to the memory 802.
[0133] The computer device also includes a power supply 803 for supplying power to each component. Preferably, the power supply 803 can be logically connected to the processor 801 through a power management system, so that the power management system can manage charging, discharging, power consumption and other functions. The power supply 803 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators and other arbitrary components.
[0134] The computer device may further include an input unit 804, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0135] Although not shown, the computer device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 801 in the computer device will load the executable files corresponding to the processes of one or more application programs into the memory 802 according to the following instructions, and the processor 801 will run the application programs stored in the memory 802, thereby realizing various functions, as follows:
[0136] Acquire a first image and a second image; the exposure amount of the first image is less than the exposure amount of the second image;
[0137] Performing portrait segmentation processing on the second image to obtain a portrait segmentation image;
[0138] The portrait segmentation image and the first image are fused to obtain a target image.
[0139] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0140] To this end, the embodiment of the present application provides a computer-readable storage medium, which may include: a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc. A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in any image processing method provided in the embodiment of the present application. For example, the computer program can be loaded by a processor to execute the following steps:
[0141] Acquire a first image and a second image; the exposure amount of the first image is less than the exposure amount of the second image;
[0142] Performing portrait segmentation processing on the second image to obtain a portrait segmentation image;
[0143] The portrait segmentation image and the first image are fused to obtain a target image.
[0144] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the detailed description of other embodiments above, and will not be repeated here.
[0145] In specific implementation, the above units or structures can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above units or structures can refer to the previous method embodiments, which will not be repeated here.
[0146] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0147] The above is a detailed introduction to an image processing method, device, computer equipment and computer-readable storage medium provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. An image processing method, characterized in that: include: Acquire a first image and a second image; the exposure amount of the first image is less than the exposure amount of the second image; Performing portrait segmentation processing on the second image to obtain a portrait segmentation image; The portrait segmentation image and the first image are fused to obtain a target image.
2. The method according to claim 1, characterized in that The first image is obtained by the following steps: Acquiring a first preview image including the photographed object through an imaging module; receiving a first adjustment instruction for the first preview image, and determining a first shooting parameter based on the first adjustment instruction; the first shooting parameter includes a first focal distance, and the first focal distance is less than a preset distance threshold; Adjusting the first preview image based on the first shooting parameter to obtain a second preview image; In response to a first shooting instruction, a first image is generated based on the second preview image.
3. The method according to claim 2, characterized in that The second image is obtained by the following steps: receiving a second adjustment instruction for the second preview image, and determining a second shooting parameter based on the second adjustment instruction; the second shooting parameter includes a second focal distance, and the second focal distance is greater than the first focal distance; adjusting the second preview image based on the second shooting parameter to obtain a third preview image; In response to a second shooting instruction, a second image is generated based on the third preview image.
4. The method according to claim 3, characterized in that The first shooting parameter further includes a first preview magnification and a first exposure, and the second shooting parameter further includes a second preview magnification and a second exposure; wherein the first preview magnification is greater than the second preview magnification, and the first exposure is less than the second exposure.
5. The method according to claim 1, characterized in that The performing portrait segmentation processing on the second image to obtain a portrait segmentation image includes: Inputting the second image into a portrait segmentation model to perform portrait segmentation processing to obtain a portrait mask image of the second image; The second image is segmented based on the portrait mask image to obtain a portrait segmentation image.
6. The method according to claim 1, characterized in that The fusing the portrait segmentation image and the first image to obtain a target image includes: Determine a fusion area of the first image; the fusion area includes a plurality of first pixel points, the portrait segmentation image includes a plurality of second pixel points, and the plurality of second pixel points correspond to the plurality of first pixel points respectively; Performing weighted processing on the pixel value of each of the first pixel points and the pixel value of the second pixel point corresponding to each of the first pixel points to obtain a target pixel value corresponding to each of the first pixel points; Adjusting the pixel values of the plurality of first pixel points based on the target pixel value to obtain an adjusted first image; The adjusted first image is determined as the target image.
7. The method according to claim 6, characterized in that The determining the fusion area of the first image includes: Determining pixel position information of the portrait segmentation image in the second image based on the portrait mask image of the second image; Based on the pixel position information and the position mapping information, a fusion area of the first image is determined; the position mapping information represents a position mapping relationship between pixel points in the first image and pixel points in the second image.
8. An image processing device, characterized in that: include: An image acquisition module, used to acquire a first image and a second image; the exposure amount of the first image is less than the exposure amount of the second image; An image segmentation module, used for performing portrait segmentation processing on the second image to obtain a portrait segmentation image; The image fusion module is used to fuse the portrait segmentation image and the first image to obtain a target image.
9. A computer device, characterized in that: The computer device comprises: one or more processors; Memory; and One or more application programs, wherein the one or more application programs are stored in the memory and are configured to be executed by the processor to implement the image processing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in the image processing method according to any one of claims 1 to 7.
