WO2022218082A1 - 基于人工智能的图像处理方法、装置、电子设备、计算机可读存储介质及计算机程序产品 - Google Patents

基于人工智能的图像处理方法、装置、电子设备、计算机可读存储介质及计算机程序产品 Download PDF

Info

Publication number
WO2022218082A1
WO2022218082A1 PCT/CN2022/080824 CN2022080824W WO2022218082A1 WO 2022218082 A1 WO2022218082 A1 WO 2022218082A1 CN 2022080824 W CN2022080824 W CN 2022080824W WO 2022218082 A1 WO2022218082 A1 WO 2022218082A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
transparency
fusion
pixel
processed
Prior art date
Application number
PCT/CN2022/080824
Other languages
English (en)
French (fr)
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 EP22787312.2A priority Critical patent/EP4261784A1/en
Publication of WO2022218082A1 publication Critical patent/WO2022218082A1/zh
Priority to US17/986,415 priority patent/US20230074060A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • 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
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/10Geometric effects
    • G06T15/20Perspective computation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N9/00Details of colour television systems
    • H04N9/64Circuits for processing colour signals
    • H04N9/74Circuits for processing colour signals for obtaining special effects
    • H04N9/75Chroma key
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10016Video; Image sequence
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20221Image fusion; Image merging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/77Retouching; Inpainting; Scratch removal
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/222Studio circuitry; Studio devices; Studio equipment
    • H04N5/262Studio circuits, e.g. for mixing, switching-over, change of character of image, other special effects ; Cameras specially adapted for the electronic generation of special effects
    • H04N5/272Means for inserting a foreground image in a background image, i.e. inlay, outlay

