CN111179282B - Image processing method, image processing device, storage medium and electronic device - Google Patents

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

Info

Publication number
CN111179282B
CN111179282B CN201911373483.9A CN201911373483A CN111179282B CN 111179282 B CN111179282 B CN 111179282B CN 201911373483 A CN201911373483 A CN 201911373483A CN 111179282 B CN111179282 B CN 111179282B
Authority
CN
China
Prior art keywords
image
sky
region
mask
target
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201911373483.9A
Other languages
Chinese (zh)
Other versions
CN111179282A (en
Inventor
颜海强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201911373483.9A priority Critical patent/CN111179282B/en
Publication of CN111179282A publication Critical patent/CN111179282A/en
Application granted granted Critical
Publication of CN111179282B publication Critical patent/CN111179282B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4038Image mosaicing, e.g. composing plane images from plane sub-images
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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 OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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 OR CALCULATING; 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]

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

本公开提供了一种图像处理方法、图像处理装置、存储介质与电子设备,涉及图像处理技术领域。该图像处理方法包括:基于分割模型识别所述第一图像中的天空区域,得到所述天空区域对应的掩膜图像;通过所述掩膜图像从所述第一图像中分割出前景区域图像,以及从第二图像中分割出背景区域图像;拼接所述前景区域图像和所述背景区域图像,得到目标图像。本公开实现了对图像的“换天”处理,能够自动分割出图像中的天空区域,无需用户手动抠图,使用方便。

The present disclosure provides an image processing method, an image processing device, a storage medium and an electronic device, and relates to the field of image processing technology. The image processing method comprises: identifying the sky area in the first image based on a segmentation model, and obtaining a mask image corresponding to the sky area; segmenting a foreground area image from the first image by the mask image, and segmenting a background area image from the second image; splicing the foreground area image and the background area image to obtain a target image. The present disclosure implements the "sky replacement" processing of the image, and can automatically segment the sky area in the image without the user manually cutting out the image, which is easy to use.

Description

图像处理方法、图像处理装置、存储介质与电子设备Image processing method, image processing device, storage medium and electronic device

技术领域Technical Field

本公开涉及图像处理技术领域,尤其涉及一种图像处理方法、图像处理装置、计算机可读存储介质与电子设备。The present disclosure relates to the field of image processing technology, and in particular to an image processing method, an image processing device, a computer-readable storage medium, and an electronic device.

背景技术Background technique

随着图像处理技术的发展,在一些图像处理、图像美化软件中,出现了更换图像背景的功能,例如可以将背景更换为纯色幕布、风景或其他特效等,以满足用户的多样化需求。With the development of image processing technology, the function of changing the image background has appeared in some image processing and image beautification software. For example, the background can be replaced with a solid color curtain, scenery or other special effects to meet the diverse needs of users.

相关技术中,在更换图像背景时,一般需要用户手动抠图,以分割出图像的前景部分,然后对剩余的背景部分进行替换。一些软件可以自动识别图像中的人像,对人像以外的部分进行背景更换,但是无法应用于非人像,且会把人像以外的前景部分误当作背景。因此,如果要对非人像的图像进行背景更换,例如在风景图像中更换天空背景,则相关技术需要用户手动抠取前景,使用较为不便。In the related art, when changing the background of an image, the user is generally required to manually cut out the foreground part of the image, and then replace the remaining background part. Some software can automatically identify the portrait in the image and replace the background of the part other than the portrait, but it cannot be applied to non-portraits and will mistake the foreground part other than the portrait as the background. Therefore, if you want to replace the background of a non-portrait image, such as replacing the sky background in a landscape image, the related art requires the user to manually cut out the foreground, which is inconvenient to use.

需要说明的是,在上述背景技术部分公开的信息仅用于加强对本公开的背景的理解,因此可以包括不构成对本领域普通技术人员已知的现有技术的信息。It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field.

发明内容Summary of the invention

本公开提供了一种图像处理方法、图像处理装置、计算机可读存储介质与电子设备,进而至少在一定程度上解决相关技术需要用户手动抠取前景的问题。The present disclosure provides an image processing method, an image processing device, a computer-readable storage medium and an electronic device, thereby at least to a certain extent solving the problem that the related art requires the user to manually extract the foreground.

本公开的其他特性和优点将通过下面的详细描述变得显然,或部分地通过本公开的实践而习得。Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.

根据本公开的第一方面,提供一种图像处理方法,包括:基于分割模型识别所述第一图像中的天空区域,得到所述天空区域对应的掩膜图像(Mask);通过所述掩膜图像从所述第一图像中分割出前景区域图像,以及从第二图像中分割出背景区域图像;拼接所述前景区域图像和所述背景区域图像,得到目标图像。According to a first aspect of the present disclosure, there is provided an image processing method, comprising: identifying a sky area in the first image based on a segmentation model to obtain a mask image (Mask) corresponding to the sky area; segmenting a foreground area image from the first image and a background area image from the second image through the mask image; and splicing the foreground area image and the background area image to obtain a target image.

根据本公开的第二方面,提供一种图像处理装置,包括:天空识别模块,用于识别所述第一图像中的天空区域,得到所述天空区域对应的掩膜图像;图像分割模块,用于通过所述掩膜图像从所述第一图像中分割出前景区域图像,以及从第二图像中分割出背景区域图像;图像拼接模块,用于拼接所述前景区域图像和所述背景区域图像,得到目标图像。According to a second aspect of the present disclosure, there is provided an image processing device, comprising: a sky recognition module, used to recognize a sky area in the first image, and obtain a mask image corresponding to the sky area; an image segmentation module, used to segment a foreground area image from the first image and a background area image from the second image through the mask image; and an image stitching module, used to stitch the foreground area image and the background area image to obtain a target image.

根据本公开的第三方面,提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述图像处理方法。According to a third aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the above-mentioned image processing method is implemented.

根据本公开的第四方面,提供一种电子设备,包括:处理器;以及存储器,用于存储所述处理器的可执行指令;其中,所述处理器配置为经由执行所述可执行指令来执行上述图像处理方法。According to a fourth aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the above-mentioned image processing method by executing the executable instructions.

本公开的技术方案具有以下有益效果:The technical solution disclosed in this disclosure has the following beneficial effects:

根据上述图像处理方法、图像处理装置、存储介质和电子设备,首先通过分割模型识别第一图像中的天空区域,以得到天空区域对应的掩膜图像;然后利用掩膜图像从第一图像中分割出前景区域图像,以及从第二图像中分割出背景区域图像;最后拼接前景区域图像和背景区域图像,得到目标图像。一方面,本方案基于分割模型对天空区域的识别,以及掩膜图像的处理,能够精准地从图像中分割出天空区域,无需用户手动抠图,智能化程度较高,使用方便,用户体验较好。另一方面,本方案实现了对图像的“换天”处理,将第一图像中的天空区域更换为第二图像中相应的部分,趣味性较高,能够满足用户的多样化需求。According to the above-mentioned image processing method, image processing device, storage medium and electronic device, the sky area in the first image is first identified by the segmentation model to obtain a mask image corresponding to the sky area; then the mask image is used to segment the foreground area image from the first image, and the background area image from the second image; finally, the foreground area image and the background area image are spliced to obtain the target image. On the one hand, this solution can accurately segment the sky area from the image based on the recognition of the sky area by the segmentation model and the processing of the mask image, without the need for the user to manually cut out the image, with a high degree of intelligence, easy to use and good user experience. On the other hand, this solution realizes the "sky replacement" processing of the image, replacing the sky area in the first image with the corresponding part in the second image, which is highly interesting and can meet the diverse needs of users.

应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本公开。It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施方式,并与说明书一起用于解释本公开的原理。显而易见地,下面描述中的附图仅仅是本公开的一些实施方式,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

图1示出本示例性实施方式的一种系统架构的示意图;FIG1 is a schematic diagram showing a system architecture of this exemplary embodiment;

图2示出本示例性实施方式的电子设备的示意图;FIG2 is a schematic diagram showing an electronic device according to the present exemplary embodiment;

图3示出本示例性实施方式的一种图像处理方法的流程图;FIG3 is a flowchart showing an image processing method according to the present exemplary embodiment;

图4示出本示例性实施方式的一种图像处理方法的子流程图;FIG4 shows a sub-flow chart of an image processing method according to this exemplary embodiment;

图5示出本示例性实施方式的另一种图像处理方法的子流程图;FIG5 shows a sub-flow chart of another image processing method according to this exemplary embodiment;

图6示出本示例性实施方式图像处理的示意性流程;FIG6 shows a schematic flow of image processing according to this exemplary embodiment;

