WO2023245363A1 - Image processing method and apparatus, and electronic device and storage medium - Google Patents

Image processing method and apparatus, and electronic device and storage medium Download PDF

Info

Publication number
WO2023245363A1
WO2023245363A1 PCT/CN2022/099927 CN2022099927W WO2023245363A1 WO 2023245363 A1 WO2023245363 A1 WO 2023245363A1 CN 2022099927 W CN2022099927 W CN 2022099927W WO 2023245363 A1 WO2023245363 A1 WO 2023245363A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
light spot
blur
sub
spot sub
Prior art date
Application number
PCT/CN2022/099927
Other languages
French (fr)
Chinese (zh)
Inventor
陈妹雅
尹双双
刘阳晨旭
饶强
江浩
Original Assignee
北京小米移动软件有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京小米移动软件有限公司 filed Critical 北京小米移动软件有限公司
Priority to PCT/CN2022/099927 priority Critical patent/WO2023245363A1/en
Priority to CN202280004313.7A priority patent/CN117859150A/en
Publication of WO2023245363A1 publication Critical patent/WO2023245363A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration using two or more images, e.g. averaging or subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing

Definitions

  • the present disclosure relates to the field of terminal technology, and in particular, to an image processing method and device, electronic equipment, and storage media.
  • the soft focus effect is an image effect that creates a beautiful and captivating atmosphere, and is deeply loved by users.
  • the present disclosure provides an image processing method and device, electronic equipment, and storage medium, which can achieve a soft focus effect without using any accessories.
  • an image processing method including:
  • the light spot sub-image includes the picture content located in the light spot area
  • the non-light spot sub-image includes the picture content located in the non-light spot area
  • the light spot sub-image and the non-light spot sub-image are respectively image blurred, and the blurred light spot sub-image and the blurred non-light spot sub-image are image fused to obtain an image with a soft focus effect.
  • an image processing device including:
  • the acquisition unit acquires the light spot sub-image and the non-light spot sub-image of the original image, the light spot sub-image includes the picture content located in the light spot area, and the non-light spot sub-image includes the picture content located in the non-light spot area;
  • the blurring unit performs image blurring on the light spot sub-image and the non-light spot sub-image respectively, and performs image fusion on the blurred light spot sub-image and the blurred non-light spot sub-image to obtain an image with a soft focus effect. .
  • an electronic device including:
  • Memory used to store instructions executable by the processor
  • the processor implements the method described in the first aspect by running the executable instructions.
  • a computer-readable storage medium is provided, computer instructions are stored thereon, and when the instructions are executed by a processor, the steps of the method described in the first aspect are implemented.
  • the spot sub-image and the non-spot sub-image of the original image can be further acquired.
  • the spot sub-image and the non-spot sub-image can be blurred respectively, and the blurred spot sub-image and the blurred non-spot sub-image can be image fused to obtain a soft focus effect. image.
  • the light spot sub-image shows the picture content of the area where the light spot is located
  • the non-light spot sub-image shows the picture content of other areas other than the light spot. Blurring the two separately is equivalent to blurring the area where the light spot is located. Targeted blur processing is used to achieve a soft focus effect in the image obtained through image fusion, which avoids the problem in related technologies that requires additional accessories to achieve the soft focus effect.
  • FIG. 2 is a schematic diagram of performing various image processing operations in an image processing process according to an exemplary embodiment of the present disclosure
  • FIG. 3A is a schematic diagram of a square blur kernel according to an exemplary embodiment of the present disclosure.
  • Figure 3B is a schematic diagram of a double ring blur kernel and a ring-shaped blur kernel according to an exemplary embodiment of the present disclosure
  • Figure 4 is a block diagram of an image processing device illustrating an exemplary embodiment of the present disclosure
  • FIG. 5 is a block diagram of another image processing device according to an exemplary embodiment of the present disclosure.
  • Figure 6 is a schematic structural diagram of an electronic device in an exemplary embodiment of the present disclosure.
  • the soft focus effect is an image effect that creates a beautiful and appealing atmosphere.
  • Related Technology In order to achieve a soft focus effect in an image, two methods, pre-production and post-production, are usually used.
  • the present disclosure proposes an image processing method that can achieve a soft focus effect without requiring the user to perform additional processing.
  • Figure 1 illustrates an image processing method according to an exemplary embodiment of the present disclosure. As shown in Figure 1, the method may include the following steps:
  • the light spot sub-image and the non-light spot sub-image of the original image can be further obtained, wherein the light spot sub-image includes the picture content located in the light spot area in the original image, and the non-light spot sub-image The image contains the content of the original image that is located in the non-spot area.
  • the present disclosure does not require the use of any physical accessories or the user to perform additional operations, thus avoiding the problem of the related technology that requires the user to perform additional operations when achieving the soft focus effect.
  • the spot sub-image and the non-spot sub-image of the original image can be obtained in various ways.
  • a spot mask image used to characterize the position of the spot area in the original image can be obtained first, and then the original image is image separated based on the spot mask image to obtain the spot sub-image and the non-spot sub-image. image.
  • the spot mask image can be generated according to the brightness value of each pixel in the original image. For example, the brightness of the original image can be obtained first. map, and then generate a spot mask image based on the brightness value of each pixel in the brightness map.
  • this example is only illustrative.
  • the specific method of obtaining the spot sub-image and the non-spot sub-image can be determined by those skilled in the art according to actual needs. For example, if the algorithm is mature enough, it can also be directly based on the original image, or The brightness map of the original image is calculated to obtain the spot sub-image and the non-spot sub-image, which is not limited by this disclosure.
  • Step 104 Perform image blur on the light spot sub-image and the non-light spot sub-image respectively, and perform image fusion on the blurred light spot sub-image and the blurred non-light spot sub-image to obtain an image with a soft focus effect. .
  • the light spot sub-image and the non-light spot sub-image can be blurred respectively.
  • different blur strategies can be used to blur the spot sub-image and the non-spot sub-image. It should be understood that due to the adoption of different blurring strategies, there are certain differences in blur effects between the light spot sub-image and the non-light spot sub-image after blur processing, and the two form a contrast. Specifically, since the brightness of the spot area is higher than that of the non-spot area, the effect of visually highlighting the spot can be achieved and the soft focus effect is enhanced.
  • the different blur strategies adopted by the spot sub-image and the non-spot sub-image may be: different blur kernels (which may also be called blur windows).
  • the present disclosure can first configure different blur kernels for the spot sub-image and the non-spot sub-image, and then perform image blurring for the spot sub-image and the non-spot sub-image based on the configured blur kernels.
  • different blur kernels can be configured for the light spot sub-image and the non-light spot sub-image according to actual needs.
  • the blur kernel configured for the light spot sub-image and the non-light spot sub-image can be: different blur kernel shapes, such as diamond, circle, ring, square, etc.; for another example, the blur kernel is configured for the light spot sub-image and the non-light spot sub-image.
  • It can be: different blur kernel sizes, that is, the blur kernel sizes used in the two sub-images are different.
  • the blur kernels configured for the spot sub-image and the non-spot sub-image can also be different in both dimensions of shape and size. The specific configuration can be determined by those skilled in the art according to actual conditions, and this disclosure does not limit this.
  • the shape of the halo depends on the shape of the blur kernel used in the blur operation. Therefore, by configuring blur kernels of different shapes for the spot sub-image and the non-spot sub-image , can make the spot shape of the spot area and the halo shape of the non-spot area (can also be regarded as a spot with smaller brightness, which is brighter than the background image, but smaller than the brightness of the spot, so usually will not be recognized as a spot area) to form a contrast to achieve the effect of highlighting the shape of the spot.
  • a blur kernel may actually be configured for each pixel in the light spot sub-image and the non-light spot sub-image.
  • the shape of the blur kernel of the pixels in the light spot sub-image may be different from the shape of the blur kernel of the pixels in the non-light spot sub-image.
  • the above multiple blur radii can be determined in a variety of ways.
  • the blur radius R can be configured for each pixel point.
  • the blur radius R is used as the first blur radius of the corresponding pixel point.
  • (R-1) is used as the second blur radius of the corresponding pixel point, and (R-2) is used as the third blur radius of the corresponding pixel point; similarly, in the non-spot sub-image, it can also be
  • Each pixel point is configured with a blur radius R.
  • the blur radius R is used as the fourth blur radius of the corresponding pixel point, and on the other hand, (R-1) is used as the fifth blur radius of the corresponding pixel point.
  • this example is only illustrative. How to determine the multiple blur radii of the double annular blur kernel and the annular blur kernel can be determined by those skilled in the art according to actual conditions, and this disclosure does not limit this.
  • the different blur strategies adopted for the light spot sub-image and the non-light spot sub-image may be: different blur algorithms.
  • different blur algorithms may be used for the light spot sub-image and the non-light spot sub-image respectively to perform image blurring.
  • the blurring effect of the blur algorithm used for the spot sub-image can be better than the blur algorithm used for the non-spot sub-image. It should be understood that the soft focus effect of the image is mostly reflected in the area where the light spot is located. Therefore, using a blur algorithm with a relatively excellent blur effect to blur the light spot sub-image can ensure the final soft focus effect.
  • the blur used in the spot sub-image in this embodiment is The power consumption of the algorithm is usually higher than the blur algorithm used for non-spot sub-images. It should be understood that for non-spot areas where the soft focus effect is not obvious, even if a less effective blur algorithm is used, the final image can already show a better soft focus effect. Therefore, through this method, soft focus can be ensured. Under the premise of ensuring the best effect, avoid the problem of excessive power consumption in blur operation.
  • the scattering blur algorithm since the area where the light spot is located is generally a textureless area, the scattering blur algorithm has better robustness than the gathering blur algorithm when blurring images in textureless areas. Therefore, the scattering blur algorithm is used.
  • the scattering blur algorithm blurs the spot sub-image, and the blurring effect is better than using the gathering blur algorithm to blur the spot sub-image.
  • the aggregation fuzzy algorithm has better parallelism than the scattering fuzzy algorithm and can be transplanted to a low-power platform to run, resulting in the aggregation fuzzy algorithm having lower power consumption than the scattering fuzzy algorithm.
  • the blur algorithm used for the spot sub-image in this embodiment may be a scattering blur algorithm
  • the blur algorithm used for the non-spot sub-image may be a gathering blur algorithm.
  • this example is only illustrative. Which blur algorithm is used for the spot sub-image and the non-spot sub-image respectively can be determined by those skilled in the art according to actual needs, and this disclosure does not limit this.
  • the different blur strategies adopted by the spot sub-image and the non-spot sub-image may be: different blur weights.
  • different blur weights can be used to blur the light spot sub-image and the non-light spot sub-image respectively.
  • the blur weight of any pixel is used to represent the degree of influence of the pixel value of any pixel on the blur operation of itself and its neighboring pixels.
  • the blur weight used in the spot sub-image may be greater than the blur weight used in the non-spot sub-image.
  • the blur weight of the pixels in the light spot sub-image can be configured as 400, and the blur weight of the pixels in the non-light spot sub-image can be configured as 10.
  • the blur weight of any pixel is used to represent the degree of influence of the pixel value of any pixel on the blur operation of itself and its neighboring pixels, which means the pixel value of the pixel after blur processing , which is more affected by the pixel values of pixels with higher weights in the blur kernel used. Therefore, configuring a higher blur weight for the light spot sub-image is equivalent to enhancing the pixel value of the pixels in the area where the light spot is located during the image blurring process, and the degree of impact on the pixel values of itself and its neighboring pixels, from the perspective of vision The angle can highlight the shape of the light spot, thereby enhancing the soft focus effect.
  • the target area of the subject in the original image can be determined first, so as to determine the blur kernel of each pixel point based on the target area.
  • the depth information difference between each pixel in the original image and the target area can be further obtained, and the blur kernel of the corresponding pixel is determined based on the depth information difference.
  • the light spot sub-image can be blurred based on the blur kernel of the pixels in the light spot area; and the non-light spot sub-image can be blurred based on the blur kernel of the pixels in the non-light spot area.
  • the blur kernel size of any pixel can be positively correlated with the difference in depth information between the any pixel and the target area.
  • the blur kernel size of any pixel directly determines the blur degree of any pixel, and the blur degree is positively correlated with the blur kernel size. Therefore, configuring a larger blur kernel size for pixels with a larger depth information difference means that the farther the physical distance from the subject is, the higher the degree of blur will be. This allows the degree of blur to increase as the depth of field increases. increased effect.
  • the shape of the blur kernel can be constrained to be annular or circular. In this case, it is only necessary to configure the blur radius for the corresponding pixel based on the difference in depth information between each pixel and the target area.
  • the shape of the constraint is annular, the light spot in the image with soft focus effect can be made to appear annular, or in an onion ring shape, which better restores the soft focus effect achieved by soft focus lenses in related technologies.
  • the above target area can be determined in various ways.
  • the depth information of each pixel in the original image can be obtained to determine the target area based on the depth information.
  • this embodiment can use any method to obtain the depth information of each pixel in the original image.
  • this disclosure does not limit this.
  • content recognition can be performed on the original image to determine the target area.
  • portrait recognition can be performed on the original image to determine the target area.
  • the above methods of determining the target area are all illustrative. The specific method of determining the target area can be determined by those skilled in the art according to actual conditions, and this disclosure does not limit this.
  • the two after blurring both the spot sub-image and the non-spot sub-image, the two can be image fused to obtain an image with a soft focus effect.
  • the spot sub-image that has undergone the initial blur processing and the non-spot sub-image that has undergone the initial blur processing can be image fused to obtain the first fused image; on the other hand, the first fused image can be obtained; , the non-spot sub-image that has undergone the primary blur processing can be subjected to secondary image blur, and then the non-spot sub-image that has undergone the secondary blur processing and the spot sub-image that has undergone the primary blur processing can be image fused to obtain a second fused image.
  • soft focus fusion is performed on the first fused image and the second fused image to obtain a soft focus image.
  • the target areas may overlap or be completely unrelated.
  • the execution subject of the technical solution of the present disclosure can be any type of electronic device.
  • the electronic device can be a mobile terminal such as a smartphone, a tablet computer, or a smart TV, PC (Personal Computer, etc.) Computer) and other fixed terminals.
  • PC Personal Computer, etc.
  • any electronic device that only has data processing capabilities can be used as the execution subject of the present disclosure.
  • Which type of electronic device is used as the execution subject of the technical solution of the present disclosure can be determined by those skilled in the art according to actual needs. To be sure, this disclosure does not limit this.
  • the present disclosure can further obtain the light spot sub-image and the non-light spot sub-image of the original image, and blur the light spot sub-image and the non-light spot sub-image respectively, so that the two All experienced a hazy look and feel.
  • the blurred spot sub-image and the non-spot sub-image can be image fused to obtain an image with a soft focus effect.
  • the present disclosure can configure a blur kernel for the corresponding pixel according to the depth information difference between each pixel and the target area, and the blur kernel size of any pixel is positively correlated with the corresponding depth information difference. Since the blur degree of each pixel is positively correlated with the blur kernel size of the corresponding pixel, this method can achieve the effect of increasing the blur degree as the depth of field increases.
  • the user can start the camera software pre-assembled in the smartphone to call the camera through the camera software to capture the image of the subject and obtain the original image.
  • Step 2 Obtain the depth information of each pixel in the original image.
  • Step 3 Generate a blur radius map corresponding to the subject based on the depth information of each pixel.
  • the area can be determined as the target area; or, when the depth information of each pixel in a certain area is When the depth information is within the preset depth range, the area can be determined as the target area.
  • this example is only illustrative. How to determine the target area based on the depth information can be determined by those skilled in the art based on actual conditions, and this embodiment does not limit this.
  • Step 1 Determine the brightness map of the original image.
  • the original image after the original image is acquired, its brightness map can be determined based on the original image, and the spot mask image can be obtained based on the brightness map.
  • Step 2 Analyze the brightness map to obtain the spot mask image.
  • the spot mask image is used to characterize the position of the spot in the original image, and the brightness of the area where the spot is located is significantly different from other areas. Therefore, the brightness map can be analyzed to obtain the spot mask image.
  • the original image can be blurred based on the spot mask image and blur radius image.
  • This process can include the following steps:
  • Step 1A Image separation is performed on the original image based on the spot mask image to obtain the spot layer and the non-spot layer.
  • the original image can be image separated based on the spot mask image to obtain the spot layer and the non-spot layer (i.e., the spot sub-image and the non-spot sub-image described above); on the other hand, a blur weight map can be generated based on the spot mask image.
  • the pixel value of each pixel in the blur weight map is used to represent: the blur weight assigned to the corresponding pixel in the original image.
  • blur weights can be assigned to pixels that belong to and do not belong to the spot area according to a preset value.
  • pixels that belong to the spot area can be assigned a fixed blur weight
  • pixels that do not belong to the spot area can be assigned another fixed blur weight.
  • the former can be 400, and the latter can be 10.
  • Step 1B Generate a blur weight map based on the spot mask image.
  • Step 2 Weight the pixels of the light spot layer and the non-light spot layer respectively based on the blur weight map to obtain a weighted light spot layer and a weighted non-light spot layer.
  • the spot layer and the non-spot layer can be weighted respectively based on the blur weight of each pixel in the blur weight map, so as to Get a weighted spot layer and a weighted non-spot layer.
  • Step 3 Perform scatter blur on the weighted spot layer based on the blur radius map to obtain the spot rendering image S; perform cluster blur on the weighted non-spot layer based on the blur radius map to obtain the non-spot rendering image B.
  • the blur effect of scattered blur is better than that of gathered blur.
  • Dispersing and blurring the spot layer can ensure the halo effect in the area where the spot is located.
  • the non-spot area is not the key area of the soft focus effect. Users usually do not pay much attention to it.
  • the blur requirements are inherently low, so focus is used on it.
  • Blur can reduce the power consumption of blur operations while ensuring a soft focus effect.
  • scattered blur and weighted blur can be performed on the two based on the blur radius map respectively. It is not difficult to see that the scattering blur and the gathering blur in this embodiment are the initial image blurring for the spot sub-image and the non-spot sub-image described above.
  • a 1 to 9 are used to represent the blur weight of each pixel in the blur kernel, and x 1 to 9 represent the pixel value of each pixel in the blur kernel. If the above example is followed and x 1 to 9 are all in the light spot area, then A 1 to 9 are all 400. It is not difficult to see that the pixel value of any pixel after blur processing is related to the sum of the pixel values of the eight surrounding pixels and itself, that is, to the sum of the pixel values of each pixel in the blur kernel of the pixel. Therefore, in the actual blurring process, only the sum of the pixel values of the pixels covered by the blur kernel is needed to obtain the pixel value of each pixel after blurring.
  • the blur kernel set for the spot area in this embodiment is the above-mentioned double annular blur kernel
  • the blur kernel set for the non-spot area is an annular blur kernel.
  • the blur kernels of the two shapes can be referred to Figure 3B. in,
  • R can be used as the blur radius of the outermost ring of the double ring
  • the blur radius of the middle circle and the blur radius of the innermost circle can be either (R-1) or (R/2). Specifically, the larger of the two is the blur radius of the middle circle, and the smaller is The innermost circle blur radius.
  • f(R-1) and f(R/2) are also similar. This will not be described again; M and N are both scalars, and N is greater than M. The specific value can be determined by those skilled in the art according to actual needs, and this embodiment does not limit this.
  • R can be used as the blur radius of the annular outer circle, and R/2 serves as the blur radius of the inner circle of the ring.
  • the two After blurring the image of the spot layer and the non-spot layer, the two can be image fused to obtain a soft-focus image with a soft-focus effect.
  • the two in order to achieve a relatively high-quality soft focus effect, multiple image fusions are performed before finally obtaining a soft focus image, and different processes are performed for different image fusions.
  • the specific image fusion process can include the following steps:
  • Step 1B Perform Gaussian blur on the non-spot rendering image B to obtain the non-spot Gaussian blur rendering image B’.
  • the blurring unit 402 performs image blurring on the light spot sub-image and the non-light spot sub-image respectively, and performs image fusion on the blurred light spot sub-image and the blurred non-light spot sub-image to obtain a soft focus effect. image.
  • the fuzzy unit 402 is further used for:
  • the processed non-spot image is image fused with the spot sub-image that has undergone the initial blurring process to obtain a second fused image; and, the first fused image and the second fused image are soft-focus fused to obtain a soft-focus effect.
  • the fuzzy unit 402 is further used for:
  • the fuzzy unit 402 is further used for:
  • the blur kernel configured for the light spot sub-image and the non-light spot sub-image is different in at least one of the following dimensions:
  • the blur kernel of any pixel in the spot sub-image is: a first blur radius based on the any pixel, a second blur radius smaller than the first blur radius, and a third blur smaller than the second blur radius.
  • Radius-determined double-ring blur kernel Radius-determined double-ring blur kernel
  • the blur kernel of any pixel in the non-spot sub-image is: an annular blur kernel determined based on the fourth blur radius of any pixel and the fifth blur radius smaller than the fourth blur radius;
  • the fuzzy unit 402 is further used for:
  • the blurring effect of the blur algorithm used in the light spot sub-image is better than the blur algorithm used in the non-light spot sub-image.
  • the spot sub-image adopts a scattering blur algorithm
  • the non-spot sub-image adopts a gathering blur algorithm
  • the fuzzy unit 402 is further used for:
  • the shape of the blur kernel is a ring.
  • the acquisition unit 401 is further used for:
  • FIG. 5 is a block diagram of another image processing device according to an exemplary embodiment of the present disclosure. Based on the aforementioned embodiment shown in FIG. 4 , this embodiment further includes: a determining unit 403 .
  • a determination unit 403 to determine the target area of the subject in the original image, and determine the blur kernel of the corresponding pixel based on the difference in depth information between each pixel in the original image and the target area; Wherein, the blur kernel size of any pixel is positively correlated with the difference in depth information between the any pixel and the target area;
  • the blur unit 402 is further configured to: blur the light spot sub-image based on the blur kernel of the pixels in the light spot area; and, based on the blur kernel of the pixels in the non-light spot area, blur the light spot sub-image.
  • Non-spot sub-images are blurred.
  • FIG. 6 is a block diagram of a device 600 for implementing an image processing method according to an exemplary embodiment.
  • the device 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, or the like.
  • the device 600 may include one or more of the following components: a processing component 602, a memory 604, a power supply component 606, a multimedia component 608, an audio component 610, an input/output (I/O) interface 612, a sensor component 614, and communications component 616.
  • Processing component 602 generally controls the overall operations of device 600, such as operations associated with display, phone calls, data communications, camera operations, and recording operations.
  • the processing component 602 may include one or more processors 620 to execute instructions to complete all or part of the steps of the above method.
  • processing component 602 may include one or more modules that facilitate interaction between processing component 602 and other components.
  • processing component 602 may include a multimedia module to facilitate interaction between multimedia component 608 and processing component 602.
  • Memory 604 is configured to store various types of data to support operations at device 600 . Examples of such data include instructions for any application or method operating on device 600, contact data, phonebook data, messages, pictures, videos, etc.
  • Memory 604 may be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EEPROM), Programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read-only memory
  • EEPROM erasable programmable read-only memory
  • EPROM Programmable read-only memory
  • PROM programmable read-only memory
  • ROM read-only memory
  • magnetic memory flash memory, magnetic or optical disk.
  • Power supply component 606 provides power to the various components of device 600.
  • Power supply components 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to device 600 .
  • Audio component 610 is configured to output and/or input audio signals.
  • audio component 610 includes a microphone (MIC) configured to receive external audio signals when device 600 is in operating modes, such as call mode, recording mode, and speech recognition mode. The received audio signals may be further stored in memory 604 or sent via communications component 616 .
  • audio component 610 also includes a speaker for outputting audio signals.
  • the I/O interface 612 provides an interface between the processing component 602 and a peripheral interface module, which may be a keyboard, a click wheel, a button, etc. These buttons may include, but are not limited to: Home button, Volume buttons, Start button, and Lock button.
  • Sensor component 614 includes one or more sensors for providing various aspects of status assessment for device 600 .
  • the sensor component 614 can detect the open/closed state of the device 600, the relative positioning of components, such as the display and keypad of the device 600, and the sensor component 614 can also detect a change in position of the device 600 or a component of the device 600. , the presence or absence of user contact with device 600 , device 600 orientation or acceleration/deceleration and temperature changes of device 600 .
  • Sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact.
  • Sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications.
  • the sensor component 614 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
  • Communication component 616 is configured to facilitate wired or wireless communication between apparatus 600 and other devices.
  • the device 600 can access a wireless network based on communication standards, such as WiFi, 2G or 3G, 4G LTE, 5G NR (New Radio) or a combination thereof.
  • the communication component 616 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel.
  • the communications component 616 also includes a near field communications (NFC) module to facilitate short-range communications.
  • NFC near field communications
  • the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
  • RFID radio frequency identification
  • IrDA infrared data association
  • UWB ultra-wideband
  • Bluetooth Bluetooth
  • apparatus 600 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable Gate array (FPGA), controller, microcontroller, microprocessor or other electronic components are implemented for executing the above method.
  • ASICs application specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGA field programmable Gate array
  • controller microcontroller, microprocessor or other electronic components are implemented for executing the above method.
  • a non-transitory computer-readable storage medium including instructions such as a memory 604 including instructions, which are executable by the processor 620 of the device 600 to complete the above method is also provided.
  • the non-transitory computer-readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

