WO2020024394A1 - Background elimination method and device, computer device and storage medium - Google Patents

Background elimination method and device, computer device and storage medium Download PDF

Info

Publication number
WO2020024394A1
WO2020024394A1 PCT/CN2018/106379 CN2018106379W WO2020024394A1 WO 2020024394 A1 WO2020024394 A1 WO 2020024394A1 CN 2018106379 W CN2018106379 W CN 2018106379W WO 2020024394 A1 WO2020024394 A1 WO 2020024394A1
Authority
WO
WIPO (PCT)
Prior art keywords
pixel
video
value
pixel point
preset
Prior art date
Application number
PCT/CN2018/106379
Other languages
French (fr)
Chinese (zh)
Inventor
车宏伟
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020024394A1 publication Critical patent/WO2020024394A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/12Edge-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/20Analysis of motion
    • G06T7/215Motion-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/20Analysis of motion
    • G06T7/246Analysis of motion using feature-based methods, e.g. the tracking of corners or segments
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10016Video; Image sequence
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person

Definitions

  • the present application relates to the field of financial technology, and in particular, to a background removal method, device, computer equipment, and storage medium.
  • the traditional pedestrian re-recognition algorithm may be a neural network algorithm or other algorithms.
  • the intercepted target person is extracted from the picture to achieve The separation of the target person from his background.
  • the traditional method has a large amount of calculation when calculating pictures in which the color difference between the background of the target person and the background of the target person is large, or the background light of the target person is strong.
  • a background culling method includes: performing a first-order derivative on pixel values corresponding to each pixel point in an initial picture obtained in advance to obtain a first processed value of the pixel value corresponding to each pixel point, wherein the pixel point There is a one-to-one correspondence between the corresponding pixel value and the first processed value of the pixel value corresponding to the pixel point; the first processed value of the pixel value corresponding to each pixel point is subjected to second order differentiation to obtain each pixel point A second processed value of the corresponding pixel value, wherein there is a one-to-one correspondence between the first processed value of the pixel value corresponding to the pixel point and the second processed value of the pixel value corresponding to the pixel point; if the pixel point If the first processing value of the corresponding pixel value satisfies a preset first condition, and the second processing value of the pixel value corresponding to the pixel satisfies a preset second condition, it is determined that the pixel is in the picture The edge point
  • a background culling device includes: a first derivation module for first-order derivation of pixel values corresponding to each pixel point in an initial picture obtained in advance, and a first process for obtaining pixel values corresponding to each pixel point A numerical value, wherein there is a one-to-one correspondence between a pixel value corresponding to the pixel point and a first processed value of the pixel value corresponding to the pixel point; a second derivative module is configured to perform a pixel value corresponding to each pixel point The second processed value of the first processed value of is respectively obtained to obtain the second processed value of the pixel value corresponding to each pixel, wherein the first processed value of the pixel value corresponding to the pixel point and the pixel value corresponding to the pixel point There is a one-to-one correspondence relationship between the second processing values of; the determining module is configured to: if the first processing value of the pixel value corresponding to the pixel meets a preset first condition, and the second value of the pixel value corresponding to the pixel
  • a computer device includes a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor.
  • the processor executes the computer-readable instructions, the background elimination method is implemented. step.
  • One or more non-volatile readable storage media storing computer-readable instructions, which when executed by one or more processors, cause the one or more processors to perform the background culling Method steps.
  • FIG. 1 is a schematic diagram of an application environment of a background removal method in an embodiment of the present application
  • FIG. 3 is a flowchart of obtaining an initial picture in a background removal method in an embodiment of the present application
  • FIG. 4 is a flowchart of obtaining a track video in a background removal method in an embodiment of the present application
  • FIG. 5 is a flowchart of calculating pixels in a background culling method according to an embodiment of the present application.
  • FIG. 6 is a schematic diagram of a background removing device in an embodiment of the present application.
  • FIG. 7 is a schematic diagram of a computer device according to an embodiment of the present application.
  • the background elimination method provided in this application can be applied in the application environment shown in FIG. 1, where a computer device communicates with a server through a network.
  • the server performs first order differentiation on the pixel values corresponding to each pixel in the initial picture obtained in advance, and obtains a first processed value of the pixel value corresponding to each pixel.
  • the server corresponds to each pixel
  • the first processed value of the pixel value is respectively subjected to second order differentiation to obtain the second processed value of the pixel value corresponding to each pixel.
  • the server determines that the pixel point is an edge point between the target person in the initial picture and the background of the target person; Removing the background of the target person to obtain a target picture.
  • the computer device may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices.
  • the server can be implemented by an independent server or a server cluster composed of multiple servers.
  • a background culling method is provided.
  • the background culling method is applied in the financial industry.
  • the method is applied to the server in FIG. 1 as an example, and includes the following steps:
  • S10 Perform first-order derivative on the pixel values corresponding to each pixel in the initial picture obtained in advance to obtain a first processed value of the pixel value corresponding to each pixel;
  • a pixel point is a pixel
  • a pixel value corresponding to the pixel point is a modulus and a color value of a position vector corresponding to the pixel.
  • each pixel in order to obtain the first processed value of the pixel value corresponding to each pixel point in the selected picture, it is necessary to first obtain the pixel value corresponding to each pixel point from each pixel point in the selected picture obtained in advance, and then First-order differentiation is performed on the obtained pixel values corresponding to each pixel point, thereby obtaining a first processed value of the pixel values corresponding to each pixel point.
  • First-order differentiation is performed on the obtained pixel values corresponding to each pixel point, thereby obtaining a first processed value of the pixel values corresponding to each pixel point.
  • the pixel value corresponding to the pixel point, and then the obtained pixel value corresponding to each pixel point is subjected to first order differentiation, preferably, the pixel value corresponding to the first pixel point is x n , and then the first order derivative is performed on x n ,
  • a first processed value to obtain a pixel value corresponding to the first pixel point is nx n-1 , where n is a positive integer greater than or equal to the number 1, and x is a positive integer greater than or equal to the number 1.
  • S20 Perform a second-order derivative on the first processed value of the pixel value corresponding to each pixel, to obtain the second processed value of the pixel value corresponding to each pixel;
  • the first order of the pixel value corresponding to each pixel point in the selected picture obtained by the first order differentiation is needed.
  • One processing value is subjected to second order derivation, so as to obtain a second processing value of a pixel value corresponding to each desired pixel point.
  • the second processed value of the pixel value corresponding to each pixel point of the selected picture "bicycle.jpg”
  • the first processed value of the pixel value of is subjected to second-order differentiation.
  • the first processed value of the pixel value corresponding to the second pixel point is nx n-1 , and then the second-order derivative of nx n-1 is obtained to obtain the first
  • the second processed value of the pixel value corresponding to a pixel is n * (n-1) x n-2 , where n is a positive integer greater than or equal to the number 2 and x is a positive integer greater than or equal to the number 1.
  • the pixel point is determined as an edge point between the target person and the background of the target person in the picture, and the edge point is also a boundary point where the target person and the background of the target person are tangent.
  • the preset first condition may be greater than the preset first threshold or equal to the preset first threshold
  • the preset second condition may be greater than the preset second threshold or equal to the preset first threshold.
  • the specific contents of the two thresholds, the preset first condition and the preset second condition can be set according to actual applications, and there is no limitation here.
  • the edge points between the target person and the background of the target person in each of the obtained pictures are first connected to obtain an edge line, and then the target person is distinguished from the background of the target person along the edge line.
  • a preset third threshold value is used to replace the pixel value corresponding to each pixel point in the background of the target person. Therefore, it can be clearly known that the area of the color corresponding to the preset third threshold value is the target person background, thereby avoiding the problem in the picture. In the detection of the target person, the background interferes, which has the effect of removing the background.
  • the specific content of the preset third threshold may be set according to actual applications, and is not limited here.
  • a first-order derivative is performed on pixel values corresponding to each pixel point in the initial picture obtained in advance to obtain a first processed value of the pixel value corresponding to each pixel point, and corresponding to each pixel point.
  • the second processing value of the first processing value of the pixel value of is obtained to obtain the second processing value of the pixel value corresponding to each pixel point.
  • the first processing value of the pixel value corresponding to the pixel point satisfies a preset first condition
  • the second processing value of the pixel value corresponding to the pixel point satisfies a preset second condition, determining that the pixel point is an edge point between the target person and the target person background in the initial picture, and according to the edge Line to remove the background of the target person in the initial picture to obtain the target picture.
  • the edge point between the target person and the background of the target person can be determined only by a derivative method with a small amount of calculation, the background of the target person is removed from the picture according to the edge line connected by the edge points to achieve the target person and Separation of the background of the target person, thereby avoiding the problem of large calculation amount when calculating pictures with a large color difference between the background of the target person and the background of the target person, or when the background light of the target person is strong.
  • the background culling method is applied in the financial industry.
  • a first processing value of a pixel value corresponding to a pixel point satisfies a preset first condition
  • a pixel corresponding to the pixel point The second processed value of the value satisfies the preset second condition is:
  • the first absolute value is greater than a preset first threshold value
  • the second absolute value is greater than a preset second threshold value
  • the first absolute value is a first-order derivative of the obtained pixel point and is transverse to the pixel point.
  • the absolute value of the difference between the first-order derivative results of adjacent preset pixel points, and the second absolute value is the result of the second-order derivative result of the obtained pixel point that is laterally adjacent to the pixel point.
  • the absolute value of the difference of the second order derivative result is the absolute value of the difference of the second order derivative result.
  • the horizontal direction may be left or right, or the preset number of pixels including both left and right may be 3 or 5 pixels, for example, 3 pixels on the left, or 3 pixels on the right.
  • the specific content of the preset pixels can be set according to the actual application. There is no limitation here.
  • the absolute value of the difference between the obtained first-order derivative result of the pixel point and the preset first-order derivative result of the pixel points laterally adjacent to the pixel point and the preset first Threshold comparison, and the absolute value of the difference between the second-order derivative result of the pixel point and the second-order derivative result of a preset number of pixel points that are laterally adjacent to the pixel point is compared to determine the obtained pixel point Is the edge point between the target person in the selected picture and the background of the target person. Because the size of the first-order derivative result represents the rate of change of the color of the pixel, that is, the larger the result of the first-order derivative, the greater the change in color of the pixel, otherwise it represents the color of the pixel.
  • the size of the second-order derivative result represents how fast the color of the pixel changes, that is, the larger the second-order derivative result represents the faster the color change of the pixel, otherwise it represents the The slower the color change of the pixel, the larger and slower the change of the color of the two pixels, which means that the two pixels are two different colors, so that the points of different colors in the picture can be easily distinguished, thereby improving the Convenience of identifying edge points.
  • the background culling method is applied in the financial industry, as shown in FIG. 3 and FIG. 2 is a flowchart of obtaining an initial picture in an application scenario in a background culling method according to the embodiment.
  • the initial image is obtained by the following steps:
  • S101 Calculate the distance between each video frame according to the time difference between the video frames in the track video and the similarity of the image color characteristics between the video frames.
  • S102 According to the distance between the video frames, a hierarchical clustering method is used to segment the track video to obtain an initial picture.
  • step S101 it can be understood that, first, the pre-captured track video is determined as the video to be divided, and then, according to the time difference between the video frames in the video to be divided and the image color between the video frames
  • the similarity of features uses the video frame distance calculation formula to calculate the distance between video frames.
  • taking the video to be divided includes M video frames as an example, according to the time difference between the first video frame and the second video frame in the video to be divided, and the first video frame and the second video frame, The similarity of the image color characteristics between the two video frames to obtain the distance between the first video frame and the second video frame; sequentially until the distance between the first video frame and the kth video frame in the video to be segmented The time difference and the similarity of image color characteristics between the first video frame and the k-th video frame, to obtain the distance between the first video frame and the k-th video frame; according to the second video frame in the video to be segmented The time difference between the third video frame and the similarity of the image color characteristics between the second video frame and the third video frame, to obtain the distance between the second video frame and the third video frame; Execute until the first video is obtained according to the time difference between the second video frame and the k-th video frame in the video to be segmented, and the similarity of the image color
  • the distance between the frame and the k-th video frame; and so on According to the time difference between the q-1th video frame and the qth video frame in the video to be divided, and the similarity of the image color characteristics between the q-1th video frame and the qth video frame, the qth The distance between the -1 video frame and the q-th video frame.
  • the distance between each video frame can be obtained, and then according to the distance, the to-be-divided video is segmented using hierarchical clustering to obtain a desired picture, and the selected picture is selected from the picture Out.
  • a desired picture can be obtained. Since the images in two video frames belonging to the same video event have similar similarity in color characteristics between the scene and the target person, Therefore, according to the time difference and similarity, video frames belonging to the same video can be divided into pictures of the video, thereby avoiding dividing video frames belonging to the same video into pictures of different videos, thereby ensuring the division of video content. Completeness.
  • the background culling method is applied in the financial industry.
  • a background culling method the time difference between video frames in the track video obtained in advance and the image color between the video frames are used. The similarity of features.
  • the distance between video frames is calculated as:
  • the chi-square distance between the video frames is calculated according to each video frame, and then the time difference between the video frames in the tracked video obtained in advance and the chi-square distance between the video frames are calculated. Enter the following calculation formula to get the distance between each video frame:
  • the track video includes q video frames, where q is greater than 1.
  • k i is the i-th video frame in the track video
  • k j is the j-th video frame in the track video
  • i is greater than or equal to 1 and less than or equal to q
  • j Greater than or equal to 1 and less than or equal to q
  • s (k i , k j ) is the distance between the i-th video frame and the j-th video frame
  • x 2 (k i , k j ) is the i-th video frame and the Chi-square distance of color histogram between j video frames
  • w 1 is a preset chi-square distance
  • r is a preset positive integer
  • represents the i-th video frame and the j-th video frame Time difference, in units of seconds, minutes, or hours
  • ) represents the maximum value between 0 and r-
  • the background culling method is applied in the financial industry, as shown in FIG. 4 and FIG. 3, which is a flowchart of obtaining a track video in an application scenario in a background culling method in the embodiment.
  • the whereabouts video is obtained by the following steps:
  • S1011 Shooting the whereabouts of the target person multiple times in succession, and during the shooting of the whereabouts video, determine whether the total time length of the whereabouts video obtained by the multiple consecutive shots reaches a preset time length;
  • the target person can be a pedestrian or other object, and the specific content of the target person can be set according to the actual situation, which is not limited here.
  • the whereabouts video of the target person may be stored in a database, or may be stored in a disc or hard disk.
  • the specific content of the storage location of the whereabouts video of the target person may be set according to actual conditions, and there is no limitation here.
  • a target person is determined from a plurality of objects, that is, a target person is artificially selected, and then a target person is selected from the plurality of objects.
  • a video of the target person's whereabouts is taken multiple times in a row, and In each process of shooting the track video, it is determined whether the total time length of the track video obtained by continuous shooting multiple times reaches the preset time length, and it is flexible to determine whether the total time length of the tracked video captured reaches the preset time length.
  • the preset time length can be 30 minutes or 1 hour.
  • the specific content of the preset time length can be set according to the actual situation. There is no limitation here.
  • the whereabouts video of the target person can be obtained through a camera device and then stored in the storage location.
  • the camera device can be a video camera or a digital camera.
  • the specific content of the camera device can be set according to the actual situation. There are no restrictions.
  • step S1012 it can be understood that if the total time length of the track video obtained during the continuous shooting of the track video reaches the preset time length, the shooting of the track video is stopped, and the target object is displayed for multiple consecutive shots.
  • the corresponding ID of the whereabouts video and according to the result of the user sorting the corresponding ID of the whereabouts video of the target object multiple times, stitching the whereabouts video of the target object multiple times into one video, or record the target object
  • the time corresponding to the whereabouts video of the video, and according to the result of the user sorting the time corresponding to the whereabouts video of the target object for multiple consecutive shots, the whereabouts video of the target object for the multiple consecutive shots is stitched into one video.
  • the preset time length is subtracted from the total time length to obtain the remaining time length, and then the remaining time length is calculated in The first proportion of the preset time length and the second proportion of the total time length within the preset time length are calculated, so that it is clear that the shooting time length progresses in the preset time length, and returns to step S1011.
  • the tracked video obtained after the stitching is determined as the acquired tracked video, and is stored in the video database.
  • the video database can be a database such as sql or Oracle.
  • the specific content of the video database can be set according to the actual application. There is no limitation here.
  • multiple selective shootings can be performed to obtain a track video, and the content of the tracked video captured can be screened independently, thereby improving the flexibility of video acquisition.
  • the background removal method is applied in the financial industry, as shown in FIG. 5 and FIG. 2 to FIG. 4 correspond to the background removal method in an embodiment before step S10. Map, the background removal method also includes:
  • S50 Obtain a first target pixel value corresponding to each pixel point of the initial picture, and a second target pixel value and a total pixel point corresponding to each pixel point of the background of the target person.
  • the pixel points of the picture include the target person's pixels and the target. Pixels of the background of the person, the total number of pixels is the total number of pixels of the picture or the total number of pixels of the background of the target person;
  • S60 Calculate the pixel value corresponding to each pixel point of the picture by using a preset calculation method according to the first target pixel value, the second target pixel value, and the pixel sum, to obtain the pixel value corresponding to the calculated pixel point.
  • the selected picture includes the target person and the target person background.
  • the selected picture is a combination of individual pixels. Obtain the first target pixel value corresponding to each pixel point in the entire selected picture, the second target pixel value corresponding to each pixel point in the background, and the sum of the pixel points, so as to perform the mean difference method on the pixel values corresponding to each pixel point.
  • the total number of pixels is the total number of pixels in the picture or the total number of pixels in the background of the target person.
  • the pixel value of a pixel point where the target person overlaps with the background of the target person is 0 in the background of the target person.
  • step S60 it can be understood that, according to the first target pixel value, the second target pixel value, and the sum of the pixel points, a preset calculation method is used to calculate a pixel value corresponding to each pixel point of the picture to obtain a calculated result.
  • the pixel value corresponding to the pixel that is, the obtained first target pixel value corresponding to each pixel point of the picture is subtracted from the second target pixel value corresponding to each pixel point of the picture background to obtain each deviation value, and then The sum of all deviation values is divided by the total number of pixels to obtain the mean difference value. Each deviation value is subtracted from the mean difference value to obtain the pixel points after each mean difference.
  • the first derivation module 701 is configured to perform first-order differentiation on pixel values corresponding to each pixel point in the initial picture obtained in advance, to obtain a first processed value of the pixel value corresponding to each pixel point, where There is a one-to-one correspondence between the pixel value and the first processed value of the pixel value corresponding to the pixel point;
  • a culling module 704 is configured to cull the background of the target person in the picture according to the edge line to obtain the target picture.
  • the edge line is formed by connecting edge points between the target person and the background of the target person in each picture.
  • track video is obtained through the following modules:
  • the background culling device further includes:
  • a third calculation module is configured to calculate a pixel value corresponding to each pixel point of the picture by using a preset calculation method according to the first target pixel value, the second target pixel value, and a sum of the pixel points to obtain the calculated pixel points. The corresponding pixel value.
  • a computer device is provided.
  • the computer device may be a server, and its internal structure diagram may be as shown in FIG. 7.
  • the computer device includes a processor, a memory, a network interface, and a database connected through a system bus.
  • the processor of the computer device is used to provide computing and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system, computer-readable instructions, and a database.
  • the internal memory provides an environment for operating the operating system and computer-readable instructions in a non-volatile storage medium.
  • the computer equipment database is used to store background-related data.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection.
  • the computer-readable instructions are executed by a processor to implement a background removal method.

