WO2020035723A1 - Method and apparatus for identifying backlighting region, and device/terminal/server - Google Patents

Method and apparatus for identifying backlighting region, and device/terminal/server Download PDF

Info

Publication number
WO2020035723A1
WO2020035723A1 PCT/IB2018/056488 IB2018056488W WO2020035723A1 WO 2020035723 A1 WO2020035723 A1 WO 2020035723A1 IB 2018056488 W IB2018056488 W IB 2018056488W WO 2020035723 A1 WO2020035723 A1 WO 2020035723A1
Authority
WO
WIPO (PCT)
Prior art keywords
pixel
color
colors
dark
image
Prior art date
Application number
PCT/IB2018/056488
Other languages
French (fr)
Chinese (zh)
Inventor
唐琪森
Original Assignee
优视科技新加坡有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 优视科技新加坡有限公司 filed Critical 优视科技新加坡有限公司
Publication of WO2020035723A1 publication Critical patent/WO2020035723A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/10Cameras or camera modules comprising electronic image sensors; Control thereof for generating image signals from different wavelengths
    • 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/187Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
    • 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

Definitions

  • the present application relates to the technical field of intelligent terminals, and in particular, to a method, a device, and a device / terminal / server for identifying a backlight region.
  • the embodiments of the present application provide a method, an apparatus, and a device / terminal / server for identifying a backlight region, which completely or partially solve a problem in the prior art.
  • a method for identifying a backlight region includes: performing color space transfer on the obtained image to obtain a color brightness value of each pixel of the image in an HSL color space; The color lightness value of each pixel determines that the color of each pixel approaches white or black; traverses the color of each pixel to obtain the boundary value of the dark connected area to determine that it is a backlight area.
  • a device for identifying a backlight region includes: a space conversion module configured to perform color space transfer on the obtained image to obtain the image in the HSL color space. Color lightness value of each pixel; color determination A module configured to judge that the color of each pixel approaches white or black according to the color lightness value of each pixel; the area determination module is configured to traverse the color of each pixel to obtain a dark color The boundary value of the connected area determines that it is a backlit area.
  • a device / terminal / server including: one or more processors; a storage device, configured to store one or more programs, and when the one or more programs are Being executed by the one or more processors, so that the one or more processors implement an operation corresponding to the method for identifying a backlight region as described above.
  • a computer-readable storage medium in which a computer program is stored, and when the program is executed by a processor, the operation corresponding to the method for identifying a backlight region as described above is implemented.
  • the embodiment of the present application obtains the color lightness value of each pixel in the HSL color space of the image, and determines that the color of each pixel is close to white according to the color lightness value of each pixel Or approaching black, traverse the colors of the pixels to obtain the boundary value of the dark connected area to determine that it is a backlight area.
  • a user judges a pixel color according to a color lightness value of each pixel, so as to determine a boundary value of a dark connected area to determine a backlight area. This optimizes the backlight area and improves the image quality in photos or videos.
  • FIG. 1 is a flowchart of steps of a method for identifying a backlight region according to Embodiment 1 of the present application
  • FIG. 2 is a flowchart of steps of an implementation of step S103 of a method for identifying a backlight region according to Embodiment 2 of the present application;
  • FIG. 3 is a flowchart of steps of an implementation of step S 1031 of a method for identifying a backlight region according to Embodiment 2 of the present application;
  • FIG. 4 is a structural block diagram of an implementation of a device for identifying a backlight region according to Embodiment 3 of the present application;
  • FIG. 5 is a structural block diagram of an implementation of another area determination module for identifying a backlight area device according to Embodiment 4 of the present application;
  • FIG. 6 is a structural block diagram of an implementation of another color traversal unit for identifying a backlight region device according to Embodiment 4 of the present application;
  • FIG. 7 is a structural block diagram of a device / terminal / server according to Embodiment 5 of the present application. detailed description The specific implementation of the embodiments of the present application will be further described in detail below with reference to the accompanying drawings (the same reference numerals in several drawings represent the same elements) and embodiments. The following examples are used to illustrate the present application, but are not intended to limit the scope of the present application.
  • FIG. 1 there is shown a flowchart of steps in a method for identifying a backlight region according to Embodiment 1 of the present application.
  • steps S 101 to S 103 described in this application do not represent the order of execution.
  • Step S101 Perform color space transfer on the obtained image to obtain a color brightness value of each pixel of the image in the HSL color space.
  • the image obtained in the embodiment of the present application includes a captured image or an image downloaded through the Internet.
  • the image described in the embodiment of the present application includes an image in a photo or an image captured in a video.
  • HSL color mode is a color standard in the industry. It obtains a variety of colors by changing the three color channels of hue (H), saturation (S), and lightness (L) and superimposing them on each other.
  • HSL is the color representing the three channels of hue, saturation, and lightness. This standard includes almost all colors that human vision can perceive. It is one of the most widely used color systems.
  • the color brightness value (L) of each pixel of the image in the HSL color space is obtained by performing color space transfer on the image.
  • the color lightness value (L) of each pixel is determined. Based on the size of the color lightness value (L), it can be determined whether the color of the pixel approaches white or black.
  • Step S103 traverse the colors of the pixels to obtain the edges of the dark connected area The threshold value determines that it is a backlit area.
  • the present application obtains a dark-colored connected region by connecting all the regions that are close to black to whether the color of each pixel approaches white or black.
  • this application by determining the boundary value of the dark-colored connected area, it is determined that the final dark-colored connected area is a backlit area.
  • the embodiment of the present application obtains the color lightness value of each pixel in the HSL color space of the image, and judges that the color of each pixel approaches white or black based on the color brightness value of each pixel.
  • the color of each pixel is traversed to obtain the boundary value of the dark connected area to determine that it is a backlight area.
  • the embodiment of the present application is convenient for a user to judge a pixel color according to a color lightness value of each pixel, thereby determining a boundary value of a dark-colored connected area to determine a backlight region. This optimizes the backlight area and improves the image quality in photos or videos.
  • the method for identifying a backlight region in this embodiment may be performed by any appropriate device having the ability to identify a backlight region, including but not limited to: various device terminals or servers, including but not limited to a PC, a tablet computer, a mobile terminal, and the like.
  • step S103 of the method includes:
  • step S1031 the colors of each pixel in the image are sequentially traversed to obtain a dark connected area where the pixel colors all approach black.
  • the color of each pixel in the image is sequentially traversed to obtain whether the color of each pixel approaches black or white. If it approaches black, the pixels are connected to obtain a dark connected area where the pixel colors are all black.
  • the step S 1031 includes:
  • Step S 1031 The color of each pixel in the image is sequentially traversed in columns or rows, and the color of each pixel in each column or each row is compared.
  • the color of each pixel in the image is sequentially traversed in columns or rows, thereby ensuring that the traversal of each pixel improves the efficiency of the traversal and facilitates the connection of the dark connected areas.
  • Step S10312 According to the colors of the pixels obtained by comparison, a dark connected area where the pixel colors are all black is obtained.
  • the color of each pixel is compared to determine whether adjacent pixels can form a dark connected area. In this way, the pixel colors obtained by the comparison can be used to obtain a dark connected area where the pixel colors are all black.
  • the step S 10312 is specifically:
  • a flood-filling algorithm is used to obtain a dark connected area where the pixel colors are all black according to the colors of the pixels.
  • the flood fill algorithm fills a connected area like a flood.
  • a connected area like a flood.
  • the flooding algorithm can be used to mark or separate a part of the image, and it can implement functions similar to the Windows paint bucket, or the magic wand selection function in PS.
  • the flood fill algorithm is most commonly implemented with four neighborhood pixel fill methods, eight neighborhood pixel fill methods, and scan line based fill methods. According to the code implementation can be divided into recursive and non-recursive.
  • a flood-filling algorithm similar to a paint bucket is used to obtain a dark connected area where the pixel colors are all black.
  • the embodiment of the present application can separate the dark connected area from other areas, and ensure the accuracy and simplicity of operation.
  • Step S1032 The dark connected areas are merged, and the boundaries of the merged dark connected areas are statistically determined to determine that they are backlit areas.
  • This application combines the dark connected areas, and calculates the boundaries of the dark connected areas obtained by the combination, and determines the backlight area according to the boundaries.
  • the step S 1032 is specifically:
  • the difference between the color lightness value of the pixel and the color lightness value of an adjacent pixel is greater than a preset value, it is determined that the pixel is a boundary pixel of the backlight region.
  • the light source is at the far end, the subject is in the middle, and the camera is at the forefront. So the backlit image, background and foreground will have very clear boundaries.
  • it is determined whether the color brightness value of a pixel differs from the color brightness value of an adjacent pixel by more than a preset value to determine whether the pixel is a boundary pixel, thereby determining the boundary value of the dark connected area.
  • the color brightness value (L) is compared to determine the boundary of the merged dark-colored connected region, and the merged dark-colored connected region can be accurately distinguished from other regions to be determined as the backlight region. .
  • the weighted average value of the color lightness value (L) of each pixel is calculated, and iteratively iterates toward the interior of the image until a large difference is found, and the The boundary of the merged dark connected region.
  • this application uses the weighted average of the color lightness value (L) of each pixel to perform internal iteration without segmentation, and uses the difference of the weighted average to determine whether the boundary pixel is determined, which can achieve more accurate boundary pixel determination, and thus more Accurately determine the backlight area.
  • the embodiment of the present application obtains the color lightness value of each pixel in the HSL color space of the image, and judges that the color of each pixel approaches white or black based on the color brightness value of each pixel.
  • the color of each pixel is traversed to obtain the boundary value of the dark connected area to determine that it is a backlight area.
  • the embodiment of the present application is convenient for a user to judge a pixel color according to a color lightness value of each pixel, thereby determining a boundary value of a dark-colored connected area to determine a backlight region. This optimizes the backlight area and improves the image quality in photos or videos.
  • the method for identifying a backlight region in this embodiment may be performed by any appropriate device having the ability to identify a backlight region, including but not limited to: various device terminals or servers, including but not limited to a PC, a tablet computer, a mobile terminal, and the like.
  • FIG. 4 a structural block diagram of a device for identifying a backlight region according to Embodiment 3 of the present application is shown.
  • the space conversion module 401 is configured to perform color space transfer on the obtained image to obtain a color brightness value of each pixel of the image in the HSL color space.
  • the color determining module 402 is configured to determine, according to the color lightness value of each pixel, that the color of each pixel approaches white or black.
  • the area determining module 403 is configured to traverse the colors of the pixels to obtain the boundary value of the dark connected area to determine that it is a backlight area.
  • the image obtained in the embodiment of the present application includes a captured image or an image downloaded through the Internet.
  • the image described in the embodiment of the present application includes an image in a photo or an image captured in a video.
  • HSL color mode is a color standard in the industry. It is obtained by changing the three color channels of hue (H), saturation (S), and lightness (L) and superimposing them on each other. HSL is the color representing the three channels of hue, saturation, and lightness. This standard includes almost all colors that human vision can perceive. It is one of the most widely used color systems.
  • the color brightness value (L) of each pixel of the image in the HSL color space is obtained by performing color space transfer on the image.
  • the color lightness value (L) of each pixel is determined. Based on the size of the color lightness value (L), it can be determined whether the color of the pixel approaches white or black.
  • Step S103 traverse the colors of the pixels to obtain the boundary value of the dark connected region to determine that it is a backlight region.
  • the present application obtains a dark-colored connected region by connecting all the regions that are close to black to whether the color of each pixel approaches white or black.
  • this application by determining the boundary value of the dark-colored connected area, it is determined that the final dark-colored connected area is a backlit area.
  • the embodiment of the present application obtains the color lightness value of each pixel in the HSL color space of the image, and judges that the color of each pixel approaches white or black based on the color brightness value of each pixel The color of each pixel is traversed to obtain the boundary value of the dark connected area to determine that it is a backlight area.
  • the embodiment of the present application is convenient for a user to judge a pixel color according to a color brightness value of each pixel, thereby determining a boundary value of a dark-colored connected area to determine a backlight region. This optimizes the backlight area and improves the image quality in photos or videos.
  • the method for identifying a backlight region in this embodiment may be performed by any appropriate device having the ability to identify a backlight region, including but not limited to: various device terminals or servers, including but not limited to a PC, a tablet computer, a mobile terminal, and the like.
  • This embodiment includes the aforementioned space conversion module 401, a color determination module 402, and an area determination module 403.
  • the area determining module 403 includes:
  • the color traversal unit 4031 is configured to sequentially traverse the colors of the pixels in the image to obtain a dark connected area in which the colors of the pixels are close to black.
  • the statistical merging unit 4032 is configured to merge the dark connected areas, and statistically obtain the boundaries of the merged dark connected areas to determine that they are backlit areas.
  • the color of each pixel in the image is sequentially processed. Over time, it is obtained whether the color of each pixel approaches black or white. If it approaches black, the pixels are connected to obtain a dark connected area where the pixel colors are all black.
  • the color traversal unit 4031 includes:
  • the traversal subunit 4031 1 is configured to sequentially traverse the color of each pixel in the image in a column or a row, and compare the color of each pixel in each column or each row;
  • the connected sub-unit 40312 is configured to obtain the color of each pixel obtained according to the comparison, and obtain a dark connected area where the pixel colors are all black.
  • the color of each pixel in the image is sequentially traversed in columns or rows, thereby ensuring that the traversal of each pixel improves the efficiency of the traversal and facilitates the connection of the dark connected areas.
  • the pixel colors obtained by the comparison can be used to obtain a dark connected area where the pixel colors are all black.
  • the connected sub-unit 40312 is specifically configured to:
  • a flood-filling algorithm is used to obtain a dark connected area where the pixel colors are all black according to the colors of the pixels.
  • the flood fill algorithm fills a connected area like a flood.
  • a connected area like a flood.
  • the flooding algorithm can be used to mark or separate a part of the image, and it can implement functions similar to the Windows paint bucket, or the magic wand selection function in PS.
  • the flood fill algorithm is most commonly implemented with four neighborhood pixel fill methods, eight neighborhood pixel fill methods, and scan line based fill methods. According to the code implementation can be divided into recursive and non-recursive.
  • a flooded filling algorithm similar to a paint bucket or a magic wand is used to obtain a dark connected area where the pixel colors are black.
  • the embodiment of the present application can separate the dark connected area from other areas, and ensure the accuracy and simplicity of operation.
  • This application combines the dark connected areas, and calculates the boundaries of the dark connected areas obtained by the combination, and determines the backlight area according to the boundaries.
  • the statistical merging unit is specifically configured to: If the difference between the color lightness value of the pixel and the color lightness value of an adjacent pixel is greater than a preset value, it is determined that the pixel is a boundary pixel of the backlight region.
  • the light source is at the far end, the subject is in the middle, and the camera is at the forefront. So the backlit image, background and foreground will have very clear boundaries.
  • it is determined whether the color brightness value of a pixel differs from the color brightness value of an adjacent pixel by more than a preset value to determine whether the pixel is a boundary pixel, thereby determining the boundary value of the dark connected area.
  • the color brightness value (L) is compared to determine the boundary of the merged dark-colored connected region, and the merged dark-colored connected region can be accurately distinguished from other regions to be determined as the backlight region. .
  • the weighted average value of the color lightness value (L) of each pixel is calculated, and iteratively iterates toward the interior of the image until a large difference is found, which can be obtained The boundary of the merged dark connected region.
  • this application uses the weighted average of the color lightness value (L) of each pixel to perform internal iteration without segmentation, and uses the difference of the weighted average to determine whether the boundary pixel is determined, which can achieve more accurate boundary pixel determination, and thus more Accurately determine the backlight area.
  • the embodiment of the present application obtains the color lightness value of each pixel in the HSL color space of the image, and judges that the color of each pixel approaches white or black based on the color brightness value of each pixel.
  • the color of each pixel is traversed to obtain the boundary value of the dark connected area to determine that it is a backlight area.
  • the embodiment of the present application is convenient for a user to judge a pixel color according to a color lightness value of each pixel, thereby determining a boundary value of a dark-colored connected area to determine a backlight region. This optimizes the backlight area and improves the image quality in photos or videos.
  • the method for identifying a backlight region in this embodiment may be performed by any appropriate device having the ability to identify a backlight region, including but not limited to: various device terminals or servers, including but not limited to a PC, a tablet computer, a mobile terminal, and the like.
  • FIG. 7 a structural block diagram of a device / terminal / server according to Embodiment 5 of the present application is shown.
  • the specific embodiment of the present application does not limit the specific implementation of the device / terminal / server.
  • the device / terminal / server may include: one or more processors
  • processor processing circuit
  • memory storage device
  • the processor 702 is configured to execute a program 706, and may specifically perform related steps in the foregoing embodiment of the method for identifying a backlight region.
  • the program 706 may include program code, where the program code includes a computer operation instruction.
  • the processor 702 may be a central processing unit CPU, or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.
  • the device / terminal / server includes one or more processors, which can be processors of the same type, such as one or more CPUs; or different types of processors, such as one or more CPUs and one or more ASICs .
  • the storage device 704 is configured to store one or more programs 706.
  • the storage device 704 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
  • the program 706 may be specifically configured to cause the processor 702 to perform the following operations: transfer the obtained image to a color space, and obtain a color brightness value of each pixel of the image in an HSL color space; and judge according to the color brightness value of each pixel The color of each pixel approaches white or black; the color of each pixel is traversed to obtain the boundary value of the dark connected region to determine that it is a backlight region.
  • the program 706 is further configured to sequentially traverse the colors of the pixels in the image to obtain a dark connected area where the pixel colors all approach black; merge the dark connected areas, The boundaries of the merged dark connected areas are determined to determine that they are backlit areas.
  • the program 706 is further configured to sequentially traverse the colors of each pixel in the image in columns or rows, and compare the colors of each pixel in each column or each row; The color of each pixel is described to obtain a dark connected area where the pixel colors are all black.
  • the program 706 is further configured to use a flood-fill algorithm to obtain a dark connected area where the pixel colors are all black according to the colors of the pixels.
  • the program 706 is further configured to determine that the pixel is a border pixel of a backlight region if the difference between the color brightness value of the pixel and the color brightness value of an adjacent pixel is greater than a preset value.
  • the embodiments of the present application perform element segmentation on the obtained image according to the segmentation rule.
  • the segmented element feature information is processed, and an image element corresponding to the instruction is obtained for a personalized operation according to a received user instruction.
  • Embodiments of the present application may segment image elements in an image and perform personalized operations on the image elements.
  • the embodiment of the present application is convenient for a user to flexibly personalize an image element in an image obtained by shooting or downloading, so that the object of the personalized operation is richer, and the user operation can be better personalized.
  • the embodiment of the present application obtains the color lightness value of each pixel of the image in the HSL color space, and determines, according to the color lightness value of each pixel, that the color of each pixel is closer to white or closer to black.
  • the color of the pixel is traversed to obtain the boundary value of the dark connected area to determine that it is a backlit area.
  • the embodiment of the present application is convenient for a user to judge a pixel color according to a color lightness value of each pixel, so as to determine a boundary value of a dark connected area to determine a backlight area. This optimizes the backlight area and improves the image quality in photos or videos.
  • each component / step described in the embodiment of the present application may be split into more components / steps, or two or more components / steps or partial operations of components / steps may be combined into New components / steps to achieve the purpose of the embodiments of the present application.
  • the process described above with reference to the flowchart may be implemented as a computer software program.
  • embodiments of the present disclosure include a computer program product including a computer program carried on a computer-readable medium, the computer program containing program code for performing a method shown in a flowchart.
  • the computer program may be downloaded and installed from a network through a communication section, and / or installed from a removable medium.
  • CPU central processing unit
  • the aforementioned functions defined in the method of the present application are executed.
  • the computer-readable medium described in this application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the foregoing.
  • the computer-readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable memories Programming read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing.
  • a computer-readable storage medium may be any tangible medium containing or storing a program, and the program may be used by or in combination with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal that is included in baseband or propagated as part of a carrier wave, which carries a computer-readable program code code. Such a propagated data signal may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • the computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, and the computer-readable medium may send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device .
  • Program code embodied on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
  • Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, the programming languages including an object-oriented programming language such as Java, Smalltalk, C ++, and also conventional A procedural programming language such as "C" or a similar programming language.
  • the program code can be executed entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer, partly on a remote computer, or entirely on a remote computer or server.
  • the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as through the Internet using an Internet service provider) Connection).
  • LAN local area network
  • WAN wide area network
  • Internet service provider Internet service provider
  • each block in the flowchart or block diagram may represent a module, a program segment, or a portion of a code, which module, program segment, or part of the code contains one or more functions for implementing a specified logical function Executable instructions.
  • the functions marked in the blocks may also occur in a different order than those marked in the drawings. For example, two blocks represented one after the other may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved.
  • each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts may be implemented in a dedicated hardware-based system that performs the specified function or operation. Or, it can be implemented by a combination of dedicated hardware and computer instructions.
  • a processor includes a receiving unit, a parsing unit, an information selecting unit, and a generating unit. Wherein, the names of these units do not constitute a limitation on the unit itself in some cases, for example, the receiving unit may also be described as a "receiving a user's web browsing request. Yuan. "
  • the present application also provides a computer-readable storage medium having stored thereon a computer program, which is executed by a processor to implement a method as described in any one of the foregoing embodiments.
  • the present application further provides a computer-readable medium, which may be included in the device described in the foregoing embodiments; or may exist alone without being assembled into the device.
  • the above computer-readable medium carries one or more programs, and when the one or more programs are executed by the device, the device is caused to: perform element segmentation on the obtained image according to a segmentation rule to obtain element feature information in the image Processing the element feature information to obtain an image element corresponding to the element feature information; obtaining an image element corresponding to the instruction according to a received user instruction, and performing a personalized operation according to the image element.