Definitions

  • the present application relates to artificial intelligence technology, and in particular, to an artificial intelligence-based image processing method, apparatus, electronic device, computer-readable storage medium, and computer program product.
  • Image matting refers to removing a certain color in the image to be processed, and superimposing a specific background image on the image to be processed, thereby forming a superimposed composition of two-layer images.
  • the indoor background in the to-be-processed image can be cut out by using the image keying technology, and the person in the to-be-processed image is superimposed with a specific background.
  • the background color to be keyed out and the corresponding tolerance range are usually set by the user, so as to control the size of the keying range through the set tolerance range, so as to perform image keying.
  • this scheme will lead to the loss of edge details (such as details of human hair) during image keying, that is, the accuracy of image processing is low.
  • the embodiments of the present application provide an artificial intelligence-based image processing method, device, electronic device, computer-readable storage medium, and computer program product, which can retain the original edge details of the image to be processed during the image processing process, and improve the resulting fusion Image quality and precision.
  • the embodiment of the present application provides an image processing method based on artificial intelligence, including:
  • image fusion processing is performed on the to-be-processed image and the background image in units of pixel points to obtain a fusion image.
  • the embodiment of the present application provides an image processing device based on artificial intelligence, including:
  • the background color determination module is configured to determine the background color in the image to be processed
  • a transparency determination module configured to determine the fusion transparency of the pixel points according to the chromaticity difference between the pixel points in the to-be-processed image and the background color
  • an image acquisition module configured to acquire a background image corresponding to the to-be-processed image
  • the image fusion module is configured to perform image fusion processing on the to-be-processed image and the background image in pixel units according to the fusion transparency of the pixel points in the to-be-processed image to obtain a fusion image.
  • the embodiment of the present application provides an electronic device, including:
  • the processor is configured to implement the artificial intelligence-based image processing method provided by the embodiments of the present application when executing the executable instructions stored in the memory.
  • Embodiments of the present application provide a computer-readable storage medium storing executable instructions for causing a processor to execute the image processing method based on artificial intelligence provided by the embodiments of the present application.
  • the embodiments of the present application provide a computer program product, including computer programs or instructions, which, when executed by a processor, implement the artificial intelligence-based image processing method provided by the embodiments of the present application.
  • the embodiment of the present application can retain the original edge details of the to-be-processed image through smoother image fusion processing, and at the same time improve the quality (image quality) and accuracy of the obtained fused image.
  • FIG. 1 is a schematic diagram of the architecture of an image processing system based on artificial intelligence provided by an embodiment of the present application
  • FIG. 2 is a schematic structural diagram of a terminal device provided by an embodiment of the present application.
  • 3A is a schematic flowchart of an image processing method based on artificial intelligence provided by an embodiment of the present application
  • 3B is a schematic flowchart of an image processing method based on artificial intelligence provided by an embodiment of the present application
  • 3C is a schematic flowchart of an image processing method based on artificial intelligence provided by an embodiment of the present application.
  • 3D is a schematic flowchart of an image processing method based on artificial intelligence provided by an embodiment of the present application
  • 3E is a schematic flowchart of an image processing method based on artificial intelligence provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of a fusion image provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of an image to be processed and a fused image provided by an embodiment of the present application
  • Fig. 6 is the comparative schematic diagram of the fusion effect provided by the embodiment of the present application.
  • FIG. 7 is a schematic flowchart of determining a foreground image and a transparent channel image provided by an embodiment of the present application
  • FIG. 8 is a schematic flowchart of table lookup acceleration provided by an embodiment of the present application.
  • first ⁇ second ⁇ third is only used to distinguish similar objects, and does not represent a specific ordering of objects. It is understood that “first ⁇ second ⁇ third” is used in Where permitted, the specific order or sequence may be interchanged to enable the embodiments of the application described herein to be practiced in sequences other than those illustrated or described herein.
  • reference to the term “plurality” refers to at least two.
  • AI Artificial Intelligence
  • CV Computer Vision
  • Background color refers to the color that needs to be cut out/covered in the image to be processed.
  • the background color may be specified by the user, or may be obtained by intelligently recognizing the image to be processed.
  • the three elements of color can include hue (hue), saturation (purity) and brightness, where color is the feeling produced by the reflection of physical light on an object to the optic nerve of the human eye. It is determined by the difference in the frequency of light, and the hue is used to reflect the color of these different frequencies; the saturation is used to express the vividness or vividness of the color; the brightness is used to express the lightness and darkness of the color.
  • chromaticity refers to a property of a color that is different from brightness.
  • chromaticity may include at least one of hue and saturation.
  • Pixel Also known as pixel, it refers to the element in the image that cannot be further divided.
  • Color Space also known as color gamut and color space, it refers to an abstract model that describes color through a set of values. For the described color, it is objective, and different color spaces describe the color from different angles.
  • the color space includes multiple channels, and the color can be described by the channel value corresponding to each channel.
  • Color spaces can be divided into two categories according to their basic structure: primary color space and color separation color space.
  • the former is like the red green blue (RGB, Red Green Blue) color space, including red channel, green channel and blue channel, that is, the primary color color space does not clearly distinguish brightness and chromaticity; the latter such as YUV color space, HSV color space Space, HSL color space, and LAB color space, etc., in the color-brightness separation color space, brightness and chroma are clearly distinguished.
  • RGB Red Green Blue
  • the Y channel included in the YUV color space corresponds to brightness, and the U channel and V channel both correspond to chroma;
  • the H channel, S channel, and V channel included in the HSV color space correspond to hue, saturation, and brightness, respectively;
  • the HSL color space includes The H channel, S channel and L channel of the LAB color space correspond to hue, saturation and brightness respectively;
  • the L channel included in the LAB color space corresponds to the brightness, and the A channel and the B channel both correspond to the chromaticity.
  • Table lookup acceleration an acceleration method in which space (storage space) is exchanged for time (running time) can be used to accelerate image processing in the embodiments of the present application, thereby improving image processing efficiency and reducing real-time computing load.
  • various results that may be involved in the image processing process can be pre-calculated and stored in a specific data structure (such as a table), so that the data structure can be directly queried in the real-time image processing process without real-time calculation.
  • the super key algorithm (such as the super key algorithm in Premiere software) is more typical.
  • the user needs to set the background color (such as green or blue, etc.) to be keyed out and the corresponding The set tolerance range is used to control the size of the keying range.
  • the user can also perform various operations such as feathering and shrinking.
  • the super key algorithm for image keying there are at least the following problems: 1) In the process of image keying, the original edge details (such as details of human hair) in the image to be processed will be lost, resulting in poor keying effect.
  • the highlights and shadows in the final superimposed image are poor, for example, the shadow is gray, and the original shadow effect in the image to be processed cannot be effectively simulated; 3) Translucent objects in the image to be processed cannot be accurately processed (such as glass), the translucent objects in the final superimposed image may have problems such as distortion and blurring; 4) in the final superimposed image, the foreground (or target) will be biased towards the background color, for example, in the background When the color is green, the person (ie the foreground) in the final superimposed image will glow green; 5) The user needs to perform too many operations, and the user's learning difficulty and learning cost are high.
  • Embodiments of the present application provide an artificial intelligence-based image processing method, device, electronic device, computer-readable storage medium, and computer program product, which can retain edge details of an image to be processed during image processing, and improve the quality of the resulting fused image. quality and precision. Exemplary applications of the electronic device provided by the embodiment of the present application are described below.
  • the electronic device provided by the embodiment of the present application may be implemented as various types of terminal devices, and may also be implemented as a server.
  • FIG. 1 is a schematic diagram of the architecture of an image processing system 100 based on artificial intelligence provided by an embodiment of the present application.
  • a terminal device 400 is connected to a server 200 through a network 300, and the server 200 is connected to a database 500, where the network 300 may be a wide area network or a local area network. , or a combination of the two.
  • the artificial intelligence-based image processing method provided by the embodiments of the present application may be implemented by a terminal device.
  • the terminal device 400 obtains the image to be processed, wherein the image to be processed may be pre-stored locally in the terminal device 400, may be captured by the terminal device 400 in real time, or may be obtained by the terminal device 400 from the outside world (such as the server 200, the database 500) and blockchain, etc.).
  • the terminal device 400 determines the background color in the image to be processed.
  • the terminal device 400 can respond to the background color setting operation and obtain the background color set by the user through the background color setting operation.
  • the terminal device 400 can Intelligent recognition of the image to be processed to automatically identify the background color.
  • the terminal device 400 determines the fusion transparency of the pixel points according to the chromaticity difference between the pixels in the image to be processed and the background color, and according to the fusion transparency, the image to be processed and the acquired background image are processed in pixel units. Image fusion processing to obtain a fusion image.
  • the background image may also be pre-stored by the terminal device 400, photographed in real time, or acquired from the outside world.
  • the artificial intelligence-based image processing method provided by the embodiments of the present application may also be implemented by a server.
  • the server 200 (such as a background server of an image application program) can obtain the image to be processed from the database 500.
  • the image to be processed can also be obtained by the server 200 from other locations (such as the terminal device 400 and the blockchain, etc.).
  • the server 200 determines the background color in the image to be processed.
  • the server 200 can receive the background color set by the user sent by the terminal device 400, and for example, the server 200 can intelligently recognize the image to be processed to automatically identify out the background color.
  • the server 200 determines the fusion transparency of the pixel points according to the chromaticity difference between the pixel points in the image to be processed and the background color, and according to the fusion transparency, the image to be processed and the acquired background image are processed in units of pixels. Fusion processing to obtain a fused image.
  • the background image may also be acquired by the server 200 from the database 500 or other locations.
  • the artificial intelligence-based image processing method provided by the embodiments of the present application may also be implemented collaboratively by a terminal device and a server.
  • the terminal device 400 in response to a user operation, sends the image to be processed, the background color and the background image to the server 200 , and the server 200 performs image processing. After obtaining the fused image through image processing, the server 200 sends the fused image to the terminal device 400 .
  • various results involved in the image processing process can be stored in the blockchain , because the blockchain is immutable, it can guarantee the accuracy of the data in the blockchain.
  • the electronic device (such as the terminal device 400 or the server 200) can send a query request to the blockchain to query the data stored in the blockchain.
  • the terminal device 400 or the server 200 may implement the artificial intelligence-based image processing method provided by the embodiments of the present application by running a computer program.
  • the computer program may be a native program or software module in an operating system; is a native (Native) application (APP, Application), that is, a program that needs to be installed in the operating system to run, such as an image-type application (the client 410 shown in FIG.
  • the client 410 may be APP for image clipping/video clipping); it can also be a small program, that is, a program that can be run only by downloading it into a browser environment; it can also be a small program that can be embedded in any APP, such as embedded in an image class
  • the above-mentioned computer programs may be any form of application, module or plug-in.
  • the server 200 may be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, or may provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, Cloud servers for basic cloud computing services such as network services, cloud communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and big data and artificial intelligence platforms, where cloud services can be images
  • the processing service is called by the terminal device 400 .
  • the terminal device 400 may be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart TV, a smart watch, etc., but is not limited thereto.
  • the terminal device and the server may be directly or indirectly connected through wired or wireless communication, which is not limited in this embodiment of the present application.
  • the database may provide data support for the server, for example, the server may connect to the database, obtain data in the database for corresponding processing, and may also store the obtained processing results in the database.
  • the database 500 can be used to store data related to image processing (including but not limited to images to be processed, background colors, and background images), and the server 200 can obtain the data in the database 500 for processing Image Processing.
  • the database and server may be set up independently.
  • the database and the server can also be integrated together, that is, the database can be regarded as existing inside the server, integrated with the server, and the server can provide data management functions of the database.
  • FIG. 2 is a schematic structural diagram of a terminal device 400 provided by an embodiment of the present application.
  • the terminal device 400 shown in FIG. The various components in terminal device 400 are coupled together by bus system 440 .
  • bus system 440 is used to implement the connection communication between these components.
  • the bus system 440 also includes a power bus, a control bus, and a status signal bus.
  • the various buses are labeled as bus system 440 in FIG. 2 .
  • the artificial intelligence-based image processing apparatus may be implemented in software.
  • FIG. 2 shows the artificial intelligence-based image processing apparatus 455 stored in the memory 450, which may be a program and Software in the form of plug-ins, including the following software modules: background color determination module 4551, transparency determination module 4552, image acquisition module 4553 and image fusion module 4554, these modules are logical, so any combination can be carried out according to the realized functions or further split. The function of each module will be explained below.
  • the artificial intelligence-based image processing method provided by the embodiment of the present application will be described with reference to the exemplary application and implementation of the electronic device provided by the embodiment of the present application.
  • FIG. 3A is a schematic flowchart of an image processing method based on artificial intelligence provided by an embodiment of the present application, which will be described with reference to the steps shown in FIG. 3A .
  • step 101 the background color in the image to be processed is determined.
  • the image to be processed is acquired, and the background color that needs to be cut out or covered in the image to be processed is determined.
  • This embodiment of the present application does not limit the number of image bits of the image to be processed, for example, it may be 8 bits (Bites), 16 bits, or 32 bits; Dogs, etc.; the size of the image to be processed is also not limited.
  • the embodiment of the present application does not limit the execution order between the steps of acquiring the image to be processed and the step of determining the background color, for example, it can be performed one by one (for example, after determining the background color, the image to be processed is acquired, Or determine the background color after acquiring the image to be processed), or it can be executed at the same time.
  • the determined background color can be applied to a specific image to be processed, or can be applied to different images to be processed at the same time.
  • the above step 101 can be implemented in any one of the following ways: acquiring the background color set for the image to be processed as the background color of the image to be processed; The color with the highest frequency in the background area of the processed image is used as the background color of the to-be-processed image; wherein, the background area is an area in the to-be-processed image that is different from the target area.
  • the embodiments of the present application provide two ways to determine the background color.
  • the first way is to obtain the background color set for the image to be processed, for example, in response to the background color setting operation, obtain the background color set by the user through the background color setting operation, and use the set background color as the background in the image to be processed color. This method can meet the needs of users to the greatest extent.
  • the second method is to perform target recognition processing on the image to be processed to obtain the target area (also known as the foreground area), use the area in the image to be processed that is different from the target area as the background area, and use the color with the highest frequency in the background area as the background area. background color.
  • target recognition processing can be performed through a target recognition model
  • the target recognition model can be a machine learning model constructed based on machine learning (ML) principles, such as a You Only Look Once (YOLO) model or a region-based Convolutional Neural Networks (Region-Convolutional Neural Networks, R-CNN) model, among which, machine learning is the core of artificial intelligence, specializing in how computers simulate or realize human learning behavior, in order to acquire new knowledge or skills, reorganize
  • ML machine learning
  • YOLO You Only Look Once
  • R-CNN region-based Convolutional Neural Networks
  • machine learning is the core of artificial intelligence, specializing in how computers simulate or realize human learning behavior, in order to acquire new knowledge or skills, reorganize
  • the existing knowledge structure enables it to continuously improve its performance.
  • the embodiment of the present application does not limit the type of the target to be recognized, for example, it may include a person, a cat, a dog, and the like.
  • the pixel point can be used as a unit to determine the color corresponding to each pixel point in the background area.
  • the color can be represented by the channel value of the pixel point in the color space channel, and the color space is not done here.
  • the definition can be, for example, the primary color space or the color separation color space.
  • the background color occupies a larger proportion in the background area, therefore, the color that appears most frequently (or appears the most frequently) in the background area can be used as the background color.
  • the background area includes a total of 100 pixels, of which 60 pixels correspond to color A, then color A has the highest frequency of occurrence in the background area, that is, 60/100, so color A is determined as out background color.
  • the second method can effectively reduce user operations and save labor costs by automatically determining the background color (especially in the case of a large number of images to be processed). At the same time, it can also ensure the determined background to a certain extent. color accuracy.
  • step 102 the fusion transparency of the pixel points is determined according to the chromaticity difference between the pixel points in the image to be processed and the background color.
  • the chromaticity difference also called chromaticity distance
  • the chromaticity difference can be directly used as the fusion transparency of the pixel, or the chromaticity difference can be further processed to obtain the fusion transparency of the pixel.
  • the embodiment of the present application does not limit the method of determining the chromaticity difference.
  • the chromaticity difference can be obtained by subtracting the chromaticity of the pixel point from the chromaticity of the background color; it can be the chromaticity of the pixel point minus the chromaticity of the background color.
  • the chromaticity difference is obtained by calculating the absolute value of the obtained result; it is also possible to subtract the chromaticity of the background color from the chromaticity of the pixel point, and then square the obtained result to obtain the chromaticity difference.
  • the chromaticity includes at least one of hue and saturation. Therefore, in step 102, the fusion of the pixel can be determined according to the hue difference between the hue of the pixel and the hue of the background color. Transparency; the fusion transparency of the pixel can be determined according to the saturation difference between the saturation of the pixel and the saturation of the background color; the difference in hue and saturation can also be calculated at the same time, and determined according to the difference in hue and saturation Fusion transparency of pixels.
  • the above-mentioned determination of the fusion transparency of the pixel points according to the chromaticity difference between the pixel points in the image to be processed and the background color can be achieved by: converting the image to be processed and the background color to the same color space; wherein, the color space includes a plurality of chroma channels; for each chroma channel, determine the difference between the channel value of the chroma channel corresponding to the pixel point in the image to be processed and the channel value of the chroma channel corresponding to the background color, and The determined difference is used as the chrominance difference corresponding to the chrominance channel; the difference fusion processing is performed on the plurality of chrominance differences corresponding to the multiple chrominance channels one-to-one to obtain the fusion transparency of the pixel point.
  • the image to be processed and the background color can be converted to the same color space, and the color space here can be a color space separated by color and brightness, that is, including multiple chrominance channels.
  • each chrominance channel can only be used to represent one property of color, such as H channel (used to represent hue) and S channel (used to represent saturation) in HSV color space and HSL color space;
  • Each chrominance channel can also represent both hue and saturation, such as the U and V channels in the YUV color space, and the A and B channels in the LAB color space.
  • the chrominance differences corresponding to all chrominance channels are subjected to differential fusion processing to obtain the fusion transparency of the pixel.
  • the manner of the difference fusion processing is not limited, for example, it may be summation processing or weighted summation processing.
  • the fusion transparency is determined by integrating multiple chroma channels, which can improve the accuracy and comprehensiveness of the obtained fusion transparency.
  • step 103 a background image corresponding to the image to be processed is acquired.
  • the background image is distinguished from the image to be processed.
  • the embodiments of the present application also do not limit the number of image bits, content, and size of the background image, and the background image may be determined according to an actual application scenario.
  • step 104 according to the fusion transparency of the pixels in the image to be processed, image fusion processing is performed on the image to be processed and the background image in units of pixels to obtain a fusion image.
  • the to-be-processed image and the background image are subjected to image fusion processing in pixel units.
  • image fusion processing since the image fusion processing method is smoother, the edge details of the target in the image to be processed (such as the details of human hair) can be preserved.
  • the embodiments of the present application do not limit the manner of image fusion processing, for example, weighting processing may be used.
  • the degree of preservation in the fused image is positively related to the fused transparency of the pixel.
  • the above-mentioned fusion transparency of pixels in the image to be processed can be achieved by performing image fusion processing on the image to be processed and the background image in units of pixels to obtain a fusion image: and the background image are converted to the same color space; wherein, the color space includes multiple channels; the following processing is performed for each channel: determining the first channel value of the channel corresponding to the first pixel in the image to be processed, and the first channel value in the background image.
  • Two pixel points correspond to the second channel value of the channel; according to the fusion transparency of the first pixel point, the first channel value and the second channel value are weighted to obtain the third channel value of the channel corresponding to the third pixel point in the fusion image ; wherein, there is a mapping relationship between the pixel position of the first pixel point, the pixel position of the second pixel point and the pixel position of the third pixel point.
  • the image to be processed and the background image can be converted to the same color space, where the color space can be a primary color space or a color separation color space, wherein the color space includes multiple channels.
  • the channel value of the channel corresponding to the first pixel is the first channel value, the same applies below
  • the second pixel point in the background image corresponds to the second channel value of the channel
  • the first channel value and the second channel value are weighted according to the fusion transparency of the first pixel point processing, to obtain the third channel value of the channel corresponding to the third pixel point in the fused image.
  • the image to be processed can be and the background image is scaled to the same size
  • the existence of a mapping relationship may mean that the pixel positions are the same.
  • the mapping relationship between the positions can also perform image fusion processing when the size of the image to be processed is different from the size of the background image.
  • weighting the first channel value and the second channel value according to the fusion transparency of the first pixel may refer to: taking the fusion transparency of the first pixel as the weight of the first channel value, and merging the first pixel
  • the complementary fusion transparency corresponding to the transparency is used as the weight of the second channel value, and the weighted summation processing is performed on the first channel value and the second channel value.
  • the sum of the fusion transparency of the first pixel and the corresponding complementary fusion transparency is the maximum transparency in the transparency range, and the transparency range is the value range of the fusion transparency.
  • the image processing solution provided by the embodiment of the application is smoother than the method of matting according to the tolerance range. It can retain more edge details in the image to be processed and improve the fineness of image processing.
  • FIG. 3B is a schematic flowchart of an image processing method based on artificial intelligence provided by an embodiment of the present application. Based on FIG. 3A , after step 102 , in step 201 , according to the image to be processed The fusion transparency of the middle pixel points, and the to-be-processed image and the replacement color are fused in pixel points to obtain the foreground image.
  • color optimization may also be performed according to the background color.
  • the image to be processed and the replacement color can be fused in units of pixels to obtain a foreground image.
  • the image to be processed and the replacement color can be converted into the same color space, where the color space can be a primary color space or a color separation color space, wherein the color space includes multiple channels.
  • the color space can be a primary color space or a color separation color space, wherein the color space includes multiple channels.
  • the channel corresponding to the first pixel is The channel value of , and the replacement color are weighted to the channel value of the channel, and the fourth pixel in the foreground image corresponds to the channel value of the channel.
  • the pixel position of the first pixel point in the image to be processed is the same as the pixel position of the fourth pixel point in the foreground image.
  • the replacement color is used to remove the background color in the image to be processed.
  • the replacement color can be set according to the actual application scenario. For example, if it is set to gray, the channel value of each channel in the RGB color space is 128.
  • step 202 the background color shift of the pixel point is determined according to the chromaticity difference between the pixel point in the foreground image and the background color.
  • the chromaticity difference is used as the background color shift of the pixel, and the chromaticity difference can also be further processed to obtain the background color shift of the pixel (eg, in the case of multiple chromatic channels).
  • the hue difference between the hue of the pixel point and the hue of the background color can be determined, and the background color shift of the pixel point can be determined according to the hue difference, so, The accuracy of color optimization can be guaranteed on the basis of reducing the amount of calculation.
  • step 203 the chromaticity of the pixel is updated according to the background color shift of the pixel.
  • the color shift of a pixel can be adjusted according to the background color shift of the pixel. to avoid the background color in the foreground image.
  • the above-mentioned update processing of the chromaticity of the pixel point according to the background color shift of the pixel point can be implemented in the following manner: when the background color shift of the pixel point reaches the set color shift degree, keep the pixel point The chromaticity remains unchanged; when the background color shift of the pixel does not reach the set color shift, the chromaticity of the background color is deviated to obtain the deviated chromaticity, and the chromaticity of the pixel is updated to the deviated chromaticity.
  • the background color shift of a pixel reaches the set color shift degree, it proves that the difference between the color of the pixel and the background color is large, so the chromaticity of the pixel can be kept unchanged; when the background of the pixel is When the color shift does not reach the set color shift degree, it proves that the difference between the color of the pixel and the background color is small. Therefore, the chromaticity of the background color can be deviated to obtain the deviated chromaticity, and the color of the pixel can be calculated.
  • the chroma is updated to deviate from the chroma. It is worth noting that performing deviation processing on the chromaticity of the background color does not mean updating the chromaticity of the background color. In fact, the step of deviation processing is only to update the chromaticity of the pixels, and the chromaticity of the background color remains unchanged. Change.
  • the hue difference between the hue of the pixel and the hue of the background color can be determined as the background color shift of the pixel, for example, the hue of the pixel can be subtracted The hue of the background color to get the background color cast of the pixel.
  • the background color shift can also be updated. For example, when the background color shift > ⁇ (ie, 180 degrees), subtract 2 ⁇ from the background color shift to update the background color shift; when the background color shift ⁇ - ⁇ (ie -180 degrees), add 2 ⁇ to the background color shift to update the background color shift; when the background color shift is within the color shift range such as [- ⁇ , ⁇ ], keep the background color shift unchanged.
  • the background color shift of the pixel reaches the set color shift degree according to the set color shift threshold T, where T is greater than zero and less than ⁇ , which can be set according to the actual application scenario, such as setting as For example, when the background color shift of a pixel is ⁇ -T, or the background color shift of a pixel is ⁇ T, it is determined that the background color shift of the pixel reaches the set color shift, so keep the hue of the pixel unchanged; when When the background color shift of a pixel is less than 0 and greater than -T, it is determined that the background color shift of the pixel does not reach the set color shift, and the hue of the background color is deviated according to T, such as subtracting T from the hue of the background color.
  • T is greater than zero and less than ⁇
  • the hue of the background color can be subtracted by T/2 to obtain the deviated hue, and the hue of the pixel point can be updated to the deviated hue; Add T/2 to the hue to get the deviated hue, and update the hue of the pixel to the deviated hue.
  • the above method can improve the effect of updating the chromaticity of the pixels, effectively avoid the background color in the foreground image, and help improve the image quality of the subsequent fusion image, thereby improving the image processing efficiency.
  • step 104 shown in FIG. 3A can be updated to step 204.
  • step 204 according to the fusion transparency of pixels in the foreground image, image fusion processing is performed on the foreground image and the background image in units of pixels to obtain Fused images.
  • the foreground image and the background image can be subjected to image fusion processing in pixel units to obtain a fusion image.
  • the image fusion process here is similar to step 104 .
  • the embodiment of the present application performs color optimization on the image to be processed to obtain a foreground image, and performs image fusion processing on the foreground image and the background image, which can further improve the accuracy of image processing.
  • FIG. 3C is a schematic flowchart of an image processing method based on artificial intelligence provided by an embodiment of the present application. Based on FIG. 3A , after step 102 , in step 301 , an image to be processed may also be determined. The difference in brightness between the pixels in and the background color.
  • shadow optimization may be performed for the image to be processed.
  • the image to be processed and the background color can be converted to the same color space, where the color space can be a color space separated by color and light, that is, including a lightness channel.
  • the color space can be a color space separated by color and light, that is, including a lightness channel.
  • step 302 the brightness difference is weighted according to the shadow compensation parameter to obtain the shadow compensation intensity of the pixel.
  • the brightness difference of the pixel is weighted according to the set shadow compensation parameter to obtain the shadow compensation intensity of the pixel, wherein the shadow compensation parameter and the shadow compensation intensity are positively correlated, which can be determined according to the actual application scene. needs to set the shadow compensation parameters.
  • the method further includes: constraining the shadow compensation intensity of the pixel point according to the intensity range.
  • the shadow compensation intensity is obtained by weighting the brightness difference according to the shadow compensation parameter, the shadow compensation intensity may exceed the intensity range, where the intensity range refers to the normal value range of the shadow compensation intensity. Therefore, in this embodiment of the present application, the shadow compensation intensity of each pixel in the image to be processed may be constrained according to the intensity range, so as to ensure that the shadow compensation intensity after constraint processing is within a normal range.
  • the intensity range includes a minimum intensity and a maximum intensity; the above-mentioned constraining processing on the shadow compensation intensity of the pixel point according to the intensity range can be implemented in this way: when the shadow compensation intensity is less than the minimum intensity, the shadow compensation intensity is The intensity is updated to the minimum intensity; when the shadow compensation intensity is within the intensity range, the shadow compensation intensity is kept unchanged; when the shadow compensation intensity is greater than the maximum intensity, the shadow compensation intensity is updated to the maximum intensity.
  • the intensity range may be an interval of [minimum intensity, maximum intensity].
  • update the shadow compensation intensity to the minimum intensity when the shadow compensation intensity is within the interval of [minimum intensity, maximum intensity], keep the shadow compensation intensity unchanged; when the shadow compensation intensity is greater than the maximum intensity , to update the shadow compensation intensity to the maximum intensity.
  • the shadow compensation intensity after constraint processing can be effectively guaranteed to be within the intensity range.
  • step 303 shadow compensation processing is performed on the brightness and fusion transparency of the pixel point according to the shadow compensation intensity of the pixel point.
  • shadow compensation processing is performed on the brightness and fusion transparency of the pixel according to the shadow compensation intensity of the pixel.
  • the shadow compensation processing can be amplification processing, and the shadow compensation intensity is positively correlated with the amplitude of the amplification processing. In this way, in the final fusion image, the shadow in the image to be processed can be simulated more accurately, which is conducive to improving the subsequent The image quality of the fusion image, thereby improving the efficiency of image processing.
  • the above-mentioned shadow compensation intensity of the pixel point can be realized by performing shadow compensation processing on the brightness and fusion transparency of the pixel point according to the shadow compensation intensity, brightness and fusion transparency of the pixel point.
  • Pixels are subjected to brightness enhancement processing, and the brightness obtained through brightness enhancement processing is constrained according to the brightness range; pixels are processed according to the shadow compensation intensity and fusion transparency of the pixel points. Constrain the fusion transparency obtained by the fusion transparency increase processing.
  • the pixel can be subjected to brightness enhancement processing according to the shadow compensation intensity, brightness and fusion transparency of the pixel, wherein the shadow compensation intensity of the pixel and the brightness enhancement processing increase strength is positively correlated.
  • the embodiments of the present application do not limit the manner of the brightness enhancement processing.
  • the brightness obtained by the brightness enhancement processing can be expressed as Among them, Y f represents the brightness of the pixel before the brightness enhancement processing, ⁇ represents the fusion transparency of the pixel (the fusion transparency before the fusion transparency amplification), Y c represents the shadow compensation intensity of the pixel, and in addition, e is a parameter set to avoid numerical overflow, for example, it can be set to 0.01.
  • the brightness obtained by the brightness enhancement processing may exceed the brightness range. Therefore, the brightness obtained by the brightness enhancement processing can also be constrained according to the brightness range, and the brightness obtained after the constraint processing can be used as the pixel.
  • the new brightness of the point, where the process of constraining the brightness is similar to the process of constraining the shadow compensation intensity above.
  • the pixel point can be subjected to fusion transparency enhancement processing according to the shadow compensation intensity and fusion transparency of the pixel point, wherein the shadow compensation intensity of the pixel point is positively correlated with the amplification intensity of fusion transparency amplification processing.
  • the embodiment of the present application does not limit the processing method of the fusion transparency increase.
  • the fusion transparency obtained by the fusion transparency amplification process can be expressed as (1 - ⁇ ) ⁇
  • the fusion transparency obtained by the fusion transparency increase processing may exceed the transparency range. Therefore, the fusion transparency obtained by the fusion transparency increase processing can also be constrained according to the transparency range, and the fusion transparency obtained after the constraint processing is used as the pixel point.
  • the new blend transparency, where the process of constraining the blend transparency is similar to the process of constraining the shadow compensation strength above.
  • shadow optimization may be performed for the foreground image, that is, the to-be-processed image in step 301 may be replaced with a foreground image.
  • shadow optimization may be performed for the fused image, that is, the to-be-processed image in step 301 may be replaced with a fused image. Since there is no need to update the fusion transparency for the fusion image, in this case, step 303 may be updated to: perform shadow compensation processing on the brightness of the pixel points according to the shadow compensation intensity of the pixel points.
  • the shadow compensation intensity is determined according to the difference in brightness, and shadow compensation processing is performed according to the shadow compensation intensity, so that effective shadow optimization can be achieved, so that in the final fusion image, the simulation results can be accurately simulated.
  • the shadows/highlights in the image to be processed are beneficial to improve the image quality of the subsequent fusion image, thereby improving the efficiency of image processing.
  • FIG. 3D is a schematic flowchart of an image processing method based on artificial intelligence provided by an embodiment of the present application. Based on FIG. 3A , after step 102 , a transparency range may also be obtained in step 401 ; The transparency range includes minimum transparency and maximum transparency.
  • the transparency range is the value range of the fusion transparency, which can be expressed as the interval of [minimum transparency, maximum transparency].
  • step 402 the fusion transparency of the pixels is stretched according to the transparency range to obtain a new fusion transparency of each pixel, wherein the new fusion transparency of at least some pixels in the image to be processed is the minimum transparency, and the remaining at least The new blended opacity of some pixels is the maximum opacity.
  • the fusion transparency of each pixel in the image to be processed is stretched according to the transparency range, so that after the stretching process, the distribution of fusion transparency of each pixel in the to-be-processed image is smoother and more uniform, so that subsequent image fusion can be improved. processing effect.
  • the fusion transparency of at least some pixels in the image to be processed is updated to the minimum transparency, and in the remaining pixels, the fusion transparency of at least some pixels is updated to the maximum transparency.
  • the above-mentioned stretching processing of the fusion transparency of the pixel points according to the transparency range can be implemented in the following manner: when the fusion transparency is less than the first transparency threshold, the minimum transparency is determined as the new fusion transparency; when the fusion transparency When greater than or equal to the first transparency threshold and less than the second transparency threshold, the intermediate transparency is determined according to the fusion transparency, the first transparency threshold and the second transparency threshold, and the intermediate transparency is determined as the new fusion transparency; when the fusion transparency is greater than or equal to the first transparency threshold When there are two transparency thresholds, the maximum transparency is determined as the new fusion transparency; wherein, the first transparency threshold is smaller than the second transparency threshold; the first transparency threshold, the second transparency threshold and the intermediate transparency are all within the transparency range.
  • the fusion transparency of the pixel points may be stretched according to the set first transparency threshold and the second transparency threshold, wherein the first transparency threshold and the second transparency threshold are both within the transparency range, It can be set according to actual application scenarios. For example, when the transparency range is [0, 1], the first transparency threshold can be set to 0.001, and the second transparency threshold can be set to 0.01.
  • the fusion transparency of the pixel is updated to the minimum transparency; when the fusion transparency of the pixel is greater than or equal to the first transparency
  • the threshold value is smaller than the second transparency threshold
  • the intermediate transparency is determined according to the fusion transparency of the pixel, the first transparency threshold and the second transparency threshold, and the fusion transparency of the pixel is updated to the intermediate transparency; when the fusion transparency of the pixel When it is greater than or equal to the second transparency threshold, the fusion transparency of the pixel is updated to the maximum transparency.
  • the intermediate transparency corresponding to the pixel is also within the transparency range, and is positively correlated with the fusion transparency of the pixel before the update.
  • the intermediate transparency may be wherein, ⁇ represents the fusion transparency of the pixel point before updating, T 1 represents the first transparency threshold, and T 2 represents the second transparency threshold.
  • the embodiments of the present application provide the stretching treatment methods shown above, and the stretching treatment can be improved in effectiveness by performing treatment according to different intervals.
  • the distribution of fusion transparency can be made smoother and more uniform, and the effect of subsequent image fusion processing is improved, that is, the final fusion is improved. image quality, thereby improving image processing efficiency.
  • FIG. 3E is a schematic flowchart of an image processing method based on artificial intelligence provided by an embodiment of the present application. Based on FIG. 3A , before step 102 , in step 501 , according to the chromaticity range Perform enumeration processing to obtain multiple chromaticities.
  • the efficiency of image processing can be improved by means of table lookup acceleration.
  • enumeration processing can be performed according to the chromaticity range (ie, the value range of chromaticity) to obtain all possible chromaticities.
  • step 502 the fusion transparency corresponding to each chromaticity is determined according to the chromaticity difference between each chromaticity and the chromaticity of the background color.
  • the fusion transparency corresponding to the chromaticity is determined.
  • the fusion transparency corresponding to the chromaticity may also be stretched according to the transparency range.
  • a fusion transparency table is established according to a plurality of chromaticities and a plurality of fusion transparency corresponding to the plurality of chromaticities one-to-one.
  • a fusion transparency table may be established according to all the chromaticities obtained through the enumeration process and the fusion transparency corresponding to each chromaticity.
  • the corresponding relationship between chromaticity and fusion transparency is stored in the fusion transparency table, that is, the chromaticity can be used as an index of fusion transparency.
  • steps 501 to 503 may be performed before acquiring the image to be processed, so as to reduce adverse effects on the real-time image processing process (here refers to the process of performing image processing on the acquired image to be processed).
  • step 102 shown in FIG. 3A can be updated to step 504.
  • step 504 query processing is performed in the fusion transparency table according to the chromaticity of the pixel points in the image to be processed, and the fusion transparency obtained by the query is used as Fusion transparency of pixels.
  • query processing can be performed in the fusion transparency table according to the chromaticity of the pixel, and the fusion transparency corresponding to the chromaticity obtained by the query can be used as the pixel In this way, the efficiency of determining the fusion transparency of pixel points can be greatly improved through the query mechanism.
  • fusion transparency-chroma in addition to establishing the fusion transparency table, other tables may be established to facilitate table lookup acceleration. For example, in the process of color optimization, enumeration processing can be performed according to the transparency range and the chromaticity range, and all possible fusion transparency-chromaticity combinations can be obtained. For each fusion transparency-chroma combination, the chroma is updated in a manner similar to steps 201 to 203 . Then, an update chromaticity table is established according to all fusion transparency-chroma combinations and the updated processed chromaticity corresponding to each fusion transparency-chroma combination. In the updated chromaticity table, the fusion transparency-chroma combination can be used as Update the index of the processed chroma.
  • enumeration processing may be performed according to the transparency range and the brightness range, so as to obtain all possible fusion transparency-brightness combinations.
  • shadow compensation processing is performed on fusion transparency and brightness in a manner similar to steps 301 to 303 .
  • a compensation fusion transparency table is established according to all fusion transparency-brightness combinations and the fusion transparency after shadow compensation processing corresponding to each fusion transparency-brightness combination.
  • the fusion transparency-brightness combination can be As the index of the fusion transparency after shadow compensation processing; establish a compensation brightness table according to all fusion transparency-brightness combinations and the brightness after shadow compensation processing corresponding to each fusion transparency-brightness combination, in the compensation brightness table , the fusion opacity-brightness combination can be used as an index of the brightness after shadow compensation processing. In the above manner, the comprehensiveness of the table lookup acceleration can be improved.
  • the embodiment of the present application can greatly improve the efficiency of image processing and reduce the computational load of real-time image processing by means of table lookup acceleration. In this way, it is convenient to deploy the image processing solution provided by the embodiment of the present application in each types of electronic devices such as cell phones.
  • the real person in the image to be processed can be fused (overlaid) with a specific background, thereby improving the look and feel of the image.
  • the fusion image 41 includes the original character 42 in the image to be processed, and also includes the game virtual background and the bullet screen in the background image, wherein the game virtual background and the bullet screen are both presented in the fusion image 41 where the character 42 is located. areas outside the area.
  • the image 51 to be processed includes a character 511 and a curtain 512, that is, the character 511 stands in front of the curtain 512, and the curtain 512 is such as a green curtain or a blue curtain.
  • the fused image 52 can be obtained by performing image processing on the to-be-processed image 51 according to the solution provided in this embodiment of the present application.
  • the curtain 512 is replaced by a virtual background 521, wherein the background color in the image processing process is the curtain 512, the virtual background 521 can be defined according to the requirements of the actual application scene.
  • the image processing solution provided by the embodiments of the present application can be deployed as an online service or an offline service, so as to be applied to various types of image clips/video clips.
  • the embodiments of the present application can at least achieve the following technical effects: 1) The edge details in the to-be-processed image can be preserved, hair-level keying can be realized, and the precision of image processing can be improved.
  • FIG. 6 a comparative schematic diagram as shown in FIG. 6 is provided.
  • the fused image 62 is obtained by performing image processing on the to-be-processed image 61 according to the solution provided by the embodiment of the present application.
  • An image 63 is obtained, wherein the fused image 62 and the virtual background in the image 63 are the same. According to FIG.
  • the fusion image 62 retains the details of the hair in the to-be-processed image 61 more precisely for the hair of the person; for the translucent object, compared with the image 63 , the fusion image 62 Translucent objects can be presented more accurately without distortion and blur; for skin color, the fusion image 62 can restore the skin color in the image 61 to be processed, while the skin color in image 63 will appear reddish; for shadows , compared with the image 63 , the fused image 62 can more accurately simulate the shadow in the image to be processed 61 .
  • the characters in the fused image 62 will not have green edges (for example, the background in the image to be processed 61 is a green curtain, and the background color in the image processing process is green).
  • the embodiment of the present application may include two steps, the first step is to calculate the foreground image and the transparent channel image according to the received image to be keyed (corresponding to the above image to be processed), and the second step is to superimpose the foreground image on the background image, Among them, according to actual needs, the step 1 can be accelerated by looking up the table, which will be described later.
  • the embodiment of the present application provides a schematic flowchart of calculating a foreground image and a transparent channel image as shown in FIG. 7 .
  • the above step 1 can be implemented through steps 1 to 7, which will be described with reference to FIG. 7 .
  • Step 1 Set the keying color C k (corresponding to the background color above).
  • the keying color can be set by the user according to the actual application scenario, for example, the keying color can be consistent with the color of the curtain in the image to be keyed. For example, if the screen in the image to be keyed is a green screen, the keying color can be set to corresponding green.
  • Step 2 convert the to-be-keyed image I and the keyed color C k to the same color space, where the color space at least includes a chromaticity channel, for example, the color space can be YUV, LAB, HSL and HSV, etc., which is not limited .
  • the color space can be YUV, LAB, HSL and HSV, etc., which is not limited .
  • the YUV color space of floating point type as an example, so, when converting the to-be-keyed image I and the keyed color C k to this YUV color space, the corresponding Y channel, U
  • the channel values of channel and V channel are normalized to the range of [0, 1].
  • Step 3 Calculate the transparent channel image ⁇ based on the hue and saturation. Step 3 can be achieved through steps 1 and 2.
  • Step 1 Since the chromaticity channel of the YUV color space includes the U channel and the V channel, the fusion transparency of each pixel in the image I to be keyed is determined based on the U channel and the V channel. Taking the ith pixel in the image I to be keyed as an example, the fusion transparency of the ith pixel can be determined by the following formula (1):
  • ⁇ i (U i -U k ) 2 +(V i -V k ) 2 (1);
  • ⁇ i represents the fusion transparency of the ith pixel
  • U i represents the channel value of the ith pixel corresponding to the U channel
  • U k represents the channel value of the key color C k corresponding to the U channel
  • V i represents the ith pixel
  • the pixel point corresponds to the channel value of the V channel
  • V k represents the channel value of the V channel corresponding to the key color C k
  • (U i -U k ) 2 represents the chromaticity difference corresponding to the U channel
  • (V i -V k ) 2 represents the chromaticity difference corresponding to the V channel.
  • the embodiment of the present application does not limit the counting order of the pixel points in the image I to be keyed.
  • the counting can be performed in the order from top to bottom and from left to right.
  • the second pixel point may refer to the adjacent pixel point located to the right of the first pixel point.
  • Step 2 Stretch the fusion transparency of each pixel point according to the transparency range (ie, the range of [0, 1]) to update the fusion transparency.
  • the transparency range ie, the range of [0, 1]
  • the function description of the stretching process is shown in formula (2):
  • T 1 corresponds to the first transparency threshold above
  • T 2 corresponds to the second transparency threshold above
  • T 1 is smaller than T 2 , for example, the value of T 1 is 0.001, and the value of T 2 is 0.01
  • the transparent channel image ⁇ can be obtained, and each fusion transparency in the transparent channel image ⁇ corresponds to a pixel in the image I to be keyed.
  • Step 4 Copy the image I to be keyed to obtain a foreground image If.
  • Step 5 This step is an optional color optimization step, which can be achieved through steps 1 and 2.
  • Step 1 De-keying color, that is, removing the keying color in the foreground image If, to update the foreground image If.
  • the keying color in the foreground image If can be removed according to the set replacement color, and the replacement color can be set according to the actual application scene.
  • the gray C gray is used as an example for description, and the C gray is in the RGB color space.
  • the channel value of each channel is 128.
  • the process of de-keying color is described by the function S(I f ), see the following formula (3):
  • Step 2 Remove foreground flooding, that is, remove the color cast that is biased towards the keying color in the foreground edge of the foreground image If. Step 2 can be achieved through step a and step b.
  • Step a the foreground image I f and the keying color C k are converted to the same color space, for ease of illustration, take the case where the color space is the HSV color space or the HSL color space as an example, of course, other color spaces can also be applied, Such as YUV color space.
  • the channel value H f of the hue channel (ie, the H channel) corresponding to the pixel point is determined.
  • the channel value H k of the H channel corresponding to the key color C k is determined. Then, calculate the error between H f and H k according to the following formula (4) (corresponding to the background color shift above):
  • d f represents the error between H f and H k
  • 180 refers to 180 degrees in the hue circle (hue wheel)
  • 360 refers to 360 degrees.
  • Step b Update the value of H f according to the function G(H f ) shown in the following formula (5):
  • the situation of “d f ⁇ -T 3 or d f ⁇ T 3 ” corresponds to the above-mentioned situation that the background color shift reaches the set color shift degree, so keep the hue of the pixel unchanged; “-T 3 ⁇ d
  • the cases of f ⁇ 0" and the cases of "0 ⁇ d f ⁇ T 3 " correspond to the above-mentioned cases where the background color shift does not reach the set color shift degree. Therefore, the hue of the pixel is updated.
  • T3 is the color deflection threshold, and the value of T3 is less than ⁇ .
  • T3 can be set as
  • Step 6 This step is an optional step of optimizing shadow details, which can be achieved through steps 1 and 2.
  • Step 1 Determine the shadow compensation intensity (also known as shadow and highlight compensation intensity) based on the brightness.
  • the foreground image I f and the keying color C k can be converted to the same color space.
  • the color space is the YUV color space.
  • other color spaces can also be applied here.
  • the channel value Y f of the luminance channel (ie, the Y channel) corresponding to the pixel point is determined.
  • the channel value Y k of the Y channel corresponding to the key color C k is determined.
  • the shadow compensation intensity of the pixel can be calculated according to the following formula (6):
  • Y c represents the shadow compensation intensity of the pixel
  • Y f -Y k corresponds to the brightness difference above
  • [-1, 1] corresponds to the intensity range above
  • m corresponds to the shadow compensation parameter above. The larger the value, the greater the intensity of shadow compensation. For example, it can be set to 1.0. When m is set to 0.0, it is equivalent to not performing shadow compensation processing.
  • Step 2 Perform shadow compensation processing on the brightness and fusion transparency of the pixel point according to the shadow compensation intensity of the pixel point, see the following formula (7):
  • A(Y f ) represents the function used to update the brightness Y f of the pixel point
  • B( ⁇ ) represents the function used to update the fusion transparency ⁇ of the pixel point
  • clip(x) represents the stage function
  • clip(x) The x in has no actual meaning and is only used for reference.
  • e is a parameter set to avoid numerical overflow, and can be set to 0.01, for example.
  • the brightness range and the transparency range are both [0, 1].
  • Step 7 output the foreground image If and the transparent channel image ⁇ .
  • the fused image (also called the composite result image) can be obtained according to the following formula (8):
  • I b represents the background image, which can be set according to the requirements in the actual application scene
  • I o represents the fusion image.
  • weighted summation processing may be performed in units of pixels. It is worth noting that the above step 6 for shadow optimization can also be performed after the fusion image is obtained.
  • the above-mentioned step 1 may also be accelerated by looking up a table, so as to improve the efficiency of image processing.
  • an embodiment of the present application provides a schematic diagram of table lookup acceleration as shown in FIG. 8 , which will be described in the form of steps with reference to FIG. 8 .
  • Step 1 Set the keying color C k .
  • Step 2 Establish a two-dimensional table t 1 (U f , V f ) for looking up the table to obtain fusion transparency, and the two-dimensional table t 1 (U f , V f ) corresponds to the fusion transparency table above.
  • the definition of U f is the same as the above U i , V f is the same, the value range of U f and V f are both integers [0, P], where P is the power of the number of image digits for 2
  • the fusion transparency is determined according to the following formula (9) and formula (10) and stored in the two-dimensional table t 1 (U f , V f ):
  • the operation process in the above formula can be a floating point operation.
  • the serial number of the combination can be determined according to U f and V f in the combination.
  • U f can be used as a high-order bit
  • V f can be used as a low-order bit, splicing to obtain The sequence number q of the combination.
  • the fusion transparency can be stored in the two-dimensional table t 1 (U f , V f ) at the position with the subscript q, so as to facilitate subsequent queries according to the subscript
  • the corresponding fusion transparency that is, the dimension of the table refers to the dimension of the subscript, and the subscript is equivalent to the index above.
  • the following table creation process is the same.
  • Step 3 Establish a three-dimensional table t u ( ⁇ , U f , V f ) for looking up the table to obtain the channel value of the U channel corresponding to the pixel point in the foreground image If, and establish a three-dimensional table t v ( ⁇ , U f , V f ) ) is used to look up the table to obtain the channel value of the V channel corresponding to the pixel point in the foreground image If, and the three-dimensional table t u ( ⁇ , U f , V f ) and t v ( ⁇ , U f , V f ) uniformly correspond to the above The updated chromaticity table. For each combination obtained by the enumeration process (the combination here includes ⁇ , U f and V f , where ⁇ represents the fusion transparency of a pixel point), perform steps 1 to 5.
  • Step 1 Update the values of U f and V f , using a function similar to the above S(I f ), as shown in the following formula (11):
  • I gray corresponds to the above C gray , for example, it can be set to gray, that is, the channel value of each channel in the RGB color space is 128.
  • the x in S(x) is the pixel represented by U f and V f in the combination.
  • Step 2 Convert the pixel point x to the HSV or HSL color space, and determine the channel value H x of the H channel corresponding to the pixel point x .
  • the key color C k is converted to the HSV or HSL color space, and the channel value H k of the H channel corresponding to the key color C k is determined.
  • Step 3 Determine the error d x between H x and H k according to the following formula (12):
  • Step 4 update the value of H x according to the following formula (13):
  • T 3 is greater than 0 and less than ⁇ .
  • Step 5 Convert the pixel point x to the YUV color space, and store the channel value of the pixel point x corresponding to the U channel in the three-dimensional table t u ( ⁇ , U f , V f ), while the pixel point x corresponds to the V channel.
  • the channel values are stored in a three-dimensional table t v ( ⁇ , U f , V f ).
  • Step 4 establish a two-dimensional table t y ( ⁇ , Y f ) for looking up the table to obtain the channel value of the Y channel corresponding to the pixel point in the foreground image If, and establish a two-dimensional table t ⁇ ( ⁇ , Y f ) for looking up.
  • the table obtains the fusion transparency of the pixels in the foreground image If, wherein the two-dimensional table t y ( ⁇ , Y f ) corresponds to the compensation brightness table above, and the two-dimensional table t ⁇ ( ⁇ , Y f ) corresponds to the above The Compensation Fusion Transparency table. For each combination obtained by the enumeration process (the combination here includes ⁇ and Y f , where ⁇ represents the fusion transparency of a pixel), perform steps 1 to 3.
  • Step 1 Determine the shadow compensation intensity according to the following formula (14):
  • Step 2 Perform shadow compensation processing on the brightness Y f and the fusion transparency ⁇ to achieve update. See equation (15) below:
  • Step 3 store the updated Y f in the two-dimensional table t y ( ⁇ , Y f ), and store the updated fusion transparency ⁇ in the two-dimensional table t ⁇ ( ⁇ , Y f ).
  • Step 5 Process the image I to be keyed, for example, it can be processed through steps 1 to 4.
  • Step 1 Convert the to-be-keyed image I to the YUV color space to obtain the foreground image If.
  • Step 2. perform the following processing for each pixel point in the foreground image If: determine the subscript according to the channel value of the corresponding U channel and the channel value of the corresponding V channel according to the pixel point, and according to the subscript in the two-dimensional table t 1 ( Perform query processing in U f , V f ) to obtain the fusion transparency ⁇ of the pixels.
  • Step 3 perform the following processing for each pixel point in the foreground image If: determine the subscript according to the fusion transparency ⁇ of the pixel point, the channel value of the corresponding U channel, and the channel value of the corresponding V channel, according to the subscript in the Perform query processing in the three-dimensional table t u ( ⁇ , U f , V f ), and update the channel value of the pixel corresponding to the U channel to the value queried in the three-dimensional table t u ( ⁇ , U f , V f ); At the same time, query processing is performed in the three-dimensional table t v ( ⁇ , U f , V f ) according to the subscript, and the channel value of the pixel corresponding to the V channel is updated to the three-dimensional table t v ( ⁇ , U f , V f ) ) in the query value.
  • Step 4. perform the following processing for each pixel point in the foreground image If: determine the subscript according to the fusion transparency ⁇ of the pixel point and the channel value of the corresponding Y channel, according to the subscript in the two-dimensional table t y ( ⁇ , Perform query processing in Y f ), and update the channel value of the pixel point corresponding to the Y channel to the value queried in the two-dimensional table t y ( ⁇ , Y f ); at the same time, according to the subscript in the two-dimensional table t ⁇ ( ⁇ , Y f ) is searched, and the fusion transparency ⁇ of the pixel is updated to the value queried in the two-dimensional table t ⁇ ( ⁇ , Y f ).
  • Step 6 output the foreground image If and the transparent channel image.
  • the corresponding table is pre-calculated and established.
  • the query can be directly performed in the table without frequent color space conversion, which can effectively improve the efficiency of image processing.
  • Reduce real-time computing load It has been proved by experiments that only one core of the Central Processing Unit (CPU), such as one core of Intel E5 v4, can perform real-time image processing by applying the table lookup acceleration method. Low, only in the tens of megabytes (MB) level. In this way, the image processing solution provided by the embodiments of the present application can be deployed not only on the server side and the computer side, but also on the mobile terminal (eg, mobile terminal device).
  • the mobile terminal eg, mobile terminal device
  • the artificial intelligence-based image processing apparatus 455 provided by the embodiments of the present application is implemented as a software module.
  • the artificial intelligence-based image processing apparatus stored in the memory 450 The software modules in 455 may include: a background color determination module 4551, configured to determine the background color in the image to be processed; a transparency determination module 4552, configured to be based on the chromaticity difference between the pixels in the image to be processed and the background color, Determine the fusion transparency of the pixel points; the image acquisition module 4553 is configured to acquire the background image corresponding to the image to be processed; the image fusion module 4554 is configured to obtain the image to be processed and the background image according to the fusion transparency of the pixel points in the image to be processed. Image fusion processing is performed in units of points to obtain a fusion image.
  • the artificial intelligence-based image processing device 455 further includes a color optimization module, configured to: perform fusion processing on the to-be-processed image and the replacement color in pixel units according to the fusion transparency of the pixels in the to-be-processed image, A foreground image is obtained; the image fusion module 4554 is further configured to perform image fusion processing on the foreground image and the background image in pixel units according to the fusion transparency of the pixels in the foreground image.
  • a color optimization module configured to: perform fusion processing on the to-be-processed image and the replacement color in pixel units according to the fusion transparency of the pixels in the to-be-processed image, A foreground image is obtained; the image fusion module 4554 is further configured to perform image fusion processing on the foreground image and the background image in pixel units according to the fusion transparency of the pixels in the foreground image.
  • the color optimization module is further configured to: determine the background color shift of the pixel point according to the chromaticity difference between the pixel point in the foreground image and the background color; when the background color shift of the pixel point reaches the set color When the deviation degree, keep the chromaticity of the pixel point unchanged; when the background color deviation of the pixel point does not reach the set color deviation degree, the deviation processing is performed on the chromaticity of the background color to obtain the deviation chromaticity, and the chromaticity of the pixel point is calculated. Update to off-chroma.
  • the artificial intelligence-based image processing device 455 further includes a shadow optimization module, configured to: determine the brightness difference between the pixels in the image to be processed and the background color; The weighting process is used to obtain the shadow compensation intensity of the pixel point; according to the shadow compensation intensity of the pixel point, the shadow compensation process is performed on the brightness and fusion transparency of the pixel point.
  • a shadow optimization module configured to: determine the brightness difference between the pixels in the image to be processed and the background color; The weighting process is used to obtain the shadow compensation intensity of the pixel point; according to the shadow compensation intensity of the pixel point, the shadow compensation process is performed on the brightness and fusion transparency of the pixel point.
  • the shadow optimization module is further configured to: perform constraint processing on the shadow compensation intensity of the pixel point according to the intensity range; perform brightness enhancement processing on the pixel point according to the shadow compensation intensity, brightness and fusion transparency of the pixel point, And according to the brightness range, the brightness obtained by the brightness increase processing is constrained; the pixel points are processed by the fusion transparency amplification according to the shadow compensation intensity and fusion transparency of the pixels, and the fusion transparency is processed according to the transparency range. Blend transparency for constraint processing.
  • the intensity range includes a minimum intensity and a maximum intensity; the shadow optimization module is further configured to: when the shadow compensation intensity is less than the minimum intensity, update the shadow compensation intensity to the minimum intensity; when the shadow compensation intensity is within the intensity range , keep the shadow compensation intensity unchanged; when the shadow compensation intensity is greater than the maximum intensity, update the shadow compensation intensity to the maximum intensity.
  • the artificial intelligence-based image processing apparatus 455 further includes a stretching module configured to: obtain a transparency range; wherein, the transparency range includes a minimum transparency and a maximum transparency; and the pixel points are fused according to the transparency range.
  • the transparency is stretched to obtain the new fusion transparency of each pixel, wherein the new fusion transparency of at least some pixels in the image to be processed is the minimum transparency, and the new fusion transparency of the remaining at least some pixels for the maximum transparency.
  • the stretching module is further configured to: when the fusion transparency is less than a first transparency threshold, determine the minimum transparency as the new fusion transparency; when the fusion transparency is greater than or equal to the first transparency When the transparency threshold is smaller than the second transparency threshold, the intermediate transparency is determined according to the fusion transparency, the first transparency threshold and the second transparency threshold, and the intermediate transparency is determined as the new fusion transparency; When the fusion transparency is greater than or equal to the second transparency threshold, the maximum transparency is determined as the new fusion transparency; wherein the first transparency threshold is less than the second transparency threshold; the first transparency threshold, the second transparency threshold and the middle Transparency is all within the transparency range.
  • the transparency determination module 4552 is further configured to: convert the image to be processed and the background color to the same color space; wherein the color space includes multiple chromaticity channels; for each chromaticity channel, determine the image to be processed The difference between the channel value of the chromaticity channel corresponding to the pixel point and the channel value of the chromaticity channel corresponding to the background color, and the determined difference is used as the chromaticity difference corresponding to the chromaticity channel; One-to-one correspondence of a plurality of chromaticity differences is subjected to differential fusion processing to obtain the fusion transparency of the pixel points.
  • the image fusion module 4554 is further configured to: convert the image to be processed and the background image into the same color space; wherein the color space includes multiple channels; perform the following processing for each channel: determine the The first pixel point corresponds to the first channel value of the channel, and the second pixel point in the background image corresponds to the second channel value of the channel; according to the fusion transparency of the first pixel point, the first channel value and the second channel value are calculated. Weighting processing to obtain the third channel value of the channel corresponding to the third pixel point in the fused image; wherein the pixel position of the first pixel point, the pixel position of the second pixel point and the pixel of the third pixel point There is a mapping relationship between locations.
  • the artificial intelligence-based image processing device 455 further includes a table building module, configured to: perform enumeration processing according to the chromaticity range to obtain multiple chromaticities; according to each of the chromaticities and the background color The chromaticity difference between the chromaticities is determined, and the fusion transparency corresponding to each of the chromaticities is determined; the fusion transparency is established according to the multiple chromaticities and the multiple fusion transparency corresponding to the multiple chromaticities one-to-one.
  • the transparency determination module 4552 is further configured to: perform query processing in the fusion transparency table according to the chromaticity of the pixel points in the image to be processed, and use the fusion transparency obtained by the query as the fusion transparency of the pixel points.
  • the background color determination module 4551 is further configured to: perform any one of the following processing: obtain the background color set for the image to be processed as the background color of the image to be processed; Perform target recognition processing to obtain a target area, and use the color with the highest frequency in the background area of the image to be processed as the background color of the image to be processed; wherein, the background area is different from the image to be processed. the area of the target area.
  • the artificial intelligence-based image processing device provided by the embodiment of the present application can at least achieve the following technical effects: 1) During the image processing process, the edge details in the image to be processed can be preserved, hair-level matting can be realized, and the efficiency of image processing can be improved.
  • the degree of fineness 2) It can retain the shadow/highlight of the background area in the image to be processed, and ensure that after image fusion processing with the background image, the shadow/highlight effect in the obtained fused image is more realistic; 3) It can target translucent objects (such as Glass) to perform high-quality keying to ensure that the translucent objects in the fused image can be accurately presented; 4) It can effectively avoid the situation where the foreground is biased to the background color (such as characters with green light) in the fused image, which can improve the visual effect.
  • translucent objects such as Glass
  • Embodiments of the present application provide a computer program product or computer program, where the computer program product or computer program includes computer instructions (ie, executable instructions), and the computer instructions are stored in a computer-readable storage medium.
  • the processor of the electronic device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the electronic device executes the above-mentioned artificial intelligence-based image processing method in the embodiment of the present application.
  • the embodiments of the present application provide a computer-readable storage medium storing executable instructions, wherein the executable instructions are stored, and when the executable instructions are executed by a processor, the processor will cause the processor to execute the method provided by the embodiments of the present application, for example , as shown in Fig. 3A, Fig. 3B, Fig. 3C, Fig. 3D and Fig. 3E, the image processing method based on artificial intelligence.
  • the computer-readable storage medium may be memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; it may also include one or any combination of the foregoing memories Various equipment.
  • executable instructions may take the form of programs, software, software modules, scripts, or code, written in any form of programming language, including compiled or interpreted languages, or declarative or procedural languages, and which Deployment may be in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
  • executable instructions may, but do not necessarily correspond to files in a file system, may be stored as part of a file that holds other programs or data, for example, a Hyper Text Markup Language (HTML, Hyper Text Markup Language) document
  • HTML Hyper Text Markup Language
  • One or more scripts in stored in a single file dedicated to the program in question, or in multiple cooperating files (eg, files that store one or more modules, subroutines, or code sections).
  • executable instructions may be deployed to execute on one electronic device, or on multiple electronic devices located at one site, or alternatively, multiple electronic devices distributed across multiple sites and interconnected by a communication network execute on.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Computing Systems (AREA)
  • Geometry (AREA)
  • Computer Graphics (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Image Processing (AREA)

Abstract

本申请提供了一种基于人工智能的图像处理方法、装置、电子设备、计算机可读存储介质及计算机程序产品;方法包括:确定待处理图像中的背景色;根据待处理图像中的像素点与背景色之间的色度差异,确定像素点的融合透明度;获取待处理图像对应的背景图像;根据待处理图像中像素点的融合透明度,将待处理图像及背景图像以像素点为单位进行图像融合处理,得到融合图像。

Description

基于人工智能的图像处理方法、装置、电子设备、计算机可读存储介质及计算机程序产品
相关申请的交叉引用
本申请实施例基于申请号为202110407801.X、申请日为2021年04月15日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请实施例作为参考。
技术领域
本申请涉及人工智能技术,尤其涉及一种基于人工智能的图像处理方法、装置、电子设备、计算机可读存储介质及计算机程序产品。
背景技术
随着计算机技术和图像技术的快速发展,图像抠像(Keying)作为一种新兴手段,已广泛地应用于如影视制作的各种场景中。图像抠像是指将待处理图像中的某一种色彩抠去,并将特定的背景图像叠加在待处理图像上,从而形成二层画面的叠加合成。例如,在室内拍摄人物得到待处理图像后,可以通过图像抠像技术将待处理图像中的室内背景抠去,并将待处理图像中的人物与特定的背景叠加在一起。
在相关技术提供的方案中,通常是由用户设置需要抠出的背景色以及对应的容差范围,以通过设置的容差范围控制抠像的范围大小,从而进行图像抠像。但是,该方案会导致图像抠像时边缘细节(如人物的发丝细节)丢失,即图像处理的精度低。
发明内容
本申请实施例提供一种基于人工智能的图像处理方法、装置、电子设备、计算机可读存储介质及计算机程序产品,能够在图像处理过程中保留待处理图像原有的边缘细节,提升得到的融合图像的质量和精度。
本申请实施例的技术方案是这样实现的:
本申请实施例提供一种基于人工智能的图像处理方法,包括:
确定待处理图像中的背景色;
根据所述待处理图像中的像素点与所述背景色之间的色度差异,确定所述像素点的融合透明度;
获取所述待处理图像对应的背景图像;
根据所述待处理图像中像素点的融合透明度,将所述待处理图像及所述背景图像以像素点为单位进行图像融合处理,得到融合图像。
本申请实施例提供一种基于人工智能的图像处理装置,包括:
背景色确定模块,配置为确定待处理图像中的背景色;
透明度确定模块,配置为根据所述待处理图像中的像素点与所述背景色之间的色度差异,确定所述像素点的融合透明度;
图像获取模块,配置为获取所述待处理图像对应的背景图像;
图像融合模块,配置为根据所述待处理图像中像素点的融合透明度,将所述待处理图像及所述背景图像以像素点为单位进行图像融合处理,得到融合图像。
本申请实施例提供一种电子设备,包括:
存储器,用于存储可执行指令;
处理器,用于执行所述存储器中存储的可执行指令时,实现本申请实施例提供的基于人工智能的图像处理方法。
本申请实施例提供一种计算机可读存储介质,存储有可执行指令,用于引起处理器执行时,实现本申请实施例提供的基于人工智能的图像处理方法。
本申请实施例提供一种计算机程序产品,包括计算机程序或指令,所述计算机程序或指令被处理器执行时,实现本申请实施例提供的基于人工智能的图像处理方法。
本申请实施例具有以下有益效果:
根据待处理图像中的像素点与背景色之间的色度差异确定像素点的融合透明度,并根据像素点的融 合透明度,将待处理图像及背景图像以像素点为单位进行图像融合处理,相较于根据容差范围进行抠像的方式,本申请实施例通过更加平滑的图像融合处理,能够保留待处理图像原有的边缘细节,同时提升得到的融合图像的质量(画质)以及精度。
附图说明
图1是本申请实施例提供的基于人工智能的图像处理系统的架构示意图;
图2是本申请实施例提供的终端设备的架构示意图;
图3A是本申请实施例提供的基于人工智能的图像处理方法的流程示意图;
图3B是本申请实施例提供的基于人工智能的图像处理方法的流程示意图;
图3C是本申请实施例提供的基于人工智能的图像处理方法的流程示意图;
图3D是本申请实施例提供的基于人工智能的图像处理方法的流程示意图;
图3E是本申请实施例提供的基于人工智能的图像处理方法的流程示意图;
图4是本申请实施例提供的融合图像的示意图;
图5是本申请实施例提供的待处理图像及融合图像的示意图;
图6是本申请实施例提供的融合效果的对比示意图;
图7是本申请实施例提供的确定前景图像及透明通道图像的流程示意图;
图8是本申请实施例提供的查表加速的流程示意图。
具体实施方式
为了使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请作进一步地详细描述,所描述的实施例不应视为对本申请的限制,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。
在以下的描述中,涉及到“一些实施例”,其描述了所有可能实施例的子集,但是可以理解,“一些实施例”可以是所有可能实施例的相同子集或不同子集,并且可以在不冲突的情况下相互结合。
在以下的描述中,所涉及的术语“第一\第二\第三”仅仅是区别类似的对象,不代表针对对象的特定排序,可以理解地,“第一\第二\第三”在允许的情况下可以互换特定的顺序或先后次序,以使这里描述的本申请实施例能够以除了在这里图示或描述的以外的顺序实施。在以下的描述中,所涉及的术语“多个”是指至少两个。
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本文中所使用的术语只是为了描述本申请实施例的目的,不是旨在限制本申请。
对本申请实施例进行进一步详细说明之前,对本申请实施例中涉及的名词和术语进行说明,本申请实施例中涉及的名词和术语适用于如下的解释。
1)人工智能(Artificial Intelligence,AI):利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能,感知环境、获取知识并使用知识获得最佳结果的理论、方法、技术及应用系统。计算机视觉技术(Computer Vision,CV)是人工智能的一个重要应用,指用摄影机和电脑代替人眼对目标进行识别、跟踪和测量等机器视觉,并进一步做图形处理,使电脑处理成为更适合人眼观察或传送给仪器检测的图像。在本申请实施例中,可以基于计算机视觉技术来实现图像处理。
2)背景色:指待处理图像中需要被抠去/覆盖的色彩。在本申请实施例中,背景色可以由用户指定,或者可以对待处理图像进行智能识别得到。
3)色度:色彩的三要素可以包括色相(色调)、饱和度(纯度)以及明亮度,其中,色彩是物体上的物理性的光反射到人眼视神经上所产生的感觉,色的不同是由光的频率高低差别所决定的,而色相用于反映这些不同频率的色的情况;饱和度用于表示色的鲜艳或鲜明的程度;明亮度用于表示色具有的亮暗程度。在本申请实施例中,色度表示色彩具有的且区别于明亮度的性质,例如色度可以包括色相以及饱和度中的至少一种。
4)像素点(Pixel):又称像素,指图像中不可继续分割的元素。
5)色彩空间(Color Space):又称色域、颜色空间,指通过一组值来描述色彩的抽象模型。对于被描述的色彩来说,其本身是客观的,不同色彩空间只是从不同的角度去描述该色彩。色彩空间包括多个通道,可以通过色彩在各个通道对应的通道值来描述该色彩。
色彩空间按照基本结构可以分为两类:基色色彩空间和色亮分离色彩空间。前者如红绿蓝(RGB,Red Green Blue)色彩空间,包括红色通道、绿色通道以及蓝色通道,即基色色彩空间未将明亮度和色度明确地区分开;后者如YUV色彩空间、HSV色彩空间、HSL色彩空间以及LAB色彩空间等,在色亮分离色 彩空间中,会将明亮度和色度明确地区分开。其中,YUV色彩空间包括的Y通道对应明亮度,U通道和V通道均对应色度;HSV色彩空间包括的H通道、S通道和V通道分别对应色相、饱和度及明亮度;HSL色彩空间包括的H通道、S通道和L通道分别对应色相、饱和度及明亮度;LAB色彩空间包括的L通道对应明亮度,A通道和B通道均对应色度。
6)查表加速:以空间(存储空间)换时间(运行时间)的加速方法,在本申请实施例中可以用于对图像处理进行加速,从而提升图像处理的效率,同时降低实时计算负载。例如,可以预先计算图像处理过程中可能涉及的各种结果,并存入特定的数据结构(如表格)中,如此,在实时的图像处理过程中直接查询该数据结构,而无需进行实时计算。
对于图像抠像,较为典型的是超级键算法(例如Premiere软件中的超级键算法),在该超级键算法中,需要由用户设置需要抠出的背景色(如绿色或蓝色等)以及对应的容差范围,设置的容差范围用于控制抠像的范围大小,此外,用户还可以进行羽化、收缩等多种操作。但是,在通过超级键算法进行图像抠像时,至少存在以下问题:1)在图像抠像过程中会丢失待处理图像中原有的边缘细节(如人物发丝细节),导致抠像效果不好;2)最终叠加得到的图像中的高光、阴影效果较差,例如阴影发灰,无法有效模拟出待处理图像中原有的阴影效果;3)无法精准处理待处理图像中的半透明物体(例如玻璃杯),最终叠加得到的图像中的半透明物体可能会出现失真、模糊等问题;4)在最终叠加得到的图像中,前景(或称目标)会出现偏向背景色的情况,例如在背景色为绿色时,最终叠加得到的图像中的人物(即前景)身上会泛绿光;5)需要用户执行的操作过多,用户的学习难度和学习成本较高。
本申请实施例提供一种基于人工智能的图像处理方法、装置、电子设备、计算机可读存储介质及计算机程序产品,能够在图像处理过程中保留待处理图像的边缘细节,提升得到的融合图像的质量和精度。下面说明本申请实施例提供的电子设备的示例性应用,本申请实施例提供的电子设备可以实施为各种类型的终端设备,也可以实施为服务器。
参见图1,图1是本申请实施例提供的基于人工智能的图像处理系统100的架构示意图,终端设备400通过网络300连接服务器200,服务器200连接数据库500,其中,网络300可以是广域网或者局域网,又或者是二者的组合。
在一些实施例中,本申请实施例提供的基于人工智能的图像处理方法可以由终端设备实现。例如,终端设备400获取待处理图像,其中,待处理图像可以是预先存储于终端设备400本地的,可以是终端设备400实时拍摄的,也可以是终端设备400从外界(如服务器200、数据库500以及区块链等)获取的。对于获取到的待处理图像,终端设备400确定待处理图像中的背景色,例如终端设备400可以响应背景色设置操作,获取用户通过背景色设置操作所设置的背景色,又例如终端设备400可以对待处理图像进行智能识别,以自动识别出背景色。然后,终端设备400根据待处理图像中的像素点与背景色之间的色度差异,确定像素点的融合透明度,并根据融合透明度,将待处理图像及获取的背景图像以像素点为单位进行图像融合处理,得到融合图像。同理,背景图像也可以是终端设备400预先存储、实时拍摄或从外界获取的。
在一些实施例中,本申请实施例提供的基于人工智能的图像处理方法也可以由服务器实现。例如,服务器200(如图像类应用程序的后台服务器)可以从数据库500中获取待处理图像,当然,待处理图像也可以是服务器200从其他位置(如终端设备400及区块链等)获取。对于获取到的待处理图像,服务器200确定待处理图像中的背景色,例如服务器200可以接收终端设备400发送的由用户设置的背景色,又例如服务器200可以对待处理图像智能识别,以自动识别出背景色。然后,服务器200根据待处理图像中的像素点与背景色之间的色度差异,确定像素点的融合透明度,并根据融合透明度,将待处理图像及获取的背景图像以像素点为单位进行图像融合处理,得到融合图像。同理,背景图像也可以是服务器200从数据库500或其他位置获取的。
在一些实施例中,本申请实施例提供的基于人工智能的图像处理方法也可以由终端设备和服务器协同实现。如图1所示,终端设备400响应于用户操作,将待处理图像、背景色以及背景图像发送至服务器200,通过服务器200进行图像处理。服务器200在经图像处理得到融合图像后,将融合图像发送至终端设备400。
在一些实施例中,可以将图像处理过程中涉及到的各种结果(如待处理图像、背景色、背景图像、融合图像以及用于查表加速建立的各种表格)存储至区块链中,由于区块链具有不可篡改的特性,因此能够保证区块链中的数据的准确性。电子设备(如终端设备400或服务器200)可以向区块链发送查询请求,以查询区块链中存储的数据。
在一些实施例中,终端设备400或服务器200可以通过运行计算机程序来实现本申请实施例提供的基于人工智能的图像处理方法,例如,计算机程序可以是操作系统中的原生程序或软件模块;可以是本地(Native)应用程序(APP,Application),即需要在操作系统中安装才能运行的程序,如图像类的应用程序(如图1中示出的客户端410,例如该客户端410可以是用于图像剪辑/视频剪辑的APP);也可以是 小程序,即只需要下载到浏览器环境中就可以运行的程序;还可以是能够嵌入至任意APP中的小程序,如嵌入至图像类的应用程序中的小程序组件,其中,该小程序组件可以由用户控制运行或关闭。总而言之,上述计算机程序可以是任意形式的应用程序、模块或插件。
在一些实施例中,服务器200可以是独立的物理服务器,也可以是多个物理服务器构成的服务器集群或者分布式系统,还可以是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、内容分发网络(Content Delivery Network,CDN)、以及大数据和人工智能平台等基础云计算服务的云服务器,其中,云服务可以是图像处理服务,供终端设备400进行调用。终端设备400可以是智能手机、平板电脑、笔记本电脑、台式计算机、智能电视、智能手表等,但并不局限于此。终端设备以及服务器可以通过有线或无线通信方式进行直接或间接地连接,本申请实施例中不做限制。
在本申请实施例中,数据库可以为服务器提供数据支持,例如服务器可以连接数据库,并获取数据库中的数据进行相应处理,还可以将得到的处理结果存储至数据库中。举例来说,如图1所示,数据库500可以用于存储与图像处理相关的数据(包括但不限于待处理图像、背景色以及背景图像),服务器200可以获取数据库500中的数据,以进行图像处理。
在一些实施例中,数据库和服务器可以独立设置。在一些实施例中,数据库和服务器也可以集成在一起,即数据库可以视为存在于服务器内部,与服务器一体化,服务器可以提供数据库的数据管理功能。
以本申请实施例提供的电子设备是终端设备为例说明,可以理解的,对于电子设备是服务器的情况,图2中示出的结构中的部分(例如用户接口、呈现模块和输入处理模块)可以缺省。参见图2,图2是本申请实施例提供的终端设备400的结构示意图,图2所示的终端设备400包括:至少一个处理器410、存储器450、至少一个网络接口420和用户接口430。终端设备400中的各个组件通过总线系统440耦合在一起。可理解,总线系统440用于实现这些组件之间的连接通信。总线系统440除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图2中将各种总线都标为总线系统440。
在一些实施例中,本申请实施例提供的基于人工智能的图像处理装置可以采用软件方式实现,图2示出了存储在存储器450中的基于人工智能的图像处理装置455,其可以是程序和插件等形式的软件,包括以下软件模块:背景色确定模块4551、透明度确定模块4552、图像获取模块4553以及图像融合模块4554,这些模块是逻辑上的,因此根据所实现的功能可以进行任意的组合或进一步拆分。将在下文中说明各个模块的功能。
将结合本申请实施例提供的电子设备的示例性应用和实施,说明本申请实施例提供的基于人工智能的图像处理方法。
参见图3A,图3A是本申请实施例提供的基于人工智能的图像处理方法的流程示意图,将结合图3A示出的步骤进行说明。
在步骤101中,确定待处理图像中的背景色。
这里,获取待处理图像,确定待处理图像中需要抠出或者覆盖的背景色。本申请实施例对待处理图像的图像位数不做限定,例如可以是8位(Bites)、16位或32位等;对待处理图像中的内容同样不做限定,例如可以是真实人物、猫或狗等;对待处理图像的尺寸也不做限定。
值得说明的是,本申请实施例对获取待处理图像的步骤与确定背景色的步骤之间的执行顺序不做限定,例如可以一先一后执行(如确定背景色之后再获取待处理图像,或者获取待处理图像之后再确定背景色),也可以同时执行。确定出的背景色可以适用于某一个特定的待处理图像,也可以同时适用于不同的待处理图像。
在一些实施例中,上述步骤101可以通过以下任意一种方式实现:获取针对待处理图像设置的背景色作为待处理图像的背景色;对待处理图像进行目标识别处理,得到目标区域,并将待处理图像的背景区域中出现频率最高的色彩作为待处理图像的背景色;其中,背景区域是待处理图像中区别于目标区域的区域。
本申请实施例提供了确定背景色的两种方式。第一种方式是,获取针对待处理图像设置的背景色,例如响应背景色设置操作,获取用户通过背景色设置操作所设置的背景色,并将该设置的背景色作为待处理图像中的背景色。该方式能够最大程度地符合用户需求。
第二种方式是,对待处理图像进行目标识别处理,得到目标区域(又称前景区域),将待处理图像中区别于目标区域的区域作为背景区域,并将背景区域中出现频率最高的色彩作为背景色。例如,可以通过目标识别模型来进行目标识别处理,目标识别模型可以是基于机器学习(Machine Learning,ML)原理构建的机器学习模型,如一次识别(You Only Look Once,YOLO)模型或基于区域的卷积神经网络(Region-Convolutional Neural Networks,R-CNN)模型等,其中,机器学习是人工智能的核心,专门研究计算机怎样模拟或实现人类的学习行为,以获取新的知识或技能,重新组织已有的知识结构使之不断 改善自身的性能。本申请实施例对待识别的目标的类型不做限定,例如可以包括人物、猫及狗等。
在确定出背景区域之后,可以将像素点作为单位,确定背景区域中每个像素点对应的色彩,其中,色彩可以通过像素点在色彩空间的通道的通道值来表示,这里对色彩空间不做限定,例如可以是基色色彩空间或色亮分离色彩空间。通常来说,背景色在背景区域中占有较大的比例,因此,可以将背景区域中出现频率最高(或者出现次数最多)的色彩作为背景色。举例来说,背景区域共包括100个像素点,其中有60个像素点对应的色彩为色彩A,则色彩A在背景区域中的出现频率最高,即为60/100,因此将色彩A作为确定出的背景色。第二种方式通过自动确定出背景色,可以有效地减少用户操作,节省人工成本(特别是在待处理图像的数量较多的情况下),同时,在一定程度上也能够保证确定出的背景色的精度。
在步骤102中,根据待处理图像中的像素点与背景色之间的色度差异,确定像素点的融合透明度。
这里,针对待处理图像中的每个像素点,确定像素点的色度与背景色的色度之间的色度差异(也称色度距离),并根据该色度差异确定该像素点的融合透明度,例如可以直接将该色度差异作为该像素点的融合透明度,也可以对该色度差异进行进一步处理得到该像素点的融合透明度。
本申请实施例对确定色度差异的方式不做限定,例如可以是将像素点的色度减去背景色的色度得到色度差异;可以是将像素点的色度减去背景色的色度,再对得到的结果进行绝对值计算得到色度差异;还可以是将像素点的色度减去背景色的色度,再对得到的结果进行平方处理得到色度差异。
在本申请实施例中,色度包括色相以及饱和度中的至少一种,因此,在步骤102中,可以根据像素点的色相与背景色的色相之间的色相差异,确定该像素点的融合透明度;可以根据像素点的饱和度与背景色的饱和度之间的饱和度差异,确定该像素点的融合透明度;也可以同时计算色相差异及饱和度差异,并根据色相差异及饱和度差异确定像素点的融合透明度。
在一些实施例中,可以通过这样的方式实现上述的根据待处理图像中的像素点与背景色之间的色度差异,确定像素点的融合透明度:将待处理图像及背景色转换至同一色彩空间;其中,色彩空间包括多个色度通道;针对每个色度通道,确定待处理图像中像素点对应色度通道的通道值与背景色对应色度通道的通道值之间的差异,并将确定出的差异作为色度通道对应的色度差异;将与多个色度通道一一对应的多个色度差异进行差异融合处理,得到像素点的融合透明度。
为了保证得到的融合透明度的准确性,可以将待处理图像及背景色转换至同一色彩空间,这里的色彩空间可以是色亮分离色彩空间,即包括多个色度通道。值得说明的是,每个色度通道可以仅用于表示色彩的一种性质,如HSV色彩空间及HSL色彩空间中的H通道(用于表示色相)及S通道(用于表示饱和度);每个色度通道也可以同时表示色相和饱和度,如YUV色彩空间中的U通道和V通道,又如LAB色彩空间中的A通道和B通道。
对于待处理图像中的每个像素点来说,首先,针对每个色度通道,确定像素点对应色度通道的通道值(即在该色度通道中的色度)与背景色对应该色度通道的通道值之间的差异,并将确定出的差异作为该色度通道对应的色度差异。然后,将所有色度通道分别对应的色度差异进行差异融合处理,得到该像素点的融合透明度。其中,对差异融合处理的方式不做限定,例如可以是求和处理或加权求和处理等。上述方式在同一色彩空间下,综合多个色度通道确定融合透明度,能够提升得到的融合透明度的准确性和全面性。
在步骤103中,获取待处理图像对应的背景图像。
这里,背景图像区别于待处理图像。本申请实施例对背景图像的图像位数、内容以及尺寸等同样不做限定,可以根据实际应用场景来确定背景图像。
在步骤104中,根据待处理图像中像素点的融合透明度,将待处理图像及背景图像以像素点为单位进行图像融合处理,得到融合图像。
相较于根据容差范围进行抠像的方式,在本申请实施例中,根据待处理图像中每个像素点的融合透明度,将待处理图像及背景图像以像素点为单位进行图像融合处理,得到融合图像,由于图像融合处理的方式更为平滑,因此能够保留待处理图像中的目标的边缘细节(如人物发丝细节)。本申请实施例对图像融合处理的方式不做限定,例如可以是加权处理等。
其中,像素点的融合透明度越大,表示该像素点对应的色彩与背景色越不同,该像素点对应的色彩在融合图像中的保留程度越高,即待处理图像中像素点对应的色彩在融合图像中的保留程度与该像素点的融合透明度正相关。
在一些实施例中,可以通过这样的方式实现上述的根据待处理图像中像素点的融合透明度,将待处理图像及背景图像以像素点为单位进行图像融合处理,得到融合图像:将待处理图像及背景图像转换至同一色彩空间;其中,色彩空间包括多个通道;针对每个通道执行以下处理:确定待处理图像中的第一像素点对应通道的第一通道值、以及背景图像中的第二像素点对应通道的第二通道值;根据第一像素点的融合透明度,对第一通道值及第二通道值进行加权处理,得到融合图像中的第三像素点对应通道的第 三通道值;其中,第一像素点的像素位置、第二像素点的像素位置以及第三像素点的像素位置之间存在映射关系。
为了保证图像融合处理的准确性,可以将待处理图像及背景图像转换至同一个色彩空间,这里的色彩空间可以是基色色彩空间或色亮分离色彩空间,其中,色彩空间包括多个通道。
对于待处理图像中的每个像素点(为了便于理解,命名为第一像素点)来说,针对色彩空间中的每个通道,确定第一像素点对应通道的通道值(为了便于理解,命名为第一通道值,以下同理)、以及背景图像中的第二像素点对应该通道的第二通道值,并根据第一像素点的融合透明度对第一通道值及第二通道值进行加权处理,得到融合图像中的第三像素点对应该通道的第三通道值。其中,第一像素点在待处理图像中的像素位置、第二像素点在背景图像中的像素位置、以及第三像素点在融合图像中的像素位置存在映射关系,例如,可以将待处理图像以及背景图像缩放至同一尺寸,则存在映射关系可以是指像素位置相同。当然,在本申请实施例中,并非一定要将待处理图像以及背景图像缩放至同一尺寸,只要设定了第一像素点的像素位置、第二像素点的像素位置以及第三像素点的像素位置之间的映射关系,在待处理图像的尺寸与背景图像的尺寸不同的情况下,也能够进行图像融合处理。
另外,根据第一像素点的融合透明度对第一通道值及第二通道值进行加权处理可以是指:将第一像素点的融合透明度作为第一通道值的权重,将第一像素点的融合透明度对应的互补融合透明度作为第二通道值的权重,并对第一通道值和第二通道值进行加权求和处理。其中,第一像素点的融合透明度与对应的互补融合透明度之和为透明度范围中的最大透明度,透明度范围即为融合透明度的取值范围。通过上述方式,能够保证图像融合处理的准确性,保证得到的融合图像具有较高的质量和精度。
如图3A所示,本申请实施例通过确定融合透明度,并基于融合透明度进行图像融合处理,相较于根据容差范围进行抠像的方式,本申请实施例提供的图像处理方案更为平滑,能够更多地保留待处理图像中的边缘细节,提升图像处理的精细程度。
在一些实施例中,参见图3B,图3B是本申请实施例提供的基于人工智能的图像处理方法的流程示意图,基于图3A,在步骤102之后,还可以在步骤201中,根据待处理图像中像素点的融合透明度,将待处理图像及替换色以像素点为单位进行融合处理,得到前景图像。
在本申请实施例中,还可以根据背景色进行色彩优化。首先,可以根据待处理图像中像素点的融合透明度,将待处理图像及替换色以像素点为单位进行融合处理,得到前景图像。
例如,可以将待处理图像及替换色转换至同一色彩空间,这里的色彩空间可以是基色色彩空间或色亮分离色彩空间,其中,色彩空间包括多个通道。对于待处理图像中的每个像素点(为了便于理解,命名为第一像素点)来说,针对色彩空间中的每个通道,根据第一像素点的融合透明度,对第一像素点对应通道的通道值、以及替换色对应该通道的通道值进行加权处理,得到前景图像中的第四像素点对应该通道的通道值。其中,第一像素点在待处理图像中的像素位置与第四像素点在前景图像中的像素位置相同。
值得说明的是,替换色用于去除待处理图像中的背景色,替换色可以根据实际应用场景进行设定,如设定为灰色,即在RGB色彩空间中各个通道的通道值均为128。
在步骤202中,根据前景图像中的像素点与背景色之间的色度差异,确定像素点的背景色偏。
例如,针对前景图像中的每个像素点,确定像素点的色度与背景色的色度之间的色度差异,并根据该色度差异确定该像素点的背景色偏,例如可以直接将该色度差异作为该像素点的背景色偏,也可以对该色度差异进行进一步处理得到该像素点的背景色偏(如存在多个色度通道的情况下)。
值得说明的是,由于色偏基于色相差异即可有效体现,因此,可以确定像素点的色相与背景色的色相之间的色相差异,并根据色相差异确定该像素点的背景色偏,如此,可以在减小计算量的基础上保证色彩优化的精度。
在步骤203中,根据像素点的背景色偏对像素点的色度进行更新处理。
由于像素点的背景色偏反映了像素点的色度与背景色的色度之间的偏离程度(或称区别程度、差异程度),因此,可以根据像素点的背景色偏对像素点的色度进行更新处理,以避免前景图像中出现较为偏向背景色的色彩。
在一些实施例中,可以通过这样的方式来实现上述的根据像素点的背景色偏对像素点的色度进行更新处理:当像素点的背景色偏达到设定色偏程度时,保持像素点的色度不变;当像素点的背景色偏未达到设定色偏程度时,对背景色的色度进行偏离处理得到偏离色度,并将像素点的色度更新为偏离色度。
这里,当像素点的背景色偏达到设定色偏程度时,证明该像素点的色彩与背景色之间的区别较大,因此可以保持该像素点的色度不变;当像素点的背景色偏未达到设定色偏程度时,证明该像素点的色彩与背景色之间的区别较小,因此可以对背景色的色度进行偏离处理得到偏离色度,并将该像素点的色度更新为偏离色度。值得说明的是,对背景色的色度进行偏离处理并不代表更新背景色的色度,实际上,偏离处理的步骤仅是为了更新像素点的色度,至于背景色的色度则保持不变。
为了便于理解,进行举例说明。首先,针对前景图像中的每个像素点,可以确定像素点的色相与背景色的色相之间的色相差异,以作为该像素点的背景色偏,例如,可以将该像素点的色相减去背景色的色相,得到该像素点的背景色偏。为了便于计算,还可以对背景色偏进行更新处理,例如,当背景色偏>π(即180度)时,将背景色偏减去2π,以更新该背景色偏;当背景色偏<-π(即-180度)时,将背景色偏加上2π,以更新该背景色偏;当背景色偏处于色偏范围如[-π,π]内时,保持该背景色偏不变。
然后,可以根据设定的色彩偏转阈值T,确定像素点的背景色偏是否达到设定色偏程度,其中,T大于零且小于π,可以根据实际应用场景进行设定,如设定为
Figure PCTCN2022080824-appb-000001
例如,当像素点的背景色偏≤-T、或者像素点的背景色偏≥T时,确定该像素点的背景色偏达到设定色偏程度,因此保持该像素点的色相不变;当像素点的背景色偏<0且大于-T时,确定该像素点的背景色偏未达到设定色偏程度,根据T对背景色的色相进行偏离处理,如将背景色的色相减去T/2得到偏离色相,并将该像素点的色相更新为该偏离色相;当像素点的背景色偏>0且小于T时,确定该像素点的背景色偏未达到设定色偏程度,根据T对背景色的色相进行偏离处理,如将背景色的色相加上T/2得到偏离色相,并将该像素点的色相更新为该偏离色相。
值得说明的是,当像素点的背景色偏=0时,可以将背景色的色相减去T/2得到偏离色相,并将该像素点的色相更新为该偏离色相;也可以将背景色的色相加上T/2得到偏离色相,并将该像素点的色相更新为该偏离色相。
通过上述方式,能够提升对像素点的色度进行更新处理的效果,有效避免前景图像中出现较为偏向背景色的色彩,有利于提升后续融合图像的图像质量,从而提升图像处理效率。
在图3B中,图3A示出的步骤104可以更新为步骤204,在步骤204中,根据前景图像中像素点的融合透明度,将前景图像及背景图像以像素点为单位进行图像融合处理,得到融合图像。
这里,可以根据前景图像中每个像素点的融合透明度,将前景图像及背景图像以像素点为单位进行图像融合处理,得到融合图像。这里的图像融合处理的方式类似于步骤104。
如图3B所示,本申请实施例对待处理图像进行色彩优化得到前景图像,并将前景图像及背景图像进行图像融合处理,能够进一步提升图像处理的精度。
在一些实施例中,参见图3C,图3C是本申请实施例提供的基于人工智能的图像处理方法的流程示意图,基于图3A,在步骤102之后,还可以在步骤301中,确定待处理图像中的像素点与背景色之间的明亮度差异。
在本申请实施例中,可以针对待处理图像进行阴影优化(或称高光优化)。例如,可以将待处理图像及背景色转换至同一色彩空间,这里的色彩空间可以是色亮分离色彩空间,即包括明亮度通道。对于待处理图像中的每个像素点来说,确定像素点对应明亮度通道的通道值(即在明亮度通道中的明亮度)与背景色对应明亮度通道的通道值之间的差异,并将这里确定出的差异作为明亮度差异。
在步骤302中,根据阴影补偿参数对明亮度差异进行加权处理,得到像素点的阴影补偿强度。
这里,根据设定的阴影补偿参数对像素点的明亮度差异进行加权处理,得到该像素点的阴影补偿强度,其中,阴影补偿参数与阴影补偿强度之间成正相关,可以根据实际应用场景中的需求来设定阴影补偿参数。
在一些实施例中,步骤302之后,还包括:根据强度范围对像素点的阴影补偿强度进行约束处理。
由于阴影补偿强度是根据阴影补偿参数对明亮度差异进行加权处理得到的,故阴影补偿强度可能会超出强度范围,其中,强度范围是指阴影补偿强度的正常取值范围。因此,在本申请实施例中,可以根据强度范围对待处理图像中每个像素点的阴影补偿强度进行约束处理,以保证约束处理后的阴影补偿强度处于正常范围内。
在一些实施例中,强度范围包括最小强度和最大强度;可以通过这样的方式来实现上述的根据强度范围对像素点的阴影补偿强度进行约束处理:当阴影补偿强度小于最小强度时,将阴影补偿强度更新为最小强度;当阴影补偿强度位于强度范围内时,保持阴影补偿强度不变;当阴影补偿强度大于最大强度时,将阴影补偿强度更新为最大强度。
这里,强度范围可以是[最小强度,最大强度]的区间。当阴影补偿强度小于最小强度时,将阴影补偿强度更新为最小强度;当阴影补偿强度位于[最小强度,最大强度]的区间内时,保持阴影补偿强度不变;当阴影补偿强度大于最大强度时,将阴影补偿强度更新为最大强度。如此,可以有效地保证约束处理后的阴影补偿强度位于强度范围内。
在步骤303中,根据像素点的阴影补偿强度,对像素点的明亮度及融合透明度进行阴影补偿处理。
这里,针对待处理图像中的每个像素点,根据该像素点的阴影补偿强度,对该像素点的明亮度及融合透明度进行阴影补偿处理。其中,阴影补偿处理可以是增幅处理,且阴影补偿强度与增幅处理的幅度成正相关,如此,在最终得到的融合图像中,能够更加准确地模拟出待处理图像中的阴影,从而有利于提升后续融合图像的图像质量,从而提升图像处理效率。
在一些实施例中,可以通过这样的方式实现上述的根据像素点的阴影补偿强度,对像素点的明亮度及融合透明度进行阴影补偿处理:根据像素点的阴影补偿强度、明亮度以及融合透明度对像素点进行明亮度增幅处理,并根据明亮度范围对通过明亮度增幅处理得到的明亮度进行约束处理;根据像素点的阴影补偿强度及融合透明度对像素点进行融合透明度增幅处理,并根据透明度范围对通过融合透明度增幅处理得到的融合透明度进行约束处理。
对于像素点的明亮度来说,可以根据该像素点的阴影补偿强度、明亮度以及融合透明度对该像素点进行明亮度增幅处理,其中,该像素点的阴影补偿强度与明亮度增幅处理的增幅强度正相关。本申请实施例对明亮度增幅处理的方式不做限定,例如当明亮度范围(即明亮度的取值范围)为[0,1]时,通过明亮度增幅处理得到的明亮度可以表示为
Figure PCTCN2022080824-appb-000002
其中,Y f表示该像素点在明亮度增幅处理之前的明亮度,α表示该像素点的融合透明度(融合透明度增幅处理之前的融合透明度),Y c表示该像素点的阴影补偿强度,另外,e是为了避免数值溢出所设置的参数,例如可以设定为0.01。通过明亮度增幅处理得到的明亮度可能会超出明亮度范围,因此,还可以根据明亮度范围对通过明亮度增幅处理得到的明亮度进行约束处理,并将约束处理后得到的明亮度作为该像素点的新的明亮度,其中,对明亮度进行约束处理的过程与上文中对阴影补偿强度进行约束处理的过程类似。
对于像素点的融合透明度来说,可以根据该像素点的阴影补偿强度及融合透明度对该像素点进行融合透明度增幅处理,其中,该像素点的阴影补偿强度与融合透明度增幅处理的增幅强度正相关。本申请实施例对融合透明度增幅处理的方式不做限定,例如当透明度范围(即融合透明度的取值范围)为[0,1]时,通过融合透明度增幅处理得到的融合透明度可以表示为(1-α)·|Y c|+α,其中,α表示该像素点在融合透明度增幅处理之前的融合透明度,Y c表示该像素点的阴影补偿强度,|Y c|是指对Y c进行绝对值运算。通过融合透明度增幅处理得到的融合透明度可能会超出透明度范围,因此,还可以根据透明度范围对通过融合透明度增幅处理得到的融合透明度进行约束处理,并将约束处理后得到的融合透明度作为该像素点的新的融合透明度,其中,对融合透明度进行约束处理的过程与上文中对阴影补偿强度进行约束处理的过程类似。
通过上述方式,能够实现准确、有效的阴影补偿处理,使得在最终得到的融合图像中,能够进一步准确模拟出待处理图像中的阴影。
在一些实施例中,可以针对前景图像进行阴影优化,即步骤301中的待处理图像可以替换为前景图像。
在一些实施例中,可以针对融合图像进行阴影优化,即步骤301中的待处理图像可以替换为融合图像。由于针对融合图像无需再更新融合透明度,因此在该情况下,步骤303可以更新为:根据像素点的阴影补偿强度,对像素点的明亮度进行阴影补偿处理。
如图3C所示,本申请实施例根据明亮度差异确定出阴影补偿强度,并根据阴影补偿强度进行阴影补偿处理,能够实现有效的阴影优化,使得在最终得到的融合图像中,能够准确模拟出待处理图像中的阴影/高光,从而有利于提升后续融合图像的图像质量,从而提升图像处理效率。
在一些实施例中,参见图3D,图3D是本申请实施例提供的基于人工智能的图像处理方法的流程示意图,基于图3A,在步骤102之后,还可以在步骤401中,获取透明度范围;其中,透明度范围包括最小透明度及最大透明度。
这里,透明度范围即为融合透明度的取值范围,可以表示为[最小透明度,最大透明度]的区间。
在步骤402中,根据透明度范围对像素点的融合透明度进行拉伸处理,得到每个像素点的新融合透明度,其中,待处理图像中至少部分像素点的新融合透明度为最小透明度,剩余的至少部分像素点的新融合透明度为最大透明度。
这里,根据透明度范围对待处理图像中各像素点的融合透明度进行拉伸处理,以使拉伸处理后,待处理图像中各像素点的融合透明度的分布更加平滑、均匀,从而能够提升后续图像融合处理的效果。在拉伸处理的过程中,将待处理图像中至少部分像素点的融合透明度更新为最小透明度,并且在剩余的像素点中,将至少部分像素点的融合透明度更新为最大透明度。
在一些实施例中,可以通过这样的方式实现上述的根据透明度范围对像素点的融合透明度进行拉伸处理:当融合透明度小于第一透明度阈值时,将最小透明度确定为新融合透明度;当融合透明度大于或等于第一透明度阈值、且小于第二透明度阈值时,根据融合透明度、第一透明度阈值及第二透明度阈值确定中间透明度,并将中间透明度确定为新融合透明度;当融合透明度大于或等于第二透明度阈值时,将最大透明度确定为新融合透明度;其中,第一透明度阈值小于第二透明度阈值;第一透明度阈值、第二透明度阈值及中间透明度均位于透明度范围内。
在本申请实施例中,可以根据设定的第一透明度阈值及第二透明度阈值,对像素点的融合透明度进行拉伸处理,其中,第一透明度阈值及第二透明度阈值均位于透明度范围内,可以根据实际应用场景进行设定,例如当透明度范围为[0,1]时,第一透明度阈值可以设定为0.001,第二透明度阈值可以设定为 0.01。
对于待处理图像中的每个像素点来说,当像素点的融合透明度小于第一透明度阈值时,将该像素点的融合透明度更新为最小透明度;当像素点的融合透明度大于或等于第一透明度阈值、且小于第二透明度阈值时,根据该像素点的融合透明度、第一透明度阈值及第二透明度阈值确定中间透明度,并将该像素点的融合透明度更新为中间透明度;当像素点的融合透明度大于或等于第二透明度阈值时,将该像素点的融合透明度更新为最大透明度。其中,像素点对应的中间透明度同样位于透明度范围内,且与该像素点的更新前的融合透明度成正相关。本申请实施例对确定中间透明度的方式不做限定,例如中间透明度可以是
Figure PCTCN2022080824-appb-000003
其中,α表示像素点的更新前的融合透明度,T 1表示第一透明度阈值,T 2表示第二透明度阈值。本申请实施例提供了如上所示的拉伸处理方式,按照不同的区间分段进行处理能够提升拉伸处理的有效性。
如图3D所示,本申请实施例通过对待处理图像中各像素点的融合透明度进行拉伸处理,能够使得融合透明度的分布更加平滑、均匀,提升后续图像融合处理的效果,即提升了最终融合图像的质量,从而提升图像处理效率。
在一些实施例中,参见图3E,图3E是本申请实施例提供的基于人工智能的图像处理方法的流程示意图,基于图3A,在步骤102之前,还可以在步骤501中,根据色度范围进行枚举处理,得到多个色度。
在本申请实施例中,可以通过查表加速的方式提升图像处理的效率。例如,可以根据色度范围(即色度的取值范围)进行枚举处理,得到所有可能出现的色度。
在步骤502中,根据每个色度与背景色的色度之间的色度差异,确定每个色度对应的融合透明度。
对于枚举处理得到的每个色度,根据该色度与背景色的色度之间的色度差异,确定该色度对应的融合透明度。在一些实施例中,还可以根据透明度范围对色度对应的融合透明度进行拉伸处理。
在步骤503中,根据多个色度、以及与多个色度一一对应的多个融合透明度,建立融合透明度表。
这里,可以根据通过枚举处理得到的所有色度、以及每个色度分别对应的融合透明度,建立融合透明度表。在该融合透明度表中存储有色度与融合透明度之间的对应关系,即可以将色度作为融合透明度的索引。
值得说明的是,步骤501至步骤503可以是在获取待处理图像之前执行的,从而可以降低对实时图像处理过程(这里指针对获取到的待处理图像进行图像处理的过程)的不良影响。
在图3E中,图3A示出的步骤102可以更新为步骤504,在步骤504中,根据待处理图像中像素点的色度在融合透明度表中进行查询处理,并将查询到的融合透明度作为像素点的融合透明度。
在获取到待处理图像后,针对待处理图像中的每个像素点,可以根据像素点的色度在融合透明度表中进行查询处理,并将查询到的该色度对应的融合透明度作为该像素点的融合透明度,如此,通过查询机制能够大大提升确定像素点的融合透明度的效率。
在一些实施例中,除了建立融合透明度表之外,还可以建立其他的表格以便于查表加速。例如,针对色彩优化的过程,可以根据透明度范围和色度范围进行枚举处理,得到所有可能出现的融合透明度-色度组合。针对每一个融合透明度-色度组合,根据与步骤201至步骤203类似的方式对色度进行更新处理。然后,根据所有融合透明度-色度组合、以及每个融合透明度-色度组合对应的更新处理后的色度建立更新色度表,在该更新色度表中,融合透明度-色度组合可以作为更新处理后的色度的索引。
又例如,针对阴影优化的过程,可以根据透明度范围和明亮度范围进行枚举处理,得到所有可能出现的融合透明度-明亮度组合。针对每一个融合透明度-明亮度组合,根据与步骤301至步骤303类似的方式对融合透明度及明亮度进行阴影补偿处理。然后,根据所有融合透明度-明亮度组合、以及每个融合透明度-明亮度组合对应的阴影补偿处理后的融合透明度建立补偿融合透明度表,在该补偿融合透明度表中,融合透明度-明亮度组合可以作为阴影补偿处理后的融合透明度的索引;根据所有融合透明度-明亮度组合、以及每个融合透明度-明亮度组合对应的阴影补偿处理后的明亮度建立补偿明亮度表,在该补偿明亮度表中,融合透明度-明亮度组合可以作为阴影补偿处理后的明亮度的索引。通过上述方式,能够提升查表加速的全面性。
如图3E所示,本申请实施例通过查表加速的方式,能够大大提升图像处理的效率,同时减轻实时图像处理的计算负载,如此,便于将本申请实施例提供的图像处理方案部署于各种类型的电子设备(如手机)中。
下面,将说明本申请实施例在实际的应用场景中的示例性应用。本申请实施例可以应用于图像抠像相关的多种场景,以下进行示例说明。
1)在直播/明星陪看场景中,可以将待处理图像中的真实人物与特定的背景融合(叠加)在一起,从而提升图像观感。如图4所示,融合图像41包括待处理图像中原有的人物42,还包括背景图像中的游戏虚拟背景以及弹幕,其中,游戏虚拟背景以及弹幕均呈现于融合图像41中人物42所在的区域之外的 区域。
2)在虚拟制片中,可以将真实人物与虚拟场景进行混合,从而取得炫酷、灵活的画面特效,给综艺、直播及点播等带来良好的特效体验。如图5所示,待处理图像51包括人物511和幕布512,即人物511站在幕布512前,幕布512如绿色幕布或蓝色幕布等。通过本申请实施例提供的方案对待处理图像51进行图像处理后可以得到融合图像52,在该融合图像52中,幕布512被替换为了虚拟背景521,其中,图像处理过程中的背景色即为幕布512的色彩,虚拟背景521可以根据实际应用场景的需求进行定义。
3)本申请实施例提供的图像处理方案可以部署为在线服务或离线服务,从而应用于各类图像剪辑/视频剪辑中。
相较于相关技术提供的方案(如超级键算法),本申请实施例至少能够实现以下技术效果:1)能够保留待处理图像中的边缘细节,实现发丝级抠像,提升图像处理的精细程度;2)能够保留待处理图像中背景区域的阴影/高光,保证与其他特效滤镜(如虚拟背景)结合使用时,效果更加逼真;3)能够针对半透明物体(如玻璃杯)进行高画质抠像,保证融合图像中的半透明物体能够精准呈现;4)缓解前景偏向背景色(如使用绿色幕布时,最终得到的图像中的人物泛绿光)的情况,提升视觉效果。
作为证据,提供了如图6所示的对比示意图,通过本申请实施例提供的方案对待处理图像61进行图像处理后得到融合图像62,通过相关技术提供的超级键算法对待处理图像61进行处理后得到图像63,其中,融合图像62以及图像63中的虚拟背景相同。根据图6可以确定,针对人物的发丝,相较于图像63,融合图像62更加精细地保留了待处理图像61中的发丝细节;针对半透明物体,相较于图像63,融合图像62能够更加精准地呈现半透明物体,不会出现失真、模糊的问题;针对肤色,融合图像62能够更加还原待处理图像61中的肤色,而图像63中的肤色会出现泛红的问题;针对阴影,相较于图像63,融合图像62能够更加准确地模拟出待处理图像61中的阴影。此外,融合图像62中的人物不会出现绿边(以待处理图像61中的背景为绿色幕布,且图像处理过程中的背景色为绿色举例)。
接下来,从底层实现的角度说明本申请实施例提供的图像处理方案。本申请实施例可以包括两个步骤,步骤一是根据接收到的待抠像图像(对应上文的待处理图像)计算前景图像及透明通道图像,步骤二是将前景图像叠加到背景图像上,其中,根据实际需要,可以对步骤一进行查表加速,将在后文进行阐述。
本申请实施例提供了如图7所示的计算前景图像及透明通道图像的流程示意图,上述的步骤一可以通过步骤1至步骤7实现,将结合图7进行说明。
步骤1、设置抠像色C k(对应上文的背景色)。该抠像色可以由用户根据实际应用场景进行设定,例如抠像色可以与待抠像图像中幕布的色彩一致。举例来说,待抠像图像中的幕布为绿色幕布,则抠像色可以设定为相应的绿色。
步骤2、将待抠像图像I及抠像色C k转换至同一色彩空间,这里的色彩空间至少包括色度通道,例如色彩空间可以是YUV、LAB、HSL及HSV等,对此不做限定。为了便于说明,以这里的色彩空间为浮点型的YUV色彩空间为例,如此,在将待抠像图像I及抠像色C k转换至该YUV色彩空间时,将分别对应Y通道、U通道及V通道的通道值均归一化至[0,1]的范围内。
步骤3、基于色相和饱和度,计算透明通道图像α。步骤3可以通过步骤①和步骤②实现。
步骤①、由于YUV色彩空间的色度通道包括U通道和V通道,因此,基于U通道和V通道确定待抠像图像I中每个像素点的融合透明度。以待抠像图像I中的第i个像素点为例,可以通过下面的公式(1)确定第i个像素点的融合透明度:
α i=(U i-U k) 2+(V i-V k) 2         (1);
其中,α i表示第i个像素点的融合透明度,U i表示第i个像素点对应U通道的通道值,U k表示抠像色C k对应U通道的通道值,V i表示第i个像素点对应V通道的通道值,V k表示抠像色C k对应V通道的通道值。另外,(U i-U k) 2表示U通道对应的色度差异,(V i-V k) 2表示V通道对应的色度差异。
值得说明的是,本申请实施例对待抠像图像I中的像素点计数顺序不做限定,例如可以按照从上至下、从左至右的顺序进行计数,如第1个像素点可以是指位于待抠像图像I左上角的像素点,第2个像素点可以是指位于第1个像素点右边的相邻像素点。
步骤②、根据透明度范围(即[0,1]的范围)对每个像素点的融合透明度进行拉伸处理,以更新融合透明度。以第i个像素点的融合透明度α i为例,拉伸处理的函数描述参见公式(2):
Figure PCTCN2022080824-appb-000004
其中,T 1对应上文的第一透明度阈值;T 2对应上文的第二透明度阈值,T 1小于T 2,例如T 1的取值为0.001,T 2的取值为0.01;
Figure PCTCN2022080824-appb-000005
对应上文的中间透明度。
经过拉伸处理后,可以得到透明通道图像α,透明通道图像α中的每个融合透明度对应待抠像图像I中的一个像素点。
步骤4、对待抠像图像I进行复制处理,得到前景图像I f
步骤5、该步骤为可选的色彩优化步骤,可以通过步骤①和步骤②实现。
步骤①、去抠像色,即去除前景图像I f中的抠像色,以更新前景图像I f。其中,可以根据设定的替换色来去除前景图像I f中的抠像色,替换色可以根据实际应用场景进行设定,这里以灰色C gray为例进行说明,该C gray在RGB色彩空间中各个通道的通道值均为128。用函数S(I f)描述去抠像色的过程,参见以下公式(3):
S(I f)=(1-α)·C gray+α·I f          (3);
步骤②、去前景泛色,即去除前景图像I f的前景边缘中带有偏向抠像色的色偏。步骤②可以通过步骤a及步骤b实现。
步骤a、将前景图像I f和抠像色C k转换至同一色彩空间,为了便于说明,以色彩空间为HSV色彩空间或者HSL色彩空间的情况为例,当然,也可以应用其他的色彩空间,如YUV色彩空间。
针对前景图像I f中的每个像素点,确定该像素点对应色相通道(即H通道)的通道值H f。同时,确定抠像色C k对应H通道的通道值H k。然后,按照如下公式(4)计算H f与H k之间的误差(对应上文的背景色偏):
Figure PCTCN2022080824-appb-000006
其中,d f表示H f与H k之间的误差,180是指色相环(色相轮)中的180度,360是指360度。
步骤b、按照如下公式(5)所示的函数G(H f)更新H f的值:
Figure PCTCN2022080824-appb-000007
其中,“d f≤-T 3或d f≥T 3”的情况对应上文的背景色偏达到设定色偏程度的情况,因此,保持像素点的色相不变;“-T 3<d f≤0”的情况以及“0<d f<T 3”的情况对应上文的背景色偏未达到设定色偏程度的情况,因此,对像素点的色相进行更新。另外,T 3为色彩偏转阈值,T 3的值小于π,例如T 3可以设置为
Figure PCTCN2022080824-appb-000008
步骤6、该步骤为可选的优化阴影细节步骤,可以通过步骤①和步骤②实现。
步骤①、基于明亮度确定阴影补偿强度(又称阴影与高光补偿强度)。举例来说,可以将前景图像I f及抠像色C k转换到同一色彩空间,这里以色彩空间为YUV色彩空间的情况为例,当然这里也可以应用其他的色彩空间。针对前景图像I f中的每个像素点,确定该像素点对应明亮度通道(即Y通道)的通道值Y f。同时,确定抠像色C k对应Y通道的通道值Y k。然后,可以按照如下公式(6)计算该像素点的阴影补偿强度:
Figure PCTCN2022080824-appb-000009
其中,Y c表示像素点的阴影补偿强度,Y f-Y k对应上文的明亮度差异,[-1,1]对应上文的强度范围。m对应上文的阴影补偿参数,该数值越大,表示阴影补偿的强度越大,例如可以设定为1.0,其中,当m设定为0.0时,等价于不进行阴影补偿处理。
步骤②、根据像素点的阴影补偿强度,对像素点的明亮度及融合透明度进行阴影补偿处理,参见以下公式(7):
Figure PCTCN2022080824-appb-000010
其中,A(Y f)表示用于更新像素点的明亮度Y f的函数,B(α)表示用于更新像素点的融合透明度α的函数,clip(x)表示阶段函数,clip(x)中的x并无实际意义,仅用于指代。此外,e是为了避免数值溢出而设定的参数,例如可以设定为0.01。上述公式中,明亮度范围和透明度范围均为[0,1]。
步骤7、输出前景图像I f及透明通道图像α。
完成步骤一,即得到前景图像I f及透明通道图像α后,即可执行步骤二,即图像融合处理。举例来说,可以按照如下公式(8)来得到融合图像(又称合成结果图像):
I o=(1-α)·I b+α·I f           (8);
其中,I b表示背景图像,可以根据实际应用场景中的需求进行设定,I o表示融合图像。在按照上述公式进行图像融合处理时,可以以像素点为单位进行加权求和处理。值得说明的是,上文用于阴影优化的步骤6也可以在得到融合图像之后执行。
在本申请实施例中,还可以对上述的步骤一进行查表加速,以提升图像处理的效率。作为示例,本申请实施例提供了如图8所示的查表加速示意图,将以步骤形式,结合图8进行说明。
步骤1、设置抠像色C k
步骤2、建立二维表格t 1(U f,V f),用于查表获取融合透明度,二维表格t 1(U f,V f)对应上文的融合透明度表。其中,U f的定义与上述的U i相同,V f同理,U f及V f的取值范围均为整型的[0,P],其中,P为对2求图像位数次方后再减1得到的结果,图像位数是指待抠像图像I的位数,例如当待抠像图像I为8位图像时,P的值为2 8-1=255。
根据U f及V f的取值范围对U f及V f进行枚举处理,可以得到256×256=65536种组合,其中每种组合包括一个U f以及一个V f。针对枚举处理得到的每种组合,按照如下公式(9)和公式(10)确定出融合透明度并存储至二维表格t 1(U f,V f)中:
Figure PCTCN2022080824-appb-000011
Figure PCTCN2022080824-appb-000012
上述公式中的运算过程可以是浮点运算。
值得说明的是,针对枚举处理得到的每种组合,可以根据该组合中的U f及V f确定出该组合的序号,例如,可以将U f作为高位,将V f作为低位,拼接得到该组合的序号q。计算出序号为q的组合对应的融合透明度后,可以将该融合透明度存储至二维表格t 1(U f,V f)中的下标为q的位置上,以便于后续根据下标来查询相应的融合透明度,即表格的维度是指下标的维度,下标等同于上文中的索引。以下的建表过程同理。
步骤3、建立三维表格t u(α,U f,V f)用于查表获取前景图像I f中的像素点对应U通道的通道值,建立三维表格t v(α,U f,V f)用于查表获取前景图像I f中的像素点对应V通道的通道值,三维表格t u(α,U f,V f)以及t v(α,U f,V f)统一对应上文的更新色度表。对于枚举处理得到的每种组合(这里的组合包括α、U f及V f,其中α表示一个像素点的融合透明度),执行步骤①至⑤。
步骤①、更新U f及V f的值,使用的函数与上述的S(I f)类似,如下公式(11)所示:
Figure PCTCN2022080824-appb-000013
其中,I gray对应上文的C gray,例如可以设定为灰色,即在RGB色彩空间中各个通道的通道值均为128。S(x)中的x即为组合中的U f及V f所表示的像素点。
步骤②、将像素点x转换到HSV或HSL色彩空间,确定像素点x对应H通道的通道值H x。同时,将抠像色C k转换至HSV或HSL色彩空间,并确定抠像色C k对应H通道的通道值H k
步骤③、按照如下公式(12)确定H x与H k之间的误差d x
Figure PCTCN2022080824-appb-000014
步骤④、按照如下公式(13)更新H x的值:
Figure PCTCN2022080824-appb-000015
其中,T 3大于0且小于π。
步骤⑤、将像素点x转换到YUV色彩空间,并将像素点x对应U通道的通道值存储至三维表格t u(α,U f,V f)中,同时将像素点x对应V通道的通道值存储至三维表格t v(α,U f,V f)中。
步骤4、建立二维表格t y(α,Y f)用于查表获取前景图像I f中的像素点对应Y通道的通道值,建立二维表格t α(α,Y f)用于查表获取前景图像I f中的像素点的融合透明度,其中,二维表格t y(α,Y f)对应上文的补偿明亮度表,二维表格t α(α,Y f)对应上文的补偿融合透明度表。对于枚举处理得到的每种组合(这里的组合包括α及Y f,其中α表示一个像素点的融合透明度),执行步骤①至③。
步骤①、按照如下公式(14)确定阴影补偿强度:
Figure PCTCN2022080824-appb-000016
步骤②、对明亮度Y f及融合透明度α进行阴影补偿处理,以实现更新。参见以下公式(15):
Figure PCTCN2022080824-appb-000017
步骤③、将更新后的Y f存储至二维表格t y(α,Y f)中,同时将更新后的融合透明度α存储至二维表格t α(α,Y f)中。
步骤5、处理待抠像图像I,例如可以通过步骤①至④进行处理。
步骤①、将待抠像图像I转换至YUV色彩空间,得到前景图像I f
步骤②、针对前景图像I f中的每个像素点执行以下处理:根据像素点对应U通道的通道值以及对应V通道的通道值确定出下标,并根据下标在二维表格t 1(U f,V f)中进行查询处理,得到像素点的融合透明度α。
步骤③、针对前景图像I f中的每个像素点执行以下处理:根据像素点的融合透明度α、对应U通道的通道值、以及对应V通道的通道值确定出下标,根据该下标在三维表格t u(α,U f,V f)中进行查询处理,并将像素点对应U通道的通道值更新为在三维表格t u(α,U f,V f)中查询到的值;同时,根据该下标在三维表格t v(α,U f,V f)中进行查询处理,并将像素点对应V通道的通道值更新为在三维表格t v(α,U f,V f)中查询到的值。
步骤④、针对前景图像I f中的每个像素点执行以下处理:根据像素点的融合透明度α以及对应Y通道的通道值确定出下标,根据该下标在二维表格t y(α,Y f)中进行查询处理,并将像素点对应Y通道的通道值更新为在二维表格t y(α,Y f)中查询到的值;同时,根据该下标在二维表格t α(α,Y f)中进行查询处理,并将像素点的融合透明度α更新为在二维表格t α(α,Y f)中查询到的值。
步骤6、输出前景图像I f及透明通道图像。
在上述的查表加速方式,预先计算并建立相应的表格,在需要对待抠像图像进行处理时直接在表格中进行查询即可,无需频繁地转换色彩空间,能够有效提升图像处理的效率,同时降低实时计算负载。经实验论证,通过应用查表加速的方式,仅需中央处理器(Central Processing Unit,CPU)的一个核心,例如Intel E5 v4的一个核心即可进行实时图像处理,同时,对内存的占用也较低,仅在几十兆(MB)的级别。如此,本申请实施例提供的图像处理方案不光可以部署至服务器端和电脑端,还可以部署至移动端(如移动终端设备)。
下面继续说明本申请实施例提供的基于人工智能的图像处理装置455实施为软件模块的示例性结构,在一些实施例中,如图2所示,存储在存储器450的基于人工智能的图像处理装置455中的软件模块可以包括:背景色确定模块4551,配置为确定待处理图像中的背景色;透明度确定模块4552,配置为根据待处理图像中的像素点与背景色之间的色度差异,确定像素点的融合透明度;图像获取模块4553,配置为获取待处理图像对应的背景图像;图像融合模块4554,配置为根据待处理图像中像素点的融合透明度,将待处理图像及背景图像以像素点为单位进行图像融合处理,得到融合图像。
在一些实施例中,基于人工智能的图像处理装置455还包括色彩优化模块,配置为:根据待处理图像中像素点的融合透明度,将待处理图像及替换色以像素点为单位进行融合处理,得到前景图像;图像融合模块4554,还配置为根据前景图像中像素点的融合透明度,将前景图像及背景图像以像素点为单位进行图像融合处理。
在一些实施例中,色彩优化模块,还配置为:根据前景图像中的像素点与背景色之间的色度差异,确定像素点的背景色偏;当像素点的背景色偏达到设定色偏程度时,保持像素点的色度不变;当像素点的背景色偏未达到设定色偏程度时,对背景色的色度进行偏离处理得到偏离色度,并将像素点的色度更 新为偏离色度。
在一些实施例中,基于人工智能的图像处理装置455还包括阴影优化模块,配置为:确定待处理图像中的像素点与背景色之间的明亮度差异;根据阴影补偿参数对明亮度差异进行加权处理,得到像素点的阴影补偿强度;根据像素点的阴影补偿强度,对像素点的明亮度及融合透明度进行阴影补偿处理。
在一些实施例中,阴影优化模块,还配置为:根据强度范围对像素点的阴影补偿强度进行约束处理;根据像素点的阴影补偿强度、明亮度以及融合透明度对像素点进行明亮度增幅处理,并根据明亮度范围对通过明亮度增幅处理得到的明亮度进行约束处理;根据像素点的阴影补偿强度及融合透明度对像素点进行融合透明度增幅处理,并根据透明度范围对通过融合透明度增幅处理得到的融合透明度进行约束处理。
在一些实施例中,强度范围包括最小强度和最大强度;阴影优化模块,还配置为:当阴影补偿强度小于最小强度时,将阴影补偿强度更新为最小强度;当阴影补偿强度位于强度范围内时,保持阴影补偿强度不变;当阴影补偿强度大于最大强度时,将阴影补偿强度更新为最大强度。
在一些实施例中,基于人工智能的图像处理装置455还包括拉伸模块,配置为:获取透明度范围;其中,透明度范围包括最小透明度及最大透明度;根据所述透明度范围对所述像素点的融合透明度进行拉伸处理,得到每个所述像素点的新融合透明度,其中,所述待处理图像中至少部分像素点的新融合透明度为所述最小透明度,剩余的至少部分像素点的新融合透明度为所述最大透明度。
在一些实施例中,拉伸模块还配置为:当所述融合透明度小于第一透明度阈值时,将所述最小透明度确定为所述新融合透明度;当所述融合透明度大于或等于所述第一透明度阈值、且小于第二透明度阈值时,根据所述融合透明度、所述第一透明度阈值及所述第二透明度阈值确定中间透明度,并将所述中间透明度确定为所述新融合透明度;当所述融合透明度大于或等于所述第二透明度阈值时,将所述最大透明度确定为所述新融合透明度;其中,第一透明度阈值小于第二透明度阈值;第一透明度阈值、第二透明度阈值及中间透明度均位于透明度范围内。
在一些实施例中,透明度确定模块4552,还配置为:将待处理图像及背景色转换至同一色彩空间;其中,色彩空间包括多个色度通道;针对每个色度通道,确定待处理图像中像素点对应色度通道的通道值与背景色对应色度通道的通道值之间的差异,并将确定出的差异作为色度通道对应的色度差异;将与所述多个色度通道一一对应的多个色度差异进行差异融合处理,得到所述像素点的融合透明度。
在一些实施例中,图像融合模块4554,还配置为:将待处理图像及背景图像转换至同一色彩空间;其中,色彩空间包括多个通道;针对每个通道执行以下处理:确定待处理图像中的第一像素点对应通道的第一通道值、以及背景图像中的第二像素点对应通道的第二通道值;根据第一像素点的融合透明度,对第一通道值及第二通道值进行加权处理,得到融合图像中的第三像素点对应通道的第三通道值;其中,所述第一像素点的像素位置、所述第二像素点的像素位置以及所述第三像素点的像素位置之间存在映射关系。
在一些实施例中,基于人工智能的图像处理装置455还包括建表模块,配置为:根据色度范围进行枚举处理,得到多个色度;根据每个所述色度与所述背景色的色度之间的色度差异,确定每个所述色度对应的融合透明度;根据所述多个色度、以及与所述多个色度一一对应的多个融合透明度,建立融合透明度表;透明度确定模块4552,还配置为:根据待处理图像中像素点的色度在融合透明度表中进行查询处理,并将查询到的融合透明度作为像素点的融合透明度。
在一些实施例中,背景色确定模块4551,还配置为:执行以下任意一种处理:获取针对所述待处理图像设置的背景色作为所述待处理图像的背景色;对所述待处理图像进行目标识别处理,得到目标区域,并将所述待处理图像的背景区域中出现频率最高的色彩作为所述待处理图像的背景色;其中,所述背景区域是所述待处理图像中区别于所述目标区域的区域。
通过本申请实施例提供的基于人工智能的图像处理装置,至少能够实现以下技术效果:1)在图像处理过程中能够保留待处理图像中的边缘细节,实现发丝级抠像,提升图像处理的精细程度;2)能够保留待处理图像中背景区域的阴影/高光,保证与背景图像进行图像融合处理后,得到的融合图像中的阴影/高光效果更加逼真;3)能够针对半透明物体(如玻璃杯)进行高画质抠像,保证融合图像中的半透明物体能够精准呈现;4)能够有效避免融合图像中出现前景偏向背景色(如人物泛绿光)的情况,能够提升视觉效果。
本申请实施例提供了一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括计算机指令(即可执行指令),该计算机指令存储在计算机可读存储介质中。电子设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该电子设备执行本申请实施例上述的基于人工智能的图像处理方法。
本申请实施例提供一种存储有可执行指令的计算机可读存储介质,其中存储有可执行指令,当可执行指令被处理器执行时,将引起处理器执行本申请实施例提供的方法,例如,如图3A、图3B、图3C、 图3D及图3E示出的基于人工智能的图像处理方法。
在一些实施例中,计算机可读存储介质可以是FRAM、ROM、PROM、EPROM、EEPROM、闪存、磁表面存储器、光盘、或CD-ROM等存储器;也可以是包括上述存储器之一或任意组合的各种设备。
在一些实施例中,可执行指令可以采用程序、软件、软件模块、脚本或代码的形式,按任意形式的编程语言(包括编译或解释语言,或者声明性或过程性语言)来编写,并且其可按任意形式部署,包括被部署为独立的程序或者被部署为模块、组件、子例程或者适合在计算环境中使用的其它单元。
作为示例,可执行指令可以但不一定对应于文件系统中的文件,可以可被存储在保存其它程序或数据的文件的一部分,例如,存储在超文本标记语言(HTML,Hyper Text Markup Language)文档中的一个或多个脚本中,存储在专用于所讨论的程序的单个文件中,或者,存储在多个协同文件(例如,存储一个或多个模块、子程序或代码部分的文件)中。
作为示例,可执行指令可被部署为在一个电子设备上执行,或者在位于一个地点的多个电子设备上执行,又或者,在分布在多个地点且通过通信网络互连的多个电子设备上执行。
以上,仅为本申请的实施例而已,并非用于限定本申请的保护范围。凡在本申请的精神和范围之内所作的任何修改、等同替换和改进等,均包含在本申请的保护范围之内。