An image processing method and apparatus, and an electronic device and a storage medium. The method comprises: acquiring a light spot sub-image and a non-light-spot sub-image of an original image, wherein the light spot sub-image comprises picture content located in a light spot region, and the non-light-spot sub-image comprises picture content located in a non-light-spot region (102); and respectively performing image blurring on the light spot sub-image and the non-light-spot sub-image, and performing image fusion on the light spot sub-image, which has been subjected to blurring processing, and the non-light-spot sub-image, which has been subjected to blurring processing, so as to obtain an image with a soft-focus effect (104).

Description

图像处理方法及装置、电子设备、存储介质Image processing methods and devices, electronic equipment, storage media 技术领域Technical field
本公开涉及终端技术领域,尤其涉及一种图像处理方法及装置、电子设备、存储介质。The present disclosure relates to the field of terminal technology, and in particular, to an image processing method and device, electronic equipment, and storage media.
背景技术Background technique
柔焦效果是一种营造唯美、旖旎氛围的图像效果,深受用户的喜爱。The soft focus effect is an image effect that creates a beautiful and charming atmosphere, and is deeply loved by users.
在相关技术中,用户通常通过在摄像头的拍摄端装配柔焦镜片的方式,在图像中实现柔焦效果。该方式依赖于实体配件,需要用户随身携带相应的柔焦镜片,否则将无法在图像中实现柔焦效果。In related technologies, users usually achieve a soft focus effect in images by assembling a soft focus lens on the shooting end of a camera. This method relies on physical accessories and requires users to carry the corresponding soft-focus lenses with them, otherwise the soft-focus effect will not be achieved in the image.
发明内容Contents of the invention
本公开提供一种图像处理方法及装置、电子设备、存储介质,能够在不借助任何配件的情况下,实现柔焦效果。The present disclosure provides an image processing method and device, electronic equipment, and storage medium, which can achieve a soft focus effect without using any accessories.
根据本公开的第一方面,提供一种图像处理方法,包括:According to a first aspect of the present disclosure, an image processing method is provided, including:
获取原始图像的光斑子图像和非光斑子图像,所述光斑子图像包含位于光斑区域的画面内容、所述非光斑子图像包含位于非光斑区域的画面内容;Obtain the light spot sub-image and the non-light spot sub-image of the original image, the light spot sub-image includes the picture content located in the light spot area, and the non-light spot sub-image includes the picture content located in the non-light spot area;
对所述光斑子图像和所述非光斑子图像分别进行图像模糊,并对经由模糊处理的光斑子图像和经由模糊处理的非光斑子图像进行图像融合,得到具备柔焦效果的图像。The light spot sub-image and the non-light spot sub-image are respectively image blurred, and the blurred light spot sub-image and the blurred non-light spot sub-image are image fused to obtain an image with a soft focus effect.
根据本公开的第二方面,提供一种图像处理装置,包括:According to a second aspect of the present disclosure, an image processing device is provided, including:
获取单元,获取原始图像的光斑子图像和非光斑子图像,所述光斑子图像包含位于光斑区域的画面内容、所述非光斑子图像包含位于非光斑区域的画面内容;The acquisition unit acquires the light spot sub-image and the non-light spot sub-image of the original image, the light spot sub-image includes the picture content located in the light spot area, and the non-light spot sub-image includes the picture content located in the non-light spot area;
模糊单元,对所述光斑子图像和所述非光斑子图像分别进行图像模糊,并对经 由模糊处理的光斑子图像和经由模糊处理的非光斑子图像进行图像融合,得到具备柔焦效果的图像。The blurring unit performs image blurring on the light spot sub-image and the non-light spot sub-image respectively, and performs image fusion on the blurred light spot sub-image and the blurred non-light spot sub-image to obtain an image with a soft focus effect. .
根据本公开的第三方面,提供一种电子设备,包括:According to a third aspect of the present disclosure, an electronic device is provided, including:
处理器;processor;
用于存储处理器可执行指令的存储器;Memory used to store instructions executable by the processor;
其中,所述处理器通过运行所述可执行指令以实现如第一方面所述的方法。Wherein, the processor implements the method described in the first aspect by running the executable instructions.
根据本公开的第四方面,提供一种计算机可读存储介质,其上存储有计算机指令,该指令被处理器执行时实现如第一方面所述方法的步骤。According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, computer instructions are stored thereon, and when the instructions are executed by a processor, the steps of the method described in the first aspect are implemented.
在本公开的技术方案中,在获取原始图像之后,可以进一步获取原始图像的光斑子图像和非光斑子图像。在此基础上,即可对光斑子图像和非光斑子图像分别进行图像模糊,并对经由模糊处理的光斑子图像和经由模糊处理的非光斑子图像进行图像融合,以得到具备柔焦效果的图像。In the technical solution of the present disclosure, after acquiring the original image, the spot sub-image and the non-spot sub-image of the original image can be further acquired. On this basis, the spot sub-image and the non-spot sub-image can be blurred respectively, and the blurred spot sub-image and the blurred non-spot sub-image can be image fused to obtain a soft focus effect. image.
应当理解的是,光斑子图像展现的为光斑所在区域的画面内容,而非光斑子图像展现的为光斑以外的其他区域的画面内容,对两者分别进行图像模糊,相当于对光斑所在区域进行了针对性的模糊处理,使通过图像融合得到图像中呈现柔焦效果,避免了相关技术中需要额外携带配件,才能够实现柔焦效果的问题。It should be understood that the light spot sub-image shows the picture content of the area where the light spot is located, while the non-light spot sub-image shows the picture content of other areas other than the light spot. Blurring the two separately is equivalent to blurring the area where the light spot is located. Targeted blur processing is used to achieve a soft focus effect in the image obtained through image fusion, which avoids the problem in related technologies that requires additional accessories to achieve the soft focus effect.
附图说明Description of the drawings
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure.
图1是本公开一示例性实施例示出的一种图像处理方法的流程图;Figure 1 is a flow chart of an image processing method according to an exemplary embodiment of the present disclosure;
图2是本公开一示例性实施例示出的一种图像处理过程中执行各个图像处理操作的示意图;FIG. 2 is a schematic diagram of performing various image processing operations in an image processing process according to an exemplary embodiment of the present disclosure;
图3A是本公开一示例性实施例示出的一种方形模糊核的示意图;FIG. 3A is a schematic diagram of a square blur kernel according to an exemplary embodiment of the present disclosure;
图3B是本公开一示例性实施例示出的一种双环形模糊核以及核环形模糊核的示意图;Figure 3B is a schematic diagram of a double ring blur kernel and a ring-shaped blur kernel according to an exemplary embodiment of the present disclosure;
图4是本公开一示例性实施例示出的一种图像处理装置的框图;Figure 4 is a block diagram of an image processing device illustrating an exemplary embodiment of the present disclosure;
图5是本公开一示例性实施例示出的另一种图像处理装置的框图;FIG. 5 is a block diagram of another image processing device according to an exemplary embodiment of the present disclosure;
图6是本公开一示例性实施例中一种电子设备的结构示意图。Figure 6 is a schematic structural diagram of an electronic device in an exemplary embodiment of the present disclosure.
具体实施方式Detailed ways
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本公开相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本公开的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, examples of which are illustrated in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with aspects of the disclosure as detailed in the appended claims.
在本公开使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本公开。在本公开和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。The terminology used in this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. As used in this disclosure and the appended claims, the singular forms "a," "the" and "the" are intended to include the plural forms as well, unless the context clearly dictates otherwise. It will also be understood that the term "and/or" as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
应当理解,尽管在本公开可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本公开范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。It should be understood that although the terms first, second, third, etc. may be used in this disclosure to describe various information, the information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of the present disclosure, the first information may also be called second information, and similarly, the second information may also be called first information. Depending on the context, the word "if" as used herein may be interpreted as "when" or "when" or "in response to determining."
柔焦效果是一种营造唯美、旖旎氛围的图像效果。相关技术为了在图像中实现柔焦效果,通常采用前期或后期两种方式。The soft focus effect is an image effect that creates a beautiful and charming atmosphere. Related Technology In order to achieve a soft focus effect in an image, two methods, pre-production and post-production, are usually used.
其中,在采用前期方式时,用户需要额外准备柔焦镜片这一拍摄配件,并在进行图像拍摄之前,将其装配于摄像头的拍摄端。在实际拍摄过程中,即可通过柔焦镜片改变光线的光路,使得最终成像呈现出柔焦效果。Among them, when using the preliminary method, the user needs to prepare an additional shooting accessory such as a soft-focus lens, and assemble it on the shooting end of the camera before taking image capture. During the actual shooting process, the light path of the light can be changed through the soft focus lens, so that the final image shows a soft focus effect.
而在采用后期方式时,用户在拍摄得到原始图像后,还需将原始图像导入相应的图像处理软件,如PS(Photoshop)中,通过该软件中的各种修图工具,对原始图像进行调整,以使调整后的图像产生柔焦效果。When using the post-production method, after taking the original image, the user needs to import the original image into the corresponding image processing software, such as PS (Photoshop), and adjust the original image through various editing tools in the software. , to create a soft focus effect on the adjusted image.
不难看出,相关技术在采用前期方式实现柔焦效果时,需要额外携带配件,不仅增加了拍摄成本,且柔焦效果取决于原始图像的成像数据,后期调整空间较小。而在采用后期方式实现柔焦效果时,不仅需要额外借助图像处理软件,且用户需要额外执行图像导入、修图等操作,操作极为繁琐。It is not difficult to see that when the related technology uses the early method to achieve the soft focus effect, it requires additional accessories, which not only increases the shooting cost, but also the soft focus effect depends on the imaging data of the original image, leaving less room for later adjustments. When using post-processing methods to achieve the soft focus effect, not only do you need to use additional image processing software, but the user also needs to perform additional operations such as image import and retouching, which is extremely cumbersome.
为此,本公开提出了一种图像处理方法,能够在无需用户执行额外处理的前提 下,实现柔焦效果。To this end, the present disclosure proposes an image processing method that can achieve a soft focus effect without requiring the user to perform additional processing.
图1为本公开一示例性实施例示出的一种图像处理方法。如图1所示,该方法可以包括以下步骤:Figure 1 illustrates an image processing method according to an exemplary embodiment of the present disclosure. As shown in Figure 1, the method may include the following steps:
步骤102,获取原始图像的光斑子图像和非光斑子图像,所述光斑子图像包含位于光斑区域的画面内容、所述非光斑子图像包含位于非光斑区域的画面内容。Step 102: Obtain the light spot sub-image and the non-light spot sub-image of the original image. The light spot sub-image includes the picture content located in the light spot area, and the non-light spot sub-image includes the picture content located in the non-light spot area.
由上述介绍可知,相关技术无论是采用前期方式,还是后期方式实现柔焦效果,均需要用户进行额外的操作,如在采用前期方式时,需要携带并装配柔焦滤镜;而在采用后期方式时,则需要进行图像导入、修图等操作。As can be seen from the above introduction, whether the related technology uses the early stage method or the post stage method to achieve the soft focus effect, the user needs to perform additional operations. For example, when using the early stage method, you need to carry and assemble a soft focus filter; while using the post stage method , you need to perform operations such as image import and image editing.
有鉴于此,本公开既不采用装配柔焦镜片的方式实现柔焦效果,又不采用后期修图的方式实现柔焦效果。In view of this, the present disclosure does not adopt the method of assembling soft-focus lenses to achieve the soft-focus effect, nor does it adopt the method of post-retouching to achieve the soft-focus effect.
在本公开中,在获取原始图像的基础上,还可以进一步获取该原始图像的光斑子图像和非光斑子图像,其中,光斑子图像包含原始图像中位于光斑区域的画面内容,而非光斑子图像包含原始图像中位于非光斑区域的画面内容。In the present disclosure, on the basis of obtaining the original image, the light spot sub-image and the non-light spot sub-image of the original image can be further obtained, wherein the light spot sub-image includes the picture content located in the light spot area in the original image, and the non-light spot sub-image The image contains the content of the original image that is located in the non-spot area.
在获得光斑子图像和非光斑子图像之后,即可对两者分别进行图像模糊,以使两者均出现朦胧的观感。其中,由于光斑区域亮度较高,因而在对光斑子图像进行模糊处理后,即可使光斑子图像产生高光晕染的效果。在此基础上,对经由模糊处理的光斑子图像和非光斑子图像进行图像融合后,在融合得到的图像中,光斑区域呈现高光晕染的效果,而非光斑区域呈现朦胧的效果,两者形成对比,实现了柔焦效果。After obtaining the light spot sub-image and the non-light spot sub-image, the images of the two can be blurred respectively, so that both have a hazy look and feel. Among them, since the brightness of the light spot area is relatively high, after blurring the light spot sub-image, the light spot sub-image can produce a highlight blooming effect. On this basis, after image fusion of the blurred spot sub-image and non-spot sub-image, in the fused image, the spot area presents a highlight halo effect, while the non-spot area presents a hazy effect. Creates contrast and achieves a soft focus effect.
应当理解的是,本公开在实现柔焦效果的过程中,既无需借助任何实体配件,又无需用户进行额外的操作,避免了相关技术在实现柔焦效果时,需要用户进行额外操作的问题。It should be understood that in the process of realizing the soft focus effect, the present disclosure does not require the use of any physical accessories or the user to perform additional operations, thus avoiding the problem of the related technology that requires the user to perform additional operations when achieving the soft focus effect.
在本公开中,可以通过多种方式获取原始图像的光斑子图像和非光斑子图像。在一实施例中,可以优先获取用于表征光斑区域在原始图像中所处位置的光斑掩膜图像,再基于该光斑掩膜图像对原始图像进行图像分离,以得到光斑子图像和非光斑子图像。应当理解的是,光斑所处位置相较于其他位置的亮度是存在差异的,因此,可以根据原始图像中各个像素的亮度值,生成该光斑掩膜图像,例如,可以优先获取原始图像的亮度图,再基于亮度图中各个像素点的亮度值生成光斑掩膜图像。In the present disclosure, the spot sub-image and the non-spot sub-image of the original image can be obtained in various ways. In one embodiment, a spot mask image used to characterize the position of the spot area in the original image can be obtained first, and then the original image is image separated based on the spot mask image to obtain the spot sub-image and the non-spot sub-image. image. It should be understood that the brightness of the location of the spot is different compared to other locations. Therefore, the spot mask image can be generated according to the brightness value of each pixel in the original image. For example, the brightness of the original image can be obtained first. map, and then generate a spot mask image based on the brightness value of each pixel in the brightness map.
当然,该举例仅是示意性的,具体如何获取光斑子图像和非光斑子图像,可由本领域技术人员根据实际需求确定,例如,在算法足够成熟的情况下,也可以直接基 于原始图像、或原始图像的亮度图计算得到光斑子图像和非光斑子图像,本公开对此不作限制。Of course, this example is only illustrative. The specific method of obtaining the spot sub-image and the non-spot sub-image can be determined by those skilled in the art according to actual needs. For example, if the algorithm is mature enough, it can also be directly based on the original image, or The brightness map of the original image is calculated to obtain the spot sub-image and the non-spot sub-image, which is not limited by this disclosure.
步骤104,对所述光斑子图像和所述非光斑子图像分别进行图像模糊,并对经由模糊处理的光斑子图像和经由模糊处理的非光斑子图像进行图像融合,得到具备柔焦效果的图像。Step 104: Perform image blur on the light spot sub-image and the non-light spot sub-image respectively, and perform image fusion on the blurred light spot sub-image and the blurred non-light spot sub-image to obtain an image with a soft focus effect. .
在本公开中,在分离得到光斑子图像和非光斑子图像后,即可分别对光斑子图像和非光斑子图像进行模糊处理。In the present disclosure, after the light spot sub-image and the non-light spot sub-image are separated, the light spot sub-image and the non-light spot sub-image can be blurred respectively.
在本公开中,可以采用不同的模糊策略对光斑子图像和非光斑子图像进行图像模糊。应当理解的是,由于采用了不同的模糊策略,使得光斑子图像和非光斑子图像在经由模糊处理后,模糊效果存在一定差异,两者形成对比。具体的,由于光斑区域的亮度高于非光斑区域,因此,可以达到从视觉上凸显光斑的效果,加强了柔焦效果。In the present disclosure, different blur strategies can be used to blur the spot sub-image and the non-spot sub-image. It should be understood that due to the adoption of different blurring strategies, there are certain differences in blur effects between the light spot sub-image and the non-light spot sub-image after blur processing, and the two form a contrast. Specifically, since the brightness of the spot area is higher than that of the non-spot area, the effect of visually highlighting the spot can be achieved and the soft focus effect is enhanced.
在一实施例中,光斑子图像和非光斑子图像采用的不同模糊策略可以为:不同的模糊核(也可以称作模糊窗口)。换言之,在进行图像模糊之前,本公开可以优先为光斑子图像和非光斑子图像配置不同的模糊核,再基于配置的模糊核为光斑子图像和非光斑子图像进行图像模糊。In an embodiment, the different blur strategies adopted by the spot sub-image and the non-spot sub-image may be: different blur kernels (which may also be called blur windows). In other words, before blurring the image, the present disclosure can first configure different blur kernels for the spot sub-image and the non-spot sub-image, and then perform image blurring for the spot sub-image and the non-spot sub-image based on the configured blur kernels.
在本实施例中,可以根据实际需求为光斑子图像和非光斑子图像配置不同的模糊核。例如,为光斑子图像和非光斑子图像配置的模糊核可以为:不同的模糊核形状,如菱形、圆形、环形、方形等;再例如,为光斑子图像和非光斑子图像配置模糊核可以为:不同的模糊核尺寸,即两子图像采用的模糊核大小不同。当然,为光斑子图像和非光斑子图像配置的模糊核也可以在形状、尺寸两个维度上均存在不同,具体如何配置可由本领域技术人员根据实际情况确定,本公开对此不作限制。In this embodiment, different blur kernels can be configured for the light spot sub-image and the non-light spot sub-image according to actual needs. For example, the blur kernel configured for the light spot sub-image and the non-light spot sub-image can be: different blur kernel shapes, such as diamond, circle, ring, square, etc.; for another example, the blur kernel is configured for the light spot sub-image and the non-light spot sub-image. It can be: different blur kernel sizes, that is, the blur kernel sizes used in the two sub-images are different. Of course, the blur kernels configured for the spot sub-image and the non-spot sub-image can also be different in both dimensions of shape and size. The specific configuration can be determined by those skilled in the art according to actual conditions, and this disclosure does not limit this.
应当理解的是,光晕的形状(在光斑区域即为光斑的形状)取决于模糊操作时采用的模糊核形状,因此,通过为光斑子图像和非光斑子图像配置不同形状的模糊核的方式,能够使光斑区域的光斑形状与非光斑区域的光晕形状(也可以视为亮度较小的光斑,其相较于背景画面亮度较高,但相较于光斑亮度又较小,因此,通常不会被识别为光斑区域)形成对比,达到凸显光斑形状的效果。It should be understood that the shape of the halo (the shape of the spot in the spot area) depends on the shape of the blur kernel used in the blur operation. Therefore, by configuring blur kernels of different shapes for the spot sub-image and the non-spot sub-image , can make the spot shape of the spot area and the halo shape of the non-spot area (can also be regarded as a spot with smaller brightness, which is brighter than the background image, but smaller than the brightness of the spot, so usually will not be recognized as a spot area) to form a contrast to achieve the effect of highlighting the shape of the spot.
在本实施例中,在为光斑子图像和非光斑子图像配置不同模糊核时,实际可以为光斑子图像和非光斑子图像中的各个像素点均配置一模糊核。而光斑子图像中的像素点的模糊核的形状可以与非光斑子图像中的像素点的模糊核存在差别。例如,可以 将光斑子图像中的像素点的模糊核配置为双环形模糊核,将非光斑子图像中的像素点的模糊核配置为环形模糊核,其中,对于光斑子图像中的任一像素点,可以优先确定该任一像素点的第一模糊半径、第二模糊半径,以及第三模糊半径,且第一模糊半径大于第二模糊半径、第二模糊半径大于第三模糊半径,以基于三个模糊半径决定该任一像素点的双环形模糊核;而对于非光斑子图像中的任一像素点,可以优先确定该任一像素点的第四模糊半径和第五模糊半径,且第四模糊半径大于第五模糊半径,以基于两个模糊半径决定该任一像素点的环形模糊核。在应用中,可以通过多种方式确定上述多个模糊半径,例如,在光斑子图像中,可以为各个像素点配置模糊半径R,一方面将该模糊半径R作为相应像素点的第一模糊半径,另一方面将(R-1)作为相应像素点的第二模糊半径、将(R-2)作为相应像素点的第三模糊半径;相类似的,在非光斑子图像中,也可以为各个像素点配置模糊半径R,一方面将该模糊半径R作为相应像素点的第四模糊半径,另一方面将(R-1)作为相应像素点的第五模糊半径。当然,该举例仅是示意性的,具体如何确定双环形模糊核和环形模糊核的多个模糊半径,可由本领域技术人员根据实际情况确定,本公开对此不作限制。In this embodiment, when different blur kernels are configured for the light spot sub-image and the non-light spot sub-image, a blur kernel may actually be configured for each pixel in the light spot sub-image and the non-light spot sub-image. The shape of the blur kernel of the pixels in the light spot sub-image may be different from the shape of the blur kernel of the pixels in the non-light spot sub-image. For example, the blur kernel of the pixels in the light spot sub-image can be configured as a double ring blur kernel, and the blur kernel of the pixels in the non-light spot sub-image can be configured as a ring blur kernel, where, for any pixel in the light spot sub-image point, the first blur radius, the second blur radius, and the third blur radius of any pixel point can be determined first, and the first blur radius is larger than the second blur radius, and the second blur radius is larger than the third blur radius, so as to determine based on The three blur radii determine the double annular blur kernel of any pixel; and for any pixel in the non-spot sub-image, the fourth blur radius and the fifth blur radius of any pixel can be determined first, and the third blur radius The fourth blur radius is greater than the fifth blur radius, so that the annular blur kernel of any pixel is determined based on the two blur radii. In applications, the above multiple blur radii can be determined in a variety of ways. For example, in the light spot sub-image, the blur radius R can be configured for each pixel point. On the one hand, the blur radius R is used as the first blur radius of the corresponding pixel point. , on the other hand, (R-1) is used as the second blur radius of the corresponding pixel point, and (R-2) is used as the third blur radius of the corresponding pixel point; similarly, in the non-spot sub-image, it can also be Each pixel point is configured with a blur radius R. On the one hand, the blur radius R is used as the fourth blur radius of the corresponding pixel point, and on the other hand, (R-1) is used as the fifth blur radius of the corresponding pixel point. Of course, this example is only illustrative. How to determine the multiple blur radii of the double annular blur kernel and the annular blur kernel can be determined by those skilled in the art according to actual conditions, and this disclosure does not limit this.
在另一实施例中,光斑子图像和非光斑子图像采用的不同模糊策略可以为:不同的模糊算法,换言之,可以对光斑子图像和非光斑子图像分别采用不同的模糊算法进行图像模糊。其中,光斑子图像采用的模糊算法的模糊效果,可以优于所述非光斑子图像采用的模糊算法。应当理解的是,图像的柔焦效果多体现于光斑所在区域,因此,采用模糊效果相对优秀的模糊算法对光斑子图像进行图像模糊,能够保证最终得到的柔焦效果。In another embodiment, the different blur strategies adopted for the light spot sub-image and the non-light spot sub-image may be: different blur algorithms. In other words, different blur algorithms may be used for the light spot sub-image and the non-light spot sub-image respectively to perform image blurring. Among them, the blurring effect of the blur algorithm used for the spot sub-image can be better than the blur algorithm used for the non-spot sub-image. It should be understood that the soft focus effect of the image is mostly reflected in the area where the light spot is located. Therefore, using a blur algorithm with a relatively excellent blur effect to blur the light spot sub-image can ensure the final soft focus effect.
在本实施例中,由于算法原理及算法复杂程度的影响,通常情况下,模糊效果的优劣程度,通常与模糊算法的功耗呈负相关,因此,本实施例中光斑子图像采用的模糊算法的功耗,通常高于非光斑子图像采用的模糊算法。应当理解的是,对于柔焦效果体现不明显的非光斑区域,即便采用效果较差的模糊算法,已然能够使最终图像呈现较好的柔焦效果,因此,通过该方式,可以在保证柔焦效果的前提下,避免模糊操作功耗过高的问题。In this embodiment, due to the influence of the algorithm principle and algorithm complexity, under normal circumstances, the degree of blur effect is usually negatively correlated with the power consumption of the blur algorithm. Therefore, the blur used in the spot sub-image in this embodiment is The power consumption of the algorithm is usually higher than the blur algorithm used for non-spot sub-images. It should be understood that for non-spot areas where the soft focus effect is not obvious, even if a less effective blur algorithm is used, the final image can already show a better soft focus effect. Therefore, through this method, soft focus can be ensured. Under the premise of ensuring the best effect, avoid the problem of excessive power consumption in blur operation.
在本实施例中,由于光斑所在区域一般为无纹理区域,而打散模糊算法相较于聚集模糊算法,在对无纹理区域进行图像模糊时,具有更优的鲁棒性,因此,采用打散模糊算法对光斑子图像进行模糊处理,相较于采用聚集模糊算法对光斑子图像进行模糊处理,模糊效果更佳。与此相对应的是,聚集模糊算法相较于打散模糊算法,并 行性更好,可以移植至低功耗平台运行,致使聚集模糊算法相较于打散模糊算法功耗更低。鉴于此,本实施例中光斑子图像采用的模糊算法可以为打散模糊算法,而非光斑子图像采用的模糊算法可以为聚集模糊算法。当然,该举例仅是示意性的,光斑子图像和非光斑子图像分别采用何种模糊算法,可由本领域技术人员根据实际需求确定,本公开对此不作限制。In this embodiment, since the area where the light spot is located is generally a textureless area, the scattering blur algorithm has better robustness than the gathering blur algorithm when blurring images in textureless areas. Therefore, the scattering blur algorithm is used. The scattering blur algorithm blurs the spot sub-image, and the blurring effect is better than using the gathering blur algorithm to blur the spot sub-image. Correspondingly, the aggregation fuzzy algorithm has better parallelism than the scattering fuzzy algorithm and can be transplanted to a low-power platform to run, resulting in the aggregation fuzzy algorithm having lower power consumption than the scattering fuzzy algorithm. In view of this, the blur algorithm used for the spot sub-image in this embodiment may be a scattering blur algorithm, and the blur algorithm used for the non-spot sub-image may be a gathering blur algorithm. Of course, this example is only illustrative. Which blur algorithm is used for the spot sub-image and the non-spot sub-image respectively can be determined by those skilled in the art according to actual needs, and this disclosure does not limit this.
在又一实施例中,光斑子图像和非光斑子图像采用的不同模糊策略可以为:不同的模糊权重。换言之,可以采用不同的模糊权重对光斑子图像和非光斑子图像分别进行图像模糊。其中,任一像素点的模糊权重用于表征该任一像素点的像素值对自身及其邻域像素点的模糊操作的影响程度。在本实施例中,光斑子图像中采用的模糊权重可以大于非光斑子图像采用的模糊权重。例如,可以将光斑子图像中的像素点的模糊权重配置为400,而将非光斑子图像的像素点的模糊权重配置为10。In yet another embodiment, the different blur strategies adopted by the spot sub-image and the non-spot sub-image may be: different blur weights. In other words, different blur weights can be used to blur the light spot sub-image and the non-light spot sub-image respectively. Among them, the blur weight of any pixel is used to represent the degree of influence of the pixel value of any pixel on the blur operation of itself and its neighboring pixels. In this embodiment, the blur weight used in the spot sub-image may be greater than the blur weight used in the non-spot sub-image. For example, the blur weight of the pixels in the light spot sub-image can be configured as 400, and the blur weight of the pixels in the non-light spot sub-image can be configured as 10.
应当理解的是,任一像素点的模糊权重用于表征该任一像素点的像素值对自身及其邻域像素点的模糊操作的影响程度,意味着经由模糊处理后的像素点的像素值,受到所采用的模糊核内权重更高的像素点的像素值影响更大。因此,为光斑子图像配置更高的模糊权重,相当于在图像模糊过程中,增强了光斑所在区域的像素点的像素值,对自身及其邻域像素点的像素值的影响程度,从视觉角度上能够凸显光斑的形状,进而加强柔焦效果。It should be understood that the blur weight of any pixel is used to represent the degree of influence of the pixel value of any pixel on the blur operation of itself and its neighboring pixels, which means the pixel value of the pixel after blur processing , which is more affected by the pixel values of pixels with higher weights in the blur kernel used. Therefore, configuring a higher blur weight for the light spot sub-image is equivalent to enhancing the pixel value of the pixels in the area where the light spot is located during the image blurring process, and the degree of impact on the pixel values of itself and its neighboring pixels, from the perspective of vision The angle can highlight the shape of the light spot, thereby enhancing the soft focus effect.
在本公开中,在进行图像模糊之前,可以优先确定出被摄主体在原始图像中的目标区域,以根据该目标区域确定各个像素点的模糊核。例如,在确定出目标区域后,可以进一步获取原始图像中各个像素点与该目标区域的深度信息差值,并基于该深度信息差值确定相应像素点的模糊核。在此基础上,即可基于光斑区域中的像素点的模糊核,对光斑子图像进行图像模糊;以及,基于非光斑区域中的像素点的模糊核,对非光斑子图像进行图像模糊。其中,任一像素点的模糊核尺寸,可以与该任一像素点和目标区域的深度信息差值呈正相关。In the present disclosure, before performing image blurring, the target area of the subject in the original image can be determined first, so as to determine the blur kernel of each pixel point based on the target area. For example, after the target area is determined, the depth information difference between each pixel in the original image and the target area can be further obtained, and the blur kernel of the corresponding pixel is determined based on the depth information difference. On this basis, the light spot sub-image can be blurred based on the blur kernel of the pixels in the light spot area; and the non-light spot sub-image can be blurred based on the blur kernel of the pixels in the non-light spot area. Among them, the blur kernel size of any pixel can be positively correlated with the difference in depth information between the any pixel and the target area.
应当理解的是,在图像模糊处理的过程中,任一像素点的模糊核尺寸直接决定了该任一像素点的模糊程度,且模糊程度与模糊核尺寸呈正相关。因此,为上述深度信息差值更大的像素点配置更大的模糊核尺寸,意味着与被摄主体的物理距离越远的区域,模糊程度越高,实现了模糊程度随景深增大而不断增大的效果。It should be understood that in the process of image blur processing, the blur kernel size of any pixel directly determines the blur degree of any pixel, and the blur degree is positively correlated with the blur kernel size. Therefore, configuring a larger blur kernel size for pixels with a larger depth information difference means that the farther the physical distance from the subject is, the higher the degree of blur will be. This allows the degree of blur to increase as the depth of field increases. increased effect.
在实际配置的过程中,可以约束模糊核的形状为环形或圆形,在该情况下,只需根据各个像素点与目标区域的深度信息差值,为相应像素点配置模糊半径即可。其 中,在约束的形状为环形时,可以使具备柔焦效果的图像中的光斑呈现环形,或者说洋葱圈形,较好地还原了相关技术中通过柔焦镜片实现的柔焦效果。In the actual configuration process, the shape of the blur kernel can be constrained to be annular or circular. In this case, it is only necessary to configure the blur radius for the corresponding pixel based on the difference in depth information between each pixel and the target area. Among them, when the shape of the constraint is annular, the light spot in the image with soft focus effect can be made to appear annular, or in an onion ring shape, which better restores the soft focus effect achieved by soft focus lenses in related technologies.
在本公开中,可以通过多种方式确定出上述目标区域。例如,可以获取原始图像中各个像素点的深度信息,以根据该深度信息确定出该目标区域,需要声明的是,本实施例可以采用任一种方式,获取原始图像中各个像素点的深度信息,本公开对此不作限制。再例如,可以对原始图像进行内容识别,以确定出目标区域,譬如,当原始图像为人像图像时,可以对原始图像进行人像识别,以确定出目标区域。当然,上述确定目标区域的方式均是示意性的,具体如何确定目标区域,可由本领域技术人员根据实际情况确定,本公开对此不作限制。In the present disclosure, the above target area can be determined in various ways. For example, the depth information of each pixel in the original image can be obtained to determine the target area based on the depth information. It should be noted that this embodiment can use any method to obtain the depth information of each pixel in the original image. , this disclosure does not limit this. For another example, content recognition can be performed on the original image to determine the target area. For example, when the original image is a portrait image, portrait recognition can be performed on the original image to determine the target area. Of course, the above methods of determining the target area are all illustrative. The specific method of determining the target area can be determined by those skilled in the art according to actual conditions, and this disclosure does not limit this.
在本公开中,在对光斑子图像和非光斑子图像均进行图像模糊之后,即可对两者进行图像融合,以得到具备柔焦效果的图像。In the present disclosure, after blurring both the spot sub-image and the non-spot sub-image, the two can be image fused to obtain an image with a soft focus effect.
在一种情况下,在分别对光斑子图像和非光斑子图像进行图像模糊后,本公开既可以直接对经由模糊处理得到的光斑子图像和经由模糊处理的非光斑子图像进行图像融合,以得到具备柔焦效果的图像,换言之,可以在不对经由模糊处理的光斑子图像和经由模糊处理的非光斑子图像做任何额外处理的情况下,便进行图像融合,并将融合得到的图像作为图像处理得到的图像。In one case, after blurring the light spot sub-image and the non-light spot sub-image respectively, the present disclosure can directly perform image fusion on the light spot sub-image obtained through blur processing and the non-light spot sub-image obtained through blur processing, so as to Obtain an image with a soft focus effect. In other words, image fusion can be performed without any additional processing on the blurred spot sub-image and the blurred non-spot sub-image, and the fused image can be used as the image processed image.
在另一种情况下,可以在对经由模糊处理后的光斑子图像和非光斑子图像进行额外处理后,再对处理后的图像进行图像融合。例如,本公开可以将上文所述的针对光斑子图像和非光斑子图像分别执行的模糊处理称作初次模糊处理。那么,在对两子图像完成初次模糊处理后,一方面,可以对经由初次模糊处理的光斑子图像和经由初次模糊处理的非光斑子图像进行图像融合,以得到第一融合图像;另一方面,可以对经由初次模糊处理的非光斑子图像进行二次图像模糊,再将经由二次模糊处理的非光斑子图像与经由初次模糊处理的光斑子图像进行图像融合,得到第二融合图像。在此基础上,再对第一融合图像和第二融合图像进行柔焦融合,以得到柔焦图像。应当理解的是,在该情况下,针对光斑子图像和非光斑子图像进行初次图像模糊时,可以如上文所述,采用不同的模糊策略。In another case, after additional processing is performed on the blurred spot sub-image and the non-spot sub-image, the processed images can then be image fused. For example, the present disclosure may refer to the above-described blur processing performed separately on the spot sub-image and the non-spot sub-image as primary blur processing. Then, after the initial blur processing of the two sub-images is completed, on the one hand, the spot sub-image that has undergone the initial blur processing and the non-spot sub-image that has undergone the initial blur processing can be image fused to obtain the first fused image; on the other hand, the first fused image can be obtained; , the non-spot sub-image that has undergone the primary blur processing can be subjected to secondary image blur, and then the non-spot sub-image that has undergone the secondary blur processing and the spot sub-image that has undergone the primary blur processing can be image fused to obtain a second fused image. On this basis, soft focus fusion is performed on the first fused image and the second fused image to obtain a soft focus image. It should be understood that in this case, when performing initial image blurring for the spot sub-image and the non-spot sub-image, different blur strategies can be used as described above.
在该情况下,在第一融合图像中,无论是光斑区域还是非光斑区域,均未执行额外的图像模糊操作;在第二融合图像中,光斑所在区域未执行额外的图像模糊操作,而非光斑区域则额外进行了一次图像模糊操作。应当理解的是,光斑区域的高光晕染效果,需要非光斑区域的朦胧感衬托,才能够展现柔焦效果,因此,为非光斑区域额 外执行一次图像模糊操作,可以提高非光斑区域的朦胧感,强化柔焦效果。而光斑区域的亮度较高,边缘存在一定的锐度,若对其也进行额外的图像模糊操作,将削弱光斑区域的锐度,不仅无法凸显光斑形状,且易破坏高光晕染的效果。可见,通过该图像融合方式,能够在强化柔焦效果的同时,避免光斑区域的锐度被弱化。In this case, in the first fused image, no additional image blur operation is performed on either the light spot area or the non-light spot area; in the second fused image, no additional image blur operation is performed on the area where the light spot is located, instead of The light spot area undergoes an additional image blur operation. It should be understood that the highlight blooming effect in the spot area requires the hazy feeling in the non-spot area to show the soft focus effect. Therefore, performing an additional image blur operation for the non-spot area can improve the hazy feeling in the non-spot area. , to enhance the soft focus effect. The brightness of the spot area is high, and there is a certain sharpness at the edge. If additional image blur operations are performed on it, the sharpness of the spot area will be weakened, which will not only fail to highlight the spot shape, but also easily destroy the highlight blooming effect. It can be seen that through this image fusion method, the soft focus effect can be enhanced while preventing the sharpness of the spot area from being weakened.
在本公开中,在图像融合得到柔焦图像时,可以根据实际情况采用任一种图像融合方式。在实际应用中,为了达到较好的柔焦效果,可以采用柔焦融合的方式进行图像融合,例如,可以在调整透明度、饱和度等参数后,再进行图像融合;再例如,可以采用滤色融合、正片叠底等融合方式进行图像融合。当然,该举例仅是示意性的,具体采用何种图像融合方式,可由本领域技术人员根据实际情况确定,本公开对此不作限制。In the present disclosure, when image fusion is used to obtain a soft-focus image, any image fusion method can be used according to the actual situation. In practical applications, in order to achieve a better soft focus effect, soft focus fusion can be used for image fusion. For example, image fusion can be performed after adjusting parameters such as transparency and saturation; for another example, color filtering can be used Fusion, multiplication and other fusion methods are used for image fusion. Of course, this example is only illustrative, and the specific image fusion method used can be determined by those skilled in the art according to actual conditions, and this disclosure does not limit this.
需要声明的是,本公开中的目标区域、光斑区域并不存在绝对的关联关系。目标区域既有可能存在重叠,又有可能完全不相关。It should be noted that there is no absolute correlation between the target area and the light spot area in this disclosure. The target areas may overlap or be completely unrelated.
还需声明的是,本公开技术方案的执行主体可以为任一类型的电子设备,例如,该电子设备可以为智能手机、平板电脑等移动终端,也可以为智能电视、PC(个人计算机,Personal Computer)等固定终端。应当理解的是,只需具备数据处理能力的的电子设备均可作为本公开的执行主体,具体将哪一种类型的电子设备作为本公开技术方案的执行主体,可以由本领域技术人员根据实际需求确定,本公开对此不作限制。It should also be stated that the execution subject of the technical solution of the present disclosure can be any type of electronic device. For example, the electronic device can be a mobile terminal such as a smartphone, a tablet computer, or a smart TV, PC (Personal Computer, etc.) Computer) and other fixed terminals. It should be understood that any electronic device that only has data processing capabilities can be used as the execution subject of the present disclosure. Which type of electronic device is used as the execution subject of the technical solution of the present disclosure can be determined by those skilled in the art according to actual needs. To be sure, this disclosure does not limit this.
由上述技术方案可知,本公开在获取原始图像的基础上,还可以进一步获取原始图像的光斑子图像和非光斑子图像,并对光斑子图像和非光斑子图像分别进行图像模糊,以使两者均出现朦胧的观感。在此基础上,即可对经由模糊处理的光斑子图像和非光斑子图像进行图像融合,以得到具备柔焦效果的图像。It can be seen from the above technical solution that, on the basis of obtaining the original image, the present disclosure can further obtain the light spot sub-image and the non-light spot sub-image of the original image, and blur the light spot sub-image and the non-light spot sub-image respectively, so that the two All experienced a hazy look and feel. On this basis, the blurred spot sub-image and the non-spot sub-image can be image fused to obtain an image with a soft focus effect.
应当理解的是,本公开在实现柔焦效果的过程中,既无需借助任何实体配件和图像处理软件,又无需用户进行额外的操作,避免了相关技术在实现柔焦效果时,需要用户进行额外操作的问题。除此之外,本公开是在获取原始图像的基础上,再进行处理,避免了相关技术在通过柔焦镜头实现柔焦效果时,由于柔焦镜头对原始图像的成像数据产生了影响,而导致后期空间较小的问题。It should be understood that in the process of realizing the soft focus effect, the present disclosure does not require the use of any physical accessories and image processing software, nor does it require the user to perform additional operations, thus avoiding the need for the user to perform additional operations when the related technology achieves the soft focus effect. Operational issues. In addition, this disclosure is based on obtaining the original image and then processing it, which avoids the impact of the soft-focus lens on the imaging data of the original image when the soft-focus lens is used to achieve the soft-focus effect in related technologies. This leads to the problem of smaller space later.
进一步的,本公开还可以采用不同的模糊策略对光斑子图像和非光斑子图像进行图像模糊,以使光斑子图像和非光斑子图像在经由模糊处理后,具有不同的模糊效果,进而使两者形成对比,强化柔焦效果。Furthermore, the present disclosure can also use different blurring strategies to blur the light spot sub-image and the non-light spot sub-image, so that the light spot sub-image and the non-light spot sub-image have different blur effects after blur processing, thereby making the two It creates contrast and enhances the soft focus effect.
再进一步的,本公开可以根据各个像素点与目标区域的深度信息差值,为相应像素点配置模糊核,且任一像素点的模糊核尺寸与相应的深度信息差值呈正相关。由于各个像素点的模糊程度与相应像素点的模糊核尺寸呈正相关,因此,通过该方式可以实现随景深增大,模糊程度不断增大的效果。Furthermore, the present disclosure can configure a blur kernel for the corresponding pixel according to the depth information difference between each pixel and the target area, and the blur kernel size of any pixel is positively correlated with the corresponding depth information difference. Since the blur degree of each pixel is positively correlated with the blur kernel size of the corresponding pixel, this method can achieve the effect of increasing the blur degree as the depth of field increases.
又进一步的,本公开对光斑子图像和非光斑子图像采用了不同的模糊算法。其中,光斑子图像采用的模糊算法的模糊效果优于非光斑子图像采用的模糊算法,但功耗高于非光斑子图像采用的模糊算法。该方式在保证柔焦效果的同时,避免了对所有画面均采用优质模糊算法,而功耗过高的问题。Furthermore, the present disclosure adopts different blur algorithms for the spot sub-image and the non-spot sub-image. Among them, the blurring effect of the blur algorithm used in the spot sub-image is better than that of the blur algorithm used in the non-spot sub-image, but the power consumption is higher than the blur algorithm used in the non-spot sub-image. This method ensures the soft focus effect while avoiding the problem of high power consumption caused by using high-quality blur algorithms for all images.
下面,以执行主体为智能手机为例,对本公开的技术方案进行介绍。Below, taking the execution subject as a smartphone as an example, the technical solution of the present disclosure is introduced.
图2为本公开一示例性实施例示出的一种图像处理过程中执行的各个图像处理操作的示意图。本公开将结合图2对图像处理过程中的各个处理进行说明,以方便理解各个操作之间的递进关系。FIG. 2 is a schematic diagram of various image processing operations performed in an image processing process according to an exemplary embodiment of the present disclosure. This disclosure will describe each process in the image processing process with reference to FIG. 2 to facilitate understanding of the progressive relationship between each operation.
一、图像获取:1. Image acquisition:
在进行图像处理之前,除了需要拍摄得到原始图像之外,还需获取该原始图像的光斑掩膜图像和模糊半径图像,并将原始图像、光斑掩膜图像、模糊半径图像三者作为入参,以输出具有柔焦效果的渲染图像。Before image processing, in addition to shooting the original image, it is also necessary to obtain the spot mask image and blur radius image of the original image, and use the original image, spot mask image, and blur radius image as input parameters. to output a rendered image with a soft focus effect.
本实施例在获取模糊半径图像时,可以包含下述步骤:When acquiring the blur radius image, this embodiment may include the following steps:
步骤1,调用摄像头对被摄主体进行图像拍摄,得到原始图像。Step 1: Call the camera to take an image of the subject and obtain the original image.
在本实施例中,用户可以启动智能手机中预先装配的相机软件,以通过该相机软件调用摄像头,对被摄主体进行图像拍摄,得到原始图像。In this embodiment, the user can start the camera software pre-assembled in the smartphone to call the camera through the camera software to capture the image of the subject and obtain the original image.
步骤2,获取原始图像中各个像素点的深度信息。Step 2: Obtain the depth information of each pixel in the original image.
在本实施例中,在调用摄像头进行图像拍摄的同时,可以调用深度传感器,对被摄主体及其附近区域进行深度检测,得到与原始图像对应的深度图像,该深度图像中记录了原始图像中各个像素点的深度信息。In this embodiment, while calling the camera to capture the image, the depth sensor can be called to perform depth detection on the subject and its nearby area to obtain a depth image corresponding to the original image. The depth image records the contents of the original image. Depth information of each pixel.
步骤3,基于各个像素点的深度信息生成与被摄主体对应的模糊半径图。Step 3: Generate a blur radius map corresponding to the subject based on the depth information of each pixel.
在本实施例中,在获得上述深度图像后,即可基于深度图像中各个像素点的深度信息,大致确定出被摄主体所处的目标区域,并根据各个像素点与该目标区域的深度信息差值确定出各个像素点的模糊半径。其中,深度信息差值越大的像素点,其模 糊半径越大。In this embodiment, after the above-mentioned depth image is obtained, the target area where the subject is located can be roughly determined based on the depth information of each pixel in the depth image, and based on the depth information of each pixel and the target area The difference determines the blur radius of each pixel. Among them, the pixels with larger depth information difference have larger blur radius.
例如,在某一区域内的各个像素点的深度信息较为接近,且与其他区域的深度信息相差较大时,即可将该区域确定为目标区域;或者,在某一区域的各个像素点的深度信息在预设的深度范围内时,即可将该区域确定为目标区域。当然,该举例仅是示意性的,具体如何根据深度信息确定目标区域,可由本领域技术人员根据实际情况确定,本实施例对此不作限制。For example, when the depth information of each pixel in a certain area is relatively close and differs greatly from the depth information of other areas, the area can be determined as the target area; or, when the depth information of each pixel in a certain area is When the depth information is within the preset depth range, the area can be determined as the target area. Of course, this example is only illustrative. How to determine the target area based on the depth information can be determined by those skilled in the art based on actual conditions, and this embodiment does not limit this.
需要声明的是,本实施例确定出的模糊半径图中的各个像素点的像素值,用于表征原始图像中相应像素点的模糊核的半径。由于模糊核的形状是预设的,因此,只需确定出各个像素点的模糊核的半径,即可确定模糊核的尺寸。可见,得到模糊半径图相当于确定了各个像素点的模糊核尺寸。为表征方便,后文中将模糊核的半径简称为模糊半径。It should be noted that the pixel value of each pixel in the blur radius map determined in this embodiment is used to characterize the radius of the blur kernel of the corresponding pixel in the original image. Since the shape of the blur kernel is preset, the size of the blur kernel can be determined by simply determining the radius of the blur kernel for each pixel. It can be seen that obtaining the blur radius map is equivalent to determining the blur kernel size of each pixel. For the convenience of characterization, the radius of the blur kernel will be referred to as the blur radius in the following text.
本实施例在获取光斑掩膜图像的过程中(对应于图2中由原始图像指向光斑掩膜图像的箭头),可以包含下述步骤:In this embodiment, during the process of acquiring the spot mask image (corresponding to the arrow pointing from the original image to the spot mask image in Figure 2), the following steps may be included:
步骤1,确定出原始图像的亮度图。Step 1: Determine the brightness map of the original image.
在本实施例中,在获取到原始图像后,即可基于该原始图像确定出其亮度图,以根据该亮度图得到光斑掩膜图像。In this embodiment, after the original image is acquired, its brightness map can be determined based on the original image, and the spot mask image can be obtained based on the brightness map.
步骤2,对亮度图进行解析,以得到光斑掩膜图像。Step 2: Analyze the brightness map to obtain the spot mask image.
如上文所述,光斑掩膜图像用于表征光斑在原始图像中的位置,而光斑所在区域的亮度与其他区域存在显著差异,因此,可以对亮度图进行解析,以得到光斑掩膜图像。As mentioned above, the spot mask image is used to characterize the position of the spot in the original image, and the brightness of the area where the spot is located is significantly different from other areas. Therefore, the brightness map can be analyzed to obtain the spot mask image.
二、图像模糊:2. Image blur:
在获取到光斑掩膜图像和模糊半径图像之后,即可基于光斑掩膜图像和模糊半径图像对原始图像进行图像模糊,该过程中可以包含以下步骤:After obtaining the spot mask image and blur radius image, the original image can be blurred based on the spot mask image and blur radius image. This process can include the following steps:
步骤1A,基于光斑掩膜图像对原始图像进行图像分离,以得到光斑图层和非光斑图层。Step 1A: Image separation is performed on the original image based on the spot mask image to obtain the spot layer and the non-spot layer.
在本实施例中,一方面可以基于光斑掩膜图像对原始图像进行图像分离,以得到光斑图层和非光斑图层(即上文所述光斑子图像和非光斑子图像);另一方面,可以基于光斑掩膜图像生成模糊权重图,该模糊权重图中各个像素点的像素值用于表征: 为原始图像中相应像素点分配的模糊权重。In this embodiment, on the one hand, the original image can be image separated based on the spot mask image to obtain the spot layer and the non-spot layer (i.e., the spot sub-image and the non-spot sub-image described above); on the other hand, , a blur weight map can be generated based on the spot mask image. The pixel value of each pixel in the blur weight map is used to represent: the blur weight assigned to the corresponding pixel in the original image.
举例而言,可以根据预设数值为属于和不属于光斑区域的像素点赋予模糊权重。例如,可以为属于光斑区域的像素点赋予一个固定的模糊权重,而为不属于光斑区域的像素点赋予另一个固定的模糊权重,譬如,前者可以为400,而后者可以为10。For example, blur weights can be assigned to pixels that belong to and do not belong to the spot area according to a preset value. For example, pixels that belong to the spot area can be assigned a fixed blur weight, and pixels that do not belong to the spot area can be assigned another fixed blur weight. For example, the former can be 400, and the latter can be 10.
步骤1B,基于光斑掩膜图像生成模糊权重图。Step 1B: Generate a blur weight map based on the spot mask image.
步骤2,基于模糊权重图分别对光斑图层、非光斑图层进行像素加权,得到加权光斑图层、加权非光斑图层。Step 2: Weight the pixels of the light spot layer and the non-light spot layer respectively based on the blur weight map to obtain a weighted light spot layer and a weighted non-light spot layer.
在本实施例中,在得到光斑图像、非光斑图层,以及模糊权重图后,即可基于模糊权重图中各个像素点的模糊权重,分别对光斑图层和非光斑图层进行加权,以得到加权光斑图层和加权非光斑图层。In this embodiment, after obtaining the spot image, the non-spot layer, and the blur weight map, the spot layer and the non-spot layer can be weighted respectively based on the blur weight of each pixel in the blur weight map, so as to Get a weighted spot layer and a weighted non-spot layer.
承接上述举例,可以采用点乘的方式,对光斑图层和非光斑图层的像素点的像素值进行调整,如,对于光斑图层中的像素点,可以对每一像素点的像素值乘400;而对于非光斑图层中的像素点,可以对每一像素点的像素值乘10。Following the above example, you can use dot multiplication to adjust the pixel values of the pixels in the spot layer and the non-spot layer. For example, for the pixels in the spot layer, you can multiply the pixel value of each pixel by 400; for pixels in the non-spot layer, you can multiply the pixel value of each pixel by 10.
步骤3,基于模糊半径图对加权光斑图层进行打散模糊,得到光斑渲染图像S;基于模糊半径图对加权非光斑图层进行聚集模糊,得到非光斑渲染图像B。Step 3: Perform scatter blur on the weighted spot layer based on the blur radius map to obtain the spot rendering image S; perform cluster blur on the weighted non-spot layer based on the blur radius map to obtain the non-spot rendering image B.
在本实施例中,打散模糊的模糊效果优于聚集模糊。对光斑图层进行打散模糊,能够保证光斑所处区域的光晕效果,而非光斑区域并非柔焦效果的重点区域,用户通常不会着重关注,模糊要求本就较低,对其采用聚集模糊能够在保证达到柔焦效果的同时,减少模糊操作的功耗。In this embodiment, the blur effect of scattered blur is better than that of gathered blur. Dispersing and blurring the spot layer can ensure the halo effect in the area where the spot is located. The non-spot area is not the key area of the soft focus effect. Users usually do not pay much attention to it. The blur requirements are inherently low, so focus is used on it. Blur can reduce the power consumption of blur operations while ensuring a soft focus effect.
在本实施例中,在得到加权光斑图层和加权非光斑图层后,即可基于模糊半径图对两者分别执行打散模糊和加权模糊。不难看出,本实施例中的打散模糊和聚集模糊即为上文所述的针对光斑子图像和非光斑子图像的初次图像模糊。In this embodiment, after obtaining the weighted spot layer and the weighted non-spot layer, scattered blur and weighted blur can be performed on the two based on the blur radius map respectively. It is not difficult to see that the scattering blur and the gathering blur in this embodiment are the initial image blurring for the spot sub-image and the non-spot sub-image described above.
为方便理解,以均值模糊为例,对模糊原理进行解释:假设任一像素点的模糊核为如图3A所示的3*3的方形模糊核,那么,经由模糊处理后像素点的像素值x 5=(A 1x 1+A 2x 2+A 3x 3+A 4x 4+A 5x 5+A 6x 6+A 7x 7+A 8x 8+A 9x 9)/(A 1+A 2+A 3+A 4+A 5+A 6+A 7+A 8+A 9)。其中,A 1~9用于表征模糊核中各个像素点的模糊权重,x 1~9表征模糊核中各个像素点的像素值。若承接上述举例, 且x 1~9均处于光斑区域,那么,A 1~9均为400。不难看出,任一像素点经由模糊处理后的像素值,与其周围8个像素点以及自身的像素值之和相关,即与该像素点的模糊核中各个像素点的像素值之和相关。因此,在实际模糊的过程中,只需求得其模糊核所覆盖的像素点的像素值之和,即可得到各个像素点经由模糊处理后的像素值。 For the convenience of understanding, the mean blur is used as an example to explain the blur principle: Assume that the blur kernel of any pixel is a 3*3 square blur kernel as shown in Figure 3A. Then, the pixel value of the pixel after blur processing is x 5 =(A 1 x 1 +A 2 x 2 +A 3 x 3 +A 4 x 4 +A 5 x 5 +A 6 x 6 +A 7 x 7 +A 8 x 8 +A 9 x 9 )/ (A 1 +A 2 +A 3 +A 4 +A 5 +A 6 +A 7 +A 8 +A 9 ). Among them, A 1 to 9 are used to represent the blur weight of each pixel in the blur kernel, and x 1 to 9 represent the pixel value of each pixel in the blur kernel. If the above example is followed and x 1 to 9 are all in the light spot area, then A 1 to 9 are all 400. It is not difficult to see that the pixel value of any pixel after blur processing is related to the sum of the pixel values of the eight surrounding pixels and itself, that is, to the sum of the pixel values of each pixel in the blur kernel of the pixel. Therefore, in the actual blurring process, only the sum of the pixel values of the pixels covered by the blur kernel is needed to obtain the pixel value of each pixel after blurring.
承接上述举例,假设本实施例为光斑区域设置的模糊核为上述双环形模糊核,而为非光斑区域设置的模糊核为环形模糊核。两形状的模糊核可参照附图3B。其中,Following the above example, assume that the blur kernel set for the spot area in this embodiment is the above-mentioned double annular blur kernel, and the blur kernel set for the non-spot area is an annular blur kernel. The blur kernels of the two shapes can be referred to Figure 3B. in,
在对加权光斑图层中的任一像素点进行图像模糊时,若基于模糊半径图确定该任一像素点的模糊半径为R,那么,可以将R作为双环形的最外圈的模糊半径,而中间圈的模糊半径和最里圈的模糊半径可以为(R-1)和(R/2)中任一,具体的,两者中较大的为中间圈的模糊半径、较小的为最里圈模糊半径。那么,对于加权光斑图层中的任一像素点,其模糊核的所覆盖的像素点的像素值之和可以为:S spot=Nf(R)-Mf(R-1)-(N-M)f(R/2);其中,f(R)表征模糊半径为R的圆形区域内的像素点的像素值之和,f(R-1)和f(R/2)的含义也是类似,在此不再赘述;M、N均为标量,且N大于M,具体为何值可由本领域技术人员根据实际需求确定,本实施例对此不作限制。 When blurring the image of any pixel in the weighted spot layer, if the blur radius of any pixel is determined to be R based on the blur radius map, then R can be used as the blur radius of the outermost ring of the double ring, The blur radius of the middle circle and the blur radius of the innermost circle can be either (R-1) or (R/2). Specifically, the larger of the two is the blur radius of the middle circle, and the smaller is The innermost circle blur radius. Then, for any pixel in the weighted spot layer, the sum of the pixel values of the pixels covered by its blur kernel can be: S spot =Nf(R)-Mf(R-1)-(NM)f (R/2); among them, f(R) represents the sum of pixel values of pixels in the circular area with a blur radius of R. The meanings of f(R-1) and f(R/2) are also similar. This will not be described again; M and N are both scalars, and N is greater than M. The specific value can be determined by those skilled in the art according to actual needs, and this embodiment does not limit this.
而在对加权非光斑图层中的任一像素点进行图像模糊时,若基于模糊半径图确定该任一像素点的模糊半径为R,那么,可以将R作为环形外圈的模糊半径,将R/2作为环形内圈的模糊半径。该任一像素的模糊核的所覆盖的像素点的像素值之和可以为:S back=f(R)-f(R/2);其中,f(R)表征模糊半径为R的圆形区域内的像素点的像素值之和。 When blurring the image of any pixel in the weighted non-spot layer, if the blur radius of any pixel is determined to be R based on the blur radius map, then R can be used as the blur radius of the annular outer circle, and R/2 serves as the blur radius of the inner circle of the ring. The sum of the pixel values of the pixels covered by the blur kernel of any pixel can be: S back =f(R)-f(R/2); where f(R) represents a circle with a blur radius of R The sum of pixel values of pixels in the area.
需要声明的是,本实施例的模糊操作,是在图像渲染的过程中执行,因此,通过模糊处理得到的图像可以被称作:光斑渲染图像S和非光斑渲染图像B。It should be noted that the blur operation in this embodiment is performed during the image rendering process. Therefore, the images obtained through the blur processing can be called: spot rendering image S and non-spot rendering image B.
三、图像融合3. Image fusion
在对光斑图层和非光斑图层进行图像模糊之后,即可对两者进行图像融合,以得到具有柔焦效果的柔焦图像。在本实施例中,为达到较为优质的柔焦效果,在最终得到柔焦图像之前,进行了多次图像融合,并针对不同的图像融合进行了不同的处理。具体的图像融合过程可以包含下述步骤:After blurring the image of the spot layer and the non-spot layer, the two can be image fused to obtain a soft-focus image with a soft-focus effect. In this embodiment, in order to achieve a relatively high-quality soft focus effect, multiple image fusions are performed before finally obtaining a soft focus image, and different processes are performed for different image fusions. The specific image fusion process can include the following steps:
步骤1A、对光斑渲染图像S和非光斑渲染图像B进行图像融合,得到渲染子图像R1。Step 1A: Perform image fusion on the light spot rendering image S and the non-light spot rendering image B to obtain the rendering sub-image R1.
在本实施例中,在得到光斑渲染图像S和非光斑渲染图像B后,可以直接对两者进行图像融合,得到渲染子图像R1。在该渲染子图像R1中,可以保证整张图像的画面内容较为清晰。In this embodiment, after obtaining the light spot rendering image S and the non-light spot rendering image B, the two can be directly image fused to obtain the rendering sub-image R1. In this rendered sub-image R1, it can be ensured that the content of the entire image is relatively clear.
在实际的融合过程中,还可以为非光斑渲染图像B中的各个像素点分配渲染权重值,各个像素点的渲染权重值组成非光斑渲染权重图像S w;相类似的,也可以为光斑渲染图像S中的各个像素点分配渲染权重值,各个像素点的渲染权重值组成光斑渲染权重图像S w。那么,图像融合公式可以为:R1 i=(S i+B i)/(S wi+B wi)。其中,i表征像素点的序号,R1 i表征该像素点在融合得到的图像中的像素值,B i表征该像素点在非光斑渲染图像B中的像素值,其他参数也是类似,在此不再赘述。 In the actual fusion process, each pixel in the non-spot rendering image B can also be assigned a rendering weight value, and the rendering weight value of each pixel constitutes the non-spot rendering weight image S w ; similarly, the light spot rendering can also be Each pixel in the image S is assigned a rendering weight value, and the rendering weight value of each pixel constitutes the spot rendering weight image S w . Then, the image fusion formula can be: R1 i =(S i +B i )/(S wi +B wi ). Among them, i represents the serial number of the pixel, R1 i represents the pixel value of the pixel in the fused image, and B i represents the pixel value of the pixel in the non-spot rendering image B. The other parameters are similar and will not be used here. Again.
步骤1B,对非光斑渲染图像B进行高斯模糊,得到非光斑高斯模糊渲染图像B’。Step 1B: Perform Gaussian blur on the non-spot rendering image B to obtain the non-spot Gaussian blur rendering image B’.
在本实施例中,由于非光斑渲染图像B用于表征不属于光斑的区域,因此,可以对其进行进一步高斯模糊,以增加非光斑区域的朦胧感。在此基础上,再将高斯模糊得到的非光斑高斯模糊渲染图像B’与光斑渲染图像S进行图像融合,以得到高斯渲染子图像R2。在该高斯渲染子图像R2中,能够保证光斑区域画面相对清晰,而非光斑区域画面内容较为模糊。不难看出,本实施例中的高斯模糊即为上文所述的针对非光斑子图像的二次图像模糊。In this embodiment, since the non-spot rendering image B is used to represent an area that does not belong to a spot, it can be further Gaussian blurred to increase the hazy feeling in the non-spot area. On this basis, the non-spot Gaussian blurred rendering image B’ obtained by Gaussian blur is image fused with the spot rendering image S to obtain the Gaussian rendered sub-image R2. In the Gaussian rendering sub-image R2, it can be ensured that the image in the spot area is relatively clear, while the content of the image in the non-spot area is relatively blurry. It is easy to see that the Gaussian blur in this embodiment is the secondary image blur for the non-spot sub-image described above.
步骤2B,对非光斑高斯模糊渲染图像B’和光斑渲染图像S进行图像融合,得到高斯渲染子图像R2。Step 2B: Perform image fusion on the non-spot Gaussian blur rendering image B’ and the spot rendering image S to obtain a Gaussian rendering sub-image R2.
与上述融合过程类似的,可以获取非光斑高斯模糊渲染图像B’的非光斑高斯模糊渲染权重图像B′ w。那么,图像融合公式可以为:R2 i=(B′ i+S i)/(B′ wi+S wi)。 Similar to the above fusion process, the non-spot Gaussian blur rendering weight image B′ w of the non-spot Gaussian blur rendering image B′ can be obtained. Then, the image fusion formula can be: R2 i =(B′ i +S i )/(B′ wi +S wi ).
步骤3,对渲染子图像R1和高斯渲染子图像R2进行柔焦融合,得到柔焦图像。Step 3: Perform soft focus fusion on the rendered sub-image R1 and the Gaussian rendered sub-image R2 to obtain a soft focus image.
在得到渲染子图像R1和高斯渲染图像R2后,即可对两者进行柔焦融合,以得到渲染图像R。例如,在实际执行柔焦融合的操作中,可以分别对渲染子图像R1和高斯渲染图像R2的RGB三个通道分别进行滤色融合,最终得到柔焦图像。该融合方式能够较好地保留图像的细节,提高柔焦图像的画质。当然,该柔焦融合操作仅是示意性的,具体采用何种方式进行柔焦融合,可由本领域技术人员根据实际需求确定,本实施例对此不作限制。在实际应用中,柔焦融合的融合公式可以为:R i=1- (1-s 1*R1 i)(1-s 2*R2 i)。其中,s 1和s 2均是标量超参数,可由本领域技术人员根据实际情况确定,本实施例对此不作限制。 After obtaining the rendered sub-image R1 and the Gaussian rendered image R2, the two can be soft-focus fused to obtain the rendered image R. For example, in the actual operation of performing soft focus fusion, the three RGB channels of the rendered sub-image R1 and the Gaussian rendered image R2 can be separately filtered and fused to finally obtain a soft focus image. This fusion method can better retain the details of the image and improve the quality of the soft-focus image. Of course, the soft focus fusion operation is only illustrative. The specific method used to perform soft focus fusion can be determined by those skilled in the art according to actual needs, and this embodiment does not limit this. In practical applications, the fusion formula of soft focus fusion can be: R i =1- (1-s 1 *R1 i )(1-s 2 *R2 i ). Among them, s 1 and s 2 are both scalar hyperparameters, which can be determined by those skilled in the art according to actual conditions, and this embodiment does not limit this.
应当理解的是,在该渲染图像R中,由于渲染子图像R1未作进一步高斯模糊,而高斯渲染图像R2中的非光斑区域经由高斯模糊,因此,渲染图像R可以在加深非光斑区域的朦胧质感的基础上,避免光斑区域被过度模糊,而出现光斑区域锐度不足的问题。It should be understood that in the rendered image R, since the rendered sub-image R1 is not further Gaussian blurred, and the non-spot area in the Gaussian rendered image R2 is Gaussian blurred, the rendered image R can deepen the hazyness of the non-spot area. On the basis of texture, it avoids the problem of insufficient sharpness in the spot area due to excessive blurring.
由上述技术方案可知,通过本实施例的技术方案,能够在图像渲染过程中,对图像进行图像模糊,以使得到的柔焦图像中,光斑所在区域呈现光斑晕染的效果,其中,光晕呈现洋葱圈形。除此之外,还能够保留光斑区域内画面内容的锐度,避免光斑区域被过度模糊,而导致清晰度下降的问题。It can be seen from the above technical solution that through the technical solution of this embodiment, the image can be blurred during the image rendering process, so that in the obtained soft focus image, the area where the light spot is located presents the effect of light spot halo, wherein the halo Onion ring shape. In addition, it can also retain the sharpness of the image content in the spot area and avoid the problem of reduced clarity caused by excessive blurring of the spot area.
图4是本公开一示例性实施例示出的一种图像处理装置的框图。参照图4,该装置包括:获取单元401和模糊单元402。FIG. 4 is a block diagram of an image processing device illustrating an exemplary embodiment of the present disclosure. Referring to FIG. 4 , the device includes: an acquisition unit 401 and a blur unit 402 .
获取单元401,获取原始图像的光斑子图像和非光斑子图像,所述光斑子图像包含位于光斑区域的画面内容、所述非光斑子图像包含位于非光斑区域的画面内容;The acquisition unit 401 acquires the light spot sub-image and the non-light spot sub-image of the original image, the light spot sub-image includes the picture content located in the light spot area, and the non-light spot sub-image includes the picture content located in the non-light spot area;
模糊单元402,对所述光斑子图像和所述非光斑子图像分别进行图像模糊,并对经由模糊处理的光斑子图像和经由模糊处理的非光斑子图像进行图像融合,得到具备柔焦效果的图像。The blurring unit 402 performs image blurring on the light spot sub-image and the non-light spot sub-image respectively, and performs image fusion on the blurred light spot sub-image and the blurred non-light spot sub-image to obtain a soft focus effect. image.
可选的,模糊单元402被进一步用于:Optionally, the fuzzy unit 402 is further used for:
对所述光斑子图像和所述非光斑子图像分别进行初次模糊处理;Perform initial blur processing on the light spot sub-image and the non-light spot sub-image respectively;
对经由初次模糊处理的光斑子图像和经由初次模糊处理的非光斑子图像进行图像融合,得到第一融合图像;对经由初次模糊处理的非光斑图像进行二次图像模糊,并将经由二次模糊处理的非光斑图像与经由初次模糊处理的光斑子图像进行图像融合,得到第二融合图像;以及,对所述第一融合图像和所述第二融合图像进行柔焦融合,得到具备柔焦效果的图像。Perform image fusion on the light spot sub-image that has undergone the primary blurring process and the non-light spot sub-image that has undergone the primary blurring process to obtain the first fused image; perform a secondary image blur on the non-spot image that has undergone the primary blurring process, and blur the light spot sub-image that has undergone the primary blurring process. The processed non-spot image is image fused with the spot sub-image that has undergone the initial blurring process to obtain a second fused image; and, the first fused image and the second fused image are soft-focus fused to obtain a soft-focus effect. Image.
可选的,模糊单元402被进一步用于:Optionally, the fuzzy unit 402 is further used for:
采用不同的模糊策略对所述光斑子图像和非光斑子图像进行图像模糊。Different blur strategies are used to blur the light spot sub-image and the non-light spot sub-image.
可选的,模糊单元402被进一步用于:Optionally, the fuzzy unit 402 is further used for:
为所述光斑子图像和所述非光斑子图像配置不同模糊核;Configuring different blur kernels for the light spot sub-image and the non-light spot sub-image;
基于配置的模糊核分别对所述光斑子图像和所述非光斑子图像进行图像模糊。The light spot sub-image and the non-light spot sub-image are respectively image blurred based on the configured blur kernel.
可选的,为所述光斑子图像和所述非光斑子图像配置的模糊核在下述至少一个维度存在区别:Optionally, the blur kernel configured for the light spot sub-image and the non-light spot sub-image is different in at least one of the following dimensions:
模糊核形状、模糊核尺寸。Blur kernel shape and blur kernel size.
可选的,optional,
所述光斑子图像中任一像素点的模糊核为:基于该任一像素点的第一模糊半径、小于该第一模糊半径的第二模糊半径,以及小于该第二模糊半径的第三模糊半径决定的双环形模糊核;The blur kernel of any pixel in the spot sub-image is: a first blur radius based on the any pixel, a second blur radius smaller than the first blur radius, and a third blur smaller than the second blur radius. Radius-determined double-ring blur kernel;
所述非光斑子图像中任一像素点的模糊核为:基于该任一像素点的第四模糊半径,以及小于该第四模糊半径的第五模糊半径决定的环形模糊核;The blur kernel of any pixel in the non-spot sub-image is: an annular blur kernel determined based on the fourth blur radius of any pixel and the fifth blur radius smaller than the fourth blur radius;
可选的,模糊单元402被进一步用于:Optionally, the fuzzy unit 402 is further used for:
采用不同的模糊算法对所述光斑子图像和所述非光斑子图像分别进行图像模糊;Using different blur algorithms to blur the light spot sub-image and the non-light spot sub-image respectively;
其中,所述光斑子图像采用的模糊算法的模糊效果,优于所述非光斑子图像采用的模糊算法。Among them, the blurring effect of the blur algorithm used in the light spot sub-image is better than the blur algorithm used in the non-light spot sub-image.
可选的,所述光斑子图像采用打散模糊算法,所述非光斑子图像采用聚集模糊算法。Optionally, the spot sub-image adopts a scattering blur algorithm, and the non-spot sub-image adopts a gathering blur algorithm.
可选的,模糊单元402被进一步用于:Optionally, the fuzzy unit 402 is further used for:
采用不同的模糊权重对所述光斑子图像和所述非光斑子图像分别进行图像模糊;所述光斑子图像采用的模糊权重,大于所述非光斑子图像采用的模糊权重;Using different blur weights to blur the light spot sub-image and the non-light spot sub-image respectively; the blur weight used in the light spot sub-image is greater than the blur weight used in the non-light spot sub-image;
其中,任一像素点的模糊权重用于表征所述任一像素点的像素值对自身及其邻域像素点的模糊操作的影响程度。The blur weight of any pixel is used to represent the degree of influence of the pixel value of any pixel on the blur operation of itself and its neighboring pixels.
可选的,所述模糊核的形状为环形。Optionally, the shape of the blur kernel is a ring.
可选的,获取单元401被进一步用于:Optionally, the acquisition unit 401 is further used for:
获取原始图像的光斑掩膜图像,所述光斑掩膜图像用于表征所述光斑区域所处的位置;Obtaining a spot mask image of the original image, where the spot mask image is used to characterize the location of the spot area;
基于所述光斑掩膜图像对所述原始图像进行图像分离,得到所述光斑子图像和 非光斑子图像。Image separation is performed on the original image based on the light spot mask image to obtain the light spot sub-image and the non-light spot sub-image.
如图5所示,图5是本公开一示例性实施例示出的另一种图像处理装置的框图,该实施例在前述图4所示实施例的基础上,还包括:确定单元403。As shown in FIG. 5 , FIG. 5 is a block diagram of another image processing device according to an exemplary embodiment of the present disclosure. Based on the aforementioned embodiment shown in FIG. 4 , this embodiment further includes: a determining unit 403 .
可选的,optional,
还包括:确定单元403,确定被摄主体在所述原始图像中的目标区域,并基于所述原始图像中各个像素点与所述目标区域的深度信息差值,确定相应像素点的模糊核;其中,任一像素点的模糊核尺寸,与所述任一像素点和所述目标区域的深度信息差值呈正相关;It also includes: a determination unit 403 to determine the target area of the subject in the original image, and determine the blur kernel of the corresponding pixel based on the difference in depth information between each pixel in the original image and the target area; Wherein, the blur kernel size of any pixel is positively correlated with the difference in depth information between the any pixel and the target area;
模糊单元402被进一步用于:基于所述光斑区域中的像素点的模糊核,对所述光斑子图像进行图像模糊;以及,基于所述非光斑区域中的像素点的模糊核,对所述非光斑子图像进行图像模糊。The blur unit 402 is further configured to: blur the light spot sub-image based on the blur kernel of the pixels in the light spot area; and, based on the blur kernel of the pixels in the non-light spot area, blur the light spot sub-image. Non-spot sub-images are blurred.
对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本公开方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。As for the device embodiment, since it basically corresponds to the method embodiment, please refer to the partial description of the method embodiment for relevant details. The device embodiments described above are only illustrative. The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they may be located in One location, or it can be distributed across multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the disclosed solution. Persons of ordinary skill in the art can understand and implement the method without any creative effort.
相应的,本公开还提供一种图像处理装置,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为实现如上述实施例中任一所述的图像处理方法,比如该方法可以包括:获取原始图像的光斑子图像和非光斑子图像,所述光斑子图像包含位于光斑区域的画面内容、所述非光斑子图像包含位于非光斑区域的画面内容;对所述光斑子图像和所述非光斑子图像分别进行图像模糊,并对经由模糊处理的光斑子图像和经由模糊处理的非光斑子图像进行图像融合,得到具备柔焦效果的图像。Correspondingly, the present disclosure also provides an image processing device, including: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to implement the image processing as described in any one of the above embodiments. The processing method, for example, the method may include: acquiring a light spot sub-image and a non-light spot sub-image of the original image, the light spot sub-image includes the picture content located in the light spot area, and the non-light spot sub-image includes the picture content located in the non-light spot area; The light spot sub-image and the non-light spot sub-image are respectively image blurred, and the blurred light spot sub-image and the blurred non-light spot sub-image are image fused to obtain an image with a soft focus effect.
相应的,本公开还提供一种电子设备,所述电子设备包括有存储器,以及一个或者一个以上的程序,其中一个或者一个以上程序存储于存储器中,且经配置以由一个或者一个以上处理器执行所述一个或者一个以上程序包含用于实现如上述实施例中任一所述的图像处理方法的指令,比如该方法可以包括:获取原始图像的光斑子图像和非光斑子图像,所述光斑子图像包含位于光斑区域的画面内容、所述非光斑子图像 包含位于非光斑区域的画面内容;对所述光斑子图像和所述非光斑子图像分别进行图像模糊,并对经由模糊处理的光斑子图像和经由模糊处理的非光斑子图像进行图像融合,得到具备柔焦效果的图像。Correspondingly, the present disclosure also provides an electronic device. The electronic device includes a memory and one or more programs, wherein the one or more programs are stored in the memory and configured to be processed by one or more processors. Executing the one or more programs includes instructions for implementing the image processing method as described in any of the above embodiments. For example, the method may include: acquiring the light spot sub-image and the non-light spot sub-image of the original image, the light spot sub-image The sub-image includes the picture content located in the light spot area, and the non-light spot sub-image includes the picture content located in the non-light spot area; the light spot sub-image and the non-light spot sub-image are separately image blurred, and the blurred light spot is The sub-image and the blurred non-spot sub-image are image fused to obtain an image with a soft focus effect.
图6是根据一示例性实施例示出的一种用于实现图像处理方法的装置600的框图。例如,装置600可以是移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等。FIG. 6 is a block diagram of a device 600 for implementing an image processing method according to an exemplary embodiment. For example, the device 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, or the like.
参照图6,装置600可以包括以下一个或多个组件:处理组件602,存储器604,电源组件606,多媒体组件608,音频组件610,输入/输出(I/O)的接口612,传感器组件614,以及通信组件616。Referring to Figure 6, the device 600 may include one or more of the following components: a processing component 602, a memory 604, a power supply component 606, a multimedia component 608, an audio component 610, an input/output (I/O) interface 612, a sensor component 614, and communications component 616.
处理组件602通常控制装置600的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件602可以包括一个或多个处理器620来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件602可以包括一个或多个模块,便于处理组件602和其他组件之间的交互。例如,处理组件602可以包括多媒体模块,以方便多媒体组件608和处理组件602之间的交互。 Processing component 602 generally controls the overall operations of device 600, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to complete all or part of the steps of the above method. Additionally, processing component 602 may include one or more modules that facilitate interaction between processing component 602 and other components. For example, processing component 602 may include a multimedia module to facilitate interaction between multimedia component 608 and processing component 602.
存储器604被配置为存储各种类型的数据以支持在装置600的操作。这些数据的示例包括用于在装置600上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器604可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。 Memory 604 is configured to store various types of data to support operations at device 600 . Examples of such data include instructions for any application or method operating on device 600, contact data, phonebook data, messages, pictures, videos, etc. Memory 604 may be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EEPROM), Programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
电源组件606为装置600的各种组件提供电力。电源组件606可以包括电源管理***,一个或多个电源,及其他与为装置600生成、管理和分配电力相关联的组件。 Power supply component 606 provides power to the various components of device 600. Power supply components 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to device 600 .
多媒体组件608包括在所述装置600和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件608包括一个前置摄像头和/或后置摄像头。当装置600处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以 接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜***或具有焦距和光学变焦能力。 Multimedia component 608 includes a screen that provides an output interface between the device 600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide action. In some embodiments, multimedia component 608 includes a front-facing camera and/or a rear-facing camera. When the device 600 is in an operating mode, such as a shooting mode or a video mode, the front camera and/or the rear camera can receive external multimedia data. Each front-facing camera and rear-facing camera can be a fixed optical lens system or have a focal length and optical zoom capabilities.
音频组件610被配置为输出和/或输入音频信号。例如,音频组件610包括一个麦克风(MIC),当装置600处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器604或经由通信组件616发送。在一些实施例中,音频组件610还包括一个扬声器,用于输出音频信号。 Audio component 610 is configured to output and/or input audio signals. For example, audio component 610 includes a microphone (MIC) configured to receive external audio signals when device 600 is in operating modes, such as call mode, recording mode, and speech recognition mode. The received audio signals may be further stored in memory 604 or sent via communications component 616 . In some embodiments, audio component 610 also includes a speaker for outputting audio signals.
I/O接口612为处理组件602和***接口模块之间提供接口,上述***接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。The I/O interface 612 provides an interface between the processing component 602 and a peripheral interface module, which may be a keyboard, a click wheel, a button, etc. These buttons may include, but are not limited to: Home button, Volume buttons, Start button, and Lock button.
传感器组件614包括一个或多个传感器,用于为装置600提供各个方面的状态评估。例如,传感器组件614可以检测到装置600的打开/关闭状态,组件的相对定位,例如所述组件为装置600的显示器和小键盘,传感器组件614还可以检测装置600或装置600一个组件的位置改变,用户与装置600接触的存在或不存在,装置600方位或加速/减速和装置600的温度变化。传感器组件614可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件614还可以包括光传感器,如CMOS或CCD图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件614还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。 Sensor component 614 includes one or more sensors for providing various aspects of status assessment for device 600 . For example, the sensor component 614 can detect the open/closed state of the device 600, the relative positioning of components, such as the display and keypad of the device 600, and the sensor component 614 can also detect a change in position of the device 600 or a component of the device 600. , the presence or absence of user contact with device 600 , device 600 orientation or acceleration/deceleration and temperature changes of device 600 . Sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor component 614 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
通信组件616被配置为便于装置600和其他设备之间有线或无线方式的通信。装置600可以接入基于通信标准的无线网络,如WiFi,2G或3G,4G LTE、5G NR(New Radio)或它们的组合。在一个示例性实施例中,通信组件616经由广播信道接收来自外部广播管理***的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件616还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。 Communication component 616 is configured to facilitate wired or wireless communication between apparatus 600 and other devices. The device 600 can access a wireless network based on communication standards, such as WiFi, 2G or 3G, 4G LTE, 5G NR (New Radio) or a combination thereof. In one exemplary embodiment, the communication component 616 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communications component 616 also includes a near field communications (NFC) module to facilitate short-range communications. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
在示例性实施例中,装置600可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述方法。In an exemplary embodiment, apparatus 600 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable Gate array (FPGA), controller, microcontroller, microprocessor or other electronic components are implemented for executing the above method.
在示例性实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器604,上述指令可由装置600的处理器620执行以完成上述方法。例如,所述非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions, such as a memory 604 including instructions, which are executable by the processor 620 of the device 600 to complete the above method is also provided. For example, the non-transitory computer-readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
本领域技术人员在考虑说明书及实践这里公开的公开后,将容易想到本公开的其它实施方案。本公开旨在涵盖本公开的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本公开的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本公开的真正范围和精神由下面的权利要求指出。Other embodiments of the disclosure will be readily apparent to those skilled in the art from consideration of the specification and practice of the disclosure herein. The present disclosure is intended to cover any variations, uses, or adaptations of the disclosure that follow the general principles of the disclosure and include common common sense or customary technical means in the technical field that are not disclosed in the disclosure. . It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
应当理解的是,本公开并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本公开的范围仅由所附的权利要求来限制。It is to be understood that the present disclosure is not limited to the precise structures described above and illustrated in the accompanying drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the disclosure is limited only by the appended claims.
以上所述仅为本公开的较佳实施例而已,并不用以限制本公开,凡在本公开的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本公开保护的范围之内。The above are only preferred embodiments of the present disclosure and are not intended to limit the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure shall be included in this disclosure. within the scope of protection.