Landscapes

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

Abstract

The embodiments of the present application provide a method and apparatus for identifying a backlighting region, and a device/terminal/server. The method comprises: carrying out color space transfer on an obtained image to obtain a color brightness value of each pixel of the image in an HSL color space; determining whether the color of each pixel is approximate to white or approximate to black according to the color brightness value of each pixel; and traversing the colors of all the pixels to obtain a boundary value of a dark color connection region to determine that the dark color connection region is a backlighting region. By means of the embodiments of the present application, a user can easily determine a pixel color according to a color brightness value of each pixel, so as to determine a boundary value of a dark color connection region to determine a backlighting region, thereby optimizing the backlighting region and improving the quality of images in photographs or videos.

Description

一种识别逆光区域方法、 装置和设备 /终端 /服务器 本申请要求在 2018 年 08 月 17 日提交中国专利局、 申请号为 201810943188.1、 发明名称为〃一种识别逆光区域方法、 装置和设备 /终端 /服务器 "的中国专利申请的优先权, 其全部内容通过引用结合在本申请 中。  Method, device and device / terminal / server for identifying backlight area This application requires that the China Patent Office be filed on August 17, 2018, with application number 201810943188.1, and the invention name is 〃A method, device and device / terminal for identifying backlight area / Server "Chinese patent application priority, the entire contents of which are incorporated herein by reference.
技术领域  Technical field
本申请涉及智能终端技术领域, 尤其涉及一种识别逆光区域方法、 装 置和设备 /终端 /服务器。  The present application relates to the technical field of intelligent terminals, and in particular, to a method, a device, and a device / terminal / server for identifying a backlight region.
背景技术  Background technique
随着智能终端技术的发展, 采用智能终端进行图像拍摄或者下载, 成 为人们日常生活中常用的图像获得手段。 而各类图像应用软件的发展, 令 用户可以对获得的图像进行一定程度简单的修图, 比如美颜处理或者添加 滤镜等。  With the development of smart terminal technology, the use of smart terminals for image capture or download has become a commonly used means of image acquisition in people's daily lives. The development of various image application software allows users to modify the obtained images to a certain degree, such as beauty treatment or adding filters.
但是由于用户的拍摄技能以及拍摄环境的限制, 如果在光照充足的情 况下拍照, 拍摄角度选择不当会形成逆光拍摄, 从而造成拍摄的图像区域 光照不足, 色彩偏黑, 图像细节不明显。  However, due to the limitation of the user's shooting skills and shooting environment, if the picture is taken under sufficient light, the shooting angle is incorrectly selected, which will result in backlit shooting, resulting in insufficient light in the captured image area, blackish colors, and inconspicuous image details.
因此, 如何识别拍摄图像的逆光区域成为现有技术中亟待解决的技术 问题。  Therefore, how to identify the backlit area of the captured image becomes a technical problem to be solved urgently in the prior art.
发明内容  Summary of the Invention
本申请实施例提供了一种识别逆光区域方法、 装置和设备 /终端 /服务 器, 全部或者部分解决现有技术中存在的问题。  The embodiments of the present application provide a method, an apparatus, and a device / terminal / server for identifying a backlight region, which completely or partially solve a problem in the prior art.
根据本申请实施例的一个方面, 提供了一种识别逆光区域方法, 所述 方法包括: 将获得的图像进行色彩空间转移, 获得 HSL色彩空间下的所 述图像的各像素的色彩明度值; 根据所述各像素的色彩明度值判断所述各 像素的颜色趋近于白色或者趋近于黑色; 对所述各像素的颜色进行遍历, 获得暗色连通区域的边界值以确定其为逆光区域。  According to an aspect of the embodiment of the present application, a method for identifying a backlight region is provided, the method includes: performing color space transfer on the obtained image to obtain a color brightness value of each pixel of the image in an HSL color space; The color lightness value of each pixel determines that the color of each pixel approaches white or black; traverses the color of each pixel to obtain the boundary value of the dark connected area to determine that it is a backlight area.
根据本申请实施例的另一个方面, 还提供了一种识别逆光区域装置, 所述装置包括: 空间转换模块, 配置用于将获得的图像进行色彩空间转 移, 获得 HSL色彩空间下的所述图像的各像素的色彩明度值; 色彩确定 模块, 配置用于根据所述各像素的色彩明度值判断所述各像素的颜色趋近 于白色或者趋近于黑色; 区域确定模块, 配置用于对所述各像素的颜色进 行遍历, 获得暗色连通区域的边界值以确定其为逆光区域。 According to another aspect of the embodiments of the present application, a device for identifying a backlight region is further provided. The device includes: a space conversion module configured to perform color space transfer on the obtained image to obtain the image in the HSL color space. Color lightness value of each pixel; color determination A module configured to judge that the color of each pixel approaches white or black according to the color lightness value of each pixel; the area determination module is configured to traverse the color of each pixel to obtain a dark color The boundary value of the connected area determines that it is a backlit area.
根据本申请实施例的又一个方面, 还提供了一种设备 /终端 /服务器, 包括: 一个或多个处理器; 存储装置, 用于存储一个或多个程序, 当所述 一个或多个程序被所述一个或多个处理器执行, 使得所述一个或多个处理 器实现如上所述的识别逆光区域方法对应的操作。  According to still another aspect of the embodiments of the present application, a device / terminal / server is further provided, including: one or more processors; a storage device, configured to store one or more programs, and when the one or more programs are Being executed by the one or more processors, so that the one or more processors implement an operation corresponding to the method for identifying a backlight region as described above.
根根据本申请实施例的又一个方面, 还提供了一种计算机可读存储介 质, 其上存储有计算机程序, 该程序被处理器执行时实现如上所述的识别 逆光区域方法对应的操作。  According to still another aspect of the embodiments of the present application, a computer-readable storage medium is further provided, in which a computer program is stored, and when the program is executed by a processor, the operation corresponding to the method for identifying a backlight region as described above is implemented.
根据本申请实施例提供的技术方案, 本申请实施例获得图像在 HSL 色彩空间下的各像素的色彩明度值, 并根据所述各像素的色彩明度值判断 所述各像素的颜色趋近于白色或者趋近于黑色, 对所述各像素的颜色进行 遍历, 获得暗色连通区域的边界值以确定其为逆光区域。 本申请实施例便 于用户根据各像素的色彩明度值判断像素颜色, 从而确定暗色连通区域的 边界值以确定逆光区域。 从而针对逆光区域进行优化, 提升照片或者视频 中的图像质量。  According to the technical solution provided by the embodiment of the present application, the embodiment of the present application obtains the color lightness value of each pixel in the HSL color space of the image, and determines that the color of each pixel is close to white according to the color lightness value of each pixel Or approaching black, traverse the colors of the pixels to obtain the boundary value of the dark connected area to determine that it is a backlight area. In the embodiment of the present application, a user judges a pixel color according to a color lightness value of each pixel, so as to determine a boundary value of a dark connected area to determine a backlight area. This optimizes the backlight area and improves the image quality in photos or videos.
附图说明  BRIEF DESCRIPTION OF THE DRAWINGS
图 1是根据本申请实施例一的一种识别逆光区域方法的步骤流程图; 图 2是根据本申请实施例二的一种识别逆光区域方法的步骤 S 103 的 一种实现的步骤流程图;  FIG. 1 is a flowchart of steps of a method for identifying a backlight region according to Embodiment 1 of the present application; FIG. 2 is a flowchart of steps of an implementation of step S103 of a method for identifying a backlight region according to Embodiment 2 of the present application;
图 3是根据本申请实施例二的一种识别逆光区域方法的步骤 S 1031的 一种实现的步骤流程图;  FIG. 3 is a flowchart of steps of an implementation of step S 1031 of a method for identifying a backlight region according to Embodiment 2 of the present application;
图 4是根据本申请实施例三的一种识别逆光区域装置的一种实现的结 构框图;  4 is a structural block diagram of an implementation of a device for identifying a backlight region according to Embodiment 3 of the present application;
图 5是根据本申请实施例四的另一种识别逆光区域装置的区域确定模 块一种实现的结构框图;  5 is a structural block diagram of an implementation of another area determination module for identifying a backlight area device according to Embodiment 4 of the present application;
图 6是根据本申请实施例四的另一种识别逆光区域装置的颜色遍历单 元一种实现的结构框图;  6 is a structural block diagram of an implementation of another color traversal unit for identifying a backlight region device according to Embodiment 4 of the present application;
图 7是根据本申请实施例五的一种设备 /终端 /服务器的结构框图。 具体实施方式 下面结合附图 (若干附图中相同的标号表示相同的元素) 和实施例, 对本申请实施例的具体实施方式作进一步详细说明。 以下实施例用于说明 本申请, 但不用来限制本申请的范围。 FIG. 7 is a structural block diagram of a device / terminal / server according to Embodiment 5 of the present application. detailed description The specific implementation of the embodiments of the present application will be further described in detail below with reference to the accompanying drawings (the same reference numerals in several drawings represent the same elements) and embodiments. The following examples are used to illustrate the present application, but are not intended to limit the scope of the present application.
本领域技术人员可以理解, 本申请实施例中的“第一”、 “第二”等术语 仅用于区别不同步骤、 设备或模块等, 既不代表任何特定技术含义, 也不 表示它们之间的必然逻辑顺序。  Those skilled in the art can understand that terms such as “first” and “second” in the embodiments of the present application are only used to distinguish different steps, devices, or modules, etc., and they do not represent any specific technical meaning, nor mean between them. Inevitable logical order.
实施例一 Example one
参照图 1, 示出了根据本申请实施例一的一种识别逆光区域方法的步 骤流程图。  Referring to FIG. 1, there is shown a flowchart of steps in a method for identifying a backlight region according to Embodiment 1 of the present application.
值得说明的是, 本申请所述步骤 S 101至 S 103并不代表其执行的先后 顺序。  It is worth noting that steps S 101 to S 103 described in this application do not represent the order of execution.
本实施例的识别逆光区域方法包括以下步骤:  The method for identifying a backlight region in this embodiment includes the following steps:
步骤 S 101 : 将获得的图像进行色彩空间转移, 获得 HSL色彩空间下 的所述图像的各像素的色彩明度值。  Step S101: Perform color space transfer on the obtained image to obtain a color brightness value of each pixel of the image in the HSL color space.
具体地, 本申请实施例所述获得的图像包括拍摄的图像或者通过互联 网下载的图像。 本申请实施例所述图像包括照片中图像或者视频中截取的 图像。  Specifically, the image obtained in the embodiment of the present application includes a captured image or an image downloaded through the Internet. The image described in the embodiment of the present application includes an image in a photo or an image captured in a video.
HSL色彩模式是工业界的一种颜色标准, 是通过对色相 (H)、 饱和度 (S)、 明度 (L)三个颜色通道的变化以及它们相互之间的叠加来得到各式各 样的颜色的, HSL即是代表色相, 饱和度, 明度三个通道的颜色, 这个标 准几乎包括了人类视力所能感知的所有颜色, 是目前运用最广的颜色系统 之一。  HSL color mode is a color standard in the industry. It obtains a variety of colors by changing the three color channels of hue (H), saturation (S), and lightness (L) and superimposing them on each other. For color, HSL is the color representing the three channels of hue, saturation, and lightness. This standard includes almost all colors that human vision can perceive. It is one of the most widely used color systems.
本申请实施例通过将所述图像进行色彩空间转移, 获得 HSL色彩空 间下的所述图像的各像素的色彩明度值 ( L )。  In the embodiment of the present application, the color brightness value (L) of each pixel of the image in the HSL color space is obtained by performing color space transfer on the image.
S 102、 根据所述各像素的色彩明度值判断所述各像素的颜色趋近于白 色或者趋近于黑色。  S102. Determine, according to the color lightness value of each pixel, that the color of each pixel approaches white or approaches black.
本申请实施例对所述各像素的色彩明度值 (L)进行判断, 通过所述色 彩明度值 (L)的大小, 可以判断所述像素的颜色是趋近于白色还是趋近于 黑色。  In the embodiment of the present application, the color lightness value (L) of each pixel is determined. Based on the size of the color lightness value (L), it can be determined whether the color of the pixel approaches white or black.
步骤 S 103: 对所述各像素的颜色进行遍历, 获得暗色连通区域的边 界值以确定其为逆光区域。 Step S103: traverse the colors of the pixels to obtain the edges of the dark connected area The threshold value determines that it is a backlit area.
本申请通过对所述各像素的颜色是趋近于白色还是趋近于黑色, 连通 所有趋近于黑色的区域, 获得暗色连通区域。 本申请通过确定所述暗色连 通区域的边界值, 确定最终的暗色联通区域为逆光区域。  The present application obtains a dark-colored connected region by connecting all the regions that are close to black to whether the color of each pixel approaches white or black. In this application, by determining the boundary value of the dark-colored connected area, it is determined that the final dark-colored connected area is a backlit area.
由此可知, 本申请实施例获得图像在 HSL色彩空间下的各像素的色 彩明度值, 并根据所述各像素的色彩明度值判断所述各像素的颜色趋近于 白色或者趋近于黑色, 对所述各像素的颜色进行遍历, 获得暗色连通区域 的边界值以确定其为逆光区域。 本申请实施例便于用户根据各像素的色彩 明度值判断像素颜色, 从而确定暗色连通区域的边界值以确定逆光区域。 从而针对逆光区域进行优化, 提升照片或者视频中的图像质量。  It can be known from this that that the embodiment of the present application obtains the color lightness value of each pixel in the HSL color space of the image, and judges that the color of each pixel approaches white or black based on the color brightness value of each pixel. The color of each pixel is traversed to obtain the boundary value of the dark connected area to determine that it is a backlight area. The embodiment of the present application is convenient for a user to judge a pixel color according to a color lightness value of each pixel, thereby determining a boundary value of a dark-colored connected area to determine a backlight region. This optimizes the backlight area and improves the image quality in photos or videos.
本实施例的识别逆光区域方法可以由任意适当的具有识别逆光区域能 力的设备执行, 包括但不限于: 各种设备终端或者服务端, 包括但不限于 PC机、 平板电脑、 移动终端等。  The method for identifying a backlight region in this embodiment may be performed by any appropriate device having the ability to identify a backlight region, including but not limited to: various device terminals or servers, including but not limited to a PC, a tablet computer, a mobile terminal, and the like.
实施例二 Example two
本实施例包括上述步骤 S 101至步骤 S 103。 参见图 2, 所述方法的步 骤 S 103包括:  This embodiment includes the above steps S101 to S103. Referring to FIG. 2, step S103 of the method includes:
步骤 S 1031、 对所述图像中各像素的颜色进行依次遍历, 获得所述像 素颜色均趋近于黑色的暗色连通区域。  In step S1031, the colors of each pixel in the image are sequentially traversed to obtain a dark connected area where the pixel colors all approach black.
具体地, 本申请实施例通过对所述图像中各像素的颜色依次进行遍 历, 得到各个像素颜色是趋近于黑色还是趋近于白色。 如果趋近于黑色, 则将所述像素进行连通, 获得所述像素颜色均为黑色的暗色连通区域。  Specifically, in the embodiment of the present application, the color of each pixel in the image is sequentially traversed to obtain whether the color of each pixel approaches black or white. If it approaches black, the pixels are connected to obtain a dark connected area where the pixel colors are all black.
参见图 3, 所述步骤 S 1031包括:  Referring to FIG. 3, the step S 1031 includes:
步骤 S 1031 1、 对所述图像中各像素的颜色以列或者行进行依次遍 历, 对比每一列或者每一行中的各像素的颜色。  Step S 1031 1. The color of each pixel in the image is sequentially traversed in columns or rows, and the color of each pixel in each column or each row is compared.
由于像素都是逐行或者逐列排列的, 因此对所述图像中各像素的颜色 以列或者行进行依次遍历, 从而保证对各像素进行遍历的同时提高遍历的 效率, 便于连通暗色连通区域。  Since the pixels are arranged row by row or column by column, the color of each pixel in the image is sequentially traversed in columns or rows, thereby ensuring that the traversal of each pixel improves the efficiency of the traversal and facilitates the connection of the dark connected areas.
步骤 S 10312、 根据对比获得的所述各像素的颜色, 得到所述像素颜 色均为黑色的暗色连通区域。  Step S10312: According to the colors of the pixels obtained by comparison, a dark connected area where the pixel colors are all black is obtained.
由于比对各像素的颜色得到相邻像素是否能够构成暗色连通区域, 因 此通过所述比对获得的像素颜色即可得到所述像素颜色均为黑色的暗色连 通区域。 The color of each pixel is compared to determine whether adjacent pixels can form a dark connected area. In this way, the pixel colors obtained by the comparison can be used to obtain a dark connected area where the pixel colors are all black.
所述步骤 S 10312具体为:  The step S 10312 is specifically:
采用漫水填充算法根据所述各像素的颜色, 得到所述像素颜色均为黑 色的暗色连通区域。  A flood-filling algorithm is used to obtain a dark connected area where the pixel colors are all black according to the colors of the pixels.
漫水填充算法 ( flood fill algorithm ) 顾名思义就像洪水漫过一样, 把 一块连通的区域填满, 当然水要能漫过需要满足一定的条件, 可以理解为 满足条件的地方就是低洼的地方, 水才能流过去。 在图像处理中就是给定 一个种子点作为起始点, 向附近相邻的像素点扩散, 把颜色相同或者相近 的所有点都找出来, 并填充上新的颜色, 这些点形成一个连通的区域。 漫 水填充算法可以用来标记或者分离图像的一部分, 可实现类似 Windows 画图油漆桶功能, 或者 PS里面的魔棒选择功能。  The flood fill algorithm, as the name suggests, fills a connected area like a flood. Of course, if the water can flow over, it needs to meet certain conditions. It can be understood that the place that meets the conditions is the low-lying place. Water To flow through. In image processing, a seed point is given as a starting point, and it is diffused to neighboring pixels, and all points with the same or similar colors are found out and filled with new colors. These points form a connected area. The flooding algorithm can be used to mark or separate a part of the image, and it can implement functions similar to the Windows paint bucket, or the magic wand selection function in PS.
漫水填充算法实现最常见有四邻域像素填充法, 八邻域像素填充法, 基于扫描线的填充方法。 根据代码实现方式又可以分为递归与非递归。  The flood fill algorithm is most commonly implemented with four neighborhood pixel fill methods, eight neighborhood pixel fill methods, and scan line based fill methods. According to the code implementation can be divided into recursive and non-recursive.
本申请实施例采用类似油漆桶的漫水填充算法来获得所述像素颜色均 为黑色的暗色连通区域。 本申请实施例可以把暗色连通区域同其他区域分 割开来, 且保证操作的准确性和简便性。  In the embodiment of the present application, a flood-filling algorithm similar to a paint bucket is used to obtain a dark connected area where the pixel colors are all black. The embodiment of the present application can separate the dark connected area from other areas, and ensure the accuracy and simplicity of operation.
步骤 S 1032、 合并所述暗色连通区域, 统计得到合并的暗色连通区域 的边界以确定其为逆光区域。  Step S1032: The dark connected areas are merged, and the boundaries of the merged dark connected areas are statistically determined to determine that they are backlit areas.
本申请对所述暗色连通区域进行合并, 并统计合并得到的暗色连通区 域的边界, 根据所述边界确定逆光区域。  This application combines the dark connected areas, and calculates the boundaries of the dark connected areas obtained by the combination, and determines the backlight area according to the boundaries.
所述步骤 S 1032具体为:  The step S 1032 is specifically:
如所述像素的色彩明度值与相邻像素的色彩明度值相差大于预设值, 则确定所述像素为逆光区域的边界像素。  If the difference between the color lightness value of the pixel and the color lightness value of an adjacent pixel is greater than a preset value, it is determined that the pixel is a boundary pixel of the backlight region.
由于逆光拍摄的情况下, 发光源处于远端, 被拍摄的物体处于中间, 相机位于最前方。 所以逆光的图像, 背景和前景会有很明晰的界限。 本申 请实施例通过像素的色彩明度值与相邻像素的色彩明度值相差大于预设值 确定所述像素是否为边界像素, 从而确定所述暗色连通区域的边界值。  In the case of backlight shooting, the light source is at the far end, the subject is in the middle, and the camera is at the forefront. So the backlit image, background and foreground will have very clear boundaries. In the embodiment of the present application, it is determined whether the color brightness value of a pixel differs from the color brightness value of an adjacent pixel by more than a preset value to determine whether the pixel is a boundary pixel, thereby determining the boundary value of the dark connected area.
因此, 本申请实施例通过所述色彩明度值 (L)进行比较确定合并后的 所述暗色连通区域的边界, 可以准确地将合并后的暗色连通区域同其他区 域区分开来, 确定为逆光区域。 具体地, 本申请实施例从所述图像的边界开始, 计算各像素的色彩明 度值 (L)的加权平均值, 不断地向所述图像内部迭代, 直至发现较大差 值, 可以得到所述合并后的暗色连通区域的边界。 Therefore, in the embodiment of the present application, the color brightness value (L) is compared to determine the boundary of the merged dark-colored connected region, and the merged dark-colored connected region can be accurately distinguished from other regions to be determined as the backlight region. . Specifically, in the embodiment of the present application, starting from the boundary of the image, the weighted average value of the color lightness value (L) of each pixel is calculated, and iteratively iterates toward the interior of the image until a large difference is found, and the The boundary of the merged dark connected region.
因此, 本申请通过各像素的色彩明度值 (L)的加权平均值, 不段进行 内部迭代, 利用加权平均值的差值来获得是否边界像素的判断可以实现更 加准确的边界像素判定, 从而更加准确的确定逆光区域。  Therefore, this application uses the weighted average of the color lightness value (L) of each pixel to perform internal iteration without segmentation, and uses the difference of the weighted average to determine whether the boundary pixel is determined, which can achieve more accurate boundary pixel determination, and thus more Accurately determine the backlight area.
由此可知, 本申请实施例获得图像在 HSL色彩空间下的各像素的色 彩明度值, 并根据所述各像素的色彩明度值判断所述各像素的颜色趋近于 白色或者趋近于黑色, 对所述各像素的颜色进行遍历, 获得暗色连通区域 的边界值以确定其为逆光区域。 本申请实施例便于用户根据各像素的色彩 明度值判断像素颜色, 从而确定暗色连通区域的边界值以确定逆光区域。 从而针对逆光区域进行优化, 提升照片或者视频中的图像质量。  It can be known from this that that the embodiment of the present application obtains the color lightness value of each pixel in the HSL color space of the image, and judges that the color of each pixel approaches white or black based on the color brightness value of each pixel. The color of each pixel is traversed to obtain the boundary value of the dark connected area to determine that it is a backlight area. The embodiment of the present application is convenient for a user to judge a pixel color according to a color lightness value of each pixel, thereby determining a boundary value of a dark-colored connected area to determine a backlight region. This optimizes the backlight area and improves the image quality in photos or videos.
本实施例的识别逆光区域方法可以由任意适当的具有识别逆光区域能 力的设备执行, 包括但不限于: 各种设备终端或者服务端, 包括但不限于 PC机、 平板电脑、 移动终端等。  The method for identifying a backlight region in this embodiment may be performed by any appropriate device having the ability to identify a backlight region, including but not limited to: various device terminals or servers, including but not limited to a PC, a tablet computer, a mobile terminal, and the like.
实施例三 Example three
参照图 4 , 示出了根据本申请实施例三的一种识别逆光区域装置的结 构框图。  Referring to FIG. 4, a structural block diagram of a device for identifying a backlight region according to Embodiment 3 of the present application is shown.
本实施例的识别逆光区域装置包括:  The device for identifying a backlight region in this embodiment includes:
空间转换模块 401, 配置用于将获得的图像进行色彩空间转移, 获得 HSL色彩空间下的所述图像的各像素的色彩明度值。  The space conversion module 401 is configured to perform color space transfer on the obtained image to obtain a color brightness value of each pixel of the image in the HSL color space.
色彩确定模块 402, 配置用于根据所述各像素的色彩明度值判断所述 各像素的颜色趋近于白色或者趋近于黑色。  The color determining module 402 is configured to determine, according to the color lightness value of each pixel, that the color of each pixel approaches white or black.
区域确定模块 403 , 配置用于对所述各像素的颜色进行遍历, 获得暗 色连通区域的边界值以确定其为逆光区域。  The area determining module 403 is configured to traverse the colors of the pixels to obtain the boundary value of the dark connected area to determine that it is a backlight area.
具体地, 本申请实施例所述获得的图像包括拍摄的图像或者通过互联 网下载的图像。 本申请实施例所述图像包括照片中图像或者视频中截取的 图像。  Specifically, the image obtained in the embodiment of the present application includes a captured image or an image downloaded through the Internet. The image described in the embodiment of the present application includes an image in a photo or an image captured in a video.
HSL色彩模式是工业界的一种颜色标准, 是通过对色相 (H)、 饱和度 (S)、 明度 (L)三个颜色通道的变化以及它们相互之间的叠加来得到各式各 样的颜色的, HSL即是代表色相, 饱和度, 明度三个通道的颜色, 这个标 准几乎包括了人类视力所能感知的所有颜色, 是目前运用最广的颜色系统 之一。 HSL color mode is a color standard in the industry. It is obtained by changing the three color channels of hue (H), saturation (S), and lightness (L) and superimposing them on each other. HSL is the color representing the three channels of hue, saturation, and lightness. This standard includes almost all colors that human vision can perceive. It is one of the most widely used color systems.
本申请实施例通过将所述图像进行色彩空间转移, 获得 HSL色彩空 间下的所述图像的各像素的色彩明度值 ( L )。  In the embodiment of the present application, the color brightness value (L) of each pixel of the image in the HSL color space is obtained by performing color space transfer on the image.
本申请实施例对所述各像素的色彩明度值 (L)进行判断, 通过所述色 彩明度值 (L)的大小, 可以判断所述像素的颜色是趋近于白色还是趋近于 黑色。  In the embodiment of the present application, the color lightness value (L) of each pixel is determined. Based on the size of the color lightness value (L), it can be determined whether the color of the pixel approaches white or black.
步骤 S 103: 对所述各像素的颜色进行遍历, 获得暗色连通区域的边 界值以确定其为逆光区域。  Step S103: traverse the colors of the pixels to obtain the boundary value of the dark connected region to determine that it is a backlight region.
本申请通过对所述各像素的颜色是趋近于白色还是趋近于黑色, 连通 所有趋近于黑色的区域, 获得暗色连通区域。 本申请通过确定所述暗色连 通区域的边界值, 确定最终的暗色联通区域为逆光区域。  The present application obtains a dark-colored connected region by connecting all the regions that are close to black to whether the color of each pixel approaches white or black. In this application, by determining the boundary value of the dark-colored connected area, it is determined that the final dark-colored connected area is a backlit area.
由此可知, 本申请实施例获得图像在 HSL色彩空间下的各像素的色 彩明度值, 并根据所述各像素的色彩明度值判断所述各像素的颜色趋近于 白色或者趋近于黑色, 对所述各像素的颜色进行遍历, 获得暗色连通区域 的边界值以确定其为逆光区域。 本申请实施例便于用户根据各像素的色彩 明度值判断像素颜色, 从而确定暗色连通区域的边界值以确定逆光区域。 从而针对逆光区域进行优化, 提升照片或者视频中的图像质量。  It can be known from this that that the embodiment of the present application obtains the color lightness value of each pixel in the HSL color space of the image, and judges that the color of each pixel approaches white or black based on the color brightness value of each pixel The color of each pixel is traversed to obtain the boundary value of the dark connected area to determine that it is a backlight area. The embodiment of the present application is convenient for a user to judge a pixel color according to a color brightness value of each pixel, thereby determining a boundary value of a dark-colored connected area to determine a backlight region. This optimizes the backlight area and improves the image quality in photos or videos.
本实施例的识别逆光区域方法可以由任意适当的具有识别逆光区域能 力的设备执行, 包括但不限于: 各种设备终端或者服务端, 包括但不限于 PC机、 平板电脑、 移动终端等。  The method for identifying a backlight region in this embodiment may be performed by any appropriate device having the ability to identify a backlight region, including but not limited to: various device terminals or servers, including but not limited to a PC, a tablet computer, a mobile terminal, and the like.
实施例四 Embodiment 4
本实施例包括上述空间转换模块 401、 色彩确定模块 402、 区域确定 模块 403。 参见图 5, 所述区域确定模块 403包括:  This embodiment includes the aforementioned space conversion module 401, a color determination module 402, and an area determination module 403. Referring to FIG. 5, the area determining module 403 includes:
颜色遍历单元 4031, 配置用于对所述图像中各像素的颜色进行依次 遍历, 获得所述像素颜色均趋近于黑色的暗色连通区域。  The color traversal unit 4031 is configured to sequentially traverse the colors of the pixels in the image to obtain a dark connected area in which the colors of the pixels are close to black.
统计合并单元 4032 , 配置用于合并所述暗色连通区域, 统计得到合 并的暗色连通区域的边界以确定其为逆光区域。  The statistical merging unit 4032 is configured to merge the dark connected areas, and statistically obtain the boundaries of the merged dark connected areas to determine that they are backlit areas.
具体地, 本申请实施例通过对所述图像中各像素的颜色依次进行遍 历, 得到各个像素颜色是趋近于黑色还是趋近于白色。 如果趋近于黑色, 则将所述像素进行连通, 获得所述像素颜色均为黑色的暗色连通区域。 Specifically, in the embodiment of the present application, the color of each pixel in the image is sequentially processed. Over time, it is obtained whether the color of each pixel approaches black or white. If it approaches black, the pixels are connected to obtain a dark connected area where the pixel colors are all black.
参见图 6, 所述颜色遍历单元 4031包括:  Referring to FIG. 6, the color traversal unit 4031 includes:
遍历子单元 4031 1, 配置用于对所述图像中各像素的颜色以列或者行 进行依次遍历, 对比每一列或者每一行中的各像素的颜色;  The traversal subunit 4031 1 is configured to sequentially traverse the color of each pixel in the image in a column or a row, and compare the color of each pixel in each column or each row;
连通子单元 40312, 配置用于根据对比获得的所述各像素的颜色, 得 到所述像素颜色均为黑色的暗色连通区域。  The connected sub-unit 40312 is configured to obtain the color of each pixel obtained according to the comparison, and obtain a dark connected area where the pixel colors are all black.
由于像素都是逐行或者逐列排列的, 因此对所述图像中各像素的颜色 以列或者行进行依次遍历, 从而保证对各像素进行遍历的同时提高遍历的 效率, 便于连通暗色连通区域。  Since the pixels are arranged row by row or column by column, the color of each pixel in the image is sequentially traversed in columns or rows, thereby ensuring that the traversal of each pixel improves the efficiency of the traversal and facilitates the connection of the dark connected areas.
由于比对各像素的颜色得到相邻像素是否能够构成暗色连通区域, 因 此通过所述比对获得的像素颜色即可得到所述像素颜色均为黑色的暗色连 通区域。  Since the colors of the respective pixels are compared to determine whether adjacent pixels can form a dark connected area, the pixel colors obtained by the comparison can be used to obtain a dark connected area where the pixel colors are all black.
所述连通子单元 40312具体配置用于:  The connected sub-unit 40312 is specifically configured to:
采用漫水填充算法根据所述各像素的颜色, 得到所述像素颜色均为黑 色的暗色连通区域。  A flood-filling algorithm is used to obtain a dark connected area where the pixel colors are all black according to the colors of the pixels.
漫水填充算法 ( flood fill algorithm ) 顾名思义就像洪水漫过一样, 把 一块连通的区域填满, 当然水要能漫过需要满足一定的条件, 可以理解为 满足条件的地方就是低洼的地方, 水才能流过去。 在图像处理中就是给定 一个种子点作为起始点, 向附近相邻的像素点扩散, 把颜色相同或者相近 的所有点都找出来, 并填充上新的颜色, 这些点形成一个连通的区域。 漫 水填充算法可以用来标记或者分离图像的一部分, 可实现类似 Windows 画图油漆桶功能, 或者 PS里面的魔棒选择功能。  The flood fill algorithm, as the name suggests, fills a connected area like a flood. Of course, if the water can flow over, it needs to meet certain conditions. It can be understood that the place that meets the conditions is the low-lying place. Water To flow through. In image processing, a seed point is given as a starting point, and it is diffused to neighboring pixels, and all points with the same or similar colors are found out and filled with new colors. These points form a connected area. The flooding algorithm can be used to mark or separate a part of the image, and it can implement functions similar to the Windows paint bucket, or the magic wand selection function in PS.
漫水填充算法实现最常见有四邻域像素填充法, 八邻域像素填充法, 基于扫描线的填充方法。 根据代码实现方式又可以分为递归与非递归。  The flood fill algorithm is most commonly implemented with four neighborhood pixel fill methods, eight neighborhood pixel fill methods, and scan line based fill methods. According to the code implementation can be divided into recursive and non-recursive.
本申请实施例采用类似油漆桶或者魔棒的漫水填充算法来获得所述像 素颜色均为黑色的暗色连通区域。 本申请实施例可以把暗色连通区域同其 他区域分割开来, 且保证操作的准确性和简便性。  In the embodiment of the present application, a flooded filling algorithm similar to a paint bucket or a magic wand is used to obtain a dark connected area where the pixel colors are black. The embodiment of the present application can separate the dark connected area from other areas, and ensure the accuracy and simplicity of operation.
本申请对所述暗色连通区域进行合并, 并统计合并得到的暗色连通区 域的边界, 根据所述边界确定逆光区域。  This application combines the dark connected areas, and calculates the boundaries of the dark connected areas obtained by the combination, and determines the backlight area according to the boundaries.
所述统计合并单元具体配置用于: 如所述像素的色彩明度值与相邻像素的色彩明度值相差大于预设值, 则确定所述像素为逆光区域的边界像素。 The statistical merging unit is specifically configured to: If the difference between the color lightness value of the pixel and the color lightness value of an adjacent pixel is greater than a preset value, it is determined that the pixel is a boundary pixel of the backlight region.
由于逆光拍摄的情况下, 发光源处于远端, 被拍摄的物体处于中间, 相机位于最前方。 所以逆光的图像, 背景和前景会有很明晰的界限。 本申 请实施例通过像素的色彩明度值与相邻像素的色彩明度值相差大于预设值 确定所述像素是否为边界像素, 从而确定所述暗色连通区域的边界值。  In the case of backlight shooting, the light source is at the far end, the subject is in the middle, and the camera is at the forefront. So the backlit image, background and foreground will have very clear boundaries. In the embodiment of the present application, it is determined whether the color brightness value of a pixel differs from the color brightness value of an adjacent pixel by more than a preset value to determine whether the pixel is a boundary pixel, thereby determining the boundary value of the dark connected area.
因此, 本申请实施例通过所述色彩明度值 (L)进行比较确定合并后的 所述暗色连通区域的边界, 可以准确地将合并后的暗色连通区域同其他区 域区分开来, 确定为逆光区域。  Therefore, in the embodiment of the present application, the color brightness value (L) is compared to determine the boundary of the merged dark-colored connected region, and the merged dark-colored connected region can be accurately distinguished from other regions to be determined as the backlight region. .
具体地, 本申请实施例从所述图像的边界开始, 计算各像素的色彩明 度值 (L)的加权平均值, 不断地向所述图像内部迭代, 直至发现较大差 值, 可以得到所述合并后的暗色连通区域的边界。  Specifically, in the embodiment of the present application, starting from the boundary of the image, the weighted average value of the color lightness value (L) of each pixel is calculated, and iteratively iterates toward the interior of the image until a large difference is found, which can be obtained The boundary of the merged dark connected region.
因此, 本申请通过各像素的色彩明度值 (L)的加权平均值, 不段进行 内部迭代, 利用加权平均值的差值来获得是否边界像素的判断可以实现更 加准确的边界像素判定, 从而更加准确的确定逆光区域。  Therefore, this application uses the weighted average of the color lightness value (L) of each pixel to perform internal iteration without segmentation, and uses the difference of the weighted average to determine whether the boundary pixel is determined, which can achieve more accurate boundary pixel determination, and thus more Accurately determine the backlight area.
由此可知, 本申请实施例获得图像在 HSL色彩空间下的各像素的色 彩明度值, 并根据所述各像素的色彩明度值判断所述各像素的颜色趋近于 白色或者趋近于黑色, 对所述各像素的颜色进行遍历, 获得暗色连通区域 的边界值以确定其为逆光区域。 本申请实施例便于用户根据各像素的色彩 明度值判断像素颜色, 从而确定暗色连通区域的边界值以确定逆光区域。 从而针对逆光区域进行优化, 提升照片或者视频中的图像质量。  It can be known from this that that the embodiment of the present application obtains the color lightness value of each pixel in the HSL color space of the image, and judges that the color of each pixel approaches white or black based on the color brightness value of each pixel. The color of each pixel is traversed to obtain the boundary value of the dark connected area to determine that it is a backlight area. The embodiment of the present application is convenient for a user to judge a pixel color according to a color lightness value of each pixel, thereby determining a boundary value of a dark-colored connected area to determine a backlight region. This optimizes the backlight area and improves the image quality in photos or videos.
本实施例的识别逆光区域方法可以由任意适当的具有识别逆光区域能 力的设备执行, 包括但不限于: 各种设备终端或者服务端, 包括但不限于 PC机、 平板电脑、 移动终端等。  The method for identifying a backlight region in this embodiment may be performed by any appropriate device having the ability to identify a backlight region, including but not limited to: various device terminals or servers, including but not limited to a PC, a tablet computer, a mobile terminal, and the like.
实施例五 Example 5
参照图 7, 示出了根据本申请实施例五的一种设备 /终端 /服务器的结 构框图, 本申请具体实施例并不对设备 /终端 /服务器的具体实现做限定。  Referring to FIG. 7, a structural block diagram of a device / terminal / server according to Embodiment 5 of the present application is shown. The specific embodiment of the present application does not limit the specific implementation of the device / terminal / server.
如图 7 所示, 该设备 /终端 /服务器可以包括: 一个或者多个处理器 As shown in Figure 7, the device / terminal / server may include: one or more processors
(processor)702、 存储装置 (memory)704。 (processor) 702, storage device (memory) 704.
其中: 处理器 702, 用于执行程序 706 , 具体可以执行上述识别逆光区域方 法实施例中的相关步骤。 among them: The processor 702 is configured to execute a program 706, and may specifically perform related steps in the foregoing embodiment of the method for identifying a backlight region.
具体地, 程序 706可以包括程序代码, 该程序代码包括计算机操作指 令。  Specifically, the program 706 may include program code, where the program code includes a computer operation instruction.
处理器 702 可能是中央处理器 CPU, 或者是特定集成电路 ASIC ( Application Specific Integrated Circuit ) , 或者是被配置成实施本申请 实施例的一个或多个集成电路。 设备 /终端 /服务器包括的一个或多个处理 器, 可以是同一类型的处理器, 如一个或多个 CPU; 也可以是不同类型的 处理器, 如一个或多个 CPU以及一个或多个 ASIC。  The processor 702 may be a central processing unit CPU, or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application. The device / terminal / server includes one or more processors, which can be processors of the same type, such as one or more CPUs; or different types of processors, such as one or more CPUs and one or more ASICs .
存储装置 704, 用于存放一个或多个程序 706。 存储装置 704可能包 含高速 RAM 存储器, 也可能还包括非易失性存储器 ( non-volatile memory ) , 例如至少一个磁盘存储器。  The storage device 704 is configured to store one or more programs 706. The storage device 704 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
程序 706具体可以用于使得处理器 702执行以下操作: 将获得的图像 进行色彩空间转移, 获得 HSL色彩空间下的所述图像的各像素的色彩明 度值; 根据所述各像素的色彩明度值判断所述各像素的颜色趋近于白色或 者趋近于黑色; 对所述各像素的颜色进行遍历, 获得暗色连通区域的边界 值以确定其为逆光区域。  The program 706 may be specifically configured to cause the processor 702 to perform the following operations: transfer the obtained image to a color space, and obtain a color brightness value of each pixel of the image in an HSL color space; and judge according to the color brightness value of each pixel The color of each pixel approaches white or black; the color of each pixel is traversed to obtain the boundary value of the dark connected region to determine that it is a backlight region.
在一种可选的实施方式中, 程序 706还用于对所述图像中各像素的颜 色进行依次遍历, 获得所述像素颜色均趋近于黑色的暗色连通区域; 合并 所述暗色连通区域, 统计得到合并的暗色连通区域的边界以确定其为逆光 区域。  In an optional implementation manner, the program 706 is further configured to sequentially traverse the colors of the pixels in the image to obtain a dark connected area where the pixel colors all approach black; merge the dark connected areas, The boundaries of the merged dark connected areas are determined to determine that they are backlit areas.
在一种可选的实施方式中, 程序 706还用于对所述图像中各像素的颜 色以列或者行进行依次遍历, 对比每一列或者每一行中的各像素的颜色; 根据对比获得的所述各像素的颜色, 得到所述像素颜色均为黑色的暗色连 通区域。  In an optional implementation manner, the program 706 is further configured to sequentially traverse the colors of each pixel in the image in columns or rows, and compare the colors of each pixel in each column or each row; The color of each pixel is described to obtain a dark connected area where the pixel colors are all black.
在一种可选的实施方式中, 程序 706还用于采用漫水填充算法根据所 述各像素的颜色, 得到所述像素颜色均为黑色的暗色连通区域。  In an optional implementation manner, the program 706 is further configured to use a flood-fill algorithm to obtain a dark connected area where the pixel colors are all black according to the colors of the pixels.
在一种可选的实施方式中, 程序 706还用于如所述像素的色彩明度值 与相邻像素的色彩明度值相差大于预设值, 则确定所述像素为逆光区域的 边界像素。  In an optional implementation manner, the program 706 is further configured to determine that the pixel is a border pixel of a backlight region if the difference between the color brightness value of the pixel and the color brightness value of an adjacent pixel is greater than a preset value.
由此可知, 本申请实施例根据切分规则对获得的图像进行元素切分, 对切分获得的元素特征信息进行处理, 并根据接收的用户指令获得与所述 指令对应的图像元素进行个性化操作。 本申请实施例可以将图像中的图像 元素进行切分, 并针对图像元素进行个性化操作。 本申请实施例便于用户 对灵活的对拍摄或者下载得到的图像中的图像元素进行个性化操作, 令个 性化操作的对象更加丰富, 能够更佳的实现用户操作个性化。 It can be known that the embodiments of the present application perform element segmentation on the obtained image according to the segmentation rule. The segmented element feature information is processed, and an image element corresponding to the instruction is obtained for a personalized operation according to a received user instruction. Embodiments of the present application may segment image elements in an image and perform personalized operations on the image elements. The embodiment of the present application is convenient for a user to flexibly personalize an image element in an image obtained by shooting or downloading, so that the object of the personalized operation is richer, and the user operation can be better personalized.
本申请实施例获得图像在 HSL色彩空间下的各像素的色彩明度值, 并根据所述各像素的色彩明度值判断所述各像素的颜色趋近于白色或者趋 近于黑色, 对所述各像素的颜色进行遍历, 获得暗色连通区域的边界值以 确定其为逆光区域。 本申请实施例便于用户根据各像素的色彩明度值判断 像素颜色, 从而确定暗色连通区域的边界值以确定逆光区域。 从而针对逆 光区域进行优化, 提升照片或者视频中的图像质量。  The embodiment of the present application obtains the color lightness value of each pixel of the image in the HSL color space, and determines, according to the color lightness value of each pixel, that the color of each pixel is closer to white or closer to black. The color of the pixel is traversed to obtain the boundary value of the dark connected area to determine that it is a backlit area. The embodiment of the present application is convenient for a user to judge a pixel color according to a color lightness value of each pixel, so as to determine a boundary value of a dark connected area to determine a backlight area. This optimizes the backlight area and improves the image quality in photos or videos.
需要指出, 根据实施的需要, 可将本申请实施例中描述的各个部件 / 步骤拆分为更多部件 /步骤, 也可将两个或多个部件 /步骤或者部件 /步骤的 部分操作组合成新的部件 /步骤, 以实现本申请实施例的目的。  It should be noted that according to the needs of implementation, each component / step described in the embodiment of the present application may be split into more components / steps, or two or more components / steps or partial operations of components / steps may be combined into New components / steps to achieve the purpose of the embodiments of the present application.
特别地, 根据本公开的实施例, 上文参考流程图描述的过程可以被实 现为计算机软件程序。 例如, 本公开的实施例包括一种计算机程序产品, 其包括承载在计算机可读介质上的计算机程序, 该计算机程序包含用于执 行流程图所示的方法的程序代码。 在这样的实施例中, 该计算机程序可以 通过通信部分从网络上被下载和安装, 和 /或从可拆卸介质被安装。 在该 计算机程序被中央处理单元 (CPU) 执行时, 执行本申请的方法中限定的 上述功能。 需要说明的是, 本申请所述的计算机可读介质可以是计算机可 读信号介质或者计算机可读存储介质或者是上述两者的任意组合。 计算机 可读存储介质例如可以是一一但不限于一一电、 磁、 光、 电磁、 红外线、 或半导体的系统、 装置或器件, 或者任意以上的组合。 计算机可读存储介 质的更具体的例子可以包括但不限于: 具有一个或多个导线的电连接、 便 携式计算机磁盘、 硬盘、 随机访问存储器 (RAM) 、 只读存储器 (ROM) 、 可擦式可编程只读存储器 (EPROM或闪存) 、 光纤、 便携式 紧凑磁盘只读存储器 (CD-ROM) 、 光存储器件、 磁存储器件、 或者上述 的任意合适的组合。 在本申请中, 计算机可读存储介质可以是任何包含或 存储程序的有形介质, 该程序可以被指令执行系统、 装置或者器件使用或 者与其结合使用。 而在本申请中, 计算机可读的信号介质可以包括在基带 中或者作为载波一部分传播的数据信号, 其中承载了计算机可读的程序代 码。 这种传播的数据信号可以采用多种形式, 包括但不限于电磁信号、 光 信号或上述的任意合适的组合。 计算机可读的信号介质还可以是计算机可 读存储介质以外的任何计算机可读介质, 该计算机可读介质可以发送、 传 播或者传输用于由指令执行系统、 装置或者器件使用或者与其结合使用的 程序。 计算机可读介质上包含的程序代码可以用任何适当的介质传输, 包 括但不限于: 无线、 电线、 光缆、 RF等等, 或者上述的任意合适的组 合。 In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart may be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product including a computer program carried on a computer-readable medium, the computer program containing program code for performing a method shown in a flowchart. In such an embodiment, the computer program may be downloaded and installed from a network through a communication section, and / or installed from a removable medium. When the computer program is executed by a central processing unit (CPU), the aforementioned functions defined in the method of the present application are executed. It should be noted that the computer-readable medium described in this application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the foregoing. The computer-readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable memories Programming read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing. In this application, a computer-readable storage medium may be any tangible medium containing or storing a program, and the program may be used by or in combination with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium may include a data signal that is included in baseband or propagated as part of a carrier wave, which carries a computer-readable program code code. Such a propagated data signal may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, and the computer-readable medium may send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device . Program code embodied on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
可以以一种或多种程序设计语言或其组合来编写用于执行本申请的操 作的计算机程序代码, 所述程序设计语言包括面向对象的程序设计语言一 诸如 Java , Smalltalk , C++, 还包括常规的过程式程序设计语言一诸 如” C”语言或类似的程序设计语言。 程序代码可以完全地在用户计算机上 执行、 部分地在用户计算机上执行、 作为一个独立的软件包执行、 部分在 用户计算机上部分在远程计算机上执行、 或者完全在远程计算机或服务器 上执行。 在涉及远程计算机的情形中, 远程计算机可以通过任意种类的网 络—包括局域网 (LAN)或广域网 (WAN)—连接到用户计算机, 或者, 可 以连接到外部计算机 (例如利用因特网服务提供商来通过因特网连接) 。  Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, the programming languages including an object-oriented programming language such as Java, Smalltalk, C ++, and also conventional A procedural programming language such as "C" or a similar programming language. The program code can be executed entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer, partly on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as through the Internet using an Internet service provider) Connection).
附图中的流程图和框图, 图示了按照本申请各种实施例的系统、 方法 和计算机程序产品的可能实现的体系架构、 功能和操作。 在这点上, 流程 图或框图中的每个方框可以代表一个模块、 程序段、 或代码的一部分, 该 模块、 程序段、 或代码的一部分包含一个或多个用于实现规定的逻辑功能 的可执行指令。 也应当注意, 在有些作为替换的实现中, 方框中所标注的 功能也可以以不同于附图中所标注的顺序发生。 例如, 两个接连地表示的 方框实际上可以基本并行地执行, 它们有时也可以按相反的顺序执行, 这 依所涉及的功能而定。 也要注意的是, 框图和 /或流程图中的每个方框、 以及框图和 /或流程图中的方框的组合, 可以用执行规定的功能或操作的 专用的基于硬件的系统来实现, 或者可以用专用硬件与计算机指令的组合 来实现。  The flowchart and block diagrams in the accompanying drawings illustrate the architecture, functions, and operations of possible implementations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a portion of a code, which module, program segment, or part of the code contains one or more functions for implementing a specified logical function Executable instructions. It should also be noted that in some alternative implementations, the functions marked in the blocks may also occur in a different order than those marked in the drawings. For example, two blocks represented one after the other may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented in a dedicated hardware-based system that performs the specified function or operation. Or, it can be implemented by a combination of dedicated hardware and computer instructions.
描述于本申请实施例中所涉及到的单元可以通过软件的方式实现, 也 可以通过硬件的方式来实现。 所描述的单元也可以设置在处理器中, 例 如, 可以描述为: 一种处理器包括接收单元、 解析单元、 信息选取单元和 生成单元。 其中, 这些单元的名称在某种情况下并不构成对该单元本身的 限定, 例如, 接收单元还可以被描述为“接收用户的网页浏览请求的单 元”。 The units described in the embodiments of the present application may be implemented in a software manner, or may be implemented in a hardware manner. The described unit may also be provided in a processor, for example, it may be described as: A processor includes a receiving unit, a parsing unit, an information selecting unit, and a generating unit. Wherein, the names of these units do not constitute a limitation on the unit itself in some cases, for example, the receiving unit may also be described as a "receiving a user's web browsing request. Yuan. "
作为另一方面, 本申请还提供了一种计算机可读存储介质, 其上存储 有计算机程序, 该程序被处理器执行时实现如上述任一实施例中所描述的 方法。  As another aspect, the present application also provides a computer-readable storage medium having stored thereon a computer program, which is executed by a processor to implement a method as described in any one of the foregoing embodiments.
作为另一方面, 本申请还提供了一种计算机可读介质, 该计算机可读 介质可以是上述实施例中描述的装置中所包含的; 也可以是单独存在, 而 未装配入该装置中。 上述计算机可读介质承载有一个或者多个程序, 当上 述一个或者多个程序被该装置执行时, 使得该装置: 根据切分规则对获得 的图像进行元素切分, 得到图像中的元素特征信息; 对所述元素特征信息 进行处理, 得到所述元素特征信息对应的图像元素; 根据接收的用户指令 获得与所述指令对应的图像元素, 并根据所述图像元素进行个性化操作。  As another aspect, the present application further provides a computer-readable medium, which may be included in the device described in the foregoing embodiments; or may exist alone without being assembled into the device. The above computer-readable medium carries one or more programs, and when the one or more programs are executed by the device, the device is caused to: perform element segmentation on the obtained image according to a segmentation rule to obtain element feature information in the image Processing the element feature information to obtain an image element corresponding to the element feature information; obtaining an image element corresponding to the instruction according to a received user instruction, and performing a personalized operation according to the image element.
以上描述仅为本申请的较佳实施例以及对所运用技术原理的说明。 本 领域技术人员应当理解, 本申请中所涉及的发明范围, 并不限于上述技术 特征的特定组合而成的技术方案, 同时也应涵盖在不脱离上述发明构思的 情况下, 由上述技术特征或其等同特征进行任意组合而形成的其它技术方 案。 例如上述特征与本申请中公开的 (但不限于) 具有类似功能的技术特 征进行互相替换而形成的技术方案。  The above description is only a preferred embodiment of the present application and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to the technical solution of the specific combination of the above technical features, but also covers the above technical features or Other technical solutions formed by arbitrarily combining their equivalent features. For example, the technical solution formed by replacing the above features with the technical features disclosed in this application (but not limited to) with similar functions.