Claims (16)

  1. 一种基于人工智能的图像处理方法,所述方法由电子设备执行,所述方法包括:
    确定待处理图像中的背景色;
    根据所述待处理图像中的像素点与所述背景色之间的色度差异,确定所述像素点的融合透明度;
    获取所述待处理图像对应的背景图像;
    根据所述待处理图像中像素点的融合透明度,将所述待处理图像及所述背景图像以像素点为单位进行图像融合处理,得到融合图像。
  2. 根据权利要求1所述的方法,其中,所述根据所述待处理图像中的像素点与所述背景色之间的色度差异,确定所述像素点的融合透明度之后,所述方法还包括:
    根据所述待处理图像中像素点的融合透明度,将所述待处理图像及替换色以像素点为单位进行融合处理,得到前景图像;
    所述根据所述待处理图像中像素点的融合透明度,将所述待处理图像及所述背景图像以像素点为单位进行图像融合处理,包括:
    根据所述前景图像中像素点的融合透明度,将所述前景图像及所述背景图像以像素点为单位进行图像融合处理。
  3. 根据权利要求2所述的方法,其中,所述将所述待处理图像及替换色以像素点为单位进行融合处理,得到前景图像之后,所述方法还包括:
    根据所述前景图像中的像素点与所述背景色之间的色度差异,确定所述像素点的背景色偏;
    当所述像素点的背景色偏达到设定色偏程度时,保持所述像素点的色度不变;
    当所述像素点的背景色偏未达到所述设定色偏程度时,对所述背景色的色度进行偏离处理,得到偏离色度,并将所述像素点的色度更新为所述偏离色度。
  4. 根据权利要求1所述的方法,其中,所述根据所述待处理图像中的像素点与所述背景色之间的色度差异,确定所述像素点的融合透明度之后,所述方法还包括:
    确定所述待处理图像中的像素点与所述背景色之间的明亮度差异;
    根据阴影补偿参数对所述明亮度差异进行加权处理,得到所述像素点的阴影补偿强度;
    根据所述像素点的阴影补偿强度,对所述像素点的明亮度及融合透明度进行阴影补偿处理。
  5. 根据权利要求4所述的方法,其中,所述根据阴影补偿参数对所述明亮度差异进行加权处理,得到所述像素点的阴影补偿强度之后,所述方法还包括:
    根据强度范围对所述像素点的阴影补偿强度进行约束处理;
    所述根据所述像素点的阴影补偿强度,对所述像素点的明亮度及融合透明度进行阴影补偿处理,包括:
    根据所述像素点的阴影补偿强度、明亮度以及融合透明度对所述像素点进行明亮度增幅处理,并根据明亮度范围对通过所述明亮度增幅处理得到的明亮度进行约束处理;
    根据所述像素点的阴影补偿强度及融合透明度对所述像素点进行融合透明度增幅处理,并根据透明度范围对通过所述融合透明度增幅处理得到的融合透明度进行约束处理。
  6. 根据权利要求5所述的方法,其中,所述强度范围包括最小强度和最大强度;所述根据强度范围对所述像素点的阴影补偿强度进行约束处理,包括:
    当所述阴影补偿强度小于所述最小强度时,将所述阴影补偿强度更新为所述最小强度;
    当所述阴影补偿强度位于所述强度范围内时,保持所述阴影补偿强度不变;
    当所述阴影补偿强度大于所述最大强度时,将所述阴影补偿强度更新为所述最大强度。
  7. 根据权利要求1至6任一项所述的方法,其中,所述根据所述待处理图像中的像素点与所述背景色之间的色度差异,确定所述像素点的融合透明度之后,所述方法还包括:
    获取透明度范围;其中,所述透明度范围包括最小透明度及最大透明度;
    根据所述透明度范围对所述像素点的融合透明度进行拉伸处理,得到每个所述像素点的新融合透明度,其中,所述待处理图像中至少部分像素点的新融合透明度为所述最小透明度,剩余的至少部分像素点的新融合透明度为所述最大透明度。
  8. 根据权利要求7所述的方法,其中,所述根据所述透明度范围对所述像素点的融合透明度进行拉伸处理,包括:
    当所述融合透明度小于第一透明度阈值时,将所述最小透明度确定为所述新融合透明度;
    当所述融合透明度大于或等于所述第一透明度阈值、且小于第二透明度阈值时,根据所述融合透明度、所述第一透明度阈值及所述第二透明度阈值确定中间透明度,并将所述中间透明度确定为所述新融合透明度;
    当所述融合透明度大于或等于所述第二透明度阈值时,将所述最大透明度确定为所述新融合透明度;
    其中,所述第一透明度阈值小于所述第二透明度阈值;所述第一透明度阈值、所述第二透明度阈值及所述中间透明度均位于所述透明度范围内。
  9. 根据权利要求1至6任一项所述的方法,其中,所述根据所述待处理图像中的像素点与所述背景色之间的色度差异,确定所述像素点的融合透明度,包括:
    将所述待处理图像及所述背景色转换至同一色彩空间;其中,所述色彩空间包括多个色度通道;
    针对每个所述色度通道,确定所述待处理图像中像素点对应所述色度通道的通道值与所述背景色对应所述色度通道的通道值之间的差异,并将确定出的差异作为所述色度通道对应的色度差异;
    将与所述多个色度通道一一对应的多个色度差异进行差异融合处理,得到所述像素点的融合透明度。
  10. 根据权利要求1至6任一项所述的方法,其中,所述根据所述待处理图像中像素点的融合透明度,将所述待处理图像及所述背景图像以像素点为单位进行图像融合处理,得到融合图像,包括:
    将所述待处理图像及所述背景图像转换至同一色彩空间;其中,所述色彩空间包括多个通道;
    针对每个所述通道执行以下处理:
    确定所述待处理图像中的第一像素点对应所述通道的第一通道值、以及所述背景图像中的第二像素点对应所述通道的第二通道值;
    根据所述第一像素点的融合透明度,对所述第一通道值及所述第二通道值进行加权处理,得到融合图像中的第三像素点对应所述通道的第三通道值;
    其中,所述第一像素点的像素位置、所述第二像素点的像素位置以及所述第三像素点的像素位置之间存在映射关系。
  11. 根据权利要求1至6任一项所述的方法,其中,所述根据所述待处理图像中的像素点与所述背景色之间的色度差异,确定所述像素点的融合透明度之前,所述方法还包括:
    根据色度范围进行枚举处理,得到多个色度;
    根据每个所述色度与所述背景色的色度之间的色度差异,确定每个所述色度对应的融合透明度;
    根据所述多个色度、以及与所述多个色度一一对应的多个融合透明度,建立融合透明度表;
    所述根据所述待处理图像中的像素点与所述背景色之间的色度差异,确定所述像素点的融合透明度,包括:
    根据所述待处理图像中像素点的色度在所述融合透明度表中进行查询处理,并将查询到的融合透明度作为所述像素点的融合透明度。
  12. 根据权利要求1至6任一项所述的方法,其中,所述确定待处理图像中的背景色,包括:
    执行以下任意一种处理:
    获取针对所述待处理图像设置的背景色作为所述待处理图像的背景色;
    对所述待处理图像进行目标识别处理,得到目标区域,并将所述待处理图像的背景区域中出现频率最高的色彩作为所述待处理图像的背景色;
    其中,所述背景区域是所述待处理图像中区别于所述目标区域的区域。
  13. 一种基于人工智能的图像处理装置,所述装置包括:
    背景色确定模块,配置为确定待处理图像中的背景色;
    透明度确定模块,配置为根据所述待处理图像中的像素点与所述背景色之间的色度差异,确定所述像素点的融合透明度;
    图像获取模块,配置为获取所述待处理图像对应的背景图像;
    图像融合模块,配置为根据所述待处理图像中像素点的融合透明度,将所述待处理图像及所述背景图像以像素点为单位进行图像融合处理,得到融合图像。
  14. 一种电子设备,包括:
    存储器,用于存储可执行指令;
    处理器,用于执行所述存储器中存储的可执行指令时,实现权利要求1至12任一项所述的基于人工智能的图像处理方法。
  15. 一种计算机可读存储介质,存储有可执行指令,用于被处理器执行时,实现权利要求1至12任一项所述的基于人工智能的图像处理方法。
  16. 一种计算机程序产品,包括计算机程序或指令,所述计算机程序或指令被处理器执行时实现权利要求1至12任一所述的基于人工智能的图像处理方法。