Landscapes

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

Abstract

A background elimination method and device, a computer device and a storage medium, comprising the steps of respectively performing a first-order derivation on pixel values corresponding to pixel points in an initial image obtained in advance, to obtain first processing values of the pixel values corresponding to the pixel points (S10), respectively performing a second-order derivation on the first processing values of the pixel values corresponding to the pixel points, to obtain second processing values of the pixel values corresponding to the pixel points (S20), if the first processing values of the pixel values corresponding to the pixel points meet a preset first condition, and the second processing values of the pixel values corresponding to the pixel points meet a preset second condition, determining the pixel points as edge points between a target person and a target person background in the initial image (S30), and eliminating the target person background in the initial image according to an edge line, to obtain a target image (S40). In this way, the problem of heavy calculation is resolved.

Description

背景剔除方法、装置、计算机设备及存储介质Background removal method, device, computer equipment and storage medium
本申请以2018年08月02日提交的申请号为201810872355.8,名称为“背景剔除方法、装置、计算机设备及存储介质”的中国发明专利申请为基础,并要求其优先权。This application is based on a Chinese invention patent application filed on August 02, 2018 with the application number 201810872355.8 and entitled "Background Removal Method, Device, Computer Equipment and Storage Medium" and claims its priority.
技术领域Technical field
本申请涉及金融科技领域,尤其涉及一种背景剔除方法、装置、计算机设备及存储介质。The present application relates to the field of financial technology, and in particular, to a background removal method, device, computer equipment, and storage medium.
背景技术Background technique
目前,社会的犯罪率正在持续上升,抓捕罪犯的任务越来越繁重。At present, the crime rate in the society is continuously rising, and the task of arresting criminals is getting more and more onerous.
为了抓捕犯罪人,出现了行人重识别技术。在采用传统的行人重识别算法对视频监控中目标人物的侦查过程中,所述传统的行人重识别算法可以为神经网络算法或其他算法等,通常都会将截取目标人物从图片中提取出来,实现目标人物与其背景的分离。但是,传统方法在计算目标人物与目标人物背景的颜色差距较大,或目标人物背景光线较强等情况下的图片时,计算量大。In order to arrest criminals, pedestrian re-identification technology has appeared. In the process of detecting a target person in video surveillance by using a traditional pedestrian re-recognition algorithm, the traditional pedestrian re-recognition algorithm may be a neural network algorithm or other algorithms. Usually, the intercepted target person is extracted from the picture to achieve The separation of the target person from his background. However, the traditional method has a large amount of calculation when calculating pictures in which the color difference between the background of the target person and the background of the target person is large, or the background light of the target person is strong.
发明内容Summary of the invention
基于此,有必要针对上述技术问题,提供一种可以避免计算目标人物与目标人物背景的颜色差距较大,或目标人物背景光线较强等情况下的图片时,计算量大的问题的背景剔除方法、装置、计算机设备及存储介质。Based on this, it is necessary to provide a background elimination for the above technical problems, which can avoid the problem of large calculations when calculating the picture in the case where the color difference between the background color of the target person and the background of the target person is large, or the background light of the target person is strong. Method, device, computer equipment and storage medium.
一种背景剔除方法,包括:对预先得到的初始图片中的各个像素点对应的像素值分别进行一阶求导,得到各个像素点对应的像素值的第一处理数值,其中,所述像素点对应的像素值与所述像素点对应的像素值的第一处理数值存在一一对应关系;对所述各个像素点对应的像素值的第一处理数值分别进行二阶求导,得到各个像素点对应的像素值的第二处理数值,其中,所述像素点对应的像素值的第一处理数值与所述像素点对应的像素值的第二处理数值存在一一对应关系;若所述像素点对应的像素值的第一处理数值满足预设的第一条件,且所述像素点对应的像素值的第二处理数值满足预设的第二条件,则确定所述像素点为所述图片中的目标人物与目标人物背景之间的边缘点;按照边缘线将所述初始图片 中的所述目标人物背景进行剔除,得到目标图片,其中,所述边缘线由各个所述初始图片中的目标人物与目标人物背景之间的边缘点连接而成。A background culling method includes: performing a first-order derivative on pixel values corresponding to each pixel point in an initial picture obtained in advance to obtain a first processed value of the pixel value corresponding to each pixel point, wherein the pixel point There is a one-to-one correspondence between the corresponding pixel value and the first processed value of the pixel value corresponding to the pixel point; the first processed value of the pixel value corresponding to each pixel point is subjected to second order differentiation to obtain each pixel point A second processed value of the corresponding pixel value, wherein there is a one-to-one correspondence between the first processed value of the pixel value corresponding to the pixel point and the second processed value of the pixel value corresponding to the pixel point; if the pixel point If the first processing value of the corresponding pixel value satisfies a preset first condition, and the second processing value of the pixel value corresponding to the pixel satisfies a preset second condition, it is determined that the pixel is in the picture The edge point between the target person and the background of the target person; removing the background of the target person in the initial picture according to the edge line to obtain the target picture, The edge line is formed by connecting edge points between the target person and the background of the target person in each of the initial pictures.
一种背景剔除装置,包括:第一求导模块,用于对预先得到的初始图片中的各个像素点对应的像素值分别进行一阶求导,得到各个像素点对应的像素值的第一处理数值,其中,所述像素点对应的像素值与所述像素点对应的像素值的第一处理数值存在一一对应关系;第二求导模块,用于对所述各个像素点对应的像素值的第一处理数值分别进行二阶求导,得到各个像素点对应的像素值的第二处理数值,其中,所述像素点对应的像素值的第一处理数值与所述像素点对应的像素值的第二处理数值存在一一对应关系;确定模块,用于若所述像素点对应的像素值的第一处理数值满足预设的第一条件,且所述像素点对应的像素值的第二处理数值满足预设的第二条件,则确定所述像素点为所述图片中的目标人物与目标人物背景之间的边缘点;剔除模块,用于按照边缘线将所述初始图片中的所述目标人物背景进行剔除,得到目标图片,其中,所述边缘线由各个所述初始图片中的目标人物与目标人物背景之间的边缘点连接而成。A background culling device includes: a first derivation module for first-order derivation of pixel values corresponding to each pixel point in an initial picture obtained in advance, and a first process for obtaining pixel values corresponding to each pixel point A numerical value, wherein there is a one-to-one correspondence between a pixel value corresponding to the pixel point and a first processed value of the pixel value corresponding to the pixel point; a second derivative module is configured to perform a pixel value corresponding to each pixel point The second processed value of the first processed value of is respectively obtained to obtain the second processed value of the pixel value corresponding to each pixel, wherein the first processed value of the pixel value corresponding to the pixel point and the pixel value corresponding to the pixel point There is a one-to-one correspondence relationship between the second processing values of; the determining module is configured to: if the first processing value of the pixel value corresponding to the pixel meets a preset first condition, and the second value of the pixel value corresponding to the pixel is If the processed value meets a preset second condition, it is determined that the pixel point is an edge point between the target person in the picture and the background of the target person; a culling module is used to The line of the initial target character background picture is removed to obtain the target image, wherein the edge points by the edge line connecting the target person and between each of the initial target character background picture from.
一种计算机设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现上述背景剔除方法的步骤。A computer device includes a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor. When the processor executes the computer-readable instructions, the background elimination method is implemented. step.
一个或多个存储有计算机可读指令的非易失性可读存储介质,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行所述背景剔除方法的步骤。One or more non-volatile readable storage media storing computer-readable instructions, which when executed by one or more processors, cause the one or more processors to perform the background culling Method steps.
本申请的一个或多个实施例的细节在下面的附图和描述中提出,本申请的其他特征和优点将从说明书、附图以及权利要求变得明显。Details of one or more embodiments of the present application are set forth in the accompanying drawings and description below, and other features and advantages of the present application will become apparent from the description, the drawings, and the claims.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本申请实施例的技术方案,下面将对本申请实施例的描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solution of the embodiments of the present application more clearly, the drawings used in the description of the embodiments of the application will be briefly introduced below. Obviously, the drawings in the following description are just some embodiments of the application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without paying creative labor.
图1是本申请一实施例中背景剔除方法的一应用环境示意图;FIG. 1 is a schematic diagram of an application environment of a background removal method in an embodiment of the present application; FIG.
图2是本申请一实施例中背景剔除方法的一流程图;2 is a flowchart of a background removal method in an embodiment of the present application;
图3是本申请一实施例中背景剔除方法中获取初始图片的一流程图;3 is a flowchart of obtaining an initial picture in a background removal method in an embodiment of the present application;
图4是本申请一实施例中背景剔除方法中获取行踪视频的一流程图;4 is a flowchart of obtaining a track video in a background removal method in an embodiment of the present application;
图5是本申请一实施例中背景剔除方法中计算像素点的一流程图;FIG. 5 is a flowchart of calculating pixels in a background culling method according to an embodiment of the present application; FIG.
图6是本申请一实施例中背景剔除装置的一示意图;6 is a schematic diagram of a background removing device in an embodiment of the present application;
图7是本申请一实施例中计算机设备的一示意图。FIG. 7 is a schematic diagram of a computer device according to an embodiment of the present application.
具体实施方式detailed description
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In the following, the technical solutions in the embodiments of the present application will be clearly and completely described with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
本申请提供的背景剔除方法,可应用在如图1的应用环境中,其中,计算机设备通过网络与服务端进行通信。首先,服务端对预先得到的初始图片中的各个像素点对应的像素值分别进行一阶求导,得到各个像素点对应的像素值的第一处理数值,然后,服务端对各个像素点对应的像素值的第一处理数值分别进行二阶求导,得到各个像素点对应的像素值的第二处理数值,若像素点对应的像素值的第一处理数值满足预设的第一条件,且像素点对应的像素值的第二处理数值满足预设的第二条件,则服务端确定像素点为初始图片中的目标人物与目标人物背景之间的边缘点;服务端按照边缘线将初始图片中的所述目标人物背景进行剔除,得到目标图片。其中,计算机设备可以但不限于各种个人计算机、笔记本电脑、智能手机、平板电脑和便携式可穿戴设备。服务端可以用独立的服务器或者是多个服务器组成的服务器集群来实现。The background elimination method provided in this application can be applied in the application environment shown in FIG. 1, where a computer device communicates with a server through a network. First, the server performs first order differentiation on the pixel values corresponding to each pixel in the initial picture obtained in advance, and obtains a first processed value of the pixel value corresponding to each pixel. Then, the server corresponds to each pixel The first processed value of the pixel value is respectively subjected to second order differentiation to obtain the second processed value of the pixel value corresponding to each pixel. If the first processed value of the pixel value corresponding to the pixel meets a preset first condition, and the pixel The second processing value of the pixel value corresponding to the point satisfies a preset second condition, the server determines that the pixel point is an edge point between the target person in the initial picture and the background of the target person; Removing the background of the target person to obtain a target picture. Among them, the computer device may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices. The server can be implemented by an independent server or a server cluster composed of multiple servers.
在一实施例中,如图2所示,提供一种背景剔除方法,该背景剔除方法应用在金融行业中,以该方法应用在图1中的服务端为例进行说明,包括如下步骤:In one embodiment, as shown in FIG. 2, a background culling method is provided. The background culling method is applied in the financial industry. The method is applied to the server in FIG. 1 as an example, and includes the following steps:
S10:对预先得到的初始图片中的各个像素点对应的像素值分别进行一阶求导,得到各个像素点对应的像素值的第一处理数值;S10: Perform first-order derivative on the pixel values corresponding to each pixel in the initial picture obtained in advance to obtain a first processed value of the pixel value corresponding to each pixel;
在本实施例中,像素点为像素,像素点对应的像素值为像素对应的位置矢量的模和色彩数值。In this embodiment, a pixel point is a pixel, and a pixel value corresponding to the pixel point is a modulus and a color value of a position vector corresponding to the pixel.
具体地,为了得到选定的图片中的各个像素点对应的像素值的第一处理数值,需要先从预先得到的选定的图片中的各个像素点上获取各个像素点对应的像素值,然后对获取到的各个像素点对应的像素值分别进行一阶求导,从而得到各个像素点对应的像素值的第一处理数值。如,为了得到选定的图片“篮球.jpg”的各个像素点对应的像素值的第一处理数值,需要先从预先得到的选定的图片“篮球.jpg”中的各个像素点上获取各个像素点对 应的像素值,然后获取到的各个像素点对应的像素值分别进行一阶求导,优选地,第一像素点对应的像素值为x n,然后对x n进行一阶求导,得到第一像素点对应的像素值的第一处理数值为nx n-1,其中,n为大于等于数字1的正整数,x为大于等于数字1的正整数。 Specifically, in order to obtain the first processed value of the pixel value corresponding to each pixel point in the selected picture, it is necessary to first obtain the pixel value corresponding to each pixel point from each pixel point in the selected picture obtained in advance, and then First-order differentiation is performed on the obtained pixel values corresponding to each pixel point, thereby obtaining a first processed value of the pixel values corresponding to each pixel point. For example, in order to obtain the first processed value of the pixel value corresponding to each pixel point of the selected picture "basketball.jpg", each pixel must be obtained from each pixel point in the selected picture "basketball.jpg" obtained in advance. The pixel value corresponding to the pixel point, and then the obtained pixel value corresponding to each pixel point is subjected to first order differentiation, preferably, the pixel value corresponding to the first pixel point is x n , and then the first order derivative is performed on x n , A first processed value to obtain a pixel value corresponding to the first pixel point is nx n-1 , where n is a positive integer greater than or equal to the number 1, and x is a positive integer greater than or equal to the number 1.
需要说明的是,像素点对应的像素值与像素点对应的像素值的第一处理数值存在一一对应关系。It should be noted that there is a one-to-one correspondence between the pixel value corresponding to the pixel point and the first processed value of the pixel value corresponding to the pixel point.
S20:对各个像素点对应的像素值的第一处理数值分别进行二阶求导,得到各个像素点对应的像素值的第二处理数值;S20: Perform a second-order derivative on the first processed value of the pixel value corresponding to each pixel, to obtain the second processed value of the pixel value corresponding to each pixel;
在本实施例中,为了得到选定的图片中的各个像素点对应的像素值的第二处理数值,需要对一阶求导得到的选定的图片中的各个像素点对应的像素值的第一处理数值进行二阶求导,从而得到想要的各个像素点对应的像素值的第二处理数值。如,为了得到选定的图片“自行车.jpg”的各个像素点对应的像素值的第二处理数值,需要对一阶求导得到的选定的图片“自行车.jpg”中的各个像素点对应的像素值的第一处理数值进行二阶求导,优选地,第二像素点对应的像素值的第一处理数值为nx n-1,然后对nx n-1进行二阶求导,得到第一像素点对应的像素值的第二处理数值为n*(n-1)x n-2,其中,n为大于等于数字2的正整数,x为大于等于数字1的正整数。 In this embodiment, in order to obtain the second processing value of the pixel value corresponding to each pixel point in the selected picture, the first order of the pixel value corresponding to each pixel point in the selected picture obtained by the first order differentiation is needed. One processing value is subjected to second order derivation, so as to obtain a second processing value of a pixel value corresponding to each desired pixel point. For example, in order to obtain the second processed value of the pixel value corresponding to each pixel point of the selected picture "bicycle.jpg", it is necessary to correspond to each pixel point in the selected picture "bicycle.jpg" obtained by first-order differentiation. The first processed value of the pixel value of is subjected to second-order differentiation. Preferably, the first processed value of the pixel value corresponding to the second pixel point is nx n-1 , and then the second-order derivative of nx n-1 is obtained to obtain the first The second processed value of the pixel value corresponding to a pixel is n * (n-1) x n-2 , where n is a positive integer greater than or equal to the number 2 and x is a positive integer greater than or equal to the number 1.
需要说明的是,像素点对应的像素值的第一处理数值与像素点对应的像素值的第二处理数值存在一一对应关系。It should be noted that there is a one-to-one correspondence between the first processed value of the pixel value corresponding to the pixel point and the second processed value of the pixel value corresponding to the pixel point.
S30:若像素点对应的像素值的第一处理数值满足预设的第一条件,且像素点对应的像素值的第二处理数值满足预设的第二条件,则确定像素点为图片中的目标人物与目标人物背景之间的边缘点;S30: If the first processing value of the pixel value corresponding to the pixel point satisfies a preset first condition, and the second processing value of the pixel value corresponding to the pixel point satisfies a preset second condition, determining that the pixel point is in the picture The edge point between the target person and the target person's background;
在本实施例中,当得到的像素点对应的像素值的第一处理数值满足预设的第一条件时,且当得到的像素点对应的像素值的第二处理数值满足预设的第二条件时,则确定该像素点为图片中的目标人物与目标人物背景之间的边缘点,该边缘点也即目标人物与目标人物背景相切的边界点。In this embodiment, when the first processed value of the pixel value corresponding to the obtained pixel point satisfies a preset first condition, and when the second processed value of the pixel value corresponding to the obtained pixel point satisfies a preset second condition When the condition is met, the pixel point is determined as an edge point between the target person and the background of the target person in the picture, and the edge point is also a boundary point where the target person and the background of the target person are tangent.
需要说明的是,预设的第一条件可以为大于预设的第一阈值或等于预设的第一阈值,预设的第二条件可以为大于预设的第二阈值或等于预设的第二阈值,预设的第一条件和预设的第二条件的具体内容,可以根据实际应用进行设定,此处不做限制。It should be noted that the preset first condition may be greater than the preset first threshold or equal to the preset first threshold, and the preset second condition may be greater than the preset second threshold or equal to the preset first threshold. The specific contents of the two thresholds, the preset first condition and the preset second condition can be set according to actual applications, and there is no limitation here.
S40:按照边缘线将图片中的目标人物背景进行剔除,得到目标图片;S40: Remove the background of the target person in the picture according to the edge line to obtain the target picture;
在本实施例中,首先将得到的各个图片中的目标人物与目标人物背景之间的边缘点连 接起来,得到边缘线,然后沿着该边缘线,将目标人物与目标人物背景区分开,接下来采用预设的第三阈值替代所述目标人物背景中的各个像素点对应的像素值,因此可以清楚地知道预设的第三阈值对应的颜色的区域为目标人物背景,从而避免在对图片中目标人物检测时背景的干扰,进而起到剔除背景的效果。In this embodiment, the edge points between the target person and the background of the target person in each of the obtained pictures are first connected to obtain an edge line, and then the target person is distinguished from the background of the target person along the edge line. Next, a preset third threshold value is used to replace the pixel value corresponding to each pixel point in the background of the target person. Therefore, it can be clearly known that the area of the color corresponding to the preset third threshold value is the target person background, thereby avoiding the problem in the picture. In the detection of the target person, the background interferes, which has the effect of removing the background.
需要说明的是,预设的第三阈值可以为的具体内容,可以根据实际应用进行设定,此处不做限制。It should be noted that the specific content of the preset third threshold may be set according to actual applications, and is not limited here.
在图2对应的实施例中,通过对预先得到的初始图片中的各个像素点对应的像素值进行一阶求导,得到各个像素点对应的像素值的第一处理数值,对各个像素点对应的像素值的第一处理数值进行二阶求导,得到各个像素点对应的像素值的第二处理数值,若所述像素点对应的像素值的第一处理数值满足预设的第一条件,和若所述像素点对应的像素值的第二处理数值满足预设的第二条件,则确定所述像素点为所述初始图片中的目标人物与目标人物背景之间的边缘点,按照边缘线,将所述初始图片中的所述目标人物背景进行剔除,得到目标图片。由于仅通过计算量很小的求导方法便能确定出目标人物与目标人物背景之间的边缘点,根据由边缘点连接而成的边缘线将目标人物背景从图片中剔除,实现目标人物与目标人物背景的分离,从而避免了计算目标人物与目标人物背景的颜色差距较大,或目标人物背景光线较强等情况下的图片时,计算量大的问题。In the embodiment corresponding to FIG. 2, a first-order derivative is performed on pixel values corresponding to each pixel point in the initial picture obtained in advance to obtain a first processed value of the pixel value corresponding to each pixel point, and corresponding to each pixel point. The second processing value of the first processing value of the pixel value of is obtained to obtain the second processing value of the pixel value corresponding to each pixel point. If the first processing value of the pixel value corresponding to the pixel point satisfies a preset first condition, And if the second processing value of the pixel value corresponding to the pixel point satisfies a preset second condition, determining that the pixel point is an edge point between the target person and the target person background in the initial picture, and according to the edge Line to remove the background of the target person in the initial picture to obtain the target picture. Because the edge point between the target person and the background of the target person can be determined only by a derivative method with a small amount of calculation, the background of the target person is removed from the picture according to the edge line connected by the edge points to achieve the target person and Separation of the background of the target person, thereby avoiding the problem of large calculation amount when calculating pictures with a large color difference between the background of the target person and the background of the target person, or when the background light of the target person is strong.
进一步地,在一实施例中,该背景剔除方法应用在金融行业中,一种背景剔除方法中像素点对应的像素值的第一处理数值满足预设的第一条件,且像素点对应的像素值的第二处理数值满足预设的第二条件为:Further, in an embodiment, the background culling method is applied in the financial industry. In a background culling method, a first processing value of a pixel value corresponding to a pixel point satisfies a preset first condition, and a pixel corresponding to the pixel point The second processed value of the value satisfies the preset second condition is:
具体地,第一绝对值大于预设的第一阈值,且第二绝对值大于预设的第二阈值,其中,第一绝对值为得到的像素点的一阶求导结果与该像素点横向相邻的预设个像素点的一阶求导结果的差值的绝对值,第二绝对值为得到的像素点的二阶求导结果与该像素点横向相邻的预设个像素点的二阶求导结果的差值的绝对值。Specifically, the first absolute value is greater than a preset first threshold value, and the second absolute value is greater than a preset second threshold value, wherein the first absolute value is a first-order derivative of the obtained pixel point and is transverse to the pixel point. The absolute value of the difference between the first-order derivative results of adjacent preset pixel points, and the second absolute value is the result of the second-order derivative result of the obtained pixel point that is laterally adjacent to the pixel point. The absolute value of the difference of the second order derivative result.
需要说明的是,所述横向可以为左或右,也可以为同时包括左和右预设个像素点可以为3个或5个像素点,如,左边3个像素点,或右边3个像素点,或同时包括左边3个像素点和右边3个像素点,也即6个像素点,预设个像素点的具体内容,可以根据实际应用进行设定,此处不做限制。It should be noted that the horizontal direction may be left or right, or the preset number of pixels including both left and right may be 3 or 5 pixels, for example, 3 pixels on the left, or 3 pixels on the right. The points, or 3 pixels on the left and 3 pixels on the right, that is, 6 pixels. The specific content of the preset pixels can be set according to the actual application. There is no limitation here.
在本一实施例中,通过将得到的像素点的一阶求导结果与该像素点横向相邻的预设个像素点的一阶求导结果的差值的绝对值与预设的第一阈值比较,且将得到的像素点的二阶求导结果与该像素点横向相邻的预设个像素点的二阶求导结果的差值的绝对值比较,便可 确定该得到的像素点为选定的图片中的目标人物与目标人物背景之间的边缘点。由于一阶求导结果的大小代表所述像素点的色彩的变化率大小,也即一阶求导结果越大所述像素点的色彩的变化就越大,反之代表所述像素点的色彩的变化就越小,同时二阶求导结果的大小代表所述像素点的色彩的变化的快慢,也即二阶求导结果的越大代表所述像素点的色彩的变化越快,反之代表所述像素点的色彩的变化越慢,两个像素点的色彩的变化大和变化慢代表该两个像素点为两种不同的色彩,从而可以方便地分辨出图片中不同色彩的点,进而提高了辨别边缘点的便捷性。In this embodiment, the absolute value of the difference between the obtained first-order derivative result of the pixel point and the preset first-order derivative result of the pixel points laterally adjacent to the pixel point and the preset first Threshold comparison, and the absolute value of the difference between the second-order derivative result of the pixel point and the second-order derivative result of a preset number of pixel points that are laterally adjacent to the pixel point is compared to determine the obtained pixel point Is the edge point between the target person in the selected picture and the background of the target person. Because the size of the first-order derivative result represents the rate of change of the color of the pixel, that is, the larger the result of the first-order derivative, the greater the change in color of the pixel, otherwise it represents the color of the pixel. The smaller the change, the size of the second-order derivative result represents how fast the color of the pixel changes, that is, the larger the second-order derivative result represents the faster the color change of the pixel, otherwise it represents the The slower the color change of the pixel, the larger and slower the change of the color of the two pixels, which means that the two pixels are two different colors, so that the points of different colors in the picture can be easily distinguished, thereby improving the Convenience of identifying edge points.
进一步地,在一实施例中,该背景剔除方法应用在金融行业中,如图3所示图2对应实施例中一种背景剔除方法中获取初始图片在一个应用场景下的流程图,所述初始图片通过以下步骤获取:Further, in one embodiment, the background culling method is applied in the financial industry, as shown in FIG. 3 and FIG. 2 is a flowchart of obtaining an initial picture in an application scenario in a background culling method according to the embodiment. The initial image is obtained by the following steps:
S101:根据预先得到的行踪视频中各视频帧之间的时间差值和各视频帧之间的图像色彩特征的相似度,计算各视频帧之间的距离;S101: Calculate the distance between each video frame according to the time difference between the video frames in the track video and the similarity of the image color characteristics between the video frames.
S102:根据各视频帧之间的距离采用层次聚类法对行踪视频进行分割,得到初始图片。S102: According to the distance between the video frames, a hierarchical clustering method is used to segment the track video to obtain an initial picture.
对于上述步骤S101,可以理解为,首先,将拍预先摄到的行踪视频确定为待分割视频,然后,根据待分割视频中各视频帧之间的时间差值和各视频帧之间的图像色彩特征的相似度,采用视频帧距离计算公式计算各视频帧之间的距离。For the above step S101, it can be understood that, first, the pre-captured track video is determined as the video to be divided, and then, according to the time difference between the video frames in the video to be divided and the image color between the video frames The similarity of features uses the video frame distance calculation formula to calculate the distance between video frames.
对于上述步骤S102,可以理解为,以待分割视频包括M个视频帧为例,根据待分割视频中第1视频帧与第2视频帧之间的时间差值,以及第1视频帧与第2个视频帧之间的图像色彩特征的相似度,获取到第1视频帧与第2视频帧之间的距离;依次执行,直到根据待分割视频中第1视频帧与第k视频帧之间的时间差值,以及第1视频帧与第k个视频帧之间的图像色彩特征的相似度,获取到第1视频帧与第k视频帧之间的距离;根据待分割视频中第2视频帧与第3视频帧之间的时间差值,以及第2视频帧与第3个视频帧之间的图像色彩特征的相似度,获取到第2视频帧与第3视频帧之间的距离;依次执行,直到根据待分割视频中第2视频帧与第k视频帧之间的时间差值,以及第2视频帧与第k个视频帧之间的图像色彩特征的相似度,获取到第1视频帧与第k视频帧之间的距离;依次类推,根据待分割视频中第q-1视频帧与第q视频帧之间的时间差值,以及第q-1视频帧与第q个视频帧之间的图像色彩特征的相似度,获取到第q-1视频帧与第q视频帧之间的距离。通过上述方式,可以获得各个视频帧之间的距离,然后根据所述距离,采用层次聚类发将所述待分割视频进行分割,得到想要的图片,选定的图片是由该图片中选择出。For the above step S102, it can be understood that taking the video to be divided includes M video frames as an example, according to the time difference between the first video frame and the second video frame in the video to be divided, and the first video frame and the second video frame, The similarity of the image color characteristics between the two video frames to obtain the distance between the first video frame and the second video frame; sequentially until the distance between the first video frame and the kth video frame in the video to be segmented The time difference and the similarity of image color characteristics between the first video frame and the k-th video frame, to obtain the distance between the first video frame and the k-th video frame; according to the second video frame in the video to be segmented The time difference between the third video frame and the similarity of the image color characteristics between the second video frame and the third video frame, to obtain the distance between the second video frame and the third video frame; Execute until the first video is obtained according to the time difference between the second video frame and the k-th video frame in the video to be segmented, and the similarity of the image color characteristics between the second video frame and the k-th video frame. The distance between the frame and the k-th video frame; and so on, According to the time difference between the q-1th video frame and the qth video frame in the video to be divided, and the similarity of the image color characteristics between the q-1th video frame and the qth video frame, the qth The distance between the -1 video frame and the q-th video frame. In the above manner, the distance between each video frame can be obtained, and then according to the distance, the to-be-divided video is segmented using hierarchical clustering to obtain a desired picture, and the selected picture is selected from the picture Out.
在图3对应的实施例中,通过步骤S101和步骤S102,可以得到想要的图片,由于属 于同一个视频事件的两个视频帧中的图像,其场景和目标人物的色彩特征相似度相同,从而根据时间差及相似度可以将属于同一个视频中的视频帧分割为该视频的图片,从而避免了将属于同一个视频中的视频帧分割为不同的视频的图片,进而保证了视频内容分割的完整性。In the embodiment corresponding to FIG. 3, through steps S101 and S102, a desired picture can be obtained. Since the images in two video frames belonging to the same video event have similar similarity in color characteristics between the scene and the target person, Therefore, according to the time difference and similarity, video frames belonging to the same video can be divided into pictures of the video, thereby avoiding dividing video frames belonging to the same video into pictures of different videos, thereby ensuring the division of video content. Completeness.
进一步地,在一实施例中,该背景剔除方法应用在金融行业中,一种背景剔除方法中根据预先得到的行踪视频中各视频帧之间的时间差值和各视频帧之间的图像色彩特征的相似度,计算各视频帧之间的距离为:Further, in an embodiment, the background culling method is applied in the financial industry. In a background culling method, the time difference between video frames in the track video obtained in advance and the image color between the video frames are used. The similarity of features. The distance between video frames is calculated as:
具体地,首先,根据各视频帧计算得到各视频帧之间的卡方距离,然后,将预先拍摄得到的行踪视频中各视频帧之间的时间差值、各视频帧之间的卡方距离输入如下计算公式,得到各视频帧之间的距离:Specifically, first, the chi-square distance between the video frames is calculated according to each video frame, and then the time difference between the video frames in the tracked video obtained in advance and the chi-square distance between the video frames are calculated. Enter the following calculation formula to get the distance between each video frame:
Figure PCTCN2018106379-appb-000001
Figure PCTCN2018106379-appb-000001
Figure PCTCN2018106379-appb-000002
Figure PCTCN2018106379-appb-000002
其中,行踪视频包括q个视频帧,q大于1;k i为行踪视频中的第i个视频帧,k j为行踪视频中的第j个视频帧,i大于等于1且小于等于q,j大于等于1且小于等于q,s(k i,k j)为第i个视频帧与第j个视频帧之间的距离,x 2(k i,k j)为第i个视频帧与第j个视频帧之间的色彩直方图的卡方距离,w 1为预设的卡方距离,r为预设的正整数,|i-j|表示第i个视频帧与第j个视频帧之间的时间差值,所述时间差值的单位为秒、分或小时,max(0,r-|i-j|)表示0与r-|i-j|之间的最大值,r-|i-j|为大于0的自然数。如r为30,i为20,j为15,|i-j|表示第20个视频帧与第15个视频帧之间的时间差值为20秒,则r-|i-j|为10,max(0,r-|i-j|)为10,或如r为7,i为8,j为5,|i-j|表示第8个视频帧与第5个视频帧之间的时间差值为1.6分,则r-|i-j|为5.4,max(0,r-|i-j|)为5.4。 Wherein, the track video includes q video frames, where q is greater than 1. k i is the i-th video frame in the track video, k j is the j-th video frame in the track video, i is greater than or equal to 1 and less than or equal to q, j Greater than or equal to 1 and less than or equal to q, s (k i , k j ) is the distance between the i-th video frame and the j-th video frame, and x 2 (k i , k j ) is the i-th video frame and the Chi-square distance of color histogram between j video frames, w 1 is a preset chi-square distance, r is a preset positive integer, and | ij | represents the i-th video frame and the j-th video frame Time difference, in units of seconds, minutes, or hours, max (0, r- | ij |) represents the maximum value between 0 and r- | ij |, and r- | ij | is greater than A natural number of 0. If r is 30, i is 20, j is 15, | ij | means the time difference between the 20th video frame and the 15th video frame is 20 seconds, then r- | ij | is 10, and max (0 , r- | ij |) is 10, or if r is 7, i is 8, j is 5, | ij | means the time difference between the 8th video frame and the 5th video frame is 1.6 points, then r- | ij | is 5.4 and max (0, r- | ij |) is 5.4.
需要说明的是,卡方距离越大表示相似度越低。It should be noted that a larger chi-square distance indicates a lower similarity.
在本一实施例中,通过上述计算公式,根据s(k i,k j)可以将一个即便含有一些无关的视频帧的短视频不会进一步分割成更短的视频,从而保证了视频的完整性。 In this embodiment, according to the above calculation formula, according to s (k i , k j ), a short video that contains some unrelated video frames will not be further divided into shorter videos, thereby ensuring the integrity of the video. Sex.
进一步地,在一实施例中,该背景剔除方法应用在金融行业中,如图4所示图3对应实施例中一种背景剔除方法中获取行踪视频在一个应用场景下的流程图,所述行踪视频通过以下步骤获取:Further, in one embodiment, the background culling method is applied in the financial industry, as shown in FIG. 4 and FIG. 3, which is a flowchart of obtaining a track video in an application scenario in a background culling method in the embodiment. The whereabouts video is obtained by the following steps:
S1011:连续多次拍摄目标人物的行踪视频,并在拍摄行踪视频的过程中判断连续多次拍摄得到的行踪视频的总时间长度是否达到预设时间长度;S1011: Shooting the whereabouts of the target person multiple times in succession, and during the shooting of the whereabouts video, determine whether the total time length of the whereabouts video obtained by the multiple consecutive shots reaches a preset time length;
S1012:若在拍摄行踪视频的过程中连续多次拍摄得到的行踪视频的总时间长度达到预设时间长度,则停止行踪视频的拍摄,并将连续多次拍摄目标人物的行踪视频拼接成一个行踪视频,得到拼接后的行踪视频;S1012: If the total time length of the tracked video obtained during the continuous shooting of the tracked video reaches the preset time length, stop the shooting of the tracked video and stitch the tracked video of the target person multiple times into a tracked Video to get spliced whereabouts video;
S1013:将拼接后的行踪视频确定为得到的行踪视频。S1013: Determine the spliced whereabouts video as the obtained whereabouts video.
对于上述步骤S1011,可以理解为,目标人物可以为行人或其他物体,目标人物的具体内容,可以根据实际情况进行设定,此处不做限制。目标人物的行踪视频可以存在在数据库中,也可以存储在光碟或硬盘中,目标人物的行踪视频的存储位置的具体内容,可以根据实际情况进行设定,此处不做限制。For the above step S1011, it can be understood that the target person can be a pedestrian or other object, and the specific content of the target person can be set according to the actual situation, which is not limited here. The whereabouts video of the target person may be stored in a database, or may be stored in a disc or hard disk. The specific content of the storage location of the whereabouts video of the target person may be set according to actual conditions, and there is no limitation here.
具体地,首先,从多个对象中确定出目标人物,也即,人为的选定目标人物,然后从多个对象中选出目标人物,接下来,连续多次拍摄目标人物的行踪视频,并在每次拍摄行踪视频的过程中判断连续多次拍摄得到的行踪视频的总时间长度是否达到预设时间长度,其中,判断拍摄的行踪视频的总时间长度是否达到预设时间长度,可以能够灵活地获取想要的时间长度的行踪视频,预设的时间长度可以为30分钟或1个小时等,预设的时间长度的具体内容,可以根据实际情况进行设定,此处不做限制。Specifically, first, a target person is determined from a plurality of objects, that is, a target person is artificially selected, and then a target person is selected from the plurality of objects. Next, a video of the target person's whereabouts is taken multiple times in a row, and In each process of shooting the track video, it is determined whether the total time length of the track video obtained by continuous shooting multiple times reaches the preset time length, and it is flexible to determine whether the total time length of the tracked video captured reaches the preset time length. Get the track video of the desired length of time. The preset time length can be 30 minutes or 1 hour. The specific content of the preset time length can be set according to the actual situation. There is no limitation here.
需要说明的是,目标人物的行踪视频可以通过摄像设备获取得到,然后存储到所述存储位置,摄像设备可以为摄像机或数码相机等,摄像设备的具体内容,可以根据实际情况进行设定,此处不做限制。It should be noted that the whereabouts video of the target person can be obtained through a camera device and then stored in the storage location. The camera device can be a video camera or a digital camera. The specific content of the camera device can be set according to the actual situation. There are no restrictions.
对于上述步骤S1012,可以理解为,若在拍摄行踪视频的过程中连续多次拍摄得到的行踪视频的总时间长度达到预设时间长度,则停止行踪视频的拍摄,并显示连续多次拍摄目标对象的行踪视频对应的标识,并根据用户对连续多次拍摄目标对象的行踪视频对应的标识进行排序的结果将连续多次拍摄目标对象的行踪视频拼接成一个视频,或者记录连续多次拍摄目标对象的行踪视频对应的时间,并根据用户对连续多次拍摄目标对象的行踪视频对应的时间进行排序的结果将连续多次拍摄目标对象的行踪视频拼接成一个视频。若在 拍摄行踪视频的过程中连续多次拍摄得到的行踪视频的总时间长度未达到预设时间长度,则采用预设时间长度减去总时间长度,得到剩余时间长度,然后计算剩余时间长度在预设时间长度中的第一占比,和计算总时间长度在预设时间长度中的第二占比,从而清楚了已拍摄时间长度在预设时间长度中进度,并返回步骤S1011。For the above step S1012, it can be understood that if the total time length of the track video obtained during the continuous shooting of the track video reaches the preset time length, the shooting of the track video is stopped, and the target object is displayed for multiple consecutive shots The corresponding ID of the whereabouts video, and according to the result of the user sorting the corresponding ID of the whereabouts video of the target object multiple times, stitching the whereabouts video of the target object multiple times into one video, or record the target object The time corresponding to the whereabouts video of the video, and according to the result of the user sorting the time corresponding to the whereabouts video of the target object for multiple consecutive shots, the whereabouts video of the target object for the multiple consecutive shots is stitched into one video. If the total time length of the tracked video obtained during the shooting of the tracked video does not reach the preset time length, the preset time length is subtracted from the total time length to obtain the remaining time length, and then the remaining time length is calculated in The first proportion of the preset time length and the second proportion of the total time length within the preset time length are calculated, so that it is clear that the shooting time length progresses in the preset time length, and returns to step S1011.
对于上述步骤S1013,可以理解为,将拼接后得到的行踪视频确定为获取到的行踪视频,并保存到视频数据库中。其中,视频数据库可以为sql或Oracle等数据库,视频数据库的具体内容,可以根据实际应用进行设定,此处不做限制。For the above step S1013, it can be understood that the tracked video obtained after the stitching is determined as the acquired tracked video, and is stored in the video database. The video database can be a database such as sql or Oracle. The specific content of the video database can be set according to the actual application. There is no limitation here.
在图4对应的实施例中,通过上述步骤S1011~步骤S1013,可以实现多次选择性的拍摄获取一个行踪视频,同时对拍摄的行踪视频的内容进行自主筛选,提高了获取视频的灵活性。In the embodiment corresponding to FIG. 4, through the foregoing steps S1011 to S1013, multiple selective shootings can be performed to obtain a track video, and the content of the tracked video captured can be screened independently, thereby improving the flexibility of video acquisition.
进一步地,在一实施例中,该背景剔除方法应用在金融行业中,如图5所示图2至图4对应实施例中一种背景剔除方法中在步骤S10之前在一个应用场景下的流程图,该背景剔除方法还包括:Further, in one embodiment, the background removal method is applied in the financial industry, as shown in FIG. 5 and FIG. 2 to FIG. 4 correspond to the background removal method in an embodiment before step S10. Map, the background removal method also includes:
S50:获取初始图片的各个像素点对应的第一目标像素值、目标人物背景的各个像素点对应的第二目标像素值和像素点总和,其中,图片的像素点包括目标人物的像素点和目标人物背景的像素点,像素点总和为图片的像素点的总个数或目标人物背景的像素点的总个数;S50: Obtain a first target pixel value corresponding to each pixel point of the initial picture, and a second target pixel value and a total pixel point corresponding to each pixel point of the background of the target person. The pixel points of the picture include the target person's pixels and the target. Pixels of the background of the person, the total number of pixels is the total number of pixels of the picture or the total number of pixels of the background of the target person;
S60:根据第一目标像素值、所述第二目标像素值和像素点总和采用预设的计算法对图片的各个像素点对应的像素值进行计算,得到计算后的像素点对应的像素值。S60: Calculate the pixel value corresponding to each pixel point of the picture by using a preset calculation method according to the first target pixel value, the second target pixel value, and the pixel sum, to obtain the pixel value corresponding to the calculated pixel point.
对于上述步骤S50,可以理解为,选定的图片包括目标人物和目标人物背景。选定的图片是由各个像素点组合而成。获取整张选定的图片中的各个像素点对应的第一目标像素值、背景的各个像素点对应的第二目标像素值和像素点总和,以便对各个像素点对应的像素值做均差法处理。其中,像素点总和为图片的像素点的总个数或目标人物背景的像素点的总个数。For the above step S50, it can be understood that the selected picture includes the target person and the target person background. The selected picture is a combination of individual pixels. Obtain the first target pixel value corresponding to each pixel point in the entire selected picture, the second target pixel value corresponding to each pixel point in the background, and the sum of the pixel points, so as to perform the mean difference method on the pixel values corresponding to each pixel point. The total number of pixels is the total number of pixels in the picture or the total number of pixels in the background of the target person.
需要说明的是,目标人物与目标人物背景重合的像素点的像素值,在目标人物背景中为0。It should be noted that the pixel value of a pixel point where the target person overlaps with the background of the target person is 0 in the background of the target person.
对于上述步骤S60,可以理解为,根据第一目标像素值、所述第二目标像素值和像素点总和采用预设的计算法对图片的各个像素点对应的像素值进行计算,得到计算后的像素点对应的像素值,也即,先将获取到的图片的各个像素点对应的第一目标像素值减去图片背景的各个像素点对应的第二目标像素值,得到各个偏差值,然后将所有偏差值的总和除 以像素点的总个数,得到均差值,将各个偏差值减去均差值,得到各个均差后的像素点。For the above step S60, it can be understood that, according to the first target pixel value, the second target pixel value, and the sum of the pixel points, a preset calculation method is used to calculate a pixel value corresponding to each pixel point of the picture to obtain a calculated result. The pixel value corresponding to the pixel, that is, the obtained first target pixel value corresponding to each pixel point of the picture is subtracted from the second target pixel value corresponding to each pixel point of the picture background to obtain each deviation value, and then The sum of all deviation values is divided by the total number of pixels to obtain the mean difference value. Each deviation value is subtracted from the mean difference value to obtain the pixel points after each mean difference.
在图5对应的实施例中,通过上述步骤S50和步骤S60,可以得到各个像素点对应的像素值的平均像素值,由于平均像素值代表所有像素点的平均像素,从而提高了评估像素点的像素的准确性。In the embodiment corresponding to FIG. 5, through the above steps S50 and S60, the average pixel value of the pixel value corresponding to each pixel point can be obtained. Since the average pixel value represents the average pixel of all the pixel points, the efficiency of the evaluation pixel point is improved. Pixel accuracy.
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the size of the sequence numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
在一实施例中,提供一种背景剔除装置,该背景剔除装置与上述实施例中背景剔除方法一一对应。如图6所示,该背景剔除装置包括第一求导模块701、第二求导模块702、确定模块703和剔除模块704。各功能模块详细说明如下:In one embodiment, a background culling device is provided. The background culling device corresponds to the background culling method in the above-mentioned embodiment. As shown in FIG. 6, the background culling device includes a first derivation module 701, a second derivation module 702, a determination module 703, and a cull module 704. The detailed description of each function module is as follows:
第一求导模块701,用于对预先得到的初始图片中的各个像素点对应的像素值分别进行一阶求导,得到各个像素点对应的像素值的第一处理数值,其中,像素点的像素值与像素点对应的像素值的第一处理数值存在一一对应关系;The first derivation module 701 is configured to perform first-order differentiation on pixel values corresponding to each pixel point in the initial picture obtained in advance, to obtain a first processed value of the pixel value corresponding to each pixel point, where There is a one-to-one correspondence between the pixel value and the first processed value of the pixel value corresponding to the pixel point;
第二求导模块702,用于对各个像素点对应的第一处理数值分别进行二阶求导,得到各个像素点对应的像素值的第二处理数值,其中,像素点对应的像素值的第一处理数值与像素点对应的像素值的第二处理数值存在一一对应关系;The second derivation module 702 is configured to perform a second-order derivative on the first processing value corresponding to each pixel, to obtain a second processing value of the pixel value corresponding to each pixel, where the first value of the pixel value corresponding to the pixel is There is a one-to-one correspondence between a processing value and a second processing value of a pixel value corresponding to a pixel point;
第一确定模块703,用于若像素点对应的像素值的第一处理数值满足预设的第一条件,且像素点对应的像素值的第二处理数值满足预设的第二条件,则确定像素点为图片中的目标人物与目标人物背景之间的边缘点;A first determining module 703 is configured to determine if a first processing value of a pixel value corresponding to a pixel satisfies a preset first condition, and a second processing value of a pixel value corresponding to a pixel meeting a preset second condition Pixel points are the edge points between the target person in the picture and the background of the target person;
剔除模块704,用于按照边缘线将图片中的目标人物背景进行剔除,得到目标图片,其中,边缘线由各个图片中的目标人物与目标人物背景之间的边缘点连接而成。A culling module 704 is configured to cull the background of the target person in the picture according to the edge line to obtain the target picture. The edge line is formed by connecting edge points between the target person and the background of the target person in each picture.
进一步地,确定模块703中像素点对应的像素值的第一处理数值满足预设的第一条件,且像素点对应的像素值的第二处理数值满足预设的第二条件为:第一判断模块,用于第一绝对值大于第一预设阈值,且第二绝对值大于第二预设阈值,其中,第一绝对值为像素点对应的像素值的第一处理数值与像素点横向相邻的预设个像素点对应的像素值的第一处理数值的差值的绝对值,第二绝对值为像素点对应的像素值的第二处理数值与像素点横向相邻的预设个像素点对应的像素值的第二处理数值的差值的绝对值。Further, the first processing value of the pixel value corresponding to the pixel point in the determining module 703 satisfies a preset first condition, and the second processing value of the pixel value corresponding to the pixel point satisfies a preset second condition is: a first judgment A module for a first absolute value greater than a first preset threshold and a second absolute value greater than a second preset threshold, wherein the first absolute value is a first processed value of a pixel value corresponding to a pixel and is horizontally relative to the pixel The absolute value of the difference between the first processed values of the pixel values corresponding to the preset pixels adjacent to each other, and the second absolute value is the preset number of pixels whose second processed values correspond to the pixel values corresponding to the pixels. The absolute value of the difference between the second processed values of the pixel values corresponding to the points.
进一步地,初始图片通过以下模块获取:Further, the initial picture is obtained through the following modules:
第一计算模块,用于根据预先得到的行踪视频中各视频帧之间的时间差值和各视频帧之间的图像色彩特征的相似度,计算各视频帧之间的距离;A first calculation module, configured to calculate a distance between each video frame according to a time difference between each video frame and a similarity of image color characteristics between each video frame in the track video;
分割模块,用于根据各视频帧之间的距离采用层次聚类法对行踪视频进行分割,得到 初始图片。A segmentation module is used to segment the track video using the hierarchical clustering method according to the distance between each video frame to obtain the initial picture.
进一步地,第一计算模块中根据预先得到的行踪视频中各视频帧之间的时间差值和各视频帧之间的图像色彩特征的相似度,计算各视频帧之间的距离具体为:第二计算模块,用于将预先得到的行踪视频中各视频帧之间的时间差值、各视频帧之间的卡方距离输入如下计算公式,得到各视频帧之间的距离:Further, the first calculation module calculates the distance between the video frames according to the time difference between the video frames in the track video and the similarity of the image color characteristics between the video frames. Two calculation modules are used to input the time difference between video frames and the chi-square distance between video frames in the following track video to obtain the distance between video frames:
Figure PCTCN2018106379-appb-000003
Figure PCTCN2018106379-appb-000003
Figure PCTCN2018106379-appb-000004
Figure PCTCN2018106379-appb-000004
其中,行踪视频包括q个视频帧,q大于1;k i为行踪视频中的第i个视频帧,k j为行踪视频中的第j个视频帧,i大于等于1且小于等于q,j大于等于1且小于等于q,s(k i,k j)为第i个视频帧与第j个视频帧之间的距离,x 2(k i,k j)为第i个视频帧与第j个视频帧之间的色彩直方图的卡方距离,w 1为预设的卡方距离,r为预设的正整数,|i-j|表示第i个视频帧与第j个视频帧之间的时间差值,max(0,r-|i-j|)表示0与r-|i-j|之间的最大值,r-|i-j|为大于0的自然数。 Wherein, the track video includes q video frames, where q is greater than 1. k i is the i-th video frame in the track video, k j is the j-th video frame in the track video, i is greater than or equal to 1 and less than or equal to q, j Greater than or equal to 1 and less than or equal to q, s (k i , k j ) is the distance between the i-th video frame and the j-th video frame, and x 2 (k i , k j ) is the i-th video frame and the Chi-square distance of color histogram between j video frames, w 1 is a preset chi-square distance, r is a preset positive integer, and | ij | represents the i-th video frame and the j-th video frame Time difference, max (0, r- | ij |) represents the maximum value between 0 and r- | ij |, and r- | ij | is a natural number greater than 0.
进一步地,行踪视频通过以下模块获取:Further, the track video is obtained through the following modules:
第二判断模块,用于连续多次拍摄目标人物的行踪视频,并在拍摄行踪视频的过程中判断连续多次拍摄得到的行踪视频的总时间长度是否达到预设时间长度;A second judgment module, configured to continuously shoot the whereabouts video of the target person multiple times, and determine whether the total time length of the whereabouts video obtained by the multiple consecutive shots reaches a preset time length during the shooting of the track video;
拼接模块,用于若在拍摄行踪视频的过程中连续多次拍摄得到的行踪视频的总时间长度达到预设时间长度,则停止行踪视频的拍摄,并将连续多次拍摄目标人物的行踪视频拼接成一个行踪视频,得到拼接后的行踪视频;Stitching module, used to stop the shooting of the track video if the total time length of the track video obtained during the continuous shooting of the track video multiple times reaches a preset time length, and stitch the track video of the target person for multiple consecutive shots Into a whereabouts video to get the spliced whereabouts video;
第二确定模块,用于将拼接后的行踪视频确定为得到的行踪视频。The second determining module is configured to determine the stitched running video as the obtained running video.
进一步地,在第一求导模块701之前,该背景剔除装置还包括:Further, before the first derivative module 701, the background culling device further includes:
获取模块,用于获取初始图片的各个像素点对应的第一目标像素值、目标人物背景的各个像素点对应的第二目标像素值和像素点总和,其中,图片的像素点包括目标人物的像 素点和目标人物背景的像素点,像素点总和为图片的像素点的总个数或目标人物背景的像素点的总个数;An obtaining module, configured to obtain a first target pixel value corresponding to each pixel point of the initial picture, a second target pixel value corresponding to each pixel point of the background of the target person, and a sum of the pixel points, where the pixel points of the picture include pixels of the target person The pixels of the point and the background of the target person, the total number of pixels is the total number of pixels of the picture or the total number of pixels of the background of the target person;
第三计算模块,用于根据第一目标像素值、所述第二目标像素值和像素点总和采用预设的计算法对图片的各个像素点对应的像素值进行计算,得到计算后的像素点对应的像素值。A third calculation module is configured to calculate a pixel value corresponding to each pixel point of the picture by using a preset calculation method according to the first target pixel value, the second target pixel value, and a sum of the pixel points to obtain the calculated pixel points. The corresponding pixel value.
关于背景剔除装置的具体限定可以参见上文中对于背景剔除方法的限定,在此不再赘述。上述背景剔除装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。For the specific limitation of the background culling device, refer to the limitation on the background culling method described above, and details are not described herein again. Each module in the background removal device can be implemented in whole or in part by software, hardware, and a combination thereof. The above-mentioned modules may be embedded in the hardware form or independent of the processor in the computer device, or may be stored in the memory of the computer device in the form of software, so that the processor calls and performs the operations corresponding to the above modules.
在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图7所示。该计算机设备包括通过***总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作***、计算机可读指令和数据库。该内存储器为非易失性存储介质中的操作***和计算机可读指令的运行提供环境。该计算机设备的数据库用于存储背景剔除方法相关数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机可读指令被处理器执行时以实现一种背景剔除方法。In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. 7. The computer device includes a processor, a memory, a network interface, and a database connected through a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer-readable instructions, and a database. The internal memory provides an environment for operating the operating system and computer-readable instructions in a non-volatile storage medium. The computer equipment database is used to store background-related data. The network interface of the computer device is used to communicate with an external terminal through a network connection. The computer-readable instructions are executed by a processor to implement a background removal method.
在一个实施例中,提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机可读指令,处理器执行计算机可读指令时实现上述实施例背景剔除方法的步骤,例如图2所示的步骤S10至步骤S40。或者,处理器执行计算机可读指令时实现上述实施例中背景剔除装置的各模块/单元的功能,例如图6所示第一求导模块701至剔除模块704的功能。为避免重复,这里不再赘述。In one embodiment, a computer device is provided, which includes a memory, a processor, and computer-readable instructions stored on the memory and executable on the processor. When the processor executes the computer-readable instructions, the background elimination of the foregoing embodiments is implemented. The steps of the method are, for example, steps S10 to S40 shown in FIG. 2. Alternatively, when the processor executes the computer-readable instructions, the functions of the modules / units of the background removal device in the foregoing embodiment are implemented, for example, the functions of the first derivative module 701 to the removal module 704 shown in FIG. 6. To avoid repetition, we will not repeat them here.
在一个实施例中,提供了一种计算机可读存储介质,该一个或多个存储有计算机可读指令的非易失性可读存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行计算机可读指令时实现上述方法实施例中背景剔除方法,或者,该一个或多个存储有计算机可读指令的非易失性可读存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行计算机可读指令时实现上述装置实施例中背景剔除装置中各模块/单元的功能。为避免重复,这里不再赘述。本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一非易失性计算机可读取存储介质中,该计算机可 读指令在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。In one embodiment, a computer-readable storage medium is provided, the one or more non-volatile storage mediums storing computer-readable instructions, and the computer-readable instructions are executed by one or more processors. , So that when one or more processors execute computer-readable instructions, the background removal method in the foregoing method embodiment is implemented, or the one or more non-volatile readable storage media storing computer-readable instructions are computer-readable When the instructions are executed by one or more processors, when the one or more processors execute computer-readable instructions, the functions of each module / unit in the background removal device in the foregoing device embodiment are implemented. To avoid repetition, we will not repeat them here. Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by computer-readable instructions to instruct related hardware. The computer-readable instructions can be stored in a non-volatile computer. In the readable storage medium, the computer-readable instructions, when executed, may include the processes of the embodiments of the methods described above. Wherein, any reference to the memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Synchlink DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。Those skilled in the art can clearly understand that, for the convenience and brevity of the description, only the above-mentioned division of functional units and modules is used as an example. In practical applications, the above functions can be assigned by different functional units, Module completion, that is, dividing the internal structure of the device into different functional units or modules to complete all or part of the functions described above.
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-mentioned embodiments are only used to describe the technical solution of the present application, but are not limited thereto. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still implement the foregoing implementations. The technical solutions described in the examples are modified, or some technical features are equivalently replaced; and these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in Within the scope of this application.