Claims

权利要求书 Claim
1、 一种识别逆光区域方法, 其特征在于, 所述方法包括:  1. A method for identifying a backlight region, characterized in that the method includes:
将获得的图像进行色彩空间转移, 获得 HSL色彩空间下的所述图像 的各像素的色彩明度值;  Color space transfer the obtained image to obtain the color lightness value of each pixel of the image in the HSL color space;
根据所述各像素的色彩明度值判断所述各像素的颜色趋近于白色或者 趋近于黑色;  Determining, according to the color lightness value of each pixel, that the color of each pixel is closer to white or closer to black;
对所述各像素的颜色进行遍历, 获得暗色连通区域的边界值以确定其 为逆光区域。  The color of each pixel is traversed to obtain the boundary value of the dark connected area to determine that it is a backlight area.
2、 根据权利要求 1 所述的方法, 其特征在于, 所述对所述各像素的 颜色进行遍历, 获得暗色连通区域的边界值以确定其为逆光区域包括: 对所述图像中各像素的颜色进行依次遍历, 获得所述像素颜色均趋近 于黑色的暗色连通区域;  2. The method according to claim 1, wherein the step of traversing the colors of the pixels to obtain the boundary value of the dark connected region to determine that it is a backlight region comprises: The colors are sequentially traversed to obtain a dark connected area where the pixel colors all approach black.
合并所述暗色连通区域, 统计得到合并的暗色连通区域的边界以确定 其为逆光区域。  The dark connected areas are merged, and the boundaries of the merged dark connected areas are statistically determined to determine that they are backlit areas.
3、 根据权利要求 2所述的方法, 其特征在于, 所述对所述图像中各 像素的颜色进行依次遍历, 获得所述像素颜色均趋近于黑色的暗色连通区 域包括:  3. The method according to claim 2, wherein the step of sequentially traversing the colors of the pixels in the image to obtain a dark connected area where the pixel colors all approach black.
对所述图像中各像素的颜色以列或者行进行依次遍历, 对比每一列或 者每一行中的各像素的颜色;  Traverse the color of each pixel in the image in a column or a row, and compare the color of each pixel in each column or each row;
根据对比获得的所述各像素的颜色, 得到所述像素颜色均为黑色的暗 色连通区域。  According to the colors of the pixels obtained by comparison, a dark connected area where the pixel colors are all black is obtained.
4、 根据权利要求 3 所述的方法, 其特征在于, 所述根据对比获得的 所述各像素的颜色, 得到所述像素颜色均为黑色的暗色连通区域具体为: 采用漫水填充算法根据所述各像素的颜色, 得到所述像素颜色均为黑 色的暗色连通区域。  4. The method according to claim 3, wherein the obtaining the dark connected area where the pixel colors are black based on the colors of the pixels obtained according to the comparison is specifically: The color of each pixel is described to obtain a dark connected area where the pixel colors are all black.
5、 根据权利要求 2所述的方法, 其特征在于, 所述合并所述暗色连 通区域, 统计得到合并的暗色连通区域的边界以确定其为逆光区域具体 为:  5. The method according to claim 2, wherein the merging the dark-colored connected regions, and obtaining the boundaries of the merged dark-colored connected regions to determine that they are backlit regions are specifically:
如所述像素的色彩明度值与相邻像素的色彩明度值相差大于预设值, 则确定所述像素为逆光区域的边界像素。  If the difference between the color lightness value of the pixel and the color lightness value of an adjacent pixel is greater than a preset value, it is determined that the pixel is a boundary pixel of the backlight region.
6、 一种识别逆光区域装置, 其特征在于, 所述装置包括: 空间转换模块, 配置用于将获得的图像进行色彩空间转移, 获得 HSL色彩空间下的所述图像的各像素的色彩明度值; 6. A device for identifying a backlight region, characterized in that the device includes: A space conversion module configured to perform color space transfer on the obtained image to obtain a color brightness value of each pixel of the image in an HSL color space;
色彩确定模块, 配置用于根据所述各像素的色彩明度值判断所述各像 素的颜色趋近于白色或者趋近于黑色;  A color determining module configured to determine that the color of each pixel approaches white or black according to the color lightness value of each pixel;
区域确定模块, 配置用于对所述各像素的颜色进行遍历, 获得暗色连 通区域的边界值以确定其为逆光区域。  The area determination module is configured to traverse the colors of the pixels to obtain the boundary value of the dark-colored continuous area to determine that it is a backlight area.
7、 根据权利要求 6所述的装置, 其特征在于, 所述区域确定模块包 括:  7. The device according to claim 6, wherein the area determining module comprises:
颜色遍历单元, 配置用于对所述图像中各像素的颜色进行依次遍历, 获得所述像素颜色均趋近于黑色的暗色连通区域;  A color traversal unit configured to sequentially traverse the color of each pixel in the image to obtain a dark connected area where the color of each pixel approaches black.
统计合并单元, 配置用于合并所述暗色连通区域, 统计得到合并的暗 色连通区域的边界以确定其为逆光区域。  The statistical merging unit is configured to merge the dark connected areas, and statistically obtain the boundaries of the merged dark connected areas to determine that they are backlit areas.
8、 根据权利要求 7所述的装置, 其特征在于, 所述颜色遍历单元包 括:  8. The device according to claim 7, wherein the color traversal unit comprises:
遍历子单元, 配置用于对所述图像中各像素的颜色以列或者行进行依 次遍历, 对比每一列或者每一行中的各像素的颜色;  A traversal subunit configured to sequentially traverse the color of each pixel in the image in columns or rows, and compare the color of each pixel in each column or each row;
连通子单元, 配置用于根据对比获得的所述各像素的颜色, 得到所述 像素颜色均为黑色的暗色连通区域。  The connected subunits are configured to obtain the dark connected areas where the pixel colors are all black according to the colors of the pixels obtained by comparison.
9、 根据权利要求 8所述的装置, 其特征在于, 所述连通子单元具体 配置用于:  9. The device according to claim 8, wherein the connected sub-unit is specifically configured to:
采用漫水填充算法根据所述各像素的颜色, 得到所述像素颜色均为黑 色的暗色连通区域。  A flood-filling algorithm is used to obtain a dark connected area where the pixel colors are all black according to the colors of the pixels.
10、 根据权利要求 7所述的装置, 其特征在于, 所述统计合并单元具 体配置用于:  10. The apparatus according to claim 7, wherein the statistical merging unit is specifically configured to:
如所述像素的色彩明度值与相邻像素的色彩明度值相差大于预设值, 则确定所述像素为逆光区域的边界像素。  If the difference between the color lightness value of the pixel and the color lightness value of an adjacent pixel is greater than a preset value, it is determined that the pixel is a boundary pixel of the backlight region.
1 1、 一种设备 /终端 /服务器, 包括:  1 1. A device / terminal / server, including:
一个或多个处理器;  One or more processors;
存储装置, 用于存储一个或多个程序,  A storage device for storing one or more programs,
当所述一个或多个程序被所述一个或多个处理器执行, 使得所述一个 或多个处理器实现如权利要求 1-5中任一所述的方法。 When the one or more programs are executed by the one or more processors, such that the one The processor or processors implement the method of any of claims 1-5.
12、 一种计算机可读存储介质, 其上存储有计算机程序, 其特征在 于, 该程序被处理器执行时实现如权利要求 1 -5中任一所述的方法。  12. A computer-readable storage medium having stored thereon a computer program, characterized in that, when the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
PCT/IB2018/056488 2018-08-17 2018-08-27 Method and apparatus for identifying backlighting region, and device/terminal/server WO2020035723A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810943188.1 2018-08-17
CN201810943188.1A CN109246399A (en) 2018-08-17 2018-08-17 A kind of identification backlight region method, device and equipment/terminal/server