PCT/CN2022/080824 2021-04-15 2022-03-15 基于人工智能的图像处理方法、装置、电子设备、计算机可读存储介质及计算机程序产品 WO2022218082A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP22787312.2A EP4261784A1 (en) 2021-04-15 2022-03-15 Image processing method and apparatus based on artificial intelligence, and electronic device, computer-readable storage medium and computer program product
US17/986,415 US20230074060A1 (en) 2021-04-15 2022-11-14 Artificial-intelligence-based image processing method and apparatus, electronic device, computer-readable storage medium, and computer program product

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110407801.X 2021-04-15
CN202110407801.XA CN113724175A (zh) 2021-04-15 2021-04-15 基于人工智能的图像处理方法、装置及电子设备

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/986,415 Continuation US20230074060A1 (en) 2021-04-15 2022-11-14 Artificial-intelligence-based image processing method and apparatus, electronic device, computer-readable storage medium, and computer program product

Publications (1)

Publication Number Publication Date
WO2022218082A1 true WO2022218082A1 (zh) 2022-10-20

Family

ID=78672618

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/080824 WO2022218082A1 (zh) 2021-04-15 2022-03-15 基于人工智能的图像处理方法、装置、电子设备、计算机可读存储介质及计算机程序产品

Country Status (4)

Country Link
US (1) US20230074060A1 (zh)
EP (1) EP4261784A1 (zh)
CN (1) CN113724175A (zh)
WO (1) WO2022218082A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113724175A (zh) * 2021-04-15 2021-11-30 腾讯科技(深圳)有限公司 基于人工智能的图像处理方法、装置及电子设备
CN115147770B (zh) * 2022-08-30 2022-12-02 山东千颐科技有限公司 基于图像处理的皮带异物视觉识别系统

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5355174A (en) * 1993-01-22 1994-10-11 Imagica Corp. Soft edge chroma-key generation based upon hexoctahedral color space
US20100277471A1 (en) * 2009-04-01 2010-11-04 Nicholas Beato Real-Time Chromakey Matting Using Image Statistics
CN103581571A (zh) * 2013-11-22 2014-02-12 北京中科大洋科技发展股份有限公司 一种基于色彩三要素的视频抠像方法
CN103618886A (zh) * 2013-12-13 2014-03-05 厦门美图网科技有限公司 一种根据主色调智能脱色的摄像方法
CN103679658A (zh) * 2013-12-13 2014-03-26 厦门美图网科技有限公司 一种根据主色调智能脱色的图像处理方法
CN112330531A (zh) * 2020-11-04 2021-02-05 广州博冠信息科技有限公司 图像处理方法、装置、电子设备及存储介质
CN113724175A (zh) * 2021-04-15 2021-11-30 腾讯科技(深圳)有限公司 基于人工智能的图像处理方法、装置及电子设备

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5355174A (en) * 1993-01-22 1994-10-11 Imagica Corp. Soft edge chroma-key generation based upon hexoctahedral color space
US20100277471A1 (en) * 2009-04-01 2010-11-04 Nicholas Beato Real-Time Chromakey Matting Using Image Statistics
CN103581571A (zh) * 2013-11-22 2014-02-12 北京中科大洋科技发展股份有限公司 一种基于色彩三要素的视频抠像方法
CN103618886A (zh) * 2013-12-13 2014-03-05 厦门美图网科技有限公司 一种根据主色调智能脱色的摄像方法
CN103679658A (zh) * 2013-12-13 2014-03-26 厦门美图网科技有限公司 一种根据主色调智能脱色的图像处理方法
CN112330531A (zh) * 2020-11-04 2021-02-05 广州博冠信息科技有限公司 图像处理方法、装置、电子设备及存储介质
CN113724175A (zh) * 2021-04-15 2021-11-30 腾讯科技(深圳)有限公司 基于人工智能的图像处理方法、装置及电子设备