Claims (15)

  1. 一种图像处理方法,其特征在于,包括:An image processing method, characterized by including:
    获取原始图像的光斑子图像和非光斑子图像,所述光斑子图像包含位于光斑区域的画面内容、所述非光斑子图像包含位于非光斑区域的画面内容;Obtain the light spot sub-image and the non-light spot sub-image of the original image, the light spot sub-image includes the picture content located in the light spot area, and the non-light spot sub-image includes the picture content located in the non-light spot area;
    对所述光斑子图像和所述非光斑子图像分别进行图像模糊,并对经由模糊处理的光斑子图像和经由模糊处理的非光斑子图像进行图像融合,得到具备柔焦效果的图像。The light spot sub-image and the non-light spot sub-image are respectively image blurred, and the blurred light spot sub-image and the blurred non-light spot sub-image are image fused to obtain an image with a soft focus effect.
  2. 根据权利要求1所述的方法,其特征在于,The method according to claim 1, characterized in that:
    所述对所述光斑子图像和所述非光斑子图像分别进行图像模糊,包括:对所述光斑子图像和所述非光斑子图像分别进行初次模糊处理;The step of blurring the light spot sub-image and the non-light spot sub-image respectively includes: performing an initial blurring process on the light spot sub-image and the non-light spot sub-image respectively;
    所述对经由模糊处理的光斑子图像和非光斑子图像进行图像融合,包括:对经由初次模糊处理的光斑子图像和经由初次模糊处理的非光斑子图像进行图像融合,得到第一融合图像;对经由初次模糊处理的非光斑子图像进行二次图像模糊,并将经由二次模糊处理的非光斑图像与经由初次模糊处理的光斑子图像进行图像融合,得到第二融合图像;以及,对所述第一融合图像和所述第二融合图像进行柔焦融合,得到具备柔焦效果的图像。The image fusion of the light spot sub-image and the non-light spot sub-image that have been blurred includes: performing image fusion on the light spot sub-image that has been initially blurred and the non-light spot sub-image that has been initially blurred to obtain a first fused image; Perform a secondary image blur on the non-spot sub-image that has undergone the primary blur processing, and perform image fusion on the non-spot sub-image that has undergone the secondary blur processing and the spot sub-image that has undergone the primary blur processing to obtain a second fused image; and, The first fused image and the second fused image are soft-focused fused to obtain an image with a soft-focus effect.
  3. 根据权利要求1所述的方法,其特征在于,所述对所述光斑子图像和所述非光斑子图像分别进行图像模糊,包括:The method of claim 1, wherein blurring the light spot sub-image and the non-light spot sub-image respectively includes:
    采用不同的模糊策略对所述光斑子图像和非光斑子图像进行图像模糊。Different blur strategies are used to blur the light spot sub-image and the non-light spot sub-image.
  4. 根据权利要求3所述的方法,其特征在于,所述采用不同的模糊策略对所述光斑子图像和非光斑子图像进行图像模糊,包括:The method according to claim 3, characterized in that the use of different blurring strategies to blur the light spot sub-image and the non-light spot sub-image includes:
    为所述光斑子图像和所述非光斑子图像配置不同模糊核;Configuring different blur kernels for the light spot sub-image and the non-light spot sub-image;
    基于配置的模糊核分别对所述光斑子图像和所述非光斑子图像进行图像模糊。The light spot sub-image and the non-light spot sub-image are respectively image blurred based on the configured blur kernel.
  5. 根据权利要求4所述的方法,其特征在于,为所述光斑子图像和所述非光斑子图像配置的模糊核在下述至少一个维度存在区别:The method according to claim 4, characterized in that the blur kernel configured for the light spot sub-image and the non-light spot sub-image is different in at least one of the following dimensions:
    模糊核形状、模糊核尺寸。Blur kernel shape and blur kernel size.
  6. 根据权利要求4所述的方法,其特征在于,The method according to claim 4, characterized in that:
    所述光斑子图像中任一像素点的模糊核为:基于该任一像素点的第一模糊半径、小于该第一模糊半径的第二模糊半径,以及小于该第二模糊半径的第三模糊半径决定的双环形模糊核;The blur kernel of any pixel in the spot sub-image is: a first blur radius based on the any pixel, a second blur radius smaller than the first blur radius, and a third blur smaller than the second blur radius. Radius-determined double-ring blur kernel;
    所述非光斑子图像中任一像素点的模糊核为:基于该任一像素点的第四模糊半径,以及小于该第四模糊半径的第五模糊半径决定的环形模糊核。The blur kernel of any pixel in the non-spot sub-image is: a ring-shaped blur kernel determined based on the fourth blur radius of any pixel and the fifth blur radius smaller than the fourth blur radius.
  7. 根据权利要求3所述的方法,其特征在于,所述采用不同的模糊策略对所述光斑子图像和非光斑子图像进行图像模糊,包括:The method according to claim 3, characterized in that the use of different blurring strategies to blur the light spot sub-image and the non-light spot sub-image includes:
    采用不同的模糊算法对所述光斑子图像和所述非光斑子图像分别进行图像模糊;Using different blur algorithms to blur the light spot sub-image and the non-light spot sub-image respectively;
    其中,所述光斑子图像采用的模糊算法的模糊效果,优于所述非光斑子图像采用的模糊算法。Among them, the blurring effect of the blur algorithm used in the light spot sub-image is better than the blur algorithm used in the non-light spot sub-image.
  8. 根据权利要求7所述的方法,其特征在于,所述光斑子图像采用打散模糊算法,所述非光斑子图像采用聚集模糊算法。The method according to claim 7, characterized in that the spot sub-image adopts a scattering blur algorithm, and the non-spot sub-image adopts a gathering blur algorithm.
  9. 根据权利要求3所述的方法,其特征在于,所述对所述光斑子图像和所述非光斑子图像分别进行图像模糊,包括:The method of claim 3, wherein blurring the light spot sub-image and the non-light spot sub-image respectively includes:
    采用不同的模糊权重对所述光斑子图像和所述非光斑子图像分别进行图像模糊;所述光斑子图像采用的模糊权重,大于所述非光斑子图像采用的模糊权重;Using different blur weights to blur the light spot sub-image and the non-light spot sub-image respectively; the blur weight used in the light spot sub-image is greater than the blur weight used in the non-light spot sub-image;
    其中,任一像素点的模糊权重用于表征所述任一像素点的像素值对自身及其邻域像素点的模糊操作的影响程度。The blur weight of any pixel is used to represent the degree of influence of the pixel value of any pixel on the blur operation of itself and its neighboring pixels.
  10. 根据权利要求1所述的方法,其特征在于,The method according to claim 1, characterized in that:
    还包括:确定被摄主体在所述原始图像中的目标区域,并基于所述原始图像中各个像素点与所述目标区域的深度信息差值,确定相应像素点的模糊核;其中,任一像素点的模糊核尺寸,与所述任一像素点和所述目标区域的深度信息差值呈正相关;It also includes: determining the target area of the subject in the original image, and determining the blur kernel of the corresponding pixel based on the depth information difference between each pixel in the original image and the target area; wherein, any The blur kernel size of a pixel is positively correlated with the difference in depth information between any pixel and the target area;
    所述对所述光斑子图像和所述非光斑子图像分别进行图像模糊,包括:基于所述光斑区域中的像素点的模糊核,对所述光斑子图像进行图像模糊;以及,基于所述非光斑区域中的像素点的模糊核,对所述非光斑子图像进行图像模糊。The step of blurring the light spot sub-image and the non-light spot sub-image respectively includes: blurring the light spot sub-image based on the blur kernel of the pixels in the light spot area; and, based on the The blur kernel of the pixels in the non-spot area is used to blur the non-spot sub-image.
  11. 根据权利要求10所述的方法,其特征在于,所述模糊核的形状为环形。The method according to claim 10, characterized in that the shape of the blur kernel is annular.
  12. 根据权利要求1所述的方法,其特征在于,所述获取原始图像的光斑子图像和非光斑子图像,包括:The method according to claim 1, characterized in that obtaining the light spot sub-image and non-light spot sub-image of the original image includes:
    获取原始图像的光斑掩膜图像,所述光斑掩膜图像用于表征所述光斑区域所处的位置;Obtaining a spot mask image of the original image, where the spot mask image is used to characterize the location of the spot area;
    基于所述光斑掩膜图像对所述原始图像进行图像分离,得到所述光斑子图像和非光斑子图像。Image separation is performed on the original image based on the light spot mask image to obtain the light spot sub-image and the non-light spot sub-image.
  13. 一种图像处理装置,其特征在于,包括:An image processing device, characterized in that it includes:
    获取单元,获取原始图像的光斑子图像和非光斑子图像,所述光斑子图像包含位于光斑区域的画面内容、所述非光斑子图像包含位于非光斑区域的画面内容;The acquisition unit acquires the light spot sub-image and the non-light spot sub-image of the original image, the light spot sub-image includes the picture content located in the light spot area, and the non-light spot sub-image includes the picture content located in the non-light spot area;
    模糊单元,对所述光斑子图像和所述非光斑子图像分别进行图像模糊,并对经由 模糊处理的光斑子图像和经由模糊处理的非光斑子图像进行图像融合,得到具备柔焦效果的图像。The blurring unit performs image blurring on the light spot sub-image and the non-light spot sub-image respectively, and performs image fusion on the blurred light spot sub-image and the blurred non-light spot sub-image to obtain an image with a soft focus effect. .
  14. 一种电子设备,其特征在于,包括:An electronic device, characterized by including:
    处理器;processor;
    用于存储处理器可执行指令的存储器;Memory used to store instructions executable by the processor;
    其中,所述处理器通过运行所述可执行指令以实现如权利要求1-12中任一项所述的方法。Wherein, the processor implements the method according to any one of claims 1-12 by running the executable instructions.
  15. 一种计算机可读存储介质,其上存储有计算机指令,其特征在于,该指令被处理器执行时实现如权利要求1-12中任一项所述方法的步骤。A computer-readable storage medium on which computer instructions are stored, characterized in that when the instructions are executed by a processor, the steps of the method according to any one of claims 1-12 are implemented.