图7示出本示例性实施方式的一种图像处理装置的结构框图;FIG7 is a block diagram showing a structure of an image processing device according to the exemplary embodiment;

图8示出本示例性实施方式的计算机可读存储介质的示意图。FIG. 8 is a schematic diagram showing a computer-readable storage medium according to the present exemplary embodiment.

具体实施方式Detailed ways

现在将参考附图更全面地描述示例实施方式。然而,示例实施方式能够以多种形式实施,且不应被理解为限于在此阐述的范例;相反,提供这些实施方式使得本公开将更加全面和完整,并将示例实施方式的构思全面地传达给本领域的技术人员。所描述的特征、结构或特性可以以任何合适的方式结合在一个或更多实施方式中。在下面的描述中,提供许多具体细节从而给出对本公开的实施方式的充分理解。然而,本领域技术人员将意识到,可以实践本公开的技术方案而省略所述特定细节中的一个或更多,或者可以采用其它的方法、组元、装置、步骤等。在其它情况下,不详细示出或描述公知技术方案以避免喧宾夺主而使得本公开的各方面变得模糊。Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.

此外,附图仅为本公开的示意性图解,并非一定是按比例绘制。图中相同的附图标记表示相同或类似的部分,因而将省略对它们的重复描述。附图中所示的一些方框图是功能实体,不一定必须与物理或逻辑上独立的实体相对应。可以采用软件形式来实现这些功能实体,或在一个或多个硬件模块或集成电路中实现这些功能实体,或在不同网络和/或处理器装置和/或微控制器装置中实现这些功能实体。In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and/or processor devices and/or microcontroller devices.

图1示出了本公开示例性实施方式的一种系统架构的示意图。如图1所示,该系统架构100可以包括:终端110、网络120和服务器130。终端110可以是具有图像拍摄功能的各种电子设备,包括但不限于手机、平板电脑、数码相机、个人电脑等。网络120用以在终端110和服务器130之间提供通信链路的介质,可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等。应该理解,图1中的终端、网络和服务器的数目仅仅是示意性的。根据实现需要,可以具有任意数目的终端、网络和服务器。比如服务器130可以是多个服务器组成的服务器集群等。FIG1 shows a schematic diagram of a system architecture of an exemplary embodiment of the present disclosure. As shown in FIG1 , the system architecture 100 may include: a terminal 110, a network 120, and a server 130. The terminal 110 may be various electronic devices with an image capture function, including but not limited to mobile phones, tablet computers, digital cameras, personal computers, etc. The network 120 is used to provide a medium for a communication link between the terminal 110 and the server 130, and may include various connection types, such as wired, wireless communication links or optical fiber cables, etc. It should be understood that the number of terminals, networks, and servers in FIG1 is merely schematic. Depending on the implementation requirements, there may be any number of terminals, networks, and servers. For example, the server 130 may be a server cluster consisting of multiple servers, etc.

本公开实施方式所提供的图像处理方法可以由终端110执行,例如在终端110拍摄图像后,对图像进行处理;也可以由服务器130执行,例如终端110拍摄图像后,上传到服务器130,使服务器130对图像进行处理。本公开对此不做限定。The image processing method provided in the embodiments of the present disclosure may be executed by the terminal 110, for example, after the terminal 110 captures the image, the image is processed; or may be executed by the server 130, for example, after the terminal 110 captures the image, the image is uploaded to the server 130, so that the server 130 processes the image. The present disclosure does not limit this.

本公开的示例性实施方式提供一种用于实现图像处理方法的电子设备,其可以是图1中的终端110或服务器130。该电子设备至少包括处理器和存储器,存储器用于存储处理器的可执行指令,处理器配置为经由执行可执行指令来执行图像处理方法。An exemplary embodiment of the present disclosure provides an electronic device for implementing an image processing method, which may be the terminal 110 or the server 130 in Figure 1. The electronic device includes at least a processor and a memory, the memory is used to store executable instructions of the processor, and the processor is configured to execute the image processing method by executing the executable instructions.

电子设备可以以各种形式来实施,例如可以包括手机、平板电脑、笔记本电脑、个人数字助理(Personal Digital Assistant,PDA)、导航装置、可穿戴设备、无人机等移动设备,以及台式电脑、智能电视等固定设备。下面以图2中的移动终端200为例,对电子设备的构造进行示例性说明。本领域技术人员应当理解,除了特别用于移动目的的部件之外,图2中的构造也能够应用于固定类型的设备。在另一些实施方式中,移动终端200可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件、软件或软件和硬件的组合实现。各部件间的接口连接关系只是示意性示出,并不构成对移动终端200的结构限定。在另一些实施方式中,移动终端200也可以采用与图2不同的接口连接方式,或多种接口连接方式的组合。Electronic devices can be implemented in various forms, for example, they can include mobile devices such as mobile phones, tablet computers, laptops, personal digital assistants (PDAs), navigation devices, wearable devices, drones, and fixed devices such as desktop computers and smart TVs. Below, the mobile terminal 200 in Figure 2 is taken as an example to illustrate the structure of the electronic device. It should be understood by those skilled in the art that, in addition to components specifically used for mobile purposes, the structure in Figure 2 can also be applied to fixed-type devices. In other embodiments, the mobile terminal 200 may include more or fewer components than shown, or combine certain components, or split certain components, or arrange different components. The illustrated components can be implemented in hardware, software, or a combination of software and hardware. The interface connection relationship between the components is only schematically shown and does not constitute a structural limitation on the mobile terminal 200. In other embodiments, the mobile terminal 200 may also adopt an interface connection method different from Figure 2, or a combination of multiple interface connection methods.

如图2所示,移动终端200具体可以包括:处理器210、内部存储器221、外部存储器接口222、通用串行总线(Universal Serial Bus,USB)接口230、充电管理模块240、电源管理模块241、电池242、天线1、天线2、移动通信模块250、无线通信模块260、音频模块270、扬声器271、受话器272、麦克风273、耳机接口274、传感器模块280、显示屏290、摄像模组291、指示器292、马达293、按键294以及用户标识模块(Subscriber Identification Module,SIM)卡接口295等。其中传感器模块280可以包括深度传感器2801、压力传感器2802、陀螺仪传感器2803、气压传感器2804等。As shown in FIG2 , the mobile terminal 200 may specifically include: a processor 210, an internal memory 221, an external memory interface 222, a Universal Serial Bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 250, a wireless communication module 260, an audio module 270, a speaker 271, a receiver 272, a microphone 273, an earphone interface 274, a sensor module 280, a display screen 290, a camera module 291, an indicator 292, a motor 293, a button 294, and a Subscriber Identification Module (SIM) card interface 295, etc. The sensor module 280 may include a depth sensor 2801, a pressure sensor 2802, a gyroscope sensor 2803, an air pressure sensor 2804, etc.