Claims (20)

  1. 一种背景剔除方法,其特征在于,所述背景剔除方法包括:A background removal method, characterized in that the background removal method includes:
    对预先得到的初始图片中的各个像素点对应的像素值分别进行一阶求导,得到各个像素点对应的像素值的第一处理数值,其中,所述像素点对应的像素值与所述像素点对应的像素值的第一处理数值存在一一对应关系;First-order derivative is performed on the pixel values corresponding to each pixel point in the initial picture obtained in advance, to obtain a first processed value of the pixel value corresponding to each pixel point, wherein the pixel value corresponding to the pixel point and the pixel are There is a one-to-one correspondence between the first processed values of the pixel values corresponding to the points;
    对所述各个像素点对应的像素值的第一处理数值分别进行二阶求导,得到各个像素点对应的像素值的第二处理数值,其中,所述像素点对应的像素值的第一处理数值与所述像素点对应的像素值的第二处理数值存在一一对应关系;Performing a second-order derivative on the first processed value of the pixel value corresponding to each pixel point to obtain a second processed value of the pixel value corresponding to each pixel point, wherein the first processing of the pixel value corresponding to the pixel point There is a one-to-one correspondence between the value and the second processed value of the pixel value corresponding to the pixel point;
    若所述像素点对应的像素值的第一处理数值满足预设的第一条件,且所述像素点对应的像素值的第二处理数值满足预设的第二条件,则确定所述像素点为所述图片中的目标人物与目标人物背景之间的边缘点;Determining a pixel point if a first processing value of a pixel value corresponding to the pixel point satisfies a preset first condition and a second processing value of a pixel value corresponding to the pixel point satisfies a preset second condition The edge point between the target person in the picture and the background of the target person;
    按照边缘线将所述初始图片中的所述目标人物背景进行剔除,得到目标图片,其中,所述边缘线由各个所述初始图片中的目标人物与目标人物背景之间的边缘点连接而成。The target person background in the initial picture is removed according to an edge line to obtain a target picture, where the edge line is formed by connecting edge points between the target person and the target person background in each of the initial pictures .
  2. 如权利要求1所述的背景剔除方法,其特征在于,所述像素点对应的像素值的第一处理数值满足预设的第一条件,且所述像素点对应的像素值的第二处理数值满足预设的第二条件为:第一绝对值大于第一预设阈值,且第二绝对值大于第二预设阈值,其中,所述第一绝对值为所述像素点对应的像素值的第一处理数值与所述像素点横向相邻的预设个像素点对应的像素值的第一处理数值的差值的绝对值,所述第二绝对值为所述像素点对应的像素值的第二处理数值与所述像素点横向相邻的预设个像素点对应的像素值的第二处理数值的差值的绝对值。The method of claim 1, wherein the first processing value of the pixel value corresponding to the pixel point satisfies a preset first condition, and the second processing value of the pixel value corresponding to the pixel point The preset second condition is satisfied: the first absolute value is greater than the first preset threshold, and the second absolute value is greater than the second preset threshold, wherein the first absolute value is a value of a pixel value corresponding to the pixel point. The absolute value of the difference between the first processed value of the first processed value and the pixel value corresponding to a preset number of pixel points adjacent to the pixel laterally, and the second absolute value is a value of the pixel value corresponding to the pixel point. The absolute value of the difference between the second processed values of the second processed values of the pixel values corresponding to the preset number of pixel points laterally adjacent to the pixel point.
  3. 如权利要求1所述的背景剔除方法,其特征在于,所述初始图片通过以下步骤获取:The background culling method according to claim 1, wherein the initial picture is obtained by the following steps:
    根据预先得到的行踪视频中各视频帧之间的时间差值和各视频帧之间的图像色彩特征的相似度,计算各视频帧之间的距离;Calculate the distance between the video frames according to the time difference between the video frames in the track video and the similarity of the image color characteristics between the video frames;
    根据所述各视频帧之间的距离采用层次聚类法对所述行踪视频进行分割,得到所述初始图片。The tracking video is segmented by using a hierarchical clustering method according to the distance between the video frames to obtain the initial picture.
  4. 如权利要求3所述的背景剔除方法,其特征在于,所述根据预先得到的行踪视频中各视频帧之间的时间差值和各视频帧之间的图像色彩特征的相似度,计算各视频帧之间的距离为:将所述预先得到的行踪视频中各视频帧之间的时间差值、各视频帧之间的卡方 距离输入如下计算公式,得到各视频帧之间的距离:The background culling method according to claim 3, wherein each video is calculated according to a time difference between video frames and a similarity of image color characteristics between video frames in a track video obtained in advance. The distance between frames is: the time difference between the video frames in the track video and the chi-square distance between the video frames are input into the following calculation formula to obtain the distance between the video frames:
    Figure PCTCN2018106379-appb-100001
    Figure PCTCN2018106379-appb-100001
    Figure PCTCN2018106379-appb-100002
    Figure PCTCN2018106379-appb-100002
    其中,所述行踪视频包括q个视频帧,所述q大于1;k i为所述行踪视频中的第i个视频帧,k j为所述行踪视频中的第j个视频帧,所述i大于等于1且小于等于所述q,所述j大于等于1且小于等于所述q,s(k i,k j)为第i个视频帧与第j个视频帧之间的距离,所述x 2(k i,k j)为所述第i个视频帧与第j个视频帧之间的色彩直方图的卡方距离,所述w 1为预设的卡方距离,所述r为预设的正整数,|i-j|表示第i个视频帧与第j个视频帧之间的时间差值,max(0,r-|i-j|)表示0与r-|i-j|之间的最大值,r-|i-j|为大于0的自然数。 Wherein, the track video includes q video frames, where q is greater than 1. k i is the i-th video frame in the track video, and k j is the j-th video frame in the track video. i is greater than or equal to 1 and less than or equal to q, the j is greater than or equal to 1 and less than or equal to q, and s (k i , k j ) is the distance between the i-th video frame and the j-th video frame, so Let x 2 (k i , k j ) be the chi-square distance of the color histogram between the i-th video frame and the j-th video frame, w 1 be the preset chi-square distance, and r Is a preset positive integer, | ij | represents the time difference between the i-th video frame and j-th video frame, and max (0, r- | ij |) represents the time between 0 and r- | ij | The maximum value, r- | ij | is a natural number greater than 0.
  5. 如权利要求3所述的背景剔除方法,其特征在于,所述行踪视频通过以下步骤获取:The background culling method according to claim 3, wherein the whereabouts video is obtained by the following steps:
    连续多次拍摄目标人物的行踪视频,并在拍摄行踪视频的过程中判断连续多次拍摄得到的行踪视频的总时间长度是否达到预设时间长度;Continuously shooting the whereabouts of the target person multiple times, and during the shooting of the whereabouts video, determine whether the total time length of the whereabouts video obtained by the multiple consecutive shots reaches a preset time length;
    若在拍摄行踪视频的过程中连续多次拍摄得到的行踪视频的总时间长度达到预设时间长度,则停止行踪视频的拍摄,并将所述连续多次拍摄目标人物的行踪视频拼接成一个行踪视频,得到拼接后的行踪视频;If the total time length of the tracked video obtained during the continuous shooting of the tracked video reaches the preset time length, the shooting of the tracked video is stopped, and the tracked video of the target person is continuously stitched into a tracked track. Video to get spliced whereabouts video;
    将所述拼接后的行踪视频确定为得到的行踪视频。The spliced whereabouts video is determined as the obtained whereabouts video.
  6. 如权利要求1至5中任一项所述的背景剔除方法,其特征在于,在所述对预先得到的初始图片中的各个像素点对应的像素值进行一阶求导之前,所述背景剔除方法还包括:The background culling method according to any one of claims 1 to 5, wherein the background culling is performed before the first-order derivation of pixel values corresponding to each pixel point in the initial picture obtained in advance. The method also includes:
    获取所述初始图片的各个像素点对应的第一目标像素值、所述目标人物背景的各个像素点对应的第二目标像素值和像素点总和,其中,所述图片的像素点包括所述目标人物的像素点和所述目标人物背景的像素点,所述像素点总和为所述图片的像素点的总个数或所 述目标人物背景的像素点的总个数;Acquiring a first target pixel value corresponding to each pixel point of the initial picture, a second target pixel value corresponding to each pixel point of the target person background, and a sum of pixel points, wherein the pixel points of the picture include the target Pixels of a person and pixels of a background of the target person, the sum of the pixels is the total number of pixels of the picture or the total number of pixels of the background of the target person;
    根据所述第一目标像素值、所述第二目标像素值和所述像素点总和采用预设的计算法对所述图片的各个像素点对应的像素值进行计算,得到计算后的像素点对应的像素值。Calculating a pixel value corresponding to each pixel point of the picture by using a preset calculation method according to the first target pixel value, the second target pixel value, and the sum of the pixel points to obtain a calculated pixel point correspondence The pixel value.
  7. 一种背景剔除装置,其特征在于,所述背景剔除装置包括:A background removal device, characterized in that the background removal device includes:
    第一求导模块,用于对预先得到的初始图片中的各个像素点对应的像素值分别进行一阶求导,得到各个像素点对应的像素值的第一处理数值,其中,所述像素点对应的像素值与所述像素点对应的像素值的第一处理数值存在一一对应关系;A first derivation module, configured to perform first-order derivation on pixel values corresponding to each pixel point in the initial picture obtained in advance, to obtain a first processed value of the pixel value corresponding to each pixel point, wherein the pixel point There is a one-to-one correspondence between the corresponding pixel value and the first processed value of the pixel value corresponding to the pixel point;
    第二求导模块,用于对所述各个像素点对应的像素值的第一处理数值分别进行二阶求导,得到各个像素点对应的像素值的第二处理数值,其中,所述像素点对应的像素值的第一处理数值与所述像素点对应的像素值的第二处理数值存在一一对应关系;A second derivative module, configured to perform a second-order derivative on the first processed value of the pixel value corresponding to each pixel point to obtain a second processed value of the pixel value corresponding to each pixel point, wherein the pixel point There is a one-to-one correspondence between the first processed value of the corresponding pixel value and the second processed value of the pixel value corresponding to the pixel point;
    确定模块,用于若所述像素点对应的像素值的第一处理数值满足预设的第一条件,且所述像素点对应的像素值的第二处理数值满足预设的第二条件,则确定所述像素点为所述图片中的目标人物与目标人物背景之间的边缘点;A determining module, configured to: if a first processing value of a pixel value corresponding to the pixel point satisfies a preset first condition, and a second processing value of a pixel value corresponding to the pixel point satisfies a preset second condition, Determining that the pixel point is an edge point between the target person in the picture and the background of the target person;
    剔除模块,用于按照边缘线将所述初始图片中的所述目标人物背景进行剔除,得到目标图片,其中,所述边缘线由各个所述初始图片中的目标人物与目标人物背景之间的边缘点连接而成。A culling module is configured to cull the background of the target person in the initial picture according to an edge line to obtain a target picture, where the edge line is defined by the distance between the target person and the target person background in each of the initial pictures. The edge points are connected.
  8. 如权利要求7所述的背景剔除装置,其特征在于,所述像素点对应的像素值的第一处理数值满足预设的第一条件,且所述像素点对应的像素值的第二处理数值满足预设的第二条件包括第一判断模块,用于第一绝对值大于第一预设阈值,且第二绝对值大于第二预设阈值,其中,第一绝对值为像素点对应的像素值的第一处理数值与像素点横向相邻的预设个像素点对应的像素值的第一处理数值的差值的绝对值,第二绝对值为像素点对应的像素值的第二处理数值与像素点横向相邻的预设个像素点对应的像素值的第二处理数值的差值的绝对值。The background culling device according to claim 7, wherein the first processing value of the pixel value corresponding to the pixel point satisfies a preset first condition, and the second processing value of the pixel value corresponding to the pixel point Satisfying the preset second condition includes a first determination module for a first absolute value greater than a first preset threshold and a second absolute value greater than a second preset threshold, where the first absolute value is a pixel corresponding to a pixel The absolute value of the difference between the first processed value of the value and the first processed value of the pixel value corresponding to a preset number of pixels laterally adjacent to the pixel, and the second absolute value is the second processed value of the pixel value corresponding to the pixel The absolute value of the difference between the second processing values of the pixel values corresponding to the preset number of pixels adjacent to the pixels in the lateral direction.
  9. 如权利要求7所述的背景剔除装置,其特征在于,所述初始图片通过以下模块获取:The background culling device according to claim 7, wherein the initial picture is obtained through the following modules:
    第一计算模块,用于根据预先得到的行踪视频中各视频帧之间的时间差值和各视频帧之间的图像色彩特征的相似度,计算各视频帧之间的距离;A first calculation module, configured to calculate a distance between each video frame according to a time difference between each video frame and a similarity of image color characteristics between each video frame in the track video;
    分割模块,用于根据所述各视频帧之间的距离采用层次聚类法对所述行踪视频进行分割,得到所述初始图片。A segmentation module is configured to segment the track video using a hierarchical clustering method according to the distance between the video frames to obtain the initial picture.
  10. 如权利要求9所述的背景剔除装置,其特征在于,所述第一计算模块包括第二计 算模块,用于将所述预先得到的行踪视频中各视频帧之间的时间差值、各视频帧之间的卡方距离输入如下计算公式,得到各视频帧之间的距离:The background culling device according to claim 9, wherein the first calculation module comprises a second calculation module, configured to convert a time difference between video frames in the previously obtained track video, each video Enter the following calculation formula for the chi-square distance between frames to get the distance between each video frame:
    Figure PCTCN2018106379-appb-100003
    Figure PCTCN2018106379-appb-100003
    Figure PCTCN2018106379-appb-100004
    Figure PCTCN2018106379-appb-100004
    其中,所述行踪视频包括q个视频帧,所述q大于1;k i为所述行踪视频中的第i个视频帧,k j为所述行踪视频中的第j个视频帧,所述i大于等于1且小于等于所述q,所述j大于等于1且小于等于所述q,s(k i,k j)为第i个视频帧与第j个视频帧之间的距离,所述x 2(k i,k j)为所述第i个视频帧与第j个视频帧之间的色彩直方图的卡方距离,所述w 1为预设的卡方距离,所述r为预设的正整数,|i-j|表示第i个视频帧与第j个视频帧之间的时间差值,max(0,r-|i-j|)表示0与r-|i-j|之间的最大值,r-|i-j|为大于0的自然数。 Wherein, the track video includes q video frames, where q is greater than 1. k i is the i-th video frame in the track video, and k j is the j-th video frame in the track video. i is greater than or equal to 1 and less than or equal to q, the j is greater than or equal to 1 and less than or equal to q, and s (k i , k j ) is the distance between the i-th video frame and the j-th video frame, so Let x 2 (k i , k j ) be the chi-square distance of the color histogram between the i-th video frame and the j-th video frame, w 1 be the preset chi-square distance, and r Is a preset positive integer, | ij | represents the time difference between the i-th video frame and j-th video frame, and max (0, r- | ij |) represents the time between 0 and r- | ij | The maximum value, r- | ij | is a natural number greater than 0.
  11. 如权利要求9所述的背景剔除装置,其特征在于,所述行踪视频通过以下模块获取:The background culling device according to claim 9, wherein the track video is obtained by the following modules:
    第二判断模块,用于连续多次拍摄目标人物的行踪视频,并在拍摄行踪视频的过程中判断连续多次拍摄得到的行踪视频的总时间长度是否达到预设时间长度;A second judgment module, configured to continuously shoot the whereabouts video of the target person multiple times, and determine whether the total time length of the whereabouts video obtained by the multiple consecutive shots reaches a preset time length during the shooting of the track video;
    拼接模块,用于若在拍摄行踪视频的过程中连续多次拍摄得到的行踪视频的总时间长度达到预设时间长度,则停止行踪视频的拍摄,并将所述连续多次拍摄目标人物的行踪视频拼接成一个行踪视频,得到拼接后的行踪视频;Stitching module, used for stopping the shooting of the track video if the total time length of the track video obtained during the continuous shooting of the track video multiple times reaches a preset time length, and shooting the track of the target person multiple times in succession The video is spliced into a tracking video to obtain the spliced tracking video;
    第二确定模块,用于将所述拼接后的行踪视频确定为得到的行踪视频。The second determining module is configured to determine the stitched running video as the obtained running video.
  12. 如权利要求7至11中任一项所述的背景剔除装置,其特征在于,所述背景剔除装置还包括:The background removal device according to any one of claims 7 to 11, wherein the background removal device further comprises:
    获取模块,用于获取所述初始图片的各个像素点对应的第一目标像素值、所述目标人物背景的各个像素点对应的第二目标像素值和像素点总和,其中,所述图片的像素点包括所述目标人物的像素点和所述目标人物背景的像素点,所述像素点总和为所述图片的像素 点的总个数或所述目标人物背景的像素点的总个数;An obtaining module, configured to obtain a first target pixel value corresponding to each pixel point of the initial picture, a second target pixel value corresponding to each pixel point of the target person background, and a sum of pixel points, wherein the pixels of the picture The points include pixels of the target person and pixels of the background of the target person, and the total number of pixels is the total number of pixels of the picture or the total number of pixels of the background of the target person;
    第三计算模块,用于根据所述第一目标像素值、所述第二目标像素值和所述像素点总和采用预设的计算法对所述图片的各个像素点对应的像素值进行计算,得到计算后的像素点对应的像素值。A third calculation module, configured to calculate a pixel value corresponding to each pixel point of the picture according to the first target pixel value, the second target pixel value, and the sum of the pixel points by using a preset calculation method, The pixel value corresponding to the calculated pixel is obtained.
  13. 一种计算机设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现如下步骤:A computer device includes a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, wherein the processor implements the computer-readable instructions as follows: step:
    对预先得到的初始图片中的各个像素点对应的像素值分别进行一阶求导,得到各个像素点对应的像素值的第一处理数值,其中,所述像素点对应的像素值与所述像素点对应的像素值的第一处理数值存在一一对应关系;First-order derivative is performed on the pixel values corresponding to each pixel point in the initial picture obtained in advance, to obtain a first processed value of the pixel value corresponding to each pixel point, wherein the pixel value corresponding to the pixel point and the pixel are There is a one-to-one correspondence between the first processed values of the pixel values corresponding to the points;
    对所述各个像素点对应的像素值的第一处理数值分别进行二阶求导,得到各个像素点对应的像素值的第二处理数值,其中,所述像素点对应的像素值的第一处理数值与所述像素点对应的像素值的第二处理数值存在一一对应关系;Performing a second-order derivative on the first processed value of the pixel value corresponding to each pixel point to obtain a second processed value of the pixel value corresponding to each pixel point, wherein the first processing of the pixel value corresponding to the pixel point There is a one-to-one correspondence between the value and the second processed value of the pixel value corresponding to the pixel point;
    若所述像素点对应的像素值的第一处理数值满足预设的第一条件,且所述像素点对应的像素值的第二处理数值满足预设的第二条件,则确定所述像素点为所述图片中的目标人物与目标人物背景之间的边缘点;Determining a pixel point if a first processing value of a pixel value corresponding to the pixel point satisfies a preset first condition and a second processing value of a pixel value corresponding to the pixel point satisfies a preset second condition The edge point between the target person in the picture and the background of the target person;
    按照边缘线将所述初始图片中的所述目标人物背景进行剔除,得到目标图片,其中,所述边缘线由各个所述初始图片中的目标人物与目标人物背景之间的边缘点连接而成。The target person background in the initial picture is removed according to an edge line to obtain a target picture, where the edge line is formed by connecting edge points between the target person and the target person background in each of the initial pictures .
  14. 如权利要求13所述的计算机设备,其特征在于,所述像素点对应的像素值的第一处理数值满足预设的第一条件,且所述像素点对应的像素值的第二处理数值满足预设的第二条件为:第一绝对值大于第一预设阈值,且第二绝对值大于第二预设阈值,其中,所述第一绝对值为所述像素点对应的像素值的第一处理数值与所述像素点横向相邻的预设个像素点对应的像素值的第一处理数值的差值的绝对值,所述第二绝对值为所述像素点对应的像素值的第二处理数值与所述像素点横向相邻的预设个像素点对应的像素值的第二处理数值的差值的绝对值。The computer device according to claim 13, wherein the first processed value of the pixel value corresponding to the pixel point satisfies a preset first condition, and the second processed value of the pixel value corresponding to the pixel point satisfies The preset second condition is that the first absolute value is greater than the first preset threshold value, and the second absolute value is greater than the second preset threshold value, wherein the first absolute value is the first value of the pixel value corresponding to the pixel point. An absolute value of a difference between a first processed value of a pixel value corresponding to a preset number of pixels whose lateral value is laterally adjacent to the pixel point, and a second absolute value of a first pixel value corresponding to the pixel point The absolute value of the difference between the second processing value of the pixel value corresponding to the preset number of pixel points where the second processing value is laterally adjacent to the pixel point.
  15. 如权利要求13所述的计算机设备,其特征在于,所述初始图片通过以下步骤获取:The computer device according to claim 13, wherein the initial picture is obtained by the following steps:
    根据预先得到的行踪视频中各视频帧之间的时间差值和各视频帧之间的图像色彩特征的相似度,计算各视频帧之间的距离;Calculate the distance between the video frames according to the time difference between the video frames in the track video and the similarity of the image color characteristics between the video frames;
    根据所述各视频帧之间的距离采用层次聚类法对所述行踪视频进行分割,得到所述初 始图片。The tracking video is segmented by using a hierarchical clustering method according to the distance between the video frames to obtain the initial picture.
  16. 如权利要求15所述的计算机设备,其特征在于,所述根据预先得到的行踪视频中各视频帧之间的时间差值和各视频帧之间的图像色彩特征的相似度,计算各视频帧之间的距离为:将所述预先得到的行踪视频中各视频帧之间的时间差值、各视频帧之间的卡方距离输入如下计算公式,得到各视频帧之间的距离:The computer device according to claim 15, wherein the video frames are calculated according to a time difference between video frames and a similarity of image color characteristics between the video frames in the track video obtained in advance. The distance between them is as follows: the time difference between the video frames in the track video and the chi-square distance between the video frames are input into the following calculation formula to obtain the distance between the video frames:
    Figure PCTCN2018106379-appb-100005
    Figure PCTCN2018106379-appb-100005
    Figure PCTCN2018106379-appb-100006
    Figure PCTCN2018106379-appb-100006
    其中,所述行踪视频包括q个视频帧,所述q大于1;k i为所述行踪视频中的第i个视频帧,k j为所述行踪视频中的第j个视频帧,所述i大于等于1且小于等于所述q,所述j大于等于1且小于等于所述q,s(k i,k j)为第i个视频帧与第j个视频帧之间的距离,所述x 2(k i,k j)为所述第i个视频帧与第j个视频帧之间的色彩直方图的卡方距离,所述w 1为预设的卡方距离,所述r为预设的正整数,|i-j|表示第i个视频帧与第j个视频帧之间的时间差值,max(0,r-|i-j|)表示0与r-|i-j|之间的最大值,r-|i-j|为大于0的自然数。 Wherein, the track video includes q video frames, where q is greater than 1. k i is the i-th video frame in the track video, and k j is the j-th video frame in the track video. i is greater than or equal to 1 and less than or equal to q, the j is greater than or equal to 1 and less than or equal to q, and s (k i , k j ) is the distance between the i-th video frame and the j-th video frame, so Let x 2 (k i , k j ) be the chi-square distance of the color histogram between the i-th video frame and the j-th video frame, w 1 be the preset chi-square distance, and r Is a preset positive integer, | ij | represents the time difference between the i-th video frame and j-th video frame, and max (0, r- | ij |) represents the time between 0 and r- | ij | The maximum value, r- | ij | is a natural number greater than 0.
  17. 如权利要求15所述的计算机设备,其特征在于,所述行踪视频通过以下步骤获取:The computer device according to claim 15, wherein the whereabouts video is obtained by the following steps:
    连续多次拍摄目标人物的行踪视频,并在拍摄行踪视频的过程中判断连续多次拍摄得到的行踪视频的总时间长度是否达到预设时间长度;Continuously shooting the whereabouts of the target person multiple times, and during the shooting of the whereabouts video, determine whether the total time length of the whereabouts video obtained by the multiple consecutive shots reaches a preset time length;
    若在拍摄行踪视频的过程中连续多次拍摄得到的行踪视频的总时间长度达到预设时间长度,则停止行踪视频的拍摄,并将所述连续多次拍摄目标人物的行踪视频拼接成一个行踪视频,得到拼接后的行踪视频;If the total time length of the tracked video obtained during the continuous shooting of the tracked video reaches the preset time length, the shooting of the tracked video is stopped, and the tracked video of the target person is continuously stitched into a tracked track. Video to get spliced whereabouts video;
    将所述拼接后的行踪视频确定为得到的行踪视频。The spliced whereabouts video is determined as the obtained whereabouts video.
  18. 如权利要求13至17中任一项所述的计算机设备,其特征在于,在所述对预先得到的初始图片中的各个像素点对应的像素值进行一阶求导之前,所述处理器执行所述计算 机可读指令时还实现如下步骤:The computer device according to any one of claims 13 to 17, wherein before the first-order derivation of pixel values corresponding to respective pixel points in an initial picture obtained in advance, the processor executes The computer-readable instructions further implement the following steps:
    获取所述初始图片的各个像素点对应的第一目标像素值、所述目标人物背景的各个像素点对应的第二目标像素值和像素点总和,其中,所述图片的像素点包括所述目标人物的像素点和所述目标人物背景的像素点,所述像素点总和为所述图片的像素点的总个数或所述目标人物背景的像素点的总个数;Acquiring a first target pixel value corresponding to each pixel point of the initial picture, a second target pixel value corresponding to each pixel point of the target person background, and a sum of pixel points, wherein the pixel points of the picture include the target Pixels of a person and pixels of a background of the target person, the sum of the pixels is the total number of pixels of the picture or the total number of pixels of the background of the target person;
    根据所述第一目标像素值、所述第二目标像素值和所述像素点总和采用预设的计算法对所述图片的各个像素点对应的像素值进行计算,得到计算后的像素点对应的像素值。Calculating a pixel value corresponding to each pixel point of the picture by using a preset calculation method according to the first target pixel value, the second target pixel value, and the sum of the pixel points to obtain a calculated pixel point correspondence The pixel value.
  19. 一个或多个存储有计算机可读指令的非易失性可读存储介质,其特征在于,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行如下步骤:One or more non-volatile readable storage media storing computer-readable instructions, wherein when the computer-readable instructions are executed by one or more processors, the one or more processors execute The following steps:
    对预先得到的初始图片中的各个像素点对应的像素值分别进行一阶求导,得到各个像素点对应的像素值的第一处理数值,其中,所述像素点对应的像素值与所述像素点对应的像素值的第一处理数值存在一一对应关系;First-order derivative is performed on the pixel values corresponding to each pixel point in the initial picture obtained in advance, to obtain a first processed value of the pixel value corresponding to each pixel point, wherein the pixel value corresponding to the pixel point and the pixel are There is a one-to-one correspondence between the first processed values of the pixel values corresponding to the points;
    对所述各个像素点对应的像素值的第一处理数值分别进行二阶求导,得到各个像素点对应的像素值的第二处理数值,其中,所述像素点对应的像素值的第一处理数值与所述像素点对应的像素值的第二处理数值存在一一对应关系;Performing a second-order derivative on the first processed value of the pixel value corresponding to each pixel point to obtain a second processed value of the pixel value corresponding to each pixel point, wherein the first processing of the pixel value corresponding to the pixel point There is a one-to-one correspondence between the value and the second processed value of the pixel value corresponding to the pixel point;
    若所述像素点对应的像素值的第一处理数值满足预设的第一条件,且所述像素点对应的像素值的第二处理数值满足预设的第二条件,则确定所述像素点为所述图片中的目标人物与目标人物背景之间的边缘点;Determining a pixel point if a first processing value of a pixel value corresponding to the pixel point satisfies a preset first condition and a second processing value of a pixel value corresponding to the pixel point satisfies a preset second condition The edge point between the target person in the picture and the background of the target person;
    按照边缘线将所述初始图片中的所述目标人物背景进行剔除,得到目标图片,其中,所述边缘线由各个所述初始图片中的目标人物与目标人物背景之间的边缘点连接而成。The target person background in the initial picture is removed according to an edge line to obtain a target picture, where the edge line is formed by connecting edge points between the target person and the target person background in each of the initial pictures .
  20. 如权利要求19所述的非易失性可读存储介质,其特征在于,所述像素点对应的像素值的第一处理数值满足预设的第一条件,且所述像素点对应的像素值的第二处理数值满足预设的第二条件为:第一绝对值大于第一预设阈值,且第二绝对值大于第二预设阈值,其中,所述第一绝对值为所述像素点对应的像素值的第一处理数值与所述像素点横向相邻的预设个像素点对应的像素值的第一处理数值的差值的绝对值,所述第二绝对值为所述像素点对应的像素值的第二处理数值与所述像素点横向相邻的预设个像素点对应的像素值的第二处理数值的差值的绝对值。The non-volatile readable storage medium according to claim 19, wherein the first processing value of the pixel value corresponding to the pixel point satisfies a preset first condition, and the pixel value corresponding to the pixel point The second processed value of is satisfied with the preset second condition: the first absolute value is greater than the first preset threshold, and the second absolute value is greater than the second preset threshold, wherein the first absolute value is the pixel point An absolute value of a difference between a first processed value of a corresponding pixel value and a first processed value of a pixel value corresponding to a preset number of pixels in which pixels are laterally adjacent, and the second absolute value is the pixel point The absolute value of the difference between the second processed value of the corresponding pixel value and the second processed value of the pixel value corresponding to a preset number of pixel points laterally adjacent to the pixel point.