Publications (1)

Publication Number Publication Date
WO2020035723A1 true WO2020035723A1 (en) 2020-02-20

Family

ID=65069715

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/IB2018/056488 WO2020035723A1 (en) 2018-08-17 2018-08-27 Method and apparatus for identifying backlighting region, and device/terminal/server

Country Status (2)

Country Link
CN (1) CN109246399A (en)
WO (1) WO2020035723A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113469923A (en) * 2021-05-28 2021-10-01 北京达佳互联信息技术有限公司 Image processing method and device, electronic equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100476874C (en) * 2003-07-31 2009-04-08 佳能株式会社 Image processing method and apparatus
CN101833749A (en) * 2009-03-12 2010-09-15 株式会社理光 Device and method for detecting shadow in image

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101854432B1 (en) * 2011-06-23 2018-05-03 삼성전자주식회사 Method and apparatus for detecting and compensating back light frame
CN103916603B (en) * 2013-01-07 2019-01-15 华为终端(东莞)有限公司 Backlighting detecting and equipment
CN103646392B (en) * 2013-11-21 2016-10-26 华为技术有限公司 Backlighting detecting and equipment
CN106791471B (en) * 2016-12-29 2021-07-20 宇龙计算机通信科技(深圳)有限公司 Image optimization method, image optimization device and terminal
CN107451969B (en) * 2017-07-27 2020-01-10 Oppo广东移动通信有限公司 Image processing method, image processing device, mobile terminal and computer readable storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100476874C (en) * 2003-07-31 2009-04-08 佳能株式会社 Image processing method and apparatus
CN101833749A (en) * 2009-03-12 2010-09-15 株式会社理光 Device and method for detecting shadow in image

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
ANDRE, P.: "Intelligent Flood Fill or: The Use of Edge Detection in Image Object Extraction", 2005, XP055685972, Retrieved from the Internet <URL:https://eprints.soton.ac.uk/263996/1/fullreport.pdf> *
Retrieved from the Internet <URL:http://oversea.cnki.net/kcms/detail/detail.aspx?recid=&FileName=1012275517.nh&DbName=CMFD2012&DbCode=CMFD> *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113469923A (en) * 2021-05-28 2021-10-01 北京达佳互联信息技术有限公司 Image processing method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN109246399A (en) 2019-01-18