处理器210可以包括一个或多个处理单元,例如:处理器210可以包括应用处理器(Application Processor,AP)、调制解调处理器、图形处理器(Graphics ProcessingUnit,GPU)、图像信号处理器(Image Signal Processor,ISP)、控制器、视频编解码器、数字信号处理器(Digital Signal Processor,DSP)、基带处理器和/或神经网络处理器(Neural-Network Processing Unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 210 may include one or more processing units, for example, the processor 210 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor and/or a neural network processor (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

处理器210中还可以设置存储器,用于存储指令和数据。存储器可以存储用于实现六个模块化功能的指令:检测指令、连接指令、信息管理指令、分析指令、数据传输指令和通知指令,并由处理器210来控制执行。在一些实施方式中,处理器210中的存储器为高速缓冲存储器。该存储器可以保存处理器210刚用过或循环使用的指令或数据。如果处理器210需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器210的等待时间,因而提高了系统的效率。A memory may also be provided in the processor 210 for storing instructions and data. The memory may store instructions for implementing six modular functions: detection instructions, connection instructions, information management instructions, analysis instructions, data transmission instructions, and notification instructions, and the execution is controlled by the processor 210. In some embodiments, the memory in the processor 210 is a cache memory. The memory may store instructions or data that the processor 210 has just used or circulated. If the processor 210 needs to use the instruction or data again, it may be directly called from the memory. Repeated access is avoided, the waiting time of the processor 210 is reduced, and the efficiency of the system is improved.

在一些实施方式中,处理器210可以包括一个或多个接口。接口可以包括集成电路(Inter-Integrated Circuit,I2C)接口、集成电路内置音频(Inter-Integrated CircuitSound,I2S)接口、脉冲编码调制(Pulse Code Modulation,PCM)接口、通用异步收发传输器(Universal Asynchronous Receiver/Transmitter,UART)接口、移动产业处理器接口(Mobile Industry Processor Interface,MIPI)、通用输入输出(General-PurposeInput/Output,GPIO)接口、用户标识模块(Subscriber Identity Module,SIM)接口和/或通用串行总线(Universal Serial Bus,USB)接口等。通过不同的接口和移动终端200的其他部件形成连接。In some embodiments, the processor 210 may include one or more interfaces. The interface may include an Inter-Integrated Circuit (I2C) interface, an Inter-Integrated Circuit Sound (I2S) interface, a Pulse Code Modulation (PCM) interface, a Universal Asynchronous Receiver/Transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI), a General-Purpose Input/Output (GPIO) interface, a Subscriber Identity Module (SIM) interface, and/or a Universal Serial Bus (USB) interface, etc. Connections are formed with other components of the mobile terminal 200 through different interfaces.

USB接口230是符合USB标准规范的接口,具体可以是MiniUSB接口,MicroUSB接口,USBTypeC接口等。USB接口230可以用于连接充电器为移动终端200充电,也可以连接耳机,通过耳机播放音频,还可以用于移动终端200连接其他电子设备,例如连接电脑、外围设备等。The USB interface 230 is an interface that complies with the USB standard specification, and specifically can be a MiniUSB interface, a MicroUSB interface, a USB Type C interface, etc. The USB interface 230 can be used to connect a charger to charge the mobile terminal 200, can also be connected to headphones to play audio through the headphones, and can also be used to connect the mobile terminal 200 to other electronic devices, such as computers, peripheral devices, etc.

充电管理模块240用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施方式中,充电管理模块240可以通过USB接口230接收有线充电器的充电输入。在一些无线充电的实施方式中,充电管理模块240可以通过移动终端200的无线充电线圈接收无线充电输入。充电管理模块240为电池242充电的同时,还可以通过电源管理模块241为电子设备供电。The charging management module 240 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging implementations, the charging management module 240 may receive charging input from a wired charger through the USB interface 230. In some wireless charging implementations, the charging management module 240 may receive wireless charging input through a wireless charging coil of the mobile terminal 200. While the charging management module 240 is charging the battery 242, it may also power the electronic device through the power management module 241.

电源管理模块241用于连接电池242、充电管理模块240与处理器210。电源管理模块241接收电池242和/或充电管理模块240的输入,为处理器210、内部存储器221、显示屏290、摄像模组291和无线通信模块260等供电。电源管理模块241还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施方式中,电源管理模块241也可以设置于处理器210中。在另一些实施方式中,电源管理模块241和充电管理模块240也可以设置于同一个器件中。The power management module 241 is used to connect the battery 242, the charging management module 240 and the processor 210. The power management module 241 receives input from the battery 242 and/or the charging management module 240, and supplies power to the processor 210, the internal memory 221, the display screen 290, the camera module 291 and the wireless communication module 260. The power management module 241 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 241 can also be set in the processor 210. In other embodiments, the power management module 241 and the charging management module 240 can also be set in the same device.

移动终端200的无线通信功能可以通过天线1、天线2、移动通信模块250、无线通信模块260、调制解调处理器以及基带处理器等实现。The wireless communication function of the mobile terminal 200 can be implemented through the antenna 1, the antenna 2, the mobile communication module 250, the wireless communication module 260, the modem processor and the baseband processor.

天线1和天线2用于发射和接收电磁波信号。移动终端200中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施方式中,天线可以和调谐开关结合使用。Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the mobile terminal 200 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

移动通信模块250可以提供应用在移动终端200上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块250可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(Low Noise Amplifier,LNA)等。移动通信模块250可以由天线1接收电磁波,并对接收的电磁波进行滤波、放大等处理,传送至调制解调处理器进行解调。移动通信模块250还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施方式中,移动通信模块250的至少部分功能模块可以被设置于处理器210中。在一些实施方式中,移动通信模块250的至少部分功能模块可以与处理器210的至少部分模块被设置在同一个器件中。The mobile communication module 250 can provide solutions for wireless communications including 2G/3G/4G/5G applied to the mobile terminal 200. The mobile communication module 250 may include at least one filter, a switch, a power amplifier, a low noise amplifier (Low Noise Amplifier, LNA), etc. The mobile communication module 250 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 250 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 250 can be set in the processor 210. In some embodiments, at least some of the functional modules of the mobile communication module 250 can be set in the same device as at least some of the modules of the processor 210.

调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器271,受话器272等)输出声音信号,或通过显示屏290显示图像或视频。在一些实施方式中,调制解调处理器可以是独立的器件。在另一些实施方式中,调制解调处理器可以独立于处理器210,与移动通信模块250或其他功能模块设置在同一个器件中。The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 271, a receiver 272, etc.), or displays an image or video through a display screen 290. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 210 and be set in the same device as the mobile communication module 250 or other functional modules.

无线通信模块260可以提供应用在移动终端200上的包括无线局域网(WirelessLocal Area Networks,WLAN)(如无线保真(Wireless Fidelity,Wi-Fi)网络)、蓝牙(Bluetooth,BT)、全球导航卫星系统(Global Navigation Satellite System,GNSS)、调频(Frequency Modulation,FM)、近距离无线通信技术(Near Field Communication,NFC)、红外技术(Infrared,IR)等无线通信的解决方案。无线通信模块260可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块260经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器210。无线通信模块260还可以从处理器210接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。The wireless communication module 260 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the mobile terminal 200. The wireless communication module 260 can be one or more devices integrating at least one communication processing module. The wireless communication module 260 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and filters it, and sends the processed signal to the processor 210. The wireless communication module 260 can also receive the signal to be sent from the processor 210, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

在一些实施方式中,移动终端200的天线1和移动通信模块250耦合,天线2和无线通信模块260耦合,使得移动终端200可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(Global System for Mobilecommunications,GSM),通用分组无线服务(General Packet Radio Service,GPRS),码分多址接入(Code Division Multiple Access,CDMA),宽带码分多址(Wideband CodeDivision Multiple Access,WCDMA),时分码分多址(Time Division-Synchronous CodeDivision Multiple Access,TD-SCDMA),长期演进(Long Term Evolution,LTE),新空口(New Radio,NR),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(Global Positioning System,GPS),全球导航卫星系统(Global NavigationSatellite System,GLONASS),北斗卫星导航系统(Beidou Navigation SatelliteSystem,BDS),准天顶卫星系统(Quasi-Zenith Satellite System,QZSS)和/或星基增强系统(Satellite Based Augmentation Systems,SBAS)。In some embodiments, the antenna 1 of the mobile terminal 200 is coupled to the mobile communication module 250, and the antenna 2 is coupled to the wireless communication module 260, so that the mobile terminal 200 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include Global System for Mobilecommunications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time Division-Synchronous Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), New Radio (NR), BT, GNSS, WLAN, NFC, FM, and/or IR technology. The GNSS may include a Global Positioning System (GPS), a Global Navigation Satellite System (GLONASS), a Beidou Navigation Satellite System (BDS), a Quasi-Zenith Satellite System (QZSS) and/or a Satellite Based Augmentation System (SBAS).

移动终端200通过GPU、显示屏290及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏290和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器210可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The mobile terminal 200 implements the display function through a GPU, a display screen 290, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 290 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 210 may include one or more GPUs that execute program instructions to generate or change display information.