PCT/CN2018/106379 2018-08-02 2018-09-19 Background elimination method and device, computer device and storage medium WO2020024394A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810872355.8A CN109308704B (en) 2018-08-02 2018-08-02 Background eliminating method, device, computer equipment and storage medium
CN201810872355.8 2018-08-02

Publications (1)

Publication Number Publication Date
WO2020024394A1 true WO2020024394A1 (en) 2020-02-06

Family

ID=65226067

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/106379 WO2020024394A1 (en) 2018-08-02 2018-09-19 Background elimination method and device, computer device and storage medium

Country Status (2)

Country Link
CN (1) CN109308704B (en)
WO (1) WO2020024394A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114140479A (en) * 2021-12-02 2022-03-04 深圳万兴软件有限公司 Optimization method and device for portrait segmentation picture and related components
CN117197706A (en) * 2023-04-23 2023-12-08 青岛尘元科技信息有限公司 Method and system for dividing progressive lens, storage medium and electronic device

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110502205B (en) * 2019-08-29 2023-08-01 百度在线网络技术(北京)有限公司 Picture display edge processing method and device, electronic equipment and readable storage medium
CN110765935A (en) * 2019-10-22 2020-02-07 上海眼控科技股份有限公司 Image processing method, image processing device, computer equipment and readable storage medium
CN111860200B (en) * 2020-06-28 2024-04-19 维沃移动通信有限公司 Video frame processing method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1601562A (en) * 2003-09-25 2005-03-30 索尼株式会社 Image processing apparatus and method of same
CN105719274A (en) * 2014-12-10 2016-06-29 全视技术有限公司 Edge Detection System And Methods
CN106534951A (en) * 2016-11-30 2017-03-22 北京小米移动软件有限公司 Method and apparatus for video segmentation
WO2017116808A1 (en) * 2015-12-30 2017-07-06 Ebay, Inc. Background removal

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100215209B1 (en) * 1996-10-24 1999-08-16 전주범 Target tracking method and device for video phone
CN106373143A (en) * 2015-07-22 2017-02-01 中兴通讯股份有限公司 Adaptive method and system
CN106056532B (en) * 2016-05-20 2020-04-07 深圳市奥拓电子股份有限公司 Method and device for removing background image
CN108038869B (en) * 2017-11-20 2020-03-27 江苏省特种设备安全监督检验研究院 Method for detecting falling behavior of passenger in elevator car

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1601562A (en) * 2003-09-25 2005-03-30 索尼株式会社 Image processing apparatus and method of same
CN105719274A (en) * 2014-12-10 2016-06-29 全视技术有限公司 Edge Detection System And Methods
WO2017116808A1 (en) * 2015-12-30 2017-07-06 Ebay, Inc. Background removal
CN106534951A (en) * 2016-11-30 2017-03-22 北京小米移动软件有限公司 Method and apparatus for video segmentation

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114140479A (en) * 2021-12-02 2022-03-04 深圳万兴软件有限公司 Optimization method and device for portrait segmentation picture and related components
CN117197706A (en) * 2023-04-23 2023-12-08 青岛尘元科技信息有限公司 Method and system for dividing progressive lens, storage medium and electronic device