Also Published As

Publication number Publication date
EP4261784A1 (en) 2023-10-18
US20230074060A1 (en) 2023-03-09
CN113724175A (zh) 2021-11-30

Similar Documents

Publication Publication Date Title
US11455516B2 (en) Image lighting methods and apparatuses, electronic devices, and storage media
WO2022218082A1 (zh) 基于人工智能的图像处理方法、装置、电子设备、计算机可读存储介质及计算机程序产品
CN105279746B (zh) 一种基于双边滤波的多曝光图像融合方法
WO2021147418A1 (zh) 一种图像去雾方法、装置、设备及计算机存储介质
CN113132696B (zh) 图像色调映射方法、装置、电子设备和存储介质
CN111489322B (zh) 给静态图片加天空滤镜的方法及装置
CA3001430A1 (en) Image processing method and device for led display screen
JP2021531571A (ja) 証明書画像抽出方法及び端末機器
US20200364839A1 (en) Image processing method and apparatus, electronic device and storage medium
CN109803172A (zh) 一种直播视频的处理方法、装置及电子设备
CN110149550B (zh) 一种图像数据处理方法、装置和存储介质
CN110177287A (zh) 一种图像处理和直播方法、装置、设备和存储介质
CN112686820A (zh) 虚拟美妆方法、装置和电子设备
CN108711160A (zh) 一种基于hsi增强性模型的目标分割方法
US9613294B2 (en) Control of computer vision pre-processing based on image matching using structural similarity
CN110321452A (zh) 一种基于方向选择机制的图像检索方法
CN113052923A (zh) 色调映射方法、装置、电子设备和存储介质
CN117372272A (zh) 一种基于注意力机制的多曝光的图像融合方法及系统
CN117061882A (zh) 视频图像处理方法、装置、设备、存储介质及程序产品
CN111738964A (zh) 一种基于建模的图像数据增强的方法
WO2023103813A1 (zh) 图像处理方法、装置、设备、存储介质及程序产品
CN112435173A (zh) 一种图像处理和直播方法、装置、设备和存储介质
WO2023273111A1 (zh) 一种图像处理方法、装置、计算机设备和存储介质
CN106887024B (zh) 照片的处理方法及处理系统
CN109360180A (zh) 一种获取多帧宽动态图像的方法及装置

Legal Events

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

Ref document number: 22787312

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2022787312

Country of ref document: EP

Effective date: 20230711

NENP Non-entry into the national phase

Ref country code: DE