显示屏290用于显示图像,视频等。显示屏290包括显示面板。显示面板可以采用液晶显示屏(Liquid Crystal Display,LCD),有机发光二极管(Organic Light-EmittingDiode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(Active-MatrixOrganic Light Emitting Diode,AMOLED),柔性发光二极管(Flexlight-Emitting Diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(Quantum dot Light EmittingDiodes,QLED)等。在一些实施方式中,移动终端200可以包括1个或N个显示屏290,N为大于1的正整数。The display screen 290 is used to display images, videos, etc. The display screen 290 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the mobile terminal 200 may include 1 or N display screens 290, where N is a positive integer greater than 1.

移动终端200可以通过ISP、摄像模组291、视频编解码器、GPU、显示屏290及应用处理器等实现拍摄功能。The mobile terminal 200 can realize the shooting function through the ISP, the camera module 291, the video codec, the GPU, the display screen 290 and the application processor.

ISP用于处理摄像模组291反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施方式中,ISP可以设置在摄像模组291中。ISP is used to process the data fed back by the camera module 291. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in the camera module 291.

摄像模组291用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(Charge Coupled Device,CCD)或互补金属氧化物半导体(Complementary Metal-Oxide-Semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施方式中,移动终端200可以包括1个或N个摄像模组291,N为大于1的正整数,若移动终端200包括N个摄像头,N个摄像头中有一个是主摄像头。The camera module 291 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal oxide semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the mobile terminal 200 may include 1 or N camera modules 291, where N is a positive integer greater than 1. If the mobile terminal 200 includes N cameras, one of the N cameras is a main camera.

数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当移动终端200在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the mobile terminal 200 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

视频编解码器用于对数字视频压缩或解压缩。移动终端200可以支持一种或多种视频编解码器。这样,移动终端200可以播放或录制多种编码格式的视频,例如:动态图像专家组(Moving Picture Experts Group,MPEG)1,MPEG2,MPEG3,MPEG4等。Video codecs are used to compress or decompress digital videos. The mobile terminal 200 may support one or more video codecs. Thus, the mobile terminal 200 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

外部存储器接口222可以用于连接外部存储卡,例如Micro SD卡,实现扩展移动终端200的存储能力。外部存储卡通过外部存储器接口222与处理器210通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。The external memory interface 222 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the mobile terminal 200. The external memory card communicates with the processor 210 through the external memory interface 222 to implement a data storage function, such as storing music, video and other files in the external memory card.

内部存储器221可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。内部存储器221可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储移动终端200使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器221可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(Universal Flash Storage,UFS)等。处理器210通过运行存储在内部存储器221的指令和/或存储在设置于处理器中的存储器的指令,执行移动终端200的各种功能应用以及数据处理。The internal memory 221 can be used to store computer executable program codes, which include instructions. The internal memory 221 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the mobile terminal 200 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 221 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash memory (Universal Flash Storage, UFS), etc. The processor 210 executes various functional applications and data processing of the mobile terminal 200 by running instructions stored in the internal memory 221 and/or instructions stored in a memory provided in the processor.

移动终端200可以通过音频模块270、扬声器271、受话器272、麦克风273、耳机接口274及应用处理器等实现音频功能。例如音乐播放、录音等。The mobile terminal 200 can implement audio functions such as music playing and recording through the audio module 270 , the speaker 271 , the receiver 272 , the microphone 273 , the earphone interface 274 and the application processor.

音频模块270用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块270还可以用于对音频信号编码和解码。在一些实施方式中,音频模块270可以设置于处理器210中,或将音频模块270的部分功能模块设置于处理器210中。The audio module 270 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signal. The audio module 270 can also be used to encode and decode audio signals. In some embodiments, the audio module 270 can be arranged in the processor 210, or some functional modules of the audio module 270 can be arranged in the processor 210.

扬声器271,也称“喇叭”,用于将音频电信号转换为声音信号。移动终端200可以通过扬声器271收听音乐,或收听免提通话。The speaker 271 , also called a “speaker”, is used to convert an audio electrical signal into a sound signal. The mobile terminal 200 can listen to music or listen to a hands-free call through the speaker 271 .

受话器272,也称“听筒”,用于将音频电信号转换成声音信号。当移动终端200接听电话或语音信息时,可以通过将受话器272靠近人耳接听语音。The receiver 272, also called a "handset", is used to convert audio electrical signals into sound signals. When the mobile terminal 200 receives a call or voice message, the voice can be received by placing the receiver 272 close to the ear.

麦克风273,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风273发声,将声音信号输入到麦克风273。移动终端200可以设置至少一个麦克风273。在另一些实施方式中,移动终端200可以设置两个麦克风273,除了采集声音信号,还可以实现降噪功能。在另一些实施方式中,移动终端200还可以设置三个,四个或更多麦克风273,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。Microphone 273, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can make a sound by putting his mouth close to the microphone 273 to input the sound signal into the microphone 273. The mobile terminal 200 can be provided with at least one microphone 273. In other embodiments, the mobile terminal 200 can be provided with two microphones 273, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the mobile terminal 200 can also be provided with three, four or more microphones 273 to realize the collection of sound signals, noise reduction, identification of sound sources, and directional recording function, etc.

耳机接口274用于连接有线耳机。耳机接口274可以是USB接口230,也可以是3.5mm的开放移动电子设备平台(Open Mobile Terminal Platform,OMTP)标准接口,美国蜂窝电信工业协会(Cellular Telecommunications Industry Association of the USA,CTIA)标准接口。The earphone interface 274 is used to connect a wired earphone and can be a USB interface 230 or a 3.5 mm Open Mobile Terminal Platform (OMTP) standard interface or a Cellular Telecommunications Industry Association of the USA (CTIA) standard interface.

深度传感器2801用于获取景物的深度信息。在一些实施方式中,深度传感器可以设置于摄像模组291。The depth sensor 2801 is used to obtain the depth information of the scene. In some embodiments, the depth sensor can be arranged in the camera module 291.

压力传感器2802用于感受压力信号,可以将压力信号转换成电信号。在一些实施方式中,压力传感器2802可以设置于显示屏290。压力传感器2802的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。The pressure sensor 2802 is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 2802 can be disposed on the display screen 290. There are many types of pressure sensors 2802, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc.

陀螺仪传感器2803可以用于确定移动终端200的运动姿态。在一些实施方式中,可以通过陀螺仪传感器2803确定移动终端200围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器2803可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器2803检测移动终端200抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消移动终端200的抖动,实现防抖。陀螺仪传感器2803还可以用于导航,体感游戏场景。The gyro sensor 2803 can be used to determine the motion posture of the mobile terminal 200. In some embodiments, the angular velocity of the mobile terminal 200 around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 2803. The gyro sensor 2803 can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 2803 detects the angle of the shaking of the mobile terminal 200, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the mobile terminal 200 through reverse movement to achieve anti-shake. The gyro sensor 2803 can also be used for navigation and somatosensory game scenes.

气压传感器2804用于测量气压。在一些实施方式中,移动终端200通过气压传感器2804测得的气压值计算海拔高度,辅助定位和导航。The air pressure sensor 2804 is used to measure air pressure. In some implementations, the mobile terminal 200 calculates the altitude through the air pressure value measured by the air pressure sensor 2804 to assist positioning and navigation.

此外,根据实际需要,还可以在传感器模块280中设置其他功能的传感器,例如磁传感器、加速度传感器、距离传感器、接近光传感器、指纹传感器、温度传感器、触摸传感器、环境光传感器、骨传导传感器等等。In addition, according to actual needs, sensors with other functions can also be set in the sensor module 280, such as magnetic sensors, acceleration sensors, distance sensors, proximity light sensors, fingerprint sensors, temperature sensors, touch sensors, ambient light sensors, bone conduction sensors, etc.

按键294包括开机键,音量键等。按键294可以是机械按键。也可以是触摸式按键。移动终端200可以接收按键输入,产生与移动终端200的用户设置以及功能控制有关的键信号输入。The key 294 includes a power key, a volume key, etc. The key 294 can be a mechanical key or a touch key. The mobile terminal 200 can receive key input and generate key signal input related to user settings and function control of the mobile terminal 200.

马达293可以产生振动提示,例如来电、闹钟、接收信息等的振动提示,也可以用于触摸振动反馈,例如作用于不同应用(如拍照、游戏、音频播放等)的触摸操作,或者作用于显示屏290不同区域的触摸操作,可以对应不同的振动反馈效果。触摸振动反馈效果可以支持自定义。The motor 293 can generate vibration prompts, such as vibration prompts for incoming calls, alarms, and received messages, and can also be used for touch vibration feedback, such as touch operations on different applications (such as taking pictures, games, audio playback, etc.), or touch operations on different areas of the display screen 290, which can correspond to different vibration feedback effects. The touch vibration feedback effect can support customization.

指示器292可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。Indicator 292 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.

SIM卡接口295用于连接SIM卡。SIM卡可以通过插入SIM卡接口295,或从SIM卡接口295拔出,实现和移动终端200的接触和分离。移动终端200可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口295可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口295可以同时插入多张卡。多张卡的类型可以相同,也可以不同。SIM卡接口295也可以兼容不同类型的SIM卡。SIM卡接口295也可以兼容外部存储卡。移动终端200通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施方式中,移动终端200采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在移动终端200中,不能和移动终端200分离。The SIM card interface 295 is used to connect a SIM card. The SIM card can be connected to and separated from the mobile terminal 200 by inserting it into the SIM card interface 295 or pulling it out from the SIM card interface 295. The mobile terminal 200 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 295 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 295 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 295 can also be compatible with different types of SIM cards. The SIM card interface 295 can also be compatible with external memory cards. The mobile terminal 200 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the mobile terminal 200 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the mobile terminal 200 and cannot be separated from the mobile terminal 200.

下面对本公开示例性实施方式的图像处理方法和图像处理装置进行具体说明。The image processing method and the image processing apparatus according to the exemplary embodiments of the present disclosure will be described in detail below.

图3示出了本示例性实施方式中一种图像处理方法的流程,包括以下步骤S310至S330:FIG3 shows a flow chart of an image processing method in this exemplary embodiment, including the following steps S310 to S330:

步骤S310,基于分割模型识别第一图像中的天空区域,得到天空区域对应的掩膜图像。Step S310: identifying a sky area in the first image based on the segmentation model, and obtaining a mask image corresponding to the sky area.

其中,第一图像为包含天空的待处理图像,可以是用户拍照时摄像头采集的原始图像。分割模型为预先训练的机器学习模型,可用于对图像进行特征处理,识别图像中的天空区域,例如可以采用YOLO(You Look Only Once,一种实时目标检测的算法框架,包括v1、v2、v3等多个版本,本公开可以采用其中任一个版本)、SSD(Single Shot MultiboxDetector,单步多框目标检测)、R-CNN(Region-Convolutional Neural Network,区域卷积神经网络,或Fast R-CNN、Faster R-CNN等改进版本)等目标检测的神经网络,检测第一图像中的天空区域。在得到第一图像中天空区域所在的位置后,可以将天空区域内的像素设为1(白色),天空区域外的像素设为0(黑色),由此得到天空区域对应的掩膜图像。Among them, the first image is an image to be processed containing the sky, which can be the original image captured by the camera when the user takes a photo. The segmentation model is a pre-trained machine learning model, which can be used to perform feature processing on the image and identify the sky area in the image. For example, YOLO (You Look Only Once, a real-time target detection algorithm framework, including multiple versions such as v1, v2, v3, etc., any one of which can be used in the present disclosure), SSD (Single Shot Multibox Detector, single-step multi-box target detection), R-CNN (Region-Convolutional Neural Network, regional convolutional neural network, or Fast R-CNN, Faster R-CNN and other improved versions) and other target detection neural networks can be used to detect the sky area in the first image. After obtaining the position of the sky area in the first image, the pixels in the sky area can be set to 1 (white), and the pixels outside the sky area can be set to 0 (black), thereby obtaining a mask image corresponding to the sky area.

在一种可选的实施方式中,参考图4所示,步骤S310可以包括以下步骤S401至S403:In an optional implementation, referring to FIG. 4 , step S310 may include the following steps S401 to S403:

步骤S401,将第一图像的像素值进行归一化处理,得到归一化图像;Step S401, normalizing the pixel values of the first image to obtain a normalized image;

步骤S402,基于预先训练的全卷积神经网络对归一化图像进行处理,得到归一化图像对于天空的响应谱;Step S402, processing the normalized image based on a pre-trained fully convolutional neural network to obtain a response spectrum of the normalized image to the sky;

步骤S403,对响应谱进行二值化处理,得到第一图像中天空区域对应的掩膜图像。Step S403: binarize the response spectrum to obtain a mask image corresponding to the sky area in the first image.

其中,全卷积神经网络(Fully Convolutional Networks,FCN)是以语义分割为基础的图像处理网络,可以通过对图像进行卷积与下采样,提取图像中的局部特征,再通过反卷积和上采样,以恢复到原图像大小,以实现像素级的分类。全卷积神经网络包括多种升级版本,例如Unet(一种分割模型)等。下面以Unet为例,对网络的训练过程进行具体说明:Among them, the Fully Convolutional Network (FCN) is an image processing network based on semantic segmentation. It can extract local features in the image by convolution and downsampling the image, and then restore it to the original image size through deconvolution and upsampling to achieve pixel-level classification. The Fully Convolutional Neural Network includes a variety of upgraded versions, such as Unet (a segmentation model). The following takes Unet as an example to explain the network training process in detail:

根据实际需求,设置单通道输入或三通道输入的Unet,单通道用于输入灰度图像,三通道用于输入RGB彩色图像。以三通道为例,获取样本图像,可以通过图像处理软件进行手动抠图,以标注出样本图像中的天空区域,作为样本图像对应的标签。将样本图像的RGB像素值分别处以255,以进行归一化处理,然后分别输入Unet的三通道,通过计算输出数据与标签的误差,调整Unet的参数,以进行训练。当Unet在测试集中的准确率达到一定标准时,训练完成,获得可用的Unet。According to actual needs, set up Unet with single-channel input or three-channel input. The single channel is used to input grayscale images, and the three channels are used to input RGB color images. Taking the three-channel as an example, obtain a sample image, and manually cut out the image through image processing software to mark the sky area in the sample image as the label corresponding to the sample image. The RGB pixel values of the sample image are respectively set to 255 for normalization, and then input into the three channels of Unet respectively. By calculating the error between the output data and the label, the parameters of Unet are adjusted for training. When the accuracy of Unet in the test set reaches a certain standard, the training is completed and a usable Unet is obtained.

在实际应用中,可以按照全卷积神经网络输入通道的需求,将第一图像的像素值进行归一化处理,得到归一化图像;然后输入全卷积神经网络,输出归一化图像对于天空的响应谱。在响应谱中,每个像素位置的数值表示该像素属于天空区域的概率。进而对响应谱进行二值化处理,通过人为设定或者自适应计算阈值,利用阈值对每个像素点进行0/1分类,从而可以得到第一图像中天空区域对应的二值化图像,即掩膜图像。In practical applications, the pixel values of the first image can be normalized according to the requirements of the input channel of the full convolutional neural network to obtain a normalized image; then the full convolutional neural network is input to output the response spectrum of the normalized image to the sky. In the response spectrum, the value of each pixel position represents the probability that the pixel belongs to the sky area. Then the response spectrum is binarized, and the threshold is manually set or adaptively calculated, and each pixel point is classified as 0/1 using the threshold, so that the binary image corresponding to the sky area in the first image, that is, the mask image, can be obtained.

步骤S320,通过掩膜图像从第一图像中分割出前景区域图像,以及从第二图像中分割出背景区域图像。Step S320: segmenting a foreground area image from the first image and segmenting a background area image from the second image using the mask image.

其中,第二图像为替换第一图像中天空背景所需的图像,可以是预先配置的模板图像,以天空素材为主要图像内容。例如,可以从网络上下载一些包含天空的模板图像,当用户需要更换图像背景时,显示模板图像的选择界面,使用户从中选择一张作为第二图像。The second image is an image required to replace the sky background in the first image, and may be a pre-configured template image with sky material as the main image content. For example, some template images containing the sky may be downloaded from the Internet, and when the user needs to change the image background, a template image selection interface is displayed, allowing the user to select one of them as the second image.

在得到上述掩膜图像后,利用该掩膜图像可以从第一图像中提取天空区域以外的部分,得到前景区域图像;相反的,从第二图像中提取天空区域对应的部分,得到背景区域图像。After obtaining the above-mentioned mask image, the mask image can be used to extract the part outside the sky area from the first image to obtain the foreground area image; conversely, the part corresponding to the sky area is extracted from the second image to obtain the background area image.

在一种可选的实施方式中,步骤S320可以包括:In an optional implementation, step S320 may include:

将掩膜图像的反掩膜图像与第一图像相乘,以从第一图像中分割出前景区域图像;multiplying the inverse mask image of the mask image and the first image to segment a foreground area image from the first image;

将掩膜图像与第二图像相乘,以从第二图像中分割出背景区域图像。The mask image is multiplied by the second image to segment the background region image from the second image.

记第一图像为IMG1,第二图像为IMG2,掩膜图像为Mask,反掩膜图像为Max-Mask,Max为最大像素值,一般为1或255。如以下公式(1)和(2)所示:The first image is IMG1, the second image is IMG2, the mask image is Mask, the inverse mask image is Max-Mask, and Max is the maximum pixel value, which is generally 1 or 255. As shown in the following formulas (1) and (2):

IMGF=IMG1×(Max-Mask)/Max; (1)IMG F =IMG1×(Max-Mask)/Max; (1)

IMGB=IMG2×Mask/Max; (2)IMG B =IMG2×Mask/Max; (2)

其中,IMGF为前景区域图像,IMGB为背景区域图像。在掩膜图像中,天空区域的部分为白色,天空以外的部分为黑色;在反掩膜图像中,天空区域的部分为黑色,天空以外的部分为白色,可以通过对掩膜图像反相处理,得到反掩膜图像。将反掩膜图像与第一图像相乘,相当于保留了天空以外的部分图像,即前景区域图像;将掩膜图像与第二图像相乘,相当于保留了天空区域对应的部分图像,即背景区域图像Among them, IMG F is the foreground area image, and IMG B is the background area image. In the mask image, the sky area is white, and the part outside the sky is black; in the inverse mask image, the sky area is black, and the part outside the sky is white. The inverse mask image can be obtained by inverting the mask image. Multiplying the inverse mask image with the first image is equivalent to retaining the part of the image outside the sky, that is, the foreground area image; multiplying the mask image with the second image is equivalent to retaining the part of the image corresponding to the sky area, that is, the background area image

步骤S330,拼接前景区域图像和背景区域图像,得到目标图像。Step S330, stitching the foreground area image and the background area image to obtain a target image.

其中,目标图像相对于第一图像而言,其天空部分为第二图像中相应的部分图像,因而实现了“换天”的处理效果。Among them, the sky part of the target image relative to the first image is the corresponding partial image in the second image, thereby achieving a "sky replacement" processing effect.

在一种可选的实施方式中,可以将前景区域图像和背景区域图像相加,得到目标图像。如以下公式(3)所示:In an optional implementation, the foreground area image and the background area image may be added together to obtain the target image, as shown in the following formula (3):

IMGT=IMGF+IMGB; (3)IMG T =IMG F +IMG B ; (3)

其中IMGT为目标图像。由于黑色部分本身的像素值为0,在相加后,前景区域图像和背景区域图像刚好形成了互补,得到完整的目标图像。Where IMG T is the target image. Since the pixel value of the black part itself is 0, after addition, the foreground area image and the background area image just complement each other to obtain a complete target image.

在一种可选的实施方式中,在得到目标图像后,还可以对目标图像进行边缘平滑处理。其目的是在前景区域和背景区域拼接的边缘部分形成颜色过度的效果,缓解分割锯齿带来的影响,减小视觉上的突变感。一般的,在拼接前景区域图像和背景区域图像,可以确定边缘部分的位置坐标;进而在目标图像中,将边缘部分进行一定的扩展,例如可以以边缘部分的每个像素点为圆心,通过预设的半径(和目标图像大小相关,如可以是5个像素)对每个像素点进行圆形扩展,形成边缘待平滑区域;然后可以采用任意的平滑方式进行处理,例如可以采用高斯平滑:基于目标图像二维的正态分布,选取边缘待平滑区域的中心点,以构建基于正态分布的平滑算法公式;计算出3x3、5x5或更高阶的权重矩阵,与目标图像进行卷积;根据需要设置迭代次数,即卷积次数,最后得到有边缘过度的目标图像。In an optional embodiment, after obtaining the target image, the target image can also be subjected to edge smoothing. The purpose is to form a color transition effect at the edge portion where the foreground area and the background area are spliced, alleviate the impact of segmentation jaggedness, and reduce the visual sense of mutation. Generally, when splicing the foreground area image and the background area image, the position coordinates of the edge portion can be determined; then in the target image, the edge portion is expanded to a certain extent, for example, each pixel point of the edge portion can be used as the center of the circle, and each pixel point can be circularly expanded by a preset radius (related to the size of the target image, such as 5 pixels) to form an edge area to be smoothed; then any smoothing method can be used for processing, for example, Gaussian smoothing can be used: based on the two-dimensional normal distribution of the target image, the center point of the edge area to be smoothed is selected to construct a smoothing algorithm formula based on the normal distribution; a 3x3, 5x5 or higher-order weight matrix is calculated and convolved with the target image; the number of iterations, that is, the number of convolutions, is set as needed, and finally a target image with edge transition is obtained.

由于第一图像和第二图像的色调可能差别较大,在拼接前景区域图像和背景区域图像后,所得到的目标图像中,可能存在两种反差较大的色调。因而可以进行颜色迁移,以融合第一图像和第二图像的色调,使目标图像在视觉上更加真实自然。参考图5所示,可以通过以下步骤S501和S502实现颜色迁移。Since the tones of the first image and the second image may be quite different, after the foreground area image and the background area image are spliced, the target image obtained may have two tones with large contrast. Therefore, color migration can be performed to merge the tones of the first image and the second image, so that the target image is more realistic and natural visually. Referring to FIG5 , color migration can be achieved by following the steps S501 and S502.

步骤S501,获取第二图像在Lab颜色空间上的均值与方差;Step S501, obtaining the mean and variance of the second image in the Lab color space;

步骤S502,根据上述均值与方差对目标图像在Lab颜色空间上进行调整,以进行颜色迁移。Step S502: adjusting the target image in the Lab color space according to the mean and variance to perform color migration.

Lab颜色空间是一种符合人眼视觉感知特征的颜色模式,L表示亮度,a和b是两个颜色通道,a是从深绿色(低亮度值)到灰色(中亮度值)再到亮粉红色(高亮度值),b是从亮蓝色(低亮度值)到灰色(中亮度值)再到黄色(高亮度值)。在颜色迁移中,通常希望在改变一种颜色属性时,不影响其它的颜色属性。由于RGB颜色空间的三通道具有较高的相关性,而Lab颜色空间的各通道具有较低的相关性,所以选择在Lab颜色空间上进行颜色迁移。The Lab color space is a color mode that conforms to the visual perception characteristics of the human eye. L represents brightness, and a and b are two color channels. a is from dark green (low brightness value) to gray (medium brightness value) and then to bright pink (high brightness value), and b is from bright blue (low brightness value) to gray (medium brightness value) and then to yellow (high brightness value). In color migration, it is usually hoped that when changing one color attribute, other color attributes will not be affected. Since the three channels of the RGB color space have a high correlation, and the channels of the Lab color space have a low correlation, the Lab color space is chosen for color migration.

首先将第二图像与目标图像均从RGB颜色空间转换到Lab颜色空间;然后统计第二图像中每个像素点的Lab通道值,并分别计算每个通道的均值与方差(或标准差,两指标的含义基本相同,本公开不做特别区分);再根据该均值和方差,对目标图像中的像素点进行颜色调整,可以根据目标图像与第二图像的Lab通道均值之差,对目标图像的Lab通道值进行整体移动,根据第二图像的Lab通道方差,对目标图像Lab通道值的分布进行调整,从而将第二图像的颜色特征融入目标图像中。First, both the second image and the target image are converted from the RGB color space to the Lab color space; then, the Lab channel value of each pixel in the second image is counted, and the mean and variance (or standard deviation, the two indicators have basically the same meaning, and the present disclosure does not make a special distinction) of each channel are calculated respectively; then, according to the mean and variance, the color of the pixels in the target image is adjusted, and the Lab channel value of the target image can be moved as a whole according to the difference between the Lab channel means of the target image and the second image, and the distribution of the Lab channel value of the target image is adjusted according to the Lab channel variance of the second image, so as to integrate the color features of the second image into the target image.

需要说明的是,上述边缘平滑处理与颜色迁移是对目标图像进行后处理的两种方式,其目的都是消除图像处理中所可能造成的缺陷,提高图像的质量和视觉真实感。因此,还可以采取其他后处理方式,例如目标图像整体进行滤波处理,图像亮度、对比度的优化,消除图像畸变等等。It should be noted that the above-mentioned edge smoothing and color migration are two ways of post-processing the target image, and their purpose is to eliminate the defects that may be caused by image processing and improve the quality and visual realism of the image. Therefore, other post-processing methods can also be adopted, such as filtering the entire target image, optimizing the image brightness and contrast, eliminating image distortion, etc.

图6示出了本示例性实施方式中图像处理的示意性流程。如图6所示,获取第一图像后,通过分割模型分割第一图像中的天空区域,以从第一图像中提取掩膜图像;对掩膜图像进行反相处理,即用1减去每个像素点的像素值,得到反掩膜图像;利用反掩膜图像与第一图像相乘,以从第一图像中提取出前景区域图像;利用掩膜图像与第二图像相乘,以从第二图像中提取出背景区域图像;然后将前景区域图像与背景区域图像拼接,得到初始的目标图像(即目标图像1);再通过边缘平滑处理、颜色迁移等方式对目标图像进行后处理,得到最终的目标图像(即目标图像2)。FIG6 shows a schematic flow of image processing in this exemplary embodiment. As shown in FIG6, after acquiring the first image, the sky area in the first image is segmented by a segmentation model to extract a mask image from the first image; the mask image is inverted, that is, the pixel value of each pixel is subtracted from 1 to obtain an inverse mask image; the inverse mask image is multiplied with the first image to extract a foreground area image from the first image; the mask image is multiplied with the second image to extract a background area image from the second image; then the foreground area image and the background area image are spliced to obtain an initial target image (i.e., target image 1); and the target image is post-processed by edge smoothing, color migration, etc. to obtain a final target image (i.e., target image 2).

综上所述,本示例性实施方式中,基于上述图像处理方法,一方面,本方案基于分割模型对天空区域的识别,以及掩膜图像的处理,能够精准地从图像中分割出天空区域,无需用户手动抠图,智能化程度较高,使用方便,用户体验较好。另一方面,本方案实现了对图像的“换天”处理,将第一图像中的天空区域更换为第二图像中相应的部分,趣味性较高,能够满足用户的多样化需求。In summary, in this exemplary embodiment, based on the above-mentioned image processing method, on the one hand, this solution can accurately segment the sky area from the image based on the recognition of the sky area by the segmentation model and the processing of the mask image, without the need for the user to manually cut out the image, with a high degree of intelligence, easy to use, and good user experience. On the other hand, this solution realizes the "sky replacement" processing of the image, replacing the sky area in the first image with the corresponding part in the second image, which is highly interesting and can meet the diverse needs of users.

图7示出了本示例性实施方式的一种图像处理装置700,可以包括以下模块:FIG. 7 shows an image processing device 700 according to this exemplary embodiment, which may include the following modules:

天空识别模块710,用于识别第一图像中的天空区域,得到天空区域对应的掩膜图像;A sky recognition module 710 is used to recognize a sky area in the first image and obtain a mask image corresponding to the sky area;

图像分割模块720,用于通过掩膜图像从第一图像中分割出前景区域图像,以及从第二图像中分割出背景区域图像;An image segmentation module 720, configured to segment a foreground region image from the first image and a background region image from the second image using a mask image;

图像拼接模块730,用于拼接前景区域图像和背景区域图像,得到目标图像。The image stitching module 730 is used to stitch the foreground area image and the background area image to obtain a target image.

在一种可选的实施方式中,天空识别模块710,用于通过执行以下方法,以得到上述掩膜图像:In an optional implementation, the sky recognition module 710 is configured to obtain the mask image by executing the following method:

将第一图像的像素值进行归一化处理,得到归一化图像;Normalizing the pixel values of the first image to obtain a normalized image;

基于预先训练的全卷积神经网络对归一化图像进行处理,得到归一化图像对于天空的响应谱;The normalized image is processed based on a pre-trained fully convolutional neural network to obtain the response spectrum of the normalized image to the sky;

对响应谱进行二值化处理,得到第一图像中天空区域对应的掩膜图像。The response spectrum is binarized to obtain a mask image corresponding to the sky area in the first image.

在一种可选的实施方式中,图像分割模块720,用于将掩膜图像的反掩膜图像与第一图像相乘,以从第一图像中分割出前景区域图像,以及将掩膜图像与第二图像相乘,以从第二图像中分割出背景区域图像。In an optional embodiment, the image segmentation module 720 is used to multiply the inverse mask image of the mask image with the first image to segment the foreground area image from the first image, and to multiply the mask image with the second image to segment the background area image from the second image.

在一种可选的实施方式中,图像拼接模块730,用于将前景区域图像和背景区域图像相加,得到目标图像。In an optional implementation, the image stitching module 730 is used to add the foreground area image and the background area image to obtain a target image.

在一种可选的实施方式中,图像处理装置700还包括:后处理模块,用于在得到目标图像后,对目标图像进行边缘平滑处理。In an optional implementation, the image processing device 700 further includes: a post-processing module, configured to perform edge smoothing processing on the target image after obtaining the target image.

在一种可选的实施方式中,图像处理装置700还包括:后处理模块,用于在得到目标图像后,根据第二图像在Lab颜色空间上的均值与方差,对目标图像在Lab颜色空间上进行调整,以进行颜色迁移。In an optional embodiment, the image processing device 700 further includes: a post-processing module for adjusting the target image in the Lab color space according to the mean and variance of the second image in the Lab color space after obtaining the target image to perform color migration.

在一种可选的实施方式中,第一图像可以是摄像头采集的原始图像,第二图像可以是预先配置的模板图像。In an optional implementation, the first image may be an original image captured by a camera, and the second image may be a preconfigured template image.

上述装置中各模块的具体细节在方法部分实施方式中已经详细说明,未披露的细节内容可以参见方法部分的实施方式内容,因而不再赘述。The specific details of each module in the above device have been described in detail in the implementation method of the method part. The undisclosed details can be found in the implementation method of the method part, so they will not be repeated here.

所属技术领域的技术人员能够理解,本公开的各个方面可以实现为系统、方法或程序产品。因此,本公开的各个方面可以具体实现为以下形式,即:完全的硬件实施方式、完全的软件实施方式(包括固件、微代码等),或硬件和软件方面结合的实施方式,这里可以统称为“电路”、“模块”或“系统”。It will be appreciated by those skilled in the art that various aspects of the present disclosure may be implemented as systems, methods or program products. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: complete hardware implementation, complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, which may be collectively referred to herein as "circuits", "modules" or "systems".

本公开的示例性实施方式还提供了一种计算机可读存储介质,其上存储有能够实现本说明书上述方法的程序产品。在一些可能的实施方式中,本公开的各个方面还可以实现为一种程序产品的形式,其包括程序代码,当程序产品在终端设备上运行时,程序代码用于使终端设备执行本说明书上述“示例性方法”部分中描述的根据本公开各种示例性实施方式的步骤,例如可以执行图3、图4或图5中任意一个或多个步骤。The exemplary embodiments of the present disclosure also provide a computer-readable storage medium on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present disclosure may also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present disclosure described in the above "Exemplary Method" section of the present specification, for example, any one or more steps in FIG. 3, FIG. 4, or FIG. 5 may be executed.

参考图8所示,描述了根据本公开的示例性实施方式的用于实现上述方法的程序产品800,其可以采用便携式紧凑盘只读存储器(CD-ROM)并包括程序代码,并可以在终端设备,例如个人电脑上运行。然而,本公开的程序产品不限于此,在本文件中,可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。Referring to FIG8 , a program product 800 for implementing the above method according to an exemplary embodiment of the present disclosure is described, which may adopt a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto, and in this document, a readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.

程序产品可以采用一个或多个可读介质的任意组合。可读介质可以是可读信号介质或者可读存储介质。可读存储介质例如可以为但不限于电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。可读存储介质的更具体的例子(非穷举的列表)包括:具有一个或多个导线的电连接、便携式盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了可读程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。可读信号介质还可以是可读存储介质以外的任何可读介质,该可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, wherein readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于无线、有线、光缆、RF等等,或者上述的任意合适的组合。The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

可以以一种或多种程序设计语言的任意组合来编写用于执行本公开操作的程序代码,程序设计语言包括面向对象的程序设计语言—诸如Java、C++等,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算设备上执行、部分地在用户设备上执行、作为一个独立的软件包执行、部分在用户计算设备上部分在远程计算设备上执行、或者完全在远程计算设备或服务器上执行。在涉及远程计算设备的情形中,远程计算设备可以通过任意种类的网络,包括局域网(LAN)或广域网(WAN),连接到用户计算设备,或者,可以连接到外部计算设备(例如利用因特网服务提供商来通过因特网连接)。Program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本公开的其他实施方式。本公开旨在涵盖本公开的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本公开的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施方式仅被视为示例性的,本公开的真正范围和精神由权利要求指出。Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and embodiments are to be regarded as exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.

应当理解的是,本公开并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本公开的范围仅由所附的权利要求来限。It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (8)

1. An image processing method, comprising:
Identifying a sky area in the first image based on the segmentation model to obtain a mask image corresponding to the sky area;
dividing a foreground region image except the sky region from the first image through the mask image, and dividing a background region image corresponding to the sky region from a second image;
Splicing the foreground region image and the background region image to obtain a target image;
Acquiring the mean value and the variance of the second image in the Lab color space;
according to the difference between the average value of the target image in the Lab color space and the average value of the second image in the Lab color space, the Lab channel value of the target image is integrally moved;
according to the variance of the second image in the Lab color space, the distribution of Lab channel values of the target image is adjusted;
Determining an edge portion between the foreground region image and the background region image in the target image; expanding the edge part to form an edge region to be smoothed; selecting a center point of the region to be smoothed of the edge based on the two-dimensional normal distribution of the target image, constructing a smoothing algorithm formula based on the normal distribution, and calculating a weight matrix; and carrying out iteration convolution on the target image by utilizing a weight matrix according to the set iteration times.
2. The method of claim 1, wherein the identifying, based on the segmentation model, a sky region in the first image to obtain a mask image corresponding to the sky region comprises:
Normalizing the pixel value of the first image to obtain a normalized image;
processing the normalized image based on a pre-trained full convolution neural network to obtain a response spectrum of the normalized image to sky;
And performing binarization processing on the response spectrum to obtain a mask image corresponding to the sky area in the first image.
3. The method of claim 1, wherein the segmenting the foreground region image from the first image and the background region image from the second image by the mask image comprises:
Multiplying an inverse mask image of the mask image with the first image to segment a foreground region image from the first image;
the mask image is multiplied with the second image to divide a background area image from the second image.
4. A method according to claim 3, wherein said stitching said foreground region image and said background region image to obtain a target image comprises:
And adding the foreground region image and the background region image to obtain the target image.
5. The method of any one of claims 1 to 4, wherein the first image is a raw image captured by a camera and the second image is a pre-configured template image.
6. An image processing apparatus, comprising:
The sky identification module is used for identifying a sky area in the first image based on the segmentation model to obtain a mask image corresponding to the sky area;
The image segmentation module is used for segmenting foreground region images except the sky region from the first image through the mask image and segmenting background region images corresponding to the sky region from the second image;
the image stitching module is used for stitching the foreground region image and the background region image to obtain a target image;
The post-processing module is used for acquiring the mean value and the variance of the second image in the Lab color space; according to the difference between the average value of the target image in the Lab color space and the average value of the second image in the Lab color space, the Lab channel value of the target image is integrally moved; according to the variance of the second image in the Lab color space, the distribution of Lab channel values of the target image is adjusted;
The post-processing module is further configured to determine an edge portion between the foreground region image and the background region image in the target image; expanding the edge part to form an edge region to be smoothed; selecting a center point of the region to be smoothed of the edge based on the two-dimensional normal distribution of the target image, constructing a smoothing algorithm formula based on the normal distribution, and calculating a weight matrix; and carrying out iteration convolution on the target image by utilizing a weight matrix according to the set iteration times.
7. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the method of any one of claims 1 to 5.
8. An electronic device, comprising:
A processor; and
A memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of any one of claims 1 to 5 via execution of the executable instructions.
CN201911373483.9A 2019-12-27 2019-12-27 Image processing method, image processing device, storage medium and electronic device Active CN111179282B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911373483.9A CN111179282B (en) 2019-12-27 2019-12-27 Image processing method, image processing device, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911373483.9A CN111179282B (en) 2019-12-27 2019-12-27 Image processing method, image processing device, storage medium and electronic device

Publications (2)

Publication Number Publication Date
CN111179282A CN111179282A (en) 2020-05-19
CN111179282B true CN111179282B (en) 2024-04-23

Family

ID=70650383

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911373483.9A Active CN111179282B (en) 2019-12-27 2019-12-27 Image processing method, image processing device, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN111179282B (en)

Families Citing this family (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111598903B (en) * 2020-05-21 2023-09-29 Oppo广东移动通信有限公司 Portrait segmentation method, device, storage medium and electronic equipment
CN111709873B (en) * 2020-05-27 2023-06-20 北京百度网讯科技有限公司 Training method and device for image conversion model generator
CN111968134B (en) * 2020-08-11 2023-11-28 影石创新科技股份有限公司 Target segmentation method, device, computer-readable storage medium and computer equipment
CN112241941B (en) * 2020-10-20 2024-03-22 北京字跳网络技术有限公司 Method, apparatus, device and computer readable medium for acquiring image
CN112561847B (en) * 2020-12-24 2024-04-12 Oppo广东移动通信有限公司 Image processing method and device, computer readable medium and electronic device
CN113099127B (en) * 2021-02-24 2024-02-02 影石创新科技股份有限公司 Video processing methods, devices, equipment and media for producing invisible special effects
CN113096069B (en) * 2021-03-08 2024-07-26 北京达佳互联信息技术有限公司 Image processing method, device, electronic equipment and storage medium
CN113034648B (en) * 2021-04-30 2025-01-07 北京字节跳动网络技术有限公司 Image processing method, device, equipment and storage medium
CN113256499B (en) * 2021-07-01 2021-10-08 北京世纪好未来教育科技有限公司 Image splicing method, device and system
CN113808005B (en) * 2021-08-04 2024-12-03 西安深信智行科技有限公司 A method and device for face posture migration based on video drive
CN113920032B (en) * 2021-10-29 2025-01-07 上海商汤智能科技有限公司 Image processing method, device, electronic device and storage medium
CN114066841B (en) * 2021-11-12 2025-10-14 百果园技术(新加坡)有限公司 Sky detection method, device, computer equipment and storage medium
CN114445447B (en) * 2021-12-27 2025-01-24 天翼云科技有限公司 Image segmentation method, device, equipment and medium
CN116433703B (en) * 2021-12-29 2026-03-24 腾讯科技(深圳)有限公司 Image processing methods, apparatus, computer equipment, storage media and software products
CN114494004B (en) * 2022-04-15 2022-08-05 北京美摄网络科技有限公司 Sky image processing method and device
CN115100040A (en) * 2022-06-30 2022-09-23 影石创新科技股份有限公司 Picture splicing method and device, storage medium and electronic equipment
CN115984867A (en) * 2022-12-14 2023-04-18 国网江苏省电力有限公司 Contract image identification method and system
CN116229203A (en) * 2023-01-10 2023-06-06 京东科技控股股份有限公司 Image processing method, model training method, device, system and medium
CN116645303A (en) * 2023-04-24 2023-08-25 杭州火烧云科技有限公司 Two-stage sky replacement method, device and storage medium based on neural network
CN119338844B (en) * 2024-12-18 2025-04-08 苏州康捷医疗股份有限公司 Slit lamp original image processing method and similarity-based prediction model application method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103745456A (en) * 2013-12-23 2014-04-23 深圳先进技术研究院 Image segmentation method and apparatus
CN108171677A (en) * 2017-12-07 2018-06-15 腾讯科技(深圳)有限公司 A kind of image processing method and relevant device
CN109961446A (en) * 2019-03-27 2019-07-02 深圳视见医疗科技有限公司 CT/MR three-dimensional image segmentation processing method, device, equipment and medium
CN110136161A (en) * 2019-05-31 2019-08-16 苏州精观医疗科技有限公司 Image feature extraction and analysis method, system and device
CN110288614A (en) * 2019-06-24 2019-09-27 睿魔智能科技(杭州)有限公司 Image processing method, device, equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6349962B2 (en) * 2014-05-27 2018-07-04 富士ゼロックス株式会社 Image processing apparatus and program
US9858675B2 (en) * 2016-02-11 2018-01-02 Adobe Systems Incorporated Object segmentation, including sky segmentation

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103745456A (en) * 2013-12-23 2014-04-23 深圳先进技术研究院 Image segmentation method and apparatus
CN108171677A (en) * 2017-12-07 2018-06-15 腾讯科技(深圳)有限公司 A kind of image processing method and relevant device
CN109961446A (en) * 2019-03-27 2019-07-02 深圳视见医疗科技有限公司 CT/MR three-dimensional image segmentation processing method, device, equipment and medium
CN110136161A (en) * 2019-05-31 2019-08-16 苏州精观医疗科技有限公司 Image feature extraction and analysis method, system and device
CN110288614A (en) * 2019-06-24 2019-09-27 睿魔智能科技(杭州)有限公司 Image processing method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN111179282A (en) 2020-05-19

Similar Documents

Publication Publication Date Title
CN111179282B (en) Image processing method, image processing device, storage medium and electronic device
US12254544B2 (en) Image-text fusion method and apparatus, and electronic device
CN108594997B (en) Gesture skeleton construction method, device, equipment and storage medium
EP4036854B1 (en) Image processing method and apparatus, and electronic device
CN113096022B (en) Image blurring processing method and device, storage medium and electronic device
CN112954251B (en) Video processing method, video processing device, storage medium and electronic equipment
CN111563466B (en) Face detection methods and related products
CN113744257B (en) Image fusion method, device, terminal equipment and storage medium
CN114724055B (en) Video switching methods, devices, storage media and equipment
US11682148B2 (en) Method for displaying advertisement picture, method for uploading advertisement picture, and apparatus
CN113411498B (en) Image shooting method, mobile terminal and storage medium
CN111741303A (en) Deep video processing method, device, storage medium and electronic device
CN115705663B (en) Image processing method and electronic equipment
WO2021179804A1 (en) Image processing method, image processing device, storage medium, and electronic apparatus
CN114005016B (en) Image processing method, electronic device, image processing system and chip system
CN112188094B (en) Image processing method and apparatus, computer readable medium and terminal device
CN111626931B (en) Image processing method, image processing device, storage medium and electronic apparatus
CN115359105A (en) Depth-of-field extended image generation method, depth-of-field extended image generation device, and storage medium
CN117519555A (en) Image processing method, electronic device and system
CN117974519B (en) Image processing method and related equipment
CN115801987B (en) A video frame interpolation method and apparatus
CN111294905B (en) Image processing method, image processing device, storage medium and electronic apparatus
CN104871532B (en) Filming apparatus and its method of controlling operation
CN111738107A (en) Video generation method, video generation device, storage medium, and electronic apparatus
CN118628475B (en) A lithium battery detection method, system, electronic device and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant