CN108875759B - An image processing method, device and server - Google Patents

An image processing method, device and server Download PDF

Info

Publication number
CN108875759B
CN108875759B CN201710326076.7A CN201710326076A CN108875759B CN 108875759 B CN108875759 B CN 108875759B CN 201710326076 A CN201710326076 A CN 201710326076A CN 108875759 B CN108875759 B CN 108875759B
Authority
CN
China
Prior art keywords
small block
color system
value
target
small
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710326076.7A
Other languages
Chinese (zh)
Other versions
CN108875759A (en
Inventor
刘永亮
武洋阳
陈茂林
周剑辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201710326076.7A priority Critical patent/CN108875759B/en
Publication of CN108875759A publication Critical patent/CN108875759A/en
Application granted granted Critical
Publication of CN108875759B publication Critical patent/CN108875759B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2411Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on the proximity to a decision surface, e.g. support vector machines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Data Mining & Analysis (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • General Engineering & Computer Science (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

本发明实施例公开了一种图像处理方法、装置及服务器,用于降低Mask中的背景图像对前景目标造成的干扰。本发明实施例在图像处理过程中,将包含前景目标Mask的边界框划分成多个小块,确定每个小块的色系,针对每种色系,确定该色系对应的缩放系数,将属于该色系的小块中的每个像素的亮度值乘以该缩放系数。本发明实施例能够将Mask分成多个小块,按照色系对小块进行分类,每一类的小块可采用不同的处理方式,同一类的分块采用相同的方式统一处理,以此能够区分出Mask中前景目标和背景图像的颜色值差异较大的小块,并对其进行不同的处理,从而降低Mask中背景图像对前景目标引起的干扰。

Figure 201710326076

The embodiment of the present invention discloses an image processing method, device and server, which are used for reducing the interference caused by the background image in the Mask to the foreground target. In the embodiment of the present invention, in the process of image processing, the bounding box containing the foreground target Mask is divided into a plurality of small blocks, the color system of each small block is determined, and for each color system, the corresponding scaling coefficient of the color system is determined, and the The luminance value of each pixel in a patch belonging to this color family is multiplied by this scaling factor. In the embodiment of the present invention, the Mask can be divided into multiple small blocks, and the small blocks can be classified according to the color system. The small blocks of each type can be processed in different ways, and the blocks of the same type can be uniformly processed in the same way. Distinguish small blocks with large differences in color values between the foreground target and the background image in the Mask, and perform different processing on them, thereby reducing the interference caused by the background image in the Mask to the foreground target.

Figure 201710326076

Description

一种图像处理方法、装置及服务器An image processing method, device and server

技术领域technical field

本申请涉及图像处理领域,尤其涉及一种图像处理方法、装置及服务器。The present application relates to the field of image processing, and in particular, to an image processing method, device and server.

背景技术Background technique

在以图搜图等视频分析的应用中,较准确地获得目标的整体或其一部分的颜色值以提取特征或做相应的处理,是非常关键的技术。In the application of video analysis such as image search, it is a very critical technology to accurately obtain the color value of the whole or part of the target to extract features or perform corresponding processing.

但目前用于确定目标的掩模(Mask)尚未能完全准确框定目标的轮廓,Mask中除了前景目标外,不可避免的会包含一部分背景图像。在一些情况下,这些背景图像对于确定前景目标的颜色会造成很大的噪声干扰。However, the current mask (Mask) used to determine the target has not been able to accurately frame the contour of the target. In addition to the foreground target, the Mask will inevitably contain a part of the background image. In some cases, these background images can be very noisy for determining the color of foreground objects.

但目前的技术无法有效地去除Mask中的背景图像,Mask中都或多或少包含有除前景目标以外的背景图像。因此,在无法获得精准Mask的情况下,在图像的增强处理中,Mask中的背景图像不可避免地会对前景目标造成噪声干扰。However, the current technology cannot effectively remove the background image in the Mask, and the Mask contains more or less background images other than the foreground target. Therefore, in the case where the accurate Mask cannot be obtained, in the image enhancement processing, the background image in the Mask will inevitably cause noise interference to the foreground target.

发明内容SUMMARY OF THE INVENTION

本发明实施例提供了一种图像处理方法、装置及服务器,能够降低Mask中的背景图像对前景目标造成的干扰。The embodiments of the present invention provide an image processing method, device and server, which can reduce the interference caused by the background image in the Mask to the foreground target.

本申请第一方面提供了一种图像处理方法,该方法包括以下步骤:A first aspect of the present application provides an image processing method, which includes the following steps:

将包含前景目标Mask的边界框划分成多个小块,每个小块中包含至少一个像素;再确定所述Mask占用的小块中的每个小块的色系;针对每种色系,确定该色系对应的缩放系数,将上述属于该色系的小块中的每个像素的亮度值乘以所述缩放系数,以对每种色系的小块进行分别处理。Divide the bounding box containing the foreground target Mask into a plurality of small blocks, and each small block contains at least one pixel; then determine the color system of each small block in the small blocks occupied by the Mask; for each color system, A scaling coefficient corresponding to the color system is determined, and the luminance value of each pixel in the small blocks belonging to the color system is multiplied by the scaling coefficient to separately process the small blocks of each color system.

当前景目标和背景图像的颜色值差异很大时,背景图像对前景目标的干扰影响较大。本发明实施例中的图像处理方法基于上述原理,通过将包含前景目标的Mask的边界框进行分块,即对Mask进行了分块,之后,按照色系对分成的小块进行分类,从而区分出前景目标和背景图像中颜色值差异较大的小块,每一类的小块可采用不同的处理方式,同一类的小块采用相同的方式统一处理,以此实现在前景目标和背景图像的颜色值差异较大时,对前景目标和背景图像进行不同的处理,从而降低Mask中背景图像对前景目标引起的干扰。When the color values of the foreground target and the background image are very different, the background image has a great influence on the interference of the foreground target. The image processing method in the embodiment of the present invention is based on the above-mentioned principle, by dividing the bounding box of the Mask containing the foreground target into blocks, that is, dividing the Mask into blocks, and then classifying the divided small blocks according to the color system, so as to distinguish The small blocks with large differences in color values between the foreground target and the background image can be processed in different ways, and the small blocks of the same type can be uniformly processed in the same way, so as to realize the difference between the foreground target and the background image. When the difference in color value is large, different processing is performed on the foreground target and the background image, thereby reducing the interference caused by the background image in the Mask to the foreground target.

可选的,每种色系对应的缩放系数具体可以是一个预先配置的缩放预设值,该缩放预设值为经过实验数据或数据模型训练得到的一个经验值。Optionally, the scaling coefficient corresponding to each color system may specifically be a preconfigured scaling preset value, and the scaling preset value is an empirical value obtained through experimental data or data model training.

可选的,每种色系对应的缩放系数可以是根据该色系的小块的平均亮度值计算获得,具体计算过程为:先确定该色系对应的亮度预期值,计算属于该色系的小块所包含的像素的平均亮度值(第一平均亮度值);计算第一平均亮度值与亮度预期值之间的比值以得到该色系对应的缩放系数。Optionally, the scaling factor corresponding to each color system can be calculated and obtained according to the average brightness value of the small blocks of the color system. The average luminance value (first average luminance value) of the pixels included in the small block; the ratio between the first average luminance value and the expected luminance value is calculated to obtain the scaling factor corresponding to the color system.

可选的,确定Mask占用的小块中的每个小块的色系的方法可以为:针对所述Mask占用的小块中的每个小块,根据所述小块的背景亮度值、所述小块的目标部分的亮度值、所述小块的目标部分的饱和度值和所述小块的目标部分的色调值中的至少一个,确定所述小块的色系。其中,所述小块的背景亮度值是指所述边界框中除所述Mask以外的多个像素的平均亮度值,所述小块的目标部分是指所述小块中属于所述Mask的部分。Optionally, the method for determining the color system of each small block in the small blocks occupied by the Mask may be: for each small block in the small blocks occupied by the Mask, according to the background brightness value of the small block, the The color system of the small block is determined by at least one of the luminance value of the target portion of the small block, the saturation value of the target portion of the small block, and the hue value of the target portion of the small block. The background brightness value of the small block refers to the average brightness value of multiple pixels in the bounding box except the Mask, and the target part of the small block refers to the part of the small block that belongs to the Mask. part.

具体的,根据小块的背景亮度值和小块的目标部分的亮度值确定所述小块的色系的方式为:先获取背景亮度值与光照系数的对应关系;根据该对应关系确定所述小块的背景亮度值对应的光照系数(第一目标光照系数),再将所述小块的目标部分的亮度值乘以第一目标光照系数以得到第一调整亮度值;再根据第一调整亮度值确定所述小块的色系。Specifically, the method of determining the color system of the small block according to the background brightness value of the small block and the brightness value of the target part of the small block is as follows: first obtain the corresponding relationship between the background brightness value and the illumination coefficient; the illumination coefficient corresponding to the background luminance value of the small block (the first target illumination coefficient), and then multiply the luminance value of the target portion of the small block by the first target illumination coefficient to obtain the first adjusted luminance value; and then adjust the luminance according to the first The luminance value determines the color family of the patch.

其中,根据第一调整亮度值确定该小块的色系具体为:通过判断第一调整亮度值是在哪个色系(黑暗色系、白亮色系或有色色系)对应的亮度值范围内来确定其所属的色系。Wherein, determining the color system of the small block according to the first adjusted brightness value is specifically: by judging which color system (dark color system, white light color system or colored color system) the first adjusted brightness value is within the corresponding brightness value range Determine the color family it belongs to.

具体的,根据小块的背景亮度值和小块的目标部分的亮度值确定所述小块的色系的方式为:先获取预置的背景亮度预设值;计算背景亮度预设值与小块的背景亮度值之间的比值以得到第二目标光照系数;将小块的目标部分的亮度值乘以第二目标光照系数以得到第二调整亮度值;根据第二调整亮度值确定所述小块的色系。其中,根据第二调整亮度值确定小块的色系的方法和上述根据第一调整亮度值确定小块的色系的方法可以相同。Specifically, the method of determining the color system of the small block according to the background brightness value of the small block and the brightness value of the target part of the small block is as follows: first obtain a preset background brightness preset value; the ratio between the background luminance values of the blocks to obtain the second target illumination coefficient; multiply the luminance value of the target portion of the small block by the second target illumination coefficient to obtain the second adjusted luminance value; determine the Small blocks of color. The method for determining the color system of the small block according to the second adjusted brightness value may be the same as the above-mentioned method for determining the color system of the small block according to the first adjusted brightness value.

具体的,根据小块的目标部分的饱和度值和小块的目标部分的色调值确定所述小块的色系的方法为:判断该小块的目标部分的色调值是否在某个色系(第一色系)的色调阈值范围内;并判断该小块的目标部分的饱和度值是否在该第一色系的饱和度阈值范围内;若该小块的目标部分的色调值在第一色系的色调阈值范围内,且该小块的目标部分的饱和度值在第一色系的饱和度阈值范围内,则确定该小块的色系属于第一色系。Specifically, the method for determining the color system of the small block according to the saturation value of the target part of the small block and the hue value of the target part of the small block is: judging whether the hue value of the target part of the small block is in a certain color system (the first color system) within the hue threshold range; and determine whether the saturation value of the target part of the small block is within the saturation threshold range of the first color system; if the hue value of the target part of the small block is within the first color range Within the hue threshold range of a color system, and the saturation value of the target portion of the small block is within the saturation threshold range of the first color system, it is determined that the color system of the small block belongs to the first color system.

需要说明的是,该方法可以结合其他方法一起对小块的色系进行判断。It should be noted that this method can be combined with other methods to judge the color system of small blocks.

具体的,根据小块的背景亮度值、小块的目标部分的亮度值、小块的目标部分的饱和度值和小块的目标部分的色调值,确定该小块的色系包括:将该小块的背景亮度值、该小块的目标部分的亮度值、该小块的目标部分的饱和度值和该小块的目标部分的色调值输入参数模型中,以得到该小块的色系。Specifically, according to the background luminance value of the small block, the luminance value of the target portion of the small block, the saturation value of the target portion of the small block, and the hue value of the target portion of the small block, determining the color system of the small block includes: applying the The background luminance value of the small block, the luminance value of the target part of the small block, the saturation value of the target part of the small block and the hue value of the target part of the small block are input into the parameter model to obtain the color system of the small block .

可选的,确定参数模型的方法可以是:获取多组模型训练参数,每组模型训练参数包括色系确定参数和所述色系确定参数对应的色系值,其中色系确定参数包括背景图像的亮度值、选定前景目标的亮度值、选定前景目标的饱和度值和选定前景目标的色调值;将上述多组模型训练参数输入SVM得到参数模型。Optionally, the method for determining the parameter model may be: acquiring multiple sets of model training parameters, each group of model training parameters includes a color system determination parameter and a color system value corresponding to the color system determination parameter, wherein the color system determination parameter includes a background image. The brightness value of the selected foreground target, the brightness value of the selected foreground target, the saturation value of the selected foreground target, and the hue value of the selected foreground target; input the above-mentioned multiple sets of model training parameters into the SVM to obtain a parameter model.

第二方面,本发明实施例还提供一种图像处理装置,具体实现对应于上述第一方面提供的图像处理方法的功能。所述功能可以通过硬件实现,也可以通过硬件执行相应的软件程序实现。硬件和软件包括一个或多个与上述功能相对应的单元模块,所述单元模块可以是软件和/或硬件。In a second aspect, an embodiment of the present invention further provides an image processing apparatus, which specifically implements functions corresponding to the image processing method provided in the first aspect. The functions can be implemented by hardware or by executing corresponding software programs in hardware. The hardware and software include one or more unit modules corresponding to the above functions, and the unit modules may be software and/or hardware.

一种可能的设计中,所述图像处理装置包括:In a possible design, the image processing device includes:

小块划分单元,用于将边界框划分成多个小块,每个小块中包含至少一个像素,所述边界框中包含前景目标的掩膜Mask;a small block dividing unit, configured to divide the bounding box into a plurality of small blocks, each small block contains at least one pixel, and the bounding box contains the mask Mask of the foreground target;

色系判断单元,用于确定所述Mask占用的小块中的每个小块的色系;a color system judgment unit for determining the color system of each small block in the small blocks occupied by the Mask;

缩放系数确定单元,用于针对每种色系,确定所述色系对应的缩放系数;a scaling factor determining unit, configured to determine, for each color system, a scaling factor corresponding to the color system;

亮度调整单元,用于将属于所述色系的小块中的每个像素的亮度值乘以所述缩放系数。A brightness adjustment unit, configured to multiply the brightness value of each pixel in the small block belonging to the color system by the scaling factor.

第三方面,本发明实施例提供了一种服务器,具体实现对应于上述第一方面提供的图像处理方法的功能。本发明实施例中的服务器可以包括:In a third aspect, an embodiment of the present invention provides a server, which specifically implements functions corresponding to the image processing method provided in the first aspect. The server in this embodiment of the present invention may include:

处理器、存储器及网络接口;其中,存储器用于存储程序代码,处理器调用所述存储器中的程序代码,以执行上述第一方面的图像处理方法中的全部或部分步骤。A processor, a memory, and a network interface; wherein, the memory is used to store program codes, and the processor invokes the program codes in the memory to execute all or part of the steps in the image processing method of the first aspect.

第四方面,本申请的提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行上述第一方面所述的方法。In a fourth aspect, the present application provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, when the computer-readable storage medium runs on a computer, the computer executes the method described in the first aspect.

本申请的又一方面提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述第一方面所述的方法。Yet another aspect of the present application provides a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method described in the first aspect above.

从以上技术方案可以看出,因为只有当前景目标和背景图像的颜色值差异很大时,背景图像对前景目标的干扰影响较大,而Mask中的前景目标和背景图像在一定程度上能够通过小块来区分。因此,在本发明实施例的图像处理过程中,先将边界框划分成多个小块,把Mask占用的小块按照色系进行分类,以对前景目标和背景图像的颜色值差异较大的小块进行区分。进而针对每种色系,确定该色系对应的缩放系数,将属于该色系的小块中的每个像素的亮度值乘以所述缩放系数,以对同一类的小块采用相同的方式统一处理,且每一类的小块可以采用不同的处理方式,以此实现对Mask中的前景目标和背景图像差异值较大的像素的不同处理。从而能够降低Mask中背景图像对前景目标引起的干扰。It can be seen from the above technical solutions that only when the color values of the foreground target and the background image are very different, the background image has a great influence on the interference of the foreground target, and the foreground target and the background image in the Mask can pass through to a certain extent. Small pieces to distinguish. Therefore, in the image processing process of the embodiment of the present invention, the bounding box is first divided into a plurality of small blocks, and the small blocks occupied by the Mask are classified according to the color system, so that the color values of the foreground target and the background image are greatly different. Small pieces are distinguished. Then, for each color system, determine the scaling coefficient corresponding to the color system, and multiply the luminance value of each pixel in the small blocks belonging to the color system by the scaling coefficient, so as to use the same method for small blocks of the same type Unified processing, and each type of small blocks can be processed in different ways, so as to achieve different processing of pixels with large difference values between the foreground target and the background image in the Mask. Therefore, the interference caused by the background image in the Mask to the foreground target can be reduced.

附图说明Description of drawings

图1a为本发明实施例中目标行人的边界框示意图;1a is a schematic diagram of a bounding box of a target pedestrian in an embodiment of the present invention;

图1b为本发明实施例中图1a中的目标行人的Mask示意图;FIG. 1b is a schematic diagram of the Mask of the target pedestrian in FIG. 1a in an embodiment of the present invention;

图2为本发明实施例中的图像处理系统示意图;2 is a schematic diagram of an image processing system in an embodiment of the present invention;

图3为本发明实施例中的图像处理方法流程图;3 is a flowchart of an image processing method in an embodiment of the present invention;

图4为本发明实施例中的对图1b中的目标行人的Mask的分块示意图;FIG. 4 is a block schematic diagram of the Mask of the target pedestrian in FIG. 1 b according to an embodiment of the present invention;

图5为本发明实施例中的判断色系时使用的一组帧图像;Fig. 5 is a group of frame images used when judging the color system in the embodiment of the present invention;

图6为本发明实施例中的图像处理装置的一种功能模块结构示意图;6 is a schematic structural diagram of a functional module of an image processing apparatus in an embodiment of the present invention;

图7为本发明实施例中的服务器的硬件结构示意图。FIG. 7 is a schematic diagram of a hardware structure of a server in an embodiment of the present invention.

具体实施方式Detailed ways

以下结合附图对本发明实施例进行进一步详细说明。The embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.

Mask中除了包含前景目标外,不可避免地包含背景噪声,背景噪声即为Mask中除前景目标以外的背景图像。由于Mask中包含背景噪声,并且很难有效地去除这些背景噪声。在一些情况下,例如:前景目标为黑色或者白色,而背景图像的亮度值与前景目标的亮度值差异较大时,这些背景噪声对于确定前景目标的颜色具有很大的干扰。In addition to the foreground target, the Mask inevitably contains background noise, and the background noise is the background image except the foreground target in the Mask. Since Mask contains background noise, it is difficult to remove these background noises effectively. In some cases, for example, when the foreground object is black or white, and the brightness value of the background image is quite different from the brightness value of the foreground object, these background noises have great interference in determining the color of the foreground object.

如图1a为一帧图像中的目标行人(即前景目标)的边界框(Bounding Box),其中,边界框是指包含前景目标的矩形框,一般来说,是包含前景目标的Mask的最小矩形框。图1b为图1a中的目标行人的Mask。从图1b中可以看出,Mask中包含了行人两腿之间的背景和脚下的影子,这些背景图像不应该包含在Mask中,这些背景图像会成为背景噪声,对确定目标行人的颜色造成干扰。Figure 1a shows the bounding box (Bounding Box) of the target pedestrian (that is, the foreground target) in a frame of image, wherein the bounding box refers to the rectangular box containing the foreground target. Generally speaking, it is the smallest rectangle of the Mask containing the foreground target. frame. Figure 1b is the Mask of the target pedestrian in Figure 1a. As can be seen from Figure 1b, the Mask contains the background between the pedestrian's legs and the shadow under the foot. These background images should not be included in the Mask. These background images will become background noise and interfere with determining the color of the target pedestrian. .

例如,临近目标行人脚部的单个像素点的像素值为(0,0,1),如果Mask中包含的背景地面(临近脚部附近)的像素点与行人临近脚部的像素点数量比例是1:3,那么这些像素点的平均像素值就可能为(48,47,50),这远远偏离的了目标行人脚部本应有的平均像素值(0,0,1),会导致很大的偏差。For example, the pixel value of a single pixel near the foot of the target pedestrian is (0, 0, 1). If the ratio of the pixels on the background ground (near the foot) contained in the Mask to the number of pixels near the foot of the pedestrian is 1:3, then the average pixel value of these pixels may be (48, 47, 50), which is far away from the average pixel value (0, 0, 1) of the target pedestrian’s foot, which will lead to big deviation.

因此,本申请的目的是在Mask不够准确,Mask中包含有背景噪声的情况下,尽可能降低背景噪声对图像增强处理造成的干扰。Therefore, the purpose of this application is to reduce the interference of the background noise on the image enhancement processing as much as possible when the Mask is not accurate enough and the Mask contains background noise.

当Mask中的前景目标和背景图像的颜色值差异不大时,背景噪声对前景目标的影响会很有限,很可能不需要区分;只有当前景目标和背景图像的颜色值差异很大时,背景噪声对前景目标的干扰影响较大。因此,只需要对前景目标和背景图像的颜色值差异较大的像素进行区分,进行降噪处理,即可以避免背景图像对前景目标的干扰。When the color values of the foreground target and the background image in Mask are not very different, the impact of background noise on the foreground target will be very limited, and it may not be necessary to distinguish; only when the color values of the foreground target and the background image are very different, the background Noise has a great influence on the interference of foreground targets. Therefore, it is only necessary to distinguish the pixels with a large difference in color value between the foreground object and the background image, and perform noise reduction processing, so as to avoid the interference of the background image to the foreground object.

本发明实施例中的图像处理方法基于上述原理,通过将Mask中的像素进行分块,将其分成多个小块,把分块(即小块)按照色系进行分类,从而区分出前景目标和背景图像中颜色值差异较大的分块,每一类的分块可采用不同的处理方式,同一类的分块采用相同的方式统一处理,以此实现在前景目标和背景图像的颜色值差异较大时,对前景目标和背景图像进行不同的处理,从而降低Mask中背景图像对前景目标引起的干扰。The image processing method in the embodiment of the present invention is based on the above-mentioned principle. By dividing the pixels in the Mask into blocks, dividing them into multiple small blocks, and classifying the blocks (ie, small blocks) according to the color system, the foreground target is distinguished. The blocks with large differences in color values from the background image, each type of block can be processed in different ways, and the blocks of the same type are processed uniformly in the same way, so as to achieve the color value of the foreground target and the background image. When the difference is large, different processing is performed on the foreground target and the background image, thereby reducing the interference caused by the background image in the Mask to the foreground target.

本发明实施例中的图像处理方法可以由网络设备执行,网络设备具体可以是各种形式的计算机设备,包括服务器、服务器集群、或是具有通信功能的终端设备。The image processing method in the embodiment of the present invention may be executed by a network device, and the network device may specifically be various forms of computer devices, including a server, a server cluster, or a terminal device with a communication function.

本发明实施例为了描述方便,以网络设备为服务器或服务器集群为例对本发明实施例中的方法进行说明。For convenience of description in the embodiments of the present invention, the method in the embodiments of the present invention is described by taking the network device as a server or a server cluster as an example.

如图2所示,实现本发明实施例中实现图像处理方法的图像处理系统主要包括服务器和客户端设备两个网元。As shown in FIG. 2 , the image processing system for implementing the image processing method in the embodiment of the present invention mainly includes two network elements, a server and a client device.

图2中的服务器可以是单个服务器,也可以是分布式部署的服务器集群。客户端设备可以为各种形式的计算机设备或用户设备,例如:手机、平板电脑、个人电脑(PersonalComputer,PC)等终端设备。The server in Figure 2 can be a single server or a distributed deployed server cluster. The client equipment may be various forms of computer equipment or user equipment, such as terminal equipment such as a mobile phone, a tablet computer, and a personal computer (Personal Computer, PC).

客户端设备通过网络与服务器进行通信,客户端设备向服务器发送图像处理请求。本发明实施例以图像处理请求为对视频中的图像处理为例进行说明,实际应用中,图像处理请求不一定是对视频中的图像进行处理,还可以是存储器中存储的单张或多张图像进行处理。The client device communicates with the server through the network, and the client device sends an image processing request to the server. The embodiments of the present invention are described by taking the image processing request as an example of processing an image in a video. In practical applications, an image processing request may not necessarily be processing an image in a video, but may also be a single or multiple images stored in a memory. image is processed.

服务器在进行视频图像处理时,通过视频内容管理程序执行客户端设备的图像处理请求,图像处理请求可以是图像增强处理,或光照处理等。之后,服务器将视频内容管理模块的图像处理结果返回给客户端设备。When the server performs video image processing, the video content management program executes the image processing request of the client device, and the image processing request may be image enhancement processing, lighting processing, or the like. After that, the server returns the image processing result of the video content management module to the client device.

如图2所示,服务器中的视频内容管理程序包括管理模块和视频分析模块。As shown in Figure 2, the video content management program in the server includes a management module and a video analysis module.

其中,管理模块负责执行调度请求、资源管理和数据检索等功能。Among them, the management module is responsible for performing functions such as scheduling requests, resource management, and data retrieval.

视频分析模块用于执行视频分析的功能,其包含图像预处理模块。图像预处理模块包含去除背景噪声模块及色系判断模块,去除背景噪声模块和色系判断模块具体用于执行本申请的方法实施例中的方法步骤。The video analysis module is used to perform the function of video analysis, which includes an image preprocessing module. The image preprocessing module includes a background noise removal module and a color system judgment module, and the background noise removal module and the color system judgment module are specifically used to execute the method steps in the method embodiments of the present application.

图像预处理模块将视频分析模块从存储模块读取的图像进行预处理并返回预处理的结果给视频分析模块中的核心分析模块,预处理的结果经由视频分析模块的核心分析模块进一步处理后,得到处理结果,最后服务器将处理结果返回给客户端设备。The image preprocessing module preprocesses the image read from the storage module by the video analysis module and returns the preprocessing result to the core analysis module in the video analysis module. After the preprocessing result is further processed by the core analysis module of the video analysis module, The processing result is obtained, and finally the server returns the processing result to the client device.

需要说明的是,图2所示的图像处理系统仅仅是一种示例,在实际应用中,图像处理系统的网元组成以及部署方式可以根据具体的应用场景而定。另外,图2中的视频内容管理程序中的功能模块划分也仅仅一种示例,仅为了说明视频图像处理的过程。It should be noted that the image processing system shown in FIG. 2 is only an example, and in practical applications, the network element composition and deployment manner of the image processing system may be determined according to specific application scenarios. In addition, the division of functional modules in the video content management program in FIG. 2 is only an example, which is only for explaining the process of video image processing.

下面结合图3对本发明实施例中的图像处理方法进行详细介绍。The image processing method in the embodiment of the present invention will be described in detail below with reference to FIG. 3 .

301、将包含前景目标的Mask的边界框划分成多个小块,每个小块中包含至少一个像素;301. Divide the bounding box of the Mask containing the foreground target into a plurality of small blocks, and each small block contains at least one pixel;

由于光照、前景目标的褶皱及遮挡,会导致前景目标的同一颜色的不同位置的像素点的像素值差异较大,基于像素点对色系进行判断及处理会导致很大的偏差,以致图像的明显失真。因此,基于多个像素点组成的小块为基本单位进行色系的判断比较合适。Due to the illumination, the wrinkles and occlusion of the foreground target, the pixel values of the pixels at different positions of the same color of the foreground target will be quite different. Judging and processing the color system based on the pixel points will lead to great deviation, so that the image Obvious distortion. Therefore, it is more appropriate to judge the color system based on a small block composed of multiple pixels as the basic unit.

所以,本发明实施例将框定前景目标的边界框划分成n×m的小块,其中,可以是将边界框在水平方向上等分成n列,在竖直方向上等分成m行,以划分成n×m的小块。每个小块中包含至少一个像素。Therefore, in this embodiment of the present invention, the bounding box for framing the foreground object is divided into n×m small blocks, wherein the bounding box can be divided into n columns in the horizontal direction and m rows in the vertical direction to divide into small blocks of n × m. Each small block contains at least one pixel.

如此,边界框中的Mask被划分成多个小块。Mask中的有些小块全部属于前景目标;有些小块全部属于背景图像;有些小块一部分属于前景目标,一部分属于背景图像。In this way, the Mask in the bounding box is divided into multiple small blocks. Some small blocks in the mask all belong to the foreground target; some small blocks all belong to the background image; some small blocks belong to the foreground target and some belong to the background image.

以图1a所示的包含目标行人的边界框为例,图4是截取图1a中的目标行人的下半身的边界框,将下半身的边界框划分成多个小块。401所示的是边界框,402所示的轮廓为下半身的Mask。下半身的Mask中标记为H的是全部属于前景的每一小块;标记为G的是全部属于背景的每一小块;标记为S1的是一半及以上属于背景的每一小块;标记为S2的一半以上属于前景的每一小块;边界框中Mask以外的其余未标记的小块均为全部属于背景的部分小块。通常,Mask中标记为S1和S2的小块数量会远少于标记为H的小块数量。Taking the bounding box containing the target pedestrian shown in FIG. 1a as an example, FIG. 4 is a cutout of the bounding box of the lower body of the target pedestrian in FIG. 1a, and the bounding box of the lower body is divided into a plurality of small blocks. 401 shows the bounding box, and 402 shows the outline of the mask of the lower body. In the mask of the lower body, the one marked H is every small piece that belongs to the foreground; the one marked G is every small piece that belongs to the background; the one marked S1 is half or more of each small piece belonging to the background; marked as More than half of S2 belongs to each patch in the foreground; the rest of the unlabeled patches outside the Mask in the bounding box are all partial patches that belong to the background. Usually, the number of small blocks marked S1 and S2 in the Mask will be much less than the number of small blocks marked H.

通过将边界框划分小块后,Mask被划分成小块。需要说明的是,实际的步骤中不需要标记,图4中标记小块是属于前景还是属于背景,只是为了能够更好地理解Mask中的前景部分(即前景目标)和背景部分(即背景图像)在一定程度上能够通过小块来区分。After dividing the bounding box into small blocks, the Mask is divided into small blocks. It should be noted that no marking is required in the actual steps. Whether the marked block in Figure 4 belongs to the foreground or the background is just to be able to better understand the foreground part (that is, the foreground target) and the background part (that is, the background image) in the Mask. ) can be distinguished to some extent by small blocks.

需要说明的是,因为本申请的目的是尽可能降低Mask中的背景噪声对前景目标造成的干扰。因此,将边界框划分小块的实质是将Mask划分成小块。因为边界框是规则的矩形,而Mask是不规则的形状,因此,对包含Mask的最小矩形框划分成小块比将Mask划分成小块更合适。It should be noted that, because the purpose of this application is to minimize the interference caused by the background noise in the Mask to the foreground target. Therefore, the essence of dividing the bounding box into small blocks is to divide the Mask into small blocks. Because the bounding box is a regular rectangle, and the mask is an irregular shape, it is more appropriate to divide the smallest rectangular box containing the mask into small blocks than to divide the mask into small blocks.

但在对边界框中的小块进行处理的过程中(即在步骤302和步骤303中),实际可以只对Mask中涉及的小块进行处理,对边界框中Mask中未涉及的小块可以不进行步骤302和步骤303中的处理,Mask中未涉及的小块可以参阅如图4中Mask以外,未被标记的属于背景图像的小块。However, in the process of processing the small blocks in the bounding box (that is, in steps 302 and 303 ), only the small blocks involved in the Mask can actually be processed, and the small blocks not involved in the Mask in the bounding box can be processed. If the processing in steps 302 and 303 is not performed, the small blocks not involved in the Mask can refer to the small blocks that are not marked in the background image except for the Mask in FIG. 4 .

此处Mask中涉及的小块为Mask占用的小块,即边界框中全部属于Mask的小块,和一部分属于Mask的小块。The small blocks involved in the Mask here are the small blocks occupied by the Mask, that is, all the small blocks in the bounding box belong to the Mask, and a part of the small blocks belong to the Mask.

302、确定所述Mask占用的小块中每个小块的色系;302. Determine the color system of each small block in the small blocks occupied by the Mask;

在将边界框划分成多个小块后,对边界框中Mask占用的每一小块,分别判断其所属的色系。色系包括黑暗色系、有色色系、白亮色系中的一种。After dividing the bounding box into multiple small blocks, for each small block occupied by Mask in the bounding box, determine the color system to which it belongs. The color system includes one of the dark color system, the colored color system, and the white light color system.

其中,黑暗色系是指黑、黑灰、藏青和藏黑等颜色及相近的颜色,它们的主要特点之一是图像在色调值(Hue,H)保持不变或者变化很小,或者在光照强度不过度的情况下,亮度(Value,V)分量的取值较小,V的取值范围也较小,例如V取值从0.02到0.18。Among them, the dark color system refers to colors such as black, black gray, navy blue, and navy black and similar colors. One of their main characteristics is that the hue value (Hue, H) of the image remains unchanged or changes very little, or in the light When the intensity is not excessive, the value of the luminance (Value, V) component is small, and the value range of V is also small, for example, the value of V ranges from 0.02 to 0.18.

有色色系指的是红、橙、黄、绿、青、蓝和紫等颜色及相近的颜色,它们的主要特点之一是图像在H值保持不变或者变化很小的情况下,V分量可以有很大的取值范围,并且V的取值可以较小也可以较大,例如从0.2到0.8。Colored colors refer to colors such as red, orange, yellow, green, cyan, blue and purple and similar colors. One of their main characteristics is that the V component of the image remains unchanged or changes very little. There can be a wide range of values, and the value of V can be small or large, such as from 0.2 to 0.8.

白亮色系是指白色或者相近的颜色,它们的主要特点之一是图像在H值保持不变或者变化很小的情况下,V分量的取值范围较小(相对有色色系而言),但V值较大,例如V取值从0.7到0.9。White and bright colors refer to white or similar colors. One of their main characteristics is that when the H value of the image remains unchanged or changes very little, the value range of the V component is small (relative to the colored color system), But the value of V is larger, for example, the value of V is from 0.7 to 0.9.

可选的,确定每一小块所属的色系的方法可以是:根据小块的背景亮度值、小块的目标部分的亮度值、小块的目标部分的饱和度值和小块的目标部分的色调值中的至少一个来确定小块的色系。Optionally, the method for determining the color system to which each small block belongs may be: according to the background luminance value of the small block, the luminance value of the target portion of the small block, the saturation value of the target portion of the small block, and the target portion of the small block. at least one of the hue values to determine the color family of the patch.

其中,小块的目标部分是指该小块中属于前景目标的Mask的部分,即属于Mask中的像素。若对于某小块,整个小块都位于Mask中,则该小块的目标部分为整个小块中的所有像素;若对于某小块,一部分位于Mask中,一部分位于Mask以外,则该小块的目标部分为位于Mask中的那一部分像素。小块的目标部分的亮度值是指小块中属于Mask中的像素的亮度平均值;小块的目标部分的饱和度值是指小块中属于Mask中的像素的饱和度平均值;小块的目标部分的色调值是指小块中属于Mask中的像素的色调平均值。The target part of the small block refers to the part of the small block belonging to the Mask of the foreground target, that is, the pixels belonging to the Mask. If for a small block, the whole small block is located in the Mask, then the target part of the small block is all the pixels in the whole small block; The target part of is the part of the pixels located in the Mask. The brightness value of the target part of the small block refers to the average brightness of the pixels in the small block belonging to the Mask; the saturation value of the target part of the small block refers to the average saturation value of the pixels belonging to the Mask in the small block; The hue value of the target part refers to the average hue of the pixels in the patch that belong to the Mask.

小块的背景亮度值为边界框中除前景目标的Mask以外多个像素的亮度平均值,具体可以是边界框中除Mask以外的全部像素的平均亮度值,或是边界框中除Mask以外的部分像素的平均亮度值,其中,部分像素可以是位于当前小块的临近区域的一部分像素。The background brightness value of the small block is the average brightness value of multiple pixels in the bounding box except for the Mask of the foreground target. The average luminance value of some pixels, where the partial pixels may be some pixels located in the adjacent area of the current small block.

根据小块的背景亮度值、小块的目标部分的亮度值、小块的目标部分的饱和度值和小块的目标部分的色调值中的至少一个来确定小块的色系的具体方式包括:可以根据小块的背景亮度值和小块的目标部分的亮度值确定小块的色系;还可以直接根据小块的目标部分的亮度值确定小块的色系;还可以根据小块的前景目标的饱和度值和小块的前景目标的色调值,确定小块的色系。The specific manner of determining the color system of the small block according to at least one of the background luminance value of the small block, the luminance value of the target part of the small block, the saturation value of the target part of the small block and the hue value of the target part of the small block includes: : The color system of the small block can be determined according to the background brightness value of the small block and the brightness value of the target part of the small block; the color system of the small block can also be directly determined according to the brightness value of the target part of the small block; The saturation value of the foreground target and the hue value of the foreground target of the patch determine the color system of the patch.

可选的,确定每一小块所属的色系的方法还可以是,通过将多组参数(每组参数包括色系值和用于确定该色系值的H、S和/或V值)输入机器学习模型进行训练得到参数模型,通过将某一小块的H、S和/或V值输入该参数模型中即可得到该小块的色系值。Optionally, the method for determining the color system to which each small block belongs can also be, by combining multiple sets of parameters (each set of parameters includes a color system value and H, S and/or V values for determining the color system value) The parameter model is obtained by inputting the machine learning model for training, and the color value of a small block can be obtained by inputting the H, S and/or V values of a small block into the parameter model.

303、针对每种色系,确定该色系对应的缩放系数,将属于该色系的小块中的每个像素的亮度值乘以该缩放系数。303. For each color system, determine a scaling coefficient corresponding to the color system, and multiply the luminance value of each pixel in the small block belonging to the color system by the scaling coefficient.

在确定了Mask占用的每一小块所属的色系后,将Mask占用的所有小块按照色系进行分类,确定属于同一色系的所有小块。After determining the color system to which each small block occupied by the Mask belongs, classify all the small blocks occupied by the Mask according to the color system, and determine all the small blocks belonging to the same color system.

对于属于同一色系的每一个小块,对其进行“统一处理”。“统一处理”是为了抑制噪声,避免引起图像较大的失真以及明显的分块效应,降低前景目标的表观差异,例如降低不同光照下引起的表观差异,将边界框中的像素点的亮度值调整至正常光照环境下的亮度值。For each patch belonging to the same color family, "unify" it. "Unified processing" is to suppress noise, avoid causing large distortion of the image and obvious blocking effect, and reduce the apparent difference of foreground objects, such as reducing the apparent difference caused by different lighting, and the pixel points in the bounding box. The brightness value is adjusted to the brightness value under normal lighting environment.

统一处理的方法为:针对每种色系,将属于该色系的小块中的每个像素的亮度值缩放同样的倍数,即乘以一个缩放系数。The unified processing method is: for each color system, the luminance value of each pixel in the small block belonging to the color system is scaled by the same multiple, that is, multiplied by a scaling factor.

可选的,该缩放系数可以是预先配置的缩放预设值,该缩放预设值可以是根据实验数据或数据模型训练得到的一个经验值。例如:黑暗色系对应的缩放系数的取值范围可以在[0.5-5]区间,有色色系对应的缩放系数的取值范围可以在[0.625-2]区间,白亮色系对应的缩放系数的取值范围可以在[0.98-1.25]区间。Optionally, the scaling factor may be a preconfigured scaling preset value, and the scaling preset value may be an empirical value obtained according to experimental data or data model training. For example, the value range of the scaling factor corresponding to the dark color system can be in the range of [0.5-5], the value range of the zoom factor corresponding to the colored color system can be in the range [0.625-2], and the value range of the zoom factor corresponding to the white and light color system The value range can be in the interval [0.98-1.25].

可选的,该缩放系数可以是根据边界框中该色系的小块的亮度值计算获得。计算某一色系对应的缩放系数的步骤具体为:确定该色系对应的亮度预期值V0,计算属于该色系的小块包含的像素(即像素点)的平均亮度值(称第一平均亮度值)

Figure BDA0001291212440000074
计算第一平均亮度值与亮度预期值之间的比值
Figure BDA0001291212440000071
以得到在边界框中该色系对应的缩放系数。举例如下:Optionally, the scaling factor may be calculated and obtained according to the luminance value of the small block of the color system in the bounding box. The step of calculating the scaling factor corresponding to a certain color system is as follows: determining the expected brightness value V 0 corresponding to the color system, and calculating the average brightness value of the pixels (ie, pixel points) included in the small blocks belonging to the color system (called the first average value). brightness value)
Figure BDA0001291212440000074
Calculate the ratio between the first average luminance value and the expected luminance value
Figure BDA0001291212440000071
to get the scaling factor corresponding to the color system in the bounding box. An example is as follows:

例如,对某类小块计算得出

Figure BDA0001291212440000072
根据各色系的亮度值的范围可知,这是黑暗色系的小块,并且其所处于光照较暗的环境,黑暗色系的亮度预期值V0=0.16,计算
Figure BDA0001291212440000073
然后该类小块中的每一个像素点的亮度值都乘以4。For example, calculating for a certain class of small blocks yields
Figure BDA0001291212440000072
According to the range of brightness values of each color system, it is known that this is a small block of dark color system, and it is located in a dark environment, the expected brightness value of dark color system V 0 =0.16, calculate
Figure BDA0001291212440000073
Then the brightness value of each pixel in this type of small block is multiplied by 4.

每种色系中的小块,乘以该色系相对应的缩放系数后,得到的实际效果是将处于光照较暗环境的图像小块进行图像增强,使其与正常光照环境下的黑暗色系图像的亮度值更接近。After multiplying the small blocks in each color system by the corresponding scaling factor of the color system, the actual effect obtained is to enhance the image small blocks in a dark environment to make them match the dark color in a normal light environment. The brightness value of the system image is closer.

这样就实现了黑暗色系、白亮色系和有色色系的像素点的独立处理。因为Mask中的前景部分和背景部分在一定程度上能够通过小块来区分,因此,本发明实施例将边界框中的图像进行分块。在对图像进行分块后,把分块按照色系进行分类,因此能够对前景目标和背景图像的颜色值差异较大的像素进行区分。进而对同一类的分块采用相同的方式统一处理,每一类的分块可以采用不同的处理方式,以此实现对前景目标和背景图像差值较大的像素的不同处理,从而能够降低Mask中背景图像对前景目标引起的干扰。In this way, the independent processing of the pixels of the dark color system, the white light color system and the colored color system is realized. Because the foreground part and the background part in the Mask can be distinguished by small blocks to a certain extent, the embodiment of the present invention divides the image in the bounding box into blocks. After the image is divided into blocks, the blocks are classified according to the color system, so that the pixels with large difference in color value between the foreground target and the background image can be distinguished. Then, the same type of blocks are processed uniformly in the same way, and each type of blocks can be processed in different ways, so as to achieve different processing of pixels with a large difference between the foreground target and the background image, which can reduce the Mask. The interference caused by the background image to the foreground target.

下面详细介绍如何确定每一小块的色系。The following describes in detail how to determine the color system of each small block.

一、通过模糊区分法判断色系:1. Judging color system by fuzzy distinction method:

在一些具体的实施例中,可以根据该小块的背景亮度值和该小块的目标部分的亮度值判断该小块的色系。具体判断方法为:In some specific embodiments, the color system of the small block may be determined according to the background luminance value of the small block and the luminance value of the target portion of the small block. The specific judgment method is:

获取预先设置的背景亮度值与光照系数的对应关系,该对应关系可以是通过大量的实验数据获得;然后根据背景亮度值与光照系数的对应关系,确定该小块的背景亮度值对应的目标光照系数(称为第一目标光照系数);将该小块的目标部分的亮度值乘以第一目标光照系数得到第一调整亮度值,以将该小块中属于Mask的像素的亮度值调整至正常光照下的亮度值;再根据第一调整亮度值确定该小块的色系。Obtain the corresponding relationship between the preset background brightness value and the illumination coefficient, which can be obtained through a large amount of experimental data; and then determine the target illumination corresponding to the background brightness value of the small block according to the corresponding relationship between the background brightness value and the illumination coefficient coefficient (referred to as the first target illumination coefficient); the luminance value of the target portion of the small block is multiplied by the first target illumination coefficient to obtain the first adjusted luminance value, so as to adjust the luminance value of the pixels belonging to the Mask in the small block to The brightness value under normal lighting; and then determine the color system of the small block according to the first adjusted brightness value.

其中,根据第一调整亮度值确定该小块的色系具体为,通过判断第一调整亮度值是在黑暗色系对应的V值范围,还是在有色色系对应的V值范围,还是在白亮色系分别对应的V值范围来确定其所属色系。Wherein, determining the color system of the small block according to the first adjusted brightness value is specifically, by judging whether the first adjusted brightness value is in the V value range corresponding to the dark color system, or in the V value range corresponding to the colored color system, or in the white light system The corresponding V value range of the color system is used to determine the color system to which it belongs.

当第一调整亮度值在黑暗色系对应的V值范围(可以设定为0.02-0.18)时,该小块的所属色系是黑暗色系;当第一调整亮度值V在有色色系对应的V值范围(可以设定为0.2-0.8)时,该小块的所属色系是有色色系;当第一调整亮度值V在白亮色系对应的V值范围(可以设定为0.7-0.9)时,该小块的所属色系是黑暗色系。When the first adjusted brightness value is in the V value range corresponding to the dark color system (can be set to 0.02-0.18), the color system to which the small block belongs is the dark color system; when the first adjusted brightness value V corresponds to the colored color system When the V value range (can be set to 0.2-0.8), the color system of the small block is a colored color system; when the first adjusted brightness value V is in the V value range corresponding to the white and bright color system (can be set to 0.7- 0.9), the color of the small block is the dark color.

进一步,若第一调整亮度值位于两个色系之间的临界值时(例如:0.18-0.2之间),无法确定当前小块的色系时,则可以结合临近的一个或多个小块的色系及其调整后的亮度值,判断当前小块的色系。Further, if the first adjusted brightness value is at a critical value between two color systems (for example, between 0.18-0.2), and the color system of the current small block cannot be determined, one or more adjacent small blocks can be combined The color system and its adjusted brightness value are used to determine the color system of the current small block.

在一些具体的实施例中,若某小块包含的像素全部位于前景目标的Mask中,则可以根据该小块的目标部分的亮度值来确定该小块的色系。具体判断方法为:计算该小块中的像素的平均亮度值(称第二平均亮度值),根据第二平均亮度值确定该小块的色系。In some specific embodiments, if all the pixels included in a small block are located in the Mask of the foreground target, the color system of the small block may be determined according to the luminance value of the target portion of the small block. The specific judging method is: calculating the average brightness value of the pixels in the small block (called the second average brightness value), and determining the color system of the small block according to the second average brightness value.

其中,根据第二平均亮度值确定该小块的色系的方法与所述根据第一调整亮度值确定小块的色系的方法相同:当第二平均亮度值V在黑暗色系对应的V值范围(可以设定为0.02-0.18)时,该小块的所属色系是黑暗色系;当第二平均亮度值V在有色色系对应的V值范围(可以设定为0.2-0.8)时,该小块的所属色系是有色色系;当第二平均亮度值V在白亮色系对应的V值范围(可以设定为0.7-0.9)时,该小块的所属色系是黑暗色系。Wherein, the method of determining the color system of the small block according to the second average brightness value is the same as the method of determining the color system of the small block according to the first adjusted brightness value: when the second average brightness value V is at the V corresponding to the dark color system When the value range (can be set to 0.02-0.18), the color system of the small block is the dark color system; when the second average brightness value V is in the V value range corresponding to the colored color system (can be set to 0.2-0.8) , the color system of the small block is a colored color system; when the second average brightness value V is in the V value range corresponding to the white and bright color system (can be set to 0.7-0.9), the color system of the small block is dark color system.

下面以具体的数据进行举例:The following is an example of specific data:

基于对待处理的多个样本(例如:5000个样本)数据的观察,获得背景亮度值与光照系数的对应关系,如表1所示,将背景亮度按照V值的大小,划分为暗、较暗、正常、较亮和亮五个范围,每个范围有对应的背景亮度V值和光照系数。Based on the observation of the data of multiple samples to be processed (for example: 5000 samples), the corresponding relationship between the background brightness value and the illumination coefficient is obtained. As shown in Table 1, the background brightness is divided into dark and dark according to the size of the V value. , normal, bright and bright five ranges, each range has a corresponding background brightness V value and illumination coefficient.

表1Table 1

背景V值Background V value 背景明暗判断结果Judgment result of background light and shade 光照系数(本例取值)Lighting coefficient (value in this example) V<=0.3V<=0.3 dark 2.02.0 0.3<V<=0.440.3<V<=0.44 较暗darker 1.41.4 0.44<V<=0.540.44<V<=0.54 正常normal 1.11.1 0.54<V<=0.650.54<V<=0.65 较亮brighter 0.90.9 V>0.65V>0.65 Bright 0.80.8

光照系数用于调整不同光照的前景目标的V值,使其更接近正常光照情况下的V值。例如,如果当前小块的背景亮度的V值为0.4,根据表1中的背景V值范围和背景明暗判断结果,将背景亮度判断为较暗,其对应的光照系数为1.4。如果小块的目标部分的亮度为0.16,则将其调整为1.4*0.16=0.224,0.224属于有色色系的亮度值0.2-0.8的区间范围,因此,然后基于调整后的V值0.224判断该小块所属的色系为有色色系。The lighting coefficient is used to adjust the V value of the foreground target with different lighting, so that it is closer to the V value under normal lighting conditions. For example, if the V value of the background brightness of the current small block is 0.4, according to the background V value range and the background brightness judgment result in Table 1, the background brightness is judged to be dark, and the corresponding illumination coefficient is 1.4. If the brightness of the target part of the small block is 0.16, it is adjusted to 1.4*0.16=0.224, and 0.224 belongs to the interval range of the brightness value of the colored color system from 0.2 to 0.8. Therefore, based on the adjusted V value of 0.224, it is judged that the small The color family to which the block belongs is the tinted color family.

下面以一组具体的图像数据进行本发明实施例中通过模糊区分法判断色系进行说明。In the following, a set of specific image data is used to describe the determination of the color system by the fuzzy discrimination method in the embodiment of the present invention.

一组具体的帧图像如图5示,该组图像帧中,每一帧图像是一个包含目标行人(前景目标为行人)的边界框,为了能够更直观地描述如何判断色系,本发明实施例以对边界框的分块为分成n×m=1×2=2个小块,将其划分为上半身和下半身两个小块为例进行说明。A set of specific frame images is shown in Figure 5. In this set of image frames, each frame image is a bounding box containing a target pedestrian (the foreground target is a pedestrian). In order to more intuitively describe how to judge the color system, the present invention The embodiment is described by taking as an example that the bounding box is divided into n×m=1×2=2 small blocks and divided into two small blocks, the upper body and the lower body.

需要说明的是,在实际应用中,应将边界框划分成更多的小块,以使得更好的通过小块来区分Mask中的前景部分和背景部分。It should be noted that, in practical applications, the bounding box should be divided into more small blocks, so that the foreground part and the background part in the Mask can be better distinguished by small blocks.

图5示的一组帧图像(图像1至10)的图片名分别为0.001png、0.002png、0.003png……0.010png,计算每一帧图像的上半身的V值(V)、下半身的V值(V)以及背景V值(V背景),数值如下所示:The image names of a group of frame images (images 1 to 10) shown in Figure 5 are 0.001png, 0.002png, 0.003png... value (V lower ) and the background V value (V background ), the values are as follows:

Figure BDA0001291212440000091
Figure BDA0001291212440000091

其中,在图5所示举例中,上半身的V值(V)是上半身对应的小块的目标部分的亮度值,即上半身的Mask中的像素的平均亮度值;下半身的V值(V)是下半身对应的小块的目标部分的亮度值,即下半身的Mask中的像素的平均亮度值;在该举例中,认为上半身和下半身所处的光照比较平均,因此,V背景是上半身的小块的背景亮度值,也是下半身的小块的背景亮度值,该V背景值可以是取的上半身和下半身的Mask以外的像素的亮度的平均值。Among them, in the example shown in FIG. 5, the V value of the upper body (V up ) is the brightness value of the target part of the small block corresponding to the upper body, that is, the average brightness value of the pixels in the Mask of the upper body; the V value of the lower body (V lower ) is the brightness value of the target part of the small block corresponding to the lower body, that is, the average brightness value of the pixels in the Mask of the lower body; in this example, it is considered that the illumination where the upper body and the lower body are located is relatively average, therefore, the V background is the smaller of the upper body. The background brightness value of the block is also the background brightness value of the small block of the lower body, and the V background value may be the average value of the brightness of the pixels other than the Mask of the upper body and the lower body.

根据表1中的背景V值与光照系数的对应关系,确定V背景对应的光照系数,将光照系数乘以对应的V得到调整后的上半身的亮度值,将光照系数乘以对应的V得到调整后的下半身的亮度值。各帧图像调整后的V和V如表2和表3所示:According to the corresponding relationship between the background V value and the illumination coefficient in Table 1, determine the illumination coefficient corresponding to the V background , multiply the illumination coefficient by the corresponding V upper body to obtain the adjusted brightness value of the upper body, and multiply the illumination coefficient by the corresponding V lower Get the brightness value of the adjusted lower body. The adjusted V and V of each frame image are shown in Table 2 and Table 3:

表2Table 2

Figure BDA0001291212440000092
Figure BDA0001291212440000092

表3table 3

Figure BDA0001291212440000093
Figure BDA0001291212440000093

将预调整后的亮度值与0.18相比较,都小于0.18,因此可以判断出这10帧图像的下半身都属于黑暗色系;图像1、4、8、9和10的上半身为有色色系。而图像2、3、5、6和7的上半身亮度位于黑暗色系和有色色系的临界值:0.18-0.2的区间范围,因此,需要进一步通过其他方法判断图像2、3、5、6和7的上半身的色系。Comparing the pre-adjusted brightness value with 0.18, both are less than 0.18, so it can be judged that the lower body of these 10 frames of images belongs to the dark color system; the upper body of the images 1, 4, 8, 9 and 10 is colored. The upper body brightness of images 2, 3, 5, 6 and 7 is located in the critical value of dark and colored colors: the interval range of 0.18-0.2. Therefore, it is necessary to further judge images 2, 3, 5, 6 and 6 through other methods. The color of the upper body of 7.

进一步,当通过调整后的亮度值无法确定上半身的色系时,可以结合临近的小块——即对应的下半身进行判断。因为上半身、下半身所处的光照环境大体相近,而下半身亮度值判断为黑暗色系,并且调整后的亮度值仍然很小,而上半身调整后的亮度值大于0.18,所以可以判断出图片2、3、5、6和7不是黑暗色,因此属于有色色系。Further, when the color system of the upper body cannot be determined by the adjusted brightness value, the judgment can be made in combination with the adjacent small blocks, that is, the corresponding lower body. Because the lighting environment of the upper body and the lower body are generally similar, the brightness value of the lower body is judged to be dark, and the adjusted brightness value is still small, while the adjusted brightness value of the upper body is greater than 0.18, so it can be judged that pictures 2 and 3 , 5, 6 and 7 are not dark and therefore belong to the tinted family.

进一步,如果结合下半身仍然无法确定其所属色系,为防止误判,可将其做二归类处理,即判断其既是黑暗色系也是有色色系,然后分别按两种色系进行处理,避免误判造成处理错误。Further, if it is still impossible to determine the color system of the lower body in combination with the lower body, in order to prevent misjudgment, it can be classified into two categories, that is, it is judged that it is both a dark color system and a colored color system, and then processed according to the two color systems to avoid Misjudgment results in processing errors.

二、通过HS的特定组合判断色系2. Judging the color system by the specific combination of HS

在一些具体的实施例中,可以根据小块的目标部分的HS的特定组合,直接确定该小块的所属色系,即根据小块的目标部分的饱和度值和该小块的目标部分的色调值,确定该小块的色系。该方法具体是:判断该小块的目标部分的色调值是否在某个色系(第一色系)的色调阈值范围内;并判断该小块的目标部分的饱和度值是否在该色系的饱和度阈值范围内;若该小块的目标部分的色调值在该色系的色调阈值范围内,且该小块的目标部分的饱和度值在该色系的饱和度阈值范围内,则确定该小块的色系属于该色系,即属于第一色系。其中,第一色系为黑暗色系、有色色系和白亮色系中的一种色系。某个色系的饱和度阈值范围与色调阈值范围是基于实验观察,得到的该色系对应的特定的饱和度范围和色调范围。In some specific embodiments, the color system to which the small block belongs can be directly determined according to a specific combination of the HS of the target part of the small block, that is, according to the saturation value of the target part of the small block and the saturation value of the target part of the small block Hue value, which determines the color family of the patch. The method is specifically: judging whether the hue value of the target part of the small block is within the hue threshold range of a certain color system (the first color system); and judging whether the saturation value of the target part of the small block is within the color system If the hue value of the target part of the small block is within the hue threshold value range of the color system, and the saturation value of the target part of the small block is within the saturation threshold value range of the color system, then It is determined that the color system of the small block belongs to the color system, that is, it belongs to the first color system. Among them, the first color system is one of the dark color system, the colored color system and the white light color system. The saturation threshold value range and the hue threshold value range of a certain color system are based on experimental observation, and obtained specific saturation range and hue range corresponding to the color system.

例如:基于实验观察,有色色系中,红色的H和S有着特定的组合范围,当H在[0.9,1]区间,而相应地S也在[0.9,1]区间时,尽管V取值完全不同,可以确定该小块的颜色为红色,属于有色色系。For example: based on experimental observations, in the colored color system, red H and S have a specific combination range, when H is in the [0.9,1] interval, and correspondingly S is also in the [0.9,1] interval, although the value of V Completely different, it can be determined that the color of the small block is red and belongs to the colored color system.

需要说明的是,通过HS的特定组合判断色系的方法可以单独使用,也可以是结合其他色系判断方法一起使用。例如:下面的HSV数据为对如图5所示的上半身作为一个小块,计算得到的HSV数据为:It should be noted that the method of judging the color system by a specific combination of HS can be used alone or in combination with other color system judging methods. For example: the following HSV data is for the upper body as shown in Figure 5 as a small block, the calculated HSV data is:

图片名 H S V V背景 Picture name H on S on V on V background

0011.png 0.982 0.936 0.095 0.2920011.png 0.982 0.936 0.095 0.292

通过本发明实施例中的模糊区分法无法确定所述图片0.011的色系,因为根据V背景及表1所示的背景亮度值与光照系数的对应关系,确定其光照系数为2.0,上半身的目标部分的亮度值V乘以光照系数得到的调整后的V值为0.19,则刚好位于黑暗色系与有色色系的临界值区间(0.18-0.2),不好确定其色系。而结合HS的特定组合,该帧图像的H值和S值均位于[0.9,1]区间,可以确定该小块的颜色为红色,属于有色色系。The color system of 0.011 in the picture cannot be determined by the fuzzy discrimination method in the embodiment of the present invention, because according to the V background and the corresponding relationship between the background brightness value and the illumination coefficient shown in Table 1, the illumination coefficient is determined to be 2.0, and the target of the upper body is determined to be 2.0. The adjusted V value obtained by multiplying the partial brightness value V by the illumination coefficient is 0.19, which is just in the critical value range (0.18-0.2) of the dark color system and the colored color system, and it is difficult to determine the color system. In combination with the specific combination of HS, the H value and S value of the frame image are both in the [0.9, 1] interval, so it can be determined that the color of the small block is red, which belongs to the colored color system.

三、通过综合评价法判断色系3. Judging color system by comprehensive evaluation method

在一些具体的实施例中,还可以采用综合评价法确定小块的色系。综合评价法具体过程包括:获取预置的背景亮度预设值,其中,预置的背景亮度预设值可以是通过根据大量的图片的背景亮度值计算出的背景亮度平均值;再计算该背景亮度预设值与当前小块的背景亮度值之间的比值以得到第二目标光照系数;再针对每个小块,将该小块的前景目标亮度值乘以得到的第二目标光照系数得到第二调整亮度值,以将该小块的亮度值调整至正常光照下的亮度值,再根据该第二调整亮度值确定该小块的色系。其中,当前小块的背景亮度值是边界框中除Mask以外的多个像素的平均亮度值,边界框中除Mask以外的多个像素可以是边界框中除Mask以外的全部像素,或是边界框中除Mask以外的部分像素,其中,部分像素可以是位于当前小块的临近区域的一部分像素。In some specific embodiments, a comprehensive evaluation method may also be used to determine the color system of the small blocks. The specific process of the comprehensive evaluation method includes: obtaining a preset background brightness preset value, wherein the preset background brightness preset value can be the background brightness average value calculated according to the background brightness values of a large number of pictures; and then calculating the background brightness The ratio between the brightness preset value and the background brightness value of the current small block to obtain the second target illumination coefficient; and then for each small block, the foreground target brightness value of the small block is multiplied by the obtained second target illumination coefficient to obtain The second adjusts the brightness value to adjust the brightness value of the small block to the brightness value under normal lighting, and then determines the color system of the small block according to the second adjusted brightness value. The background brightness value of the current small block is the average brightness value of multiple pixels in the bounding box except for Mask, and the multiple pixels in the bounding box except for Mask can be all pixels in the bounding box except for Mask, or the boundary Part of the pixels other than the Mask in the box, where the part of the pixels may be a part of the pixels located in the adjacent area of the current small block.

其中,根据第二调整亮度值确定该小块的色系的方法与所述根据第一调整亮度值确定小块的色系的方法相同:即当第二调整亮度值V在黑暗色系对应的V值范围(可以设定为0.02-0.18)时,该小块的所属色系是黑暗色系;当第二调整亮度值V在有色色系对应的V值范围(可以设定为0.2-0.8)时,该小块的所属色系是有色色系;当第二调整亮度值V在白亮色系对应的V值范围(可以设定为0.7-0.9)时,该小块的所属色系是黑暗色系。The method of determining the color system of the small block according to the second adjusted brightness value is the same as the method of determining the color system of the small block according to the first adjusted brightness value: that is, when the second adjusted brightness value V corresponds to the dark color system When the V value range (can be set to 0.02-0.18), the color system of the small block is the dark color system; when the second adjusted brightness value V is in the V value range corresponding to the colored color system (can be set to 0.2-0.8 ), the color system of the small block is a colored color system; when the second adjusted brightness value V is in the V value range corresponding to the white and bright color system (can be set to 0.7-0.9), the color system of the small block is Dark shades.

下面以一组具体的图像数据进行本发明实施例中通过综合评价法判断色系进行说明。The following describes how to judge the color system by the comprehensive evaluation method in the embodiment of the present invention with a set of specific image data.

首先获取现有数据库中数百万张图片,计算这些图片的背景亮度的均值,若计算结果为0.491,将其设置为预置的背景亮度预设值。First, acquire millions of pictures in the existing database, and calculate the average value of the background brightness of these pictures. If the calculation result is 0.491, set it as the preset background brightness preset value.

然后计算每一小块的背景亮度与0.491的比值,计算结果称为该小块的光照系数。将光照系数乘以该小块的目标部分的亮度值得到该小块的前景目标的调整亮度值,然后与设定的各色系的阈值进行比较,以确定该小块的所属色系。Then calculate the ratio of the background brightness of each small block to 0.491, and the calculation result is called the illumination coefficient of the small block. Multiply the illumination coefficient by the brightness value of the target part of the small block to obtain the adjusted brightness value of the foreground target of the small block, and then compare with the set thresholds of each color system to determine the color system to which the small block belongs.

四、通过机器学习方法判断色系4. Judging color system by machine learning method

在一些具体的实施例中,还可以通过机器学习方法建立参数模型,通过将小块的相关参数输入参数模型得到小块的色系。具体的实现方法为:In some specific embodiments, a parametric model can also be established by a machine learning method, and the color system of the small block is obtained by inputting the relevant parameters of the small block into the parametric model. The specific implementation method is:

确定参数模型,针对每个小块,将该小块的背景亮度值和小块的目标部分的参数(小块的目标部分的H、S和V值)输入该参数模型,得到该小块的色系。Determine the parameter model, for each small block, input the background brightness value of the small block and the parameters of the target part of the small block (H, S and V values of the target part of the small block) into the parameter model, and obtain the small block's color system.

确定参数模型的具体方法为:获取多组模型训练参数,每组模型训练参数包括色系确定参数和所述色系确定参数对应的色系值,所述色系确定参数包括背景图像的亮度值、选定前景目标的亮度值、所述选定前景目标的饱和度值和所述选定前景目标的色调值;将所述多组模型训练参数输入机器学习模型得到所述参数模型。The specific method for determining the parameter model is: obtaining multiple sets of model training parameters, each group of model training parameters includes a color system determination parameter and a color system value corresponding to the color system determination parameter, and the color system determination parameter includes the brightness value of the background image , the brightness value of the selected foreground target, the saturation value of the selected foreground target, and the hue value of the selected foreground target; inputting the multiple sets of model training parameters into the machine learning model to obtain the parameter model.

具体的,进行模型训练的机器学习模型可以采用SVM模型,可以使用Matlab自带的SVM模型进行训练。首先对数据进行标注,例如对黑暗色系、有色色系和白亮色系分别设置其标签值为-1,0和1。然后将选定的前景目标的H、S和V值和背景图像的V值,以及标注结果的标签值作为参数输入,进行训练。训练的结果是一个参数模型,将训练得到的参数模型用于未进行过人工标注的小块,输出结果是一个标签值。基于此标签值(黑暗色系、有色色系和白亮色系的标签值分别为-1,0和1)即可确该小块的色系。Specifically, the machine learning model for model training can use the SVM model, and can use the SVM model that comes with Matlab for training. First, label the data, for example, set the label values of -1, 0, and 1 for dark color, colored color, and white light color, respectively. Then, the H, S, and V values of the selected foreground objects and the V value of the background image, and the label value of the annotation result are input as parameters for training. The result of the training is a parametric model, and the parametric model obtained by training is used for the small blocks that have not been manually labeled, and the output result is a label value. Based on this label value (the label values of the dark color system, the colored color system and the white light color system are -1, 0 and 1 respectively), the color system of the small block can be determined.

需要说明的是,本发明实施例中的各色系判断方法可以单独使用,当使用其中的一种方法不能够判断出某小块的色系时,可以结合其他方法一起判断。It should be noted that the color system judgment methods in the embodiments of the present invention can be used alone, and when one of the methods cannot be used to judge the color system of a small block, it can be judged in combination with other methods.

以上是对本发明实施例中的方法实施例的介绍,下面从功能模块角度以对本发明实施例中的图像处理装置进行介绍。The above is an introduction to the method embodiments in the embodiments of the present invention, and the following describes the image processing apparatuses in the embodiments of the present invention from the perspective of functional modules.

如图6所示,该图像处理装置包括以下几个功能单元:As shown in Figure 6, the image processing device includes the following functional units:

小块划分单元601,用于将包含前景目标的Mask的边界框划分成多个小块,每个小块中包含至少一个像素;A small block dividing unit 601, for dividing the bounding box of the Mask containing the foreground target into a plurality of small blocks, and each small block contains at least one pixel;

色系判断单元602,用于确定Mask占用的小块中的每个小块的色系;Color system judgment unit 602, for determining the color system of each small block in the small block occupied by Mask;

缩放系数确定单元603,用于针对每种色系,确定该色系对应的缩放系数;A scaling factor determining unit 603, configured to determine, for each color system, a scaling factor corresponding to the color system;

亮度调整单元604,用于将属于色系的小块中的每个像素的亮度值乘以缩放系数。A brightness adjustment unit 604, configured to multiply the brightness value of each pixel in the small block belonging to the color system by a scaling factor.

可选的,在一些具体的实施例中,缩放系数确定单元603,具体用于确定色系对应的亮度预期值;计算属于色系的小块包含的像素的第一平均亮度值;计算第一平均亮度值与亮度预期值之间的比值以得到在边界框中色系对应的缩放系数。Optionally, in some specific embodiments, the scaling coefficient determination unit 603 is specifically configured to determine the expected brightness value corresponding to the color system; calculate the first average brightness value of the pixels included in the small block belonging to the color system; calculate the first average brightness value. The ratio between the average luminance value and the expected luminance value to obtain the scaling factor corresponding to the color system in the bounding box.

可选的,在一些具体的实施例中,色系判断单元602,具体用于针对Mask占用的多个小块中的每个小块,根据该小块的背景亮度值、该小块的目标部分的亮度值、该小块的目标部分的饱和度值和该小块的目标部分的色调值中的至少一个,确定该小块的色系;其中,小块的背景亮度值包括边界框中除Mask以外的多个像素的平均亮度值,小块的目标部分包括小块中属于Mask的部分。Optionally, in some specific embodiments, the color system judgment unit 602 is specifically configured to, for each small block in the plurality of small blocks occupied by the Mask, according to the background brightness value of the small block, the target of the small block. at least one of the luminance value of the portion, the saturation value of the target portion of the small block, and the hue value of the target portion of the small block, to determine the color system of the small block; wherein the background luminance value of the small block includes the bounding box The average luminance value of multiple pixels other than Mask, and the target part of the small block includes the part belonging to the Mask in the small block.

可选的,在一些具体的实施例中,色系判断单元602,具体用于获取背景亮度值与光照系数的对应关系;根据背景亮度值与光照系数的对应关系,确定当前小块的背景亮度值对应的第一目标光照系数;将该小块的目标部分的亮度值乘以第一目标光照系数得到第一调整亮度值;根据第一调整亮度值确定该小块的色系。Optionally, in some specific embodiments, the color system judgment unit 602 is specifically configured to obtain the corresponding relationship between the background brightness value and the illumination coefficient; determine the background brightness of the current small block according to the corresponding relationship between the background brightness value and the illumination coefficient. The first target illumination coefficient corresponding to the value; the luminance value of the target portion of the small block is multiplied by the first target illumination coefficient to obtain the first adjusted luminance value; the color system of the small block is determined according to the first adjusted luminance value.

可选的,在一些具体的实施例中,色系判断单元602,具体用于获取预置的背景亮度预设值;计算背景亮度预设值与当前小块的背景亮度值之间的比值以得到第二目标光照系数;将该小块的目标部分的亮度值乘以第二目标光照系数得到第二调整亮度值;根据第二调整亮度值确定该小块的色系。Optionally, in some specific embodiments, the color system determination unit 602 is specifically configured to obtain a preset background brightness preset value; calculate the ratio between the background brightness preset value and the background brightness value of the current small block to obtaining a second target illumination coefficient; multiplying the luminance value of the target portion of the small block by the second target illumination coefficient to obtain a second adjusted luminance value; and determining the color system of the small block according to the second adjusted luminance value.

可选的,在一些具体的实施例中,色系判断单元602,具体用于判断小块的目标部分的色调值是否在第一色系的色调阈值范围内;判断小块的目标部分的饱和度值是否在第一色系的饱和度阈值范围内;若小块的目标部分的色调值在第一色系的色调阈值范围内,且小块的目标部分的饱和度值在第一色系的饱和度阈值范围内,则确定该小块的色系属于第一色系。Optionally, in some specific embodiments, the color system determination unit 602 is specifically configured to determine whether the hue value of the target part of the small block is within the hue threshold range of the first color system; determine the saturation of the target part of the small block. Whether the hue value is within the saturation threshold range of the first color system; if the hue value of the target part of the small block is within the hue threshold range of the first color system, and the saturation value of the target part of the small block is within the first color system Within the saturation threshold range of , it is determined that the color system of the small block belongs to the first color system.

可选的,在一些具体的实施例中,色系判断单元602,具体用于将小块的背景亮度值、小块的目标部分的亮度值、小块的目标部分的饱和度值和小块的目标部分的色调值输入参数模型中,以得到小块的色系。Optionally, in some specific embodiments, the color system judgment unit 602 is specifically configured to compare the background luminance value of the small block, the luminance value of the target part of the small block, the saturation value of the target part of the small block and the small block. The hue value of the target part is input into the parametric model to get the hue of the patch.

可选的,该装置还包括:模型训练单元(图中未示出),用于获取多组模型训练参数,每组模型训练参数包括色系确定参数和色系确定参数对应的色系值,色系确定参数包括背景图像的亮度值、选定前景目标的亮度值、选定前景目标的饱和度值和选定前景目标的色调值;将多组模型训练参数输入支持向量机SVM得到参数模型。Optionally, the device further includes: a model training unit (not shown in the figure) for acquiring multiple groups of model training parameters, each group of model training parameters including a color system determination parameter and a color system value corresponding to the color system determination parameter, The color system determination parameters include the brightness value of the background image, the brightness value of the selected foreground object, the saturation value of the selected foreground object, and the hue value of the selected foreground object; input multiple sets of model training parameters into the support vector machine SVM to obtain the parameter model .

以上图像处理装置中的各单元之间的信息交互可以参阅上述方法实施例(图1至图5所示的实施例),本申请不做赘述。For the information interaction between the units in the above image processing apparatus, reference may be made to the above method embodiments (the embodiments shown in FIG. 1 to FIG. 5 ), which will not be described in detail in this application.

图6所示的图像处理装置在实际应用中,可以通过专用集成电路(application-specific integrated circuit,ASIC)实现,或可编程逻辑器件(programmable logicdevice,PLD)实现。上述PLD可以是复杂可编程逻辑器件(complex programmable logicdevice,CPLD),现场可编程门阵列(Field-Programmable Gate Array,FPGA),通用阵列逻辑(generic array logic,GAL)或其任意组合。In practical applications, the image processing apparatus shown in FIG. 6 may be implemented by an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The above-mentioned PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.

图6所示的图像处理装置在实际应用中,可以是服务器。图7是本发明实施例提供的一种服务器硬件结构示意图,该服务器可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上处理器(central processing units,CPU)722、存储器730和一个或一个以上有线或无线网络接口750。其中,存储器730上存储有一个或一个以上应用程序742、数据744和一个或一个以上操作系统741,存储在存储器730的应用程序742可以包括一个或一个以上模块,每个模块可以包括一系列的指令操作。In practical applications, the image processing apparatus shown in FIG. 6 may be a server. 7 is a schematic diagram of a hardware structure of a server according to an embodiment of the present invention. The server may vary greatly due to different configurations or performance, and may include one or more processors (central processing units, CPU) 722 and memory 730 and one or more wired or wireless network interfaces 750. The memory 730 stores one or more application programs 742, data 744 and one or more operating systems 741. The application program 742 stored in the memory 730 may include one or more modules, and each module may include a series of Command operation.

本发明实施例中,应用程序742中可以包括图2中所示的视频内容管理程序,处理器720运行存储器730中存储的视频内容管理程序,用于实现上述方法实施例(图1至图5所示的实施例)中的全部或部分步骤。In this embodiment of the present invention, the application program 742 may include the video content management program shown in FIG. 2 , and the processor 720 runs the video content management program stored in the memory 730 to implement the above method embodiments (FIG. 1 to FIG. 5 ). all or part of the steps in the examples shown).