PCT/CN2022/099927 2022-06-20 2022-06-20 Image processing method and apparatus, and electronic device and storage medium WO2023245363A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2022/099927 WO2023245363A1 (en) 2022-06-20 2022-06-20 Image processing method and apparatus, and electronic device and storage medium
CN202280004313.7A CN117859150A (en) 2022-06-20 2022-06-20 Image processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/099927 WO2023245363A1 (en) 2022-06-20 2022-06-20 Image processing method and apparatus, and electronic device and storage medium

Publications (1)

Publication Number Publication Date
WO2023245363A1 true WO2023245363A1 (en) 2023-12-28

Family

ID=89378999

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/099927 WO2023245363A1 (en) 2022-06-20 2022-06-20 Image processing method and apparatus, and electronic device and storage medium

Country Status (2)

Country Link
CN (1) CN117859150A (en)
WO (1) WO2023245363A1 (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120044385A1 (en) * 2010-08-20 2012-02-23 Canon Kabushiki Kaisha Image processing apparatus capable of adding soft focus effects, image processing method, and storage medium
CN105827947A (en) * 2015-01-23 2016-08-03 卡西欧计算机株式会社 Image processing apparatus and image processing method
CN106504220A (en) * 2016-08-19 2017-03-15 华为机器有限公司 A kind of image processing method and device
CN106600559A (en) * 2016-12-21 2017-04-26 东方网力科技股份有限公司 Fuzzy kernel obtaining and image de-blurring method and apparatus
JP2019047204A (en) * 2017-08-30 2019-03-22 キヤノン株式会社 Image processing device, image processing method, and program
CN112561777A (en) * 2019-09-25 2021-03-26 北京迈格威科技有限公司 Method and device for adding light spots to image
CN113421211A (en) * 2021-06-18 2021-09-21 Oppo广东移动通信有限公司 Method for blurring light spots, terminal device and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120044385A1 (en) * 2010-08-20 2012-02-23 Canon Kabushiki Kaisha Image processing apparatus capable of adding soft focus effects, image processing method, and storage medium
CN105827947A (en) * 2015-01-23 2016-08-03 卡西欧计算机株式会社 Image processing apparatus and image processing method
CN106504220A (en) * 2016-08-19 2017-03-15 华为机器有限公司 A kind of image processing method and device
CN106600559A (en) * 2016-12-21 2017-04-26 东方网力科技股份有限公司 Fuzzy kernel obtaining and image de-blurring method and apparatus
JP2019047204A (en) * 2017-08-30 2019-03-22 キヤノン株式会社 Image processing device, image processing method, and program
CN112561777A (en) * 2019-09-25 2021-03-26 北京迈格威科技有限公司 Method and device for adding light spots to image
CN113421211A (en) * 2021-06-18 2021-09-21 Oppo广东移动通信有限公司 Method for blurring light spots, terminal device and storage medium

Also Published As

Publication number Publication date
CN117859150A (en) 2024-04-09

Similar Documents

Publication Publication Date Title
CN111669493B (en) Shooting method, device and equipment
EP3531689B1 (en) Optical imaging method and apparatus
CN108898546B (en) Face image processing method, device and equipment and readable storage medium
CN109345485B (en) Image enhancement method and device, electronic equipment and storage medium
CN108154465B (en) Image processing method and device
WO2016011747A1 (en) Skin color adjustment method and device
CN108154466B (en) Image processing method and device
US11847769B2 (en) Photographing method, terminal, and storage medium
WO2022077970A1 (en) Method and apparatus for adding special effects
CN114500821B (en) Photographing method and device, terminal and storage medium
US11222235B2 (en) Method and apparatus for training image processing model, and storage medium
EP3813010B1 (en) Facial image enhancement method, device and electronic device
US11756167B2 (en) Method for processing image, electronic device and storage medium
CN107730443B (en) Image processing method and device and user equipment
WO2023245363A1 (en) Image processing method and apparatus, and electronic device and storage medium
CN112188095B (en) Photographing method, photographing device and storage medium
CN111835977B (en) Image sensor, image generation method and device, electronic device, and storage medium
WO2023231009A1 (en) Focusing method and apparatus, and storage medium
WO2023240452A1 (en) Image processing method and apparatus, electronic device, and storage medium
CN114338956B (en) Image processing method, image processing apparatus, and storage medium
WO2023221119A1 (en) Image processing method and apparatus and storage medium
CN114338956A (en) Image processing method, image processing apparatus, and storage medium
CN117876275A (en) Image processing method, device, terminal and storage medium
CN115550548A (en) Shooting processing method, intelligent terminal and storage medium
JP2024000481A (en) Image processing method, device, mobile terminal, and storage medium

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 202280004313.7

Country of ref document: CN

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22947144

Country of ref document: EP

Kind code of ref document: A1