Also Published As

Publication number Publication date
CN109308704A (en) 2019-02-05
CN109308704B (en) 2024-01-16

Similar Documents

Publication Publication Date Title
WO2020024394A1 (en) Background elimination method and device, computer device and storage medium
WO2021139787A2 (en) Target tracking method for panoramic video, readable storage medium, and computer device
WO2019237536A1 (en) Target real-time tracking method and apparatus, and computer device and storage medium
CN110765860B (en) Tumble judging method, tumble judging device, computer equipment and storage medium
KR102122348B1 (en) Method and device for face in-vivo detection
WO2020199480A1 (en) Body movement recognition method and device
CN109241896B (en) Channel safety detection method and device and electronic equipment
US10970823B2 (en) System and method for detecting motion anomalies in video
US11900676B2 (en) Method and apparatus for detecting target in video, computing device, and storage medium
WO2021174789A1 (en) Feature extraction-based image recognition method and image recognition device
CN111126208B (en) Pedestrian archiving method and device, computer equipment and storage medium
KR102578209B1 (en) Apparatus and method for image processing
CN108898057B (en) Method, device, computer equipment and storage medium for tracking target detection
US11250269B2 (en) Recognition method and apparatus for false detection of an abandoned object and image processing device
CN108229281B (en) Neural network generation method, face detection device and electronic equipment
CN110298239B (en) Target monitoring method, device, computer equipment and storage medium
CN114387296A (en) Target track tracking method and device, computer equipment and storage medium
CN111159476A (en) Target object searching method and device, computer equipment and storage medium
CN108334811B (en) Face image processing method and device
CN113989914B (en) Security monitoring method and system based on face recognition
CN113762027B (en) Abnormal behavior identification method, device, equipment and storage medium
TWI728655B (en) Convolutional neural network detection method and system for animals
CN109815369B (en) Filing method and device
CN114092845A (en) Target detection method, device and system and computer readable storage medium
CN111091135B (en) Method and system for eliminating false detection of static object

Legal Events

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

Ref document number: 18928730

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 11.05.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 18928730

Country of ref document: EP

Kind code of ref document: A1