Similar Documents

Publication Publication Date Title
US8965121B2 (en) Image color matching and equalization devices and related methods
US9451173B2 (en) Electronic device and control method of the same
CN111353948B (en) Image noise reduction method, device and equipment
CN111669502B (en) Target object display method and device and electronic equipment
CN107704798B (en) Image blurring method and device, computer readable storage medium and computer device
CN110069974B (en) Highlight image processing method and device and electronic equipment
CN111260601B (en) Image fusion method and device, readable medium and electronic equipment
WO2014187265A1 (en) Photo-capture processing method, device and computer storage medium
US11893770B2 (en) Method for converting a picture into a video, device, and storage medium
CN113962859B (en) Panorama generation method, device, equipment and medium
CN113989396A (en) Picture rendering method, device, equipment, storage medium and program product
WO2020035723A1 (en) Method and apparatus for identifying backlighting region, and device/terminal/server
US11871137B2 (en) Method and apparatus for converting picture into video, and device and storage medium
CN110689565B (en) Depth map determination method and device and electronic equipment
CN108470327B (en) Image enhancement method and device, electronic equipment and storage medium
CN111292247A (en) Image processing method and device
CN111292276B (en) Image processing method and device
CN110399802B (en) Method, apparatus, medium, and electronic device for processing eye brightness of face image
CN114037716A (en) Image segmentation method, device, equipment and storage medium
CN108924410B (en) Photographing control method and related device
CN112312200A (en) Video cover generation method and device and electronic equipment
CN108683842A (en) A kind of panorama camera and the method and apparatus for exporting panoramic video
CN111292245A (en) Image processing method and device
CN112991188B (en) Image processing method and device, storage medium and electronic equipment
CN116567194B (en) Virtual image synthesis method, device, equipment and storage medium

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: 18930383

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18930383

Country of ref document: EP

Kind code of ref document: A1