存储器730中存储的数据744可以包括视频、图像以及可能的视频或图像摘要、索引等信息。Data 744 stored in memory 730 may include video, images, and possibly video or image summaries, indexes, and other information.

此外,服务器还可以包括一个或一个以上电源726,一个或一个以上输入输出接口758。In addition, the server may also include one or more power supplies 726 , and one or more input and output interfaces 758 .

需要说明的是,图7所示的服务器可以为分布式部署的服务器集群,存储器730上的应用程序、数据744等可以分布式存储在服务器集群的各服务器中。It should be noted that the server shown in FIG. 7 may be a distributed deployment server cluster, and the application programs, data 744 and the like on the storage 730 may be distributed and stored in each server of the server cluster.

图7所示的服务器对应图2所示的图像处理系统架构中的服务器,客户端设备与服务器之间进行交互,服务器通过视频内容管理模块执行客户端设备的请求并返回相应结果给客户端设备。The server shown in FIG. 7 corresponds to the server in the image processing system architecture shown in FIG. 2. The client device interacts with the server. The server executes the request of the client device through the video content management module and returns the corresponding result to the client device. .

需要说明的是,在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。It should be noted that, in the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented in whole or in part in the form of a computer program product.

所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘(Solid State Disk,SSD))等。The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer may be a general purpose computer, special purpose computer, computer network, or other programmable device. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be downloaded from a website site, computer, server, or data center Transmission to another website site, computer, server, or data center is by wire (eg, coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (eg, infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a server, a data center, etc. that includes one or more available media integrated. The usable media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVD), or semiconductor media (eg, Solid State Disk (SSD)), and the like.

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system, device and unit described above may refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.

本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", "third", "fourth", etc. (if any) in the description and claims of this application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to Describe a particular order or sequence. It is to be understood that data so used may be interchanged under appropriate circumstances so that the embodiments described herein can be practiced in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" and "having" and any variations thereof, are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those expressly listed Rather, those steps or units may include other steps or units not expressly listed or inherent to these processes, methods, products or devices.

在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.

所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented in the form of a software functional unit and sold or used as an independent product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the present application can be embodied in the form of software products in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, and the computer software products are stored in a storage medium , including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program codes .

以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。As mentioned above, the above embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand: The technical solutions described in the embodiments are modified, or some technical features thereof are equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions in the embodiments of the present application.

Claims (15)

1.一种图像处理方法,其特征在于,所述方法包括:1. an image processing method, is characterized in that, described method comprises: 将边界框划分成多个小块,每个小块中包含至少一个像素,所述边界框中包含前景目标的掩膜Mask;Divide the bounding box into a plurality of small blocks, each small block contains at least one pixel, and the bounding box contains the mask Mask of the foreground target; 确定所述Mask占用的小块中的每个小块的色系;determining the color system of each of the small blocks occupied by the Mask; 针对每种色系,确定所述色系对应的缩放系数,将属于所述色系的小块中的每个像素的亮度值乘以所述缩放系数;For each color system, determine a scaling factor corresponding to the color system, and multiply the luminance value of each pixel in the small block belonging to the color system by the scaling factor; 所述确定所述Mask占用的小块中的每个小块的色系包括:The determining the color system of each small block in the small blocks occupied by the Mask includes: 针对所述Mask占用的小块中的每个小块,根据所述小块的背景亮度值、所述小块的目标部分的亮度值、所述小块的目标部分的饱和度值和所述小块的目标部分的色调值中的至少一个,确定所述小块的色系;For each small block in the small blocks occupied by the Mask, according to the background luminance value of the small block, the luminance value of the target part of the small block, the saturation value of the target part of the small block and the at least one of the hue values of the target portion of the small block, determining the color system of the small block; 其中,所述小块的背景亮度值包括所述边界框中除所述Mask以外的多个像素的平均亮度值,所述小块的目标部分包括所述小块中属于所述Mask的部分。The background luminance value of the small block includes the average luminance value of a plurality of pixels other than the Mask in the bounding box, and the target portion of the small block includes the portion of the small block that belongs to the Mask. 2.根据权利要求1所述的方法,其特征在于,所述确定所述色系对应的缩放系数包括:2. The method according to claim 1, wherein the determining the scaling factor corresponding to the color system comprises: 确定所述色系对应的亮度预期值;determining the expected brightness value corresponding to the color system; 计算属于所述色系的小块包含的像素的第一平均亮度值;calculating the first average luminance value of the pixels included in the small blocks belonging to the color system; 计算所述第一平均亮度值与所述亮度预期值之间的比值以得到所述色系对应的缩放系数。A ratio between the first average luminance value and the expected luminance value is calculated to obtain a scaling factor corresponding to the color system. 3.根据权利要求1所述的方法,其特征在于,所述根据小块的背景亮度值和所述小块的目标部分的亮度值,确定所述小块的色系包括:3. The method according to claim 1, wherein the determining the color system of the small block according to the background luminance value of the small block and the luminance value of the target portion of the small block comprises: 获取背景亮度值与光照系数的对应关系;Obtain the corresponding relationship between the background brightness value and the illumination coefficient; 根据所述背景亮度值与光照系数的对应关系,确定所述小块的背景亮度值对应的第一目标光照系数;determining the first target illumination coefficient corresponding to the background luminance value of the small block according to the correspondence between the background luminance value and the illumination coefficient; 将所述小块的目标部分的亮度值乘以所述第一目标光照系数以得到第一调整亮度值;multiplying the brightness value of the target portion of the small block by the first target illumination coefficient to obtain a first adjusted brightness value; 根据所述第一调整亮度值确定所述小块的色系。The color system of the small block is determined according to the first adjusted luminance value. 4.根据权利要求1所述的方法,其特征在于,所述根据小块的背景亮度值和所述小块的目标部分的亮度值,确定所述小块的色系包括:4. The method according to claim 1, wherein the determining the color system of the small block according to the background luminance value of the small block and the luminance value of the target part of the small block comprises: 获取预置的背景亮度预设值;Get the preset background brightness preset value; 计算所述背景亮度预设值与所述小块的背景亮度值之间的比值以得到第二目标光照系数;calculating the ratio between the background brightness preset value and the background brightness value of the small block to obtain a second target illumination coefficient; 将所述小块的目标部分的亮度值乘以所述第二目标光照系数以得到第二调整亮度值;multiplying the brightness value of the target portion of the small block by the second target illumination coefficient to obtain a second adjusted brightness value; 根据所述第二调整亮度值确定所述小块的色系。The color system of the small block is determined according to the second adjusted luminance value. 5.根据权利要求1至4中任一项所述的方法,其特征在于,所述根据所述小块的目标部分的饱和度值和所述小块的目标部分的色调值,确定所述小块的色系包括:5. The method according to any one of claims 1 to 4, wherein the determining the Small block shades include: 判断所述小块的目标部分的色调值是否在第一色系的色调阈值范围内;Judging whether the hue value of the target portion of the small block is within the hue threshold range of the first color system; 判断所述小块的目标部分的饱和度值是否在所述第一色系的饱和度阈值范围内;judging whether the saturation value of the target portion of the small block is within the saturation threshold range of the first color system; 若所述小块的目标部分的色调值在所述第一色系的色调阈值范围内,且所述小块的目标部分的饱和度值在所述第一色系的饱和度阈值范围内,则确定所述小块的色系属于所述第一色系。If the hue value of the target portion of the small block is within the hue threshold range of the first color system, and the saturation value of the target portion of the small block is within the saturation threshold range of the first color system, Then it is determined that the color system of the small block belongs to the first color system. 6.根据权利要求1至4中任一项所述的方法,其特征在于,所述根据小块的背景亮度值、所述小块的目标部分的亮度值、所述小块的目标部分的饱和度值和所述小块的目标部分的色调值,确定所述小块的色系包括:6. The method according to any one of claims 1 to 4, wherein the background luminance value of the small block, the luminance value of the target portion of the small block, the luminance value of the target portion of the small block The saturation value and the hue value of the target portion of the small block, determining the color system of the small block includes: 将所述小块的背景亮度值、所述小块的目标部分的亮度值、所述小块的目标部分的饱和度值和所述小块的目标部分的色调值输入参数模型中,以得到所述小块的色系。Input the background brightness value of the small block, the brightness value of the target part of the small block, the saturation value of the target part of the small block and the hue value of the target part of the small block into the parameter model to obtain The color of the small pieces. 7.根据权利要求6所述的方法,其特征在于,所述方法还包括:7. The method according to claim 6, wherein the method further comprises: 获取多组模型训练参数,每组模型训练参数包括色系确定参数和所述色系确定参数对应的色系值,所述色系确定参数包括背景图像的亮度值、选定前景目标的亮度值、所述选定前景目标的饱和度值和所述选定前景目标的色调值;Obtain multiple sets of model training parameters, each set of model training parameters includes a color system determination parameter and a color system value corresponding to the color system determination parameter, and the color system determination parameter includes the brightness value of the background image and the brightness value of the selected foreground target. , the saturation value of the selected foreground target and the hue value of the selected foreground target; 将所述多组模型训练参数输入支持向量机SVM得到所述参数模型。Inputting the multiple sets of model training parameters into a support vector machine (SVM) to obtain the parameter model. 8.一种图像处理装置,其特征在于,所述装置包括:8. An image processing device, wherein the device comprises: 小块划分单元,用于将边界框划分成多个小块,每个小块中包含至少一个像素,所述边界框中包含前景目标的掩膜Mask;a small block dividing unit, configured to divide the bounding box into a plurality of small blocks, each small block contains at least one pixel, and the bounding box contains the mask Mask of the foreground target; 色系判断单元,用于确定所述Mask占用的小块中的每个小块的色系;a color system judgment unit for determining the color system of each small block in the small blocks occupied by the Mask; 缩放系数确定单元,用于针对每种色系,确定所述色系对应的缩放系数;a scaling factor determining unit, configured to determine, for each color system, a scaling factor corresponding to the color system; 亮度调整单元,用于将属于所述色系的小块中的每个像素的亮度值乘以所述缩放系数;a brightness adjustment unit, configured to multiply the brightness value of each pixel in the small block belonging to the color system by the scaling factor; 所述色系判断单元,具体用于针对所述Mask占用的多个小块中的每个小块,根据所述小块的背景亮度值、所述小块的目标部分的亮度值、所述小块的目标部分的饱和度值和所述小块的目标部分的色调值中的至少一个,确定所述小块的色系;其中,所述小块的背景亮度值包括所述边界框中除所述Mask以外的多个像素的平均亮度值,所述小块的目标部分包括所述小块中属于所述Mask的部分。The color system judgment unit is specifically configured to, for each small block in the plurality of small blocks occupied by the Mask, according to the background brightness value of the small block, the brightness value of the target part of the small block, the at least one of the saturation value of the target portion of the small block and the hue value of the target portion of the small block, to determine the color system of the small block; wherein the background luminance value of the small block includes the bounding box The average luminance value of a plurality of pixels other than the Mask, and the target part of the small block includes the part of the small block that belongs to the Mask. 9.根据权利要求8所述的装置,其特征在于,9. The device of claim 8, wherein 所述缩放系数确定单元,具体用于确定所述色系对应的亮度预期值;计算属于所述色系的小块包含的像素的第一平均亮度值;计算所述第一平均亮度值与所述亮度预期值之间的比值以得到在所述边界框中所述色系对应的缩放系数。The scaling coefficient determination unit is specifically configured to determine the expected brightness value corresponding to the color system; calculate the first average brightness value of the pixels included in the small blocks belonging to the color system; calculate the first average brightness value and the The ratio between the expected values of luminance is obtained to obtain the scaling factor corresponding to the color system in the bounding box. 10.根据权利要求8所述的装置,其特征在于,10. The device of claim 8, wherein 所述色系判断单元,具体用于获取背景亮度值与光照系数的对应关系;根据所述背景亮度值与光照系数的对应关系,确定所述小块的背景亮度值对应的第一目标光照系数;将所述小块的目标部分的亮度值乘以所述第一目标光照系数以得到第一调整亮度值;根据所述第一调整亮度值确定所述小块的色系。The color system judging unit is specifically configured to obtain the corresponding relationship between the background brightness value and the lighting coefficient; according to the corresponding relationship between the background brightness value and the lighting coefficient, determine the first target lighting coefficient corresponding to the background brightness value of the small block ; multiply the brightness value of the target portion of the small block by the first target illumination coefficient to obtain a first adjusted brightness value; and determine the color system of the small block according to the first adjusted brightness value. 11.根据权利要求8所述的装置,其特征在于,11. The apparatus of claim 8, wherein 所述色系判断单元,具体用于获取预置的背景亮度预设值;计算所述背景亮度预设值与所述小块的背景亮度值之间的比值以得到第二目标光照系数;将所述小块的目标部分的亮度值乘以所述第二目标光照系数以得到第二调整亮度值;根据所述第二调整亮度值确定所述小块的色系。The color system judgment unit is specifically configured to obtain a preset background brightness preset value; calculate the ratio between the background brightness preset value and the background brightness value of the small block to obtain the second target illumination coefficient; The luminance value of the target portion of the small block is multiplied by the second target illumination coefficient to obtain a second adjusted luminance value; the color system of the small block is determined according to the second adjusted luminance value. 12.根据权利要求8至11中任一项所述的装置,其特征在于,12. The device according to any one of claims 8 to 11, wherein 所述色系判断单元,具体用于判断所述小块的目标部分的色调值是否在第一色系的色调阈值范围内;判断所述小块的目标部分的饱和度值是否在所述第一色系的饱和度阈值范围内;若所述小块的目标部分的色调值在所述第一色系的色调阈值范围内,且所述小块的目标部分的饱和度值在所述第一色系的饱和度阈值范围内,则确定所述小块的色系属于所述第一色系。The color system judgment unit is specifically configured to judge whether the hue value of the target part of the small block is within the hue threshold value range of the first color system; judge whether the saturation value of the target part of the small block is within the first color system. If the hue value of the target part of the small block is within the hue threshold range of the first color system, and the saturation value of the target part of the small block is within the range of the saturation threshold of the first color system Within the saturation threshold range of a color system, it is determined that the color system of the small block belongs to the first color system. 13.根据权利要求8至11中任一项所述的装置,其特征在于,13. The device according to any one of claims 8 to 11, wherein 所述色系判断单元,具体用于将所述小块的背景亮度值、所述小块的目标部分的亮度值、所述小块的目标部分的饱和度值和所述小块的目标部分的色调值输入参数模型中,以得到所述小块的色系。The color system judgment unit is specifically configured to compare the background luminance value of the small block, the luminance value of the target portion of the small block, the saturation value of the target portion of the small block, and the target portion of the small block. The hue value of is input into the parametric model to get the hue of the patch. 14.根据权利要求13所述的装置,其特征在于,所述装置还包括:14. The apparatus of claim 13, wherein the apparatus further comprises: 模型训练单元,用于获取多组模型训练参数,每组模型训练参数包括色系确定参数和所述色系确定参数对应的色系值,所述色系确定参数包括背景图像的亮度值、选定前景目标的亮度值、所述选定前景目标的饱和度值和所述选定前景目标的色调值;将所述多组模型训练参数输入支持向量机SVM得到所述参数模型。The model training unit is used to obtain multiple groups of model training parameters, each group of model training parameters includes a color system determination parameter and a color system value corresponding to the color system determination parameter, and the color system determination parameter includes the brightness value of the background image, the selected Determine the brightness value of the foreground target, the saturation value of the selected foreground target and the hue value of the selected foreground target; input the multiple sets of model training parameters into the support vector machine SVM to obtain the parameter model. 15.一种服务器,其特征在于,包括:15. A server, comprising: 处理器、存储器及网络接口;processors, memory and network interfaces; 所述存储器用于存储程序代码,所述处理器调用所述存储器中的所述程序代码,以执行以下操作:The memory is used to store program code, and the processor invokes the program code in the memory to perform the following operations: 将边界框划分成多个小块,每个小块中包含至少一个像素,所述边界框中包含前景目标的掩膜Mask;确定所述Mask占用的小块中的每个小块的色系;针对每种色系,确定所述色系对应的缩放系数,将属于所述色系的小块中的每个像素的亮度值乘以所述缩放系数;Divide the bounding box into a plurality of small blocks, each small block contains at least one pixel, and the bounding box contains the mask Mask of the foreground target; determine the color system of each small block in the small blocks occupied by the Mask ; For each color system, determine the corresponding scaling factor of the color system, and multiply the brightness value of each pixel in the small block belonging to the color system by the scaling factor; 所述确定所述Mask占用的小块中的每个小块的色系包括:The determining the color system of each small block in the small blocks occupied by the Mask includes: 针对所述Mask占用的小块中的每个小块,根据所述小块的背景亮度值、所述小块的目标部分的亮度值、所述小块的目标部分的饱和度值和所述小块的目标部分的色调值中的至少一个,确定所述小块的色系;For each small block in the small blocks occupied by the Mask, according to the background luminance value of the small block, the luminance value of the target part of the small block, the saturation value of the target part of the small block and the at least one of the hue values of the target portion of the small block, determining the color system of the small block; 其中,所述小块的背景亮度值包括所述边界框中除所述Mask以外的多个像素的平均亮度值,所述小块的目标部分包括所述小块中属于所述Mask的部分。The background luminance value of the small block includes the average luminance value of a plurality of pixels in the bounding box except the Mask, and the target portion of the small block includes the portion of the small block that belongs to the Mask.
CN201710326076.7A 2017-05-10 2017-05-10 An image processing method, device and server Active CN108875759B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710326076.7A CN108875759B (en) 2017-05-10 2017-05-10 An image processing method, device and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710326076.7A CN108875759B (en) 2017-05-10 2017-05-10 An image processing method, device and server

Publications (2)

Publication Number Publication Date
CN108875759A CN108875759A (en) 2018-11-23
CN108875759B true CN108875759B (en) 2022-05-24

Family

ID=64287631

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710326076.7A Active CN108875759B (en) 2017-05-10 2017-05-10 An image processing method, device and server

Country Status (1)

Country Link
CN (1) CN108875759B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110189354B (en) * 2019-04-18 2021-12-28 北京迈格威科技有限公司 Image processing method, image processor, image processing apparatus, and medium
CN110659581B (en) * 2019-08-29 2024-02-20 腾讯科技(深圳)有限公司 Image processing method, device, equipment and storage medium
CN111275648B (en) * 2020-01-21 2024-02-09 腾讯科技(深圳)有限公司 Face image processing method, device, equipment and computer readable storage medium
CN111861869B (en) * 2020-07-15 2024-02-02 广州光锥元信息科技有限公司 Image processing method and device for beautifying human images and preventing background distortion
CN114119778A (en) * 2020-08-27 2022-03-01 华为技术有限公司 Deep color mode generation method of user interface, electronic equipment and storage medium
CN114419560B (en) * 2022-04-01 2022-07-12 苏州万店掌网络科技有限公司 Method, device and medium for detecting target object

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101790023A (en) * 2009-01-22 2010-07-28 夏普株式会社 Method for compressing image, image compressing device and image processing system
CN102292991A (en) * 2009-05-15 2011-12-21 夏普株式会社 Image processing device and image processing method
CN103116763A (en) * 2013-01-30 2013-05-22 宁波大学 Vivo-face detection method based on HSV (hue, saturation, value) color space statistical characteristics
CN103414841A (en) * 2013-07-29 2013-11-27 西北工业大学 Image encryption and decryption method for utilizing gray system theory to confirm ICA output
CN103945089A (en) * 2014-04-18 2014-07-23 上海复控华龙微系统技术有限公司 Dynamic target detection method based on brightness flicker correction and IP camera
CN104364825A (en) * 2012-04-09 2015-02-18 华为技术有限公司 Visual conditioning for augmented-reality-assisted video conferencing
CN104809245A (en) * 2015-05-13 2015-07-29 信阳师范学院 Image retrieval method
CN105761267A (en) * 2016-03-08 2016-07-13 重庆邮电大学 Image processing method and device
CN106251286A (en) * 2015-12-30 2016-12-21 深圳超多维科技有限公司 Image processing method, device and equipment
CN106504241A (en) * 2016-10-25 2017-03-15 西安交通大学 An automatic color matching device and method

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040091173A1 (en) * 2002-07-17 2004-05-13 Hiroshi Akimoto Method, apparatus and system for the spatial interpolation of color images and video sequences in real time
US8335344B2 (en) * 2010-03-31 2012-12-18 Xerox Corporation Method and system for document annotation
US9349054B1 (en) * 2014-10-29 2016-05-24 Behavioral Recognition Systems, Inc. Foreground detector for video analytics system

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101790023A (en) * 2009-01-22 2010-07-28 夏普株式会社 Method for compressing image, image compressing device and image processing system
CN102292991A (en) * 2009-05-15 2011-12-21 夏普株式会社 Image processing device and image processing method
CN104364825A (en) * 2012-04-09 2015-02-18 华为技术有限公司 Visual conditioning for augmented-reality-assisted video conferencing
CN103116763A (en) * 2013-01-30 2013-05-22 宁波大学 Vivo-face detection method based on HSV (hue, saturation, value) color space statistical characteristics
CN103414841A (en) * 2013-07-29 2013-11-27 西北工业大学 Image encryption and decryption method for utilizing gray system theory to confirm ICA output
CN103945089A (en) * 2014-04-18 2014-07-23 上海复控华龙微系统技术有限公司 Dynamic target detection method based on brightness flicker correction and IP camera
CN104809245A (en) * 2015-05-13 2015-07-29 信阳师范学院 Image retrieval method
CN106251286A (en) * 2015-12-30 2016-12-21 深圳超多维科技有限公司 Image processing method, device and equipment
CN105761267A (en) * 2016-03-08 2016-07-13 重庆邮电大学 Image processing method and device
CN106504241A (en) * 2016-10-25 2017-03-15 西安交通大学 An automatic color matching device and method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
一种地震属性图像配色阈值选取算法;唐世伟等;《计算机与数字工程》;20130220;第287-290页 *

Also Published As

Publication number Publication date
CN108875759A (en) 2018-11-23

Similar Documents

Publication Publication Date Title
CN108875759B (en) An image processing method, device and server
CN110544258B (en) Image segmentation method and device, electronic equipment and storage medium
KR102595704B1 (en) Image detection method, device, electronic device, storage medium, and program
CN105359162B (en) For the pattern mask of the selection and processing related with face in image
AU2017264371A1 (en) System and method for detecting plant diseases
CN103646392B (en) Backlighting detecting and equipment
CN109658330B (en) Color development adjusting method and device
CN111079637B (en) Method, device, equipment and storage medium for segmenting rape flowers in field image
WO2015070723A1 (en) Eye image processing method and apparatus
CN110706196B (en) Clustering perception-based no-reference tone mapping image quality evaluation algorithm
WO2018149253A1 (en) Image processing method and device
CN108205671A (en) Image processing method and device
CN110428439A (en) A kind of shadow detection method based on shadow region color saturation property
CN109448009A (en) Infrared Image Processing Method and device for transmission line faultlocating
US11461880B2 (en) Generating image masks from digital images utilizing color density estimation and deep learning models
CN111311500B (en) A method and device for color restoration of an image
CN111626967A (en) Image enhancement method, image enhancement device, computer device and readable storage medium
CN112257501A (en) Face feature enhancement display method and device, electronic equipment and medium
CN108615030A (en) A kind of title consistency detecting method, device and electronic equipment
CN115082400A (en) An image processing method, apparatus, computer equipment and readable storage medium
Jha et al. l2‐norm‐based prior for haze‐removal from single image
CN110956604B (en) Method and system for counting effective bonding area of bonding glue
CN108711160B (en) Target segmentation method based on HSI (high speed input/output) enhanced model
CN110310341B (en) Method, device, equipment and storage medium for generating default parameters in color algorithm
JP2013211807A (en) Image processing device and program

Legal Events

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