WO2020029518A1 - Monitoring video processing method, device and computer readable medium - Google Patents

Monitoring video processing method, device and computer readable medium Download PDF

Info

Publication number
WO2020029518A1
WO2020029518A1 PCT/CN2018/123511 CN2018123511W WO2020029518A1 WO 2020029518 A1 WO2020029518 A1 WO 2020029518A1 CN 2018123511 W CN2018123511 W CN 2018123511W WO 2020029518 A1 WO2020029518 A1 WO 2020029518A1
Authority
WO
WIPO (PCT)
Prior art keywords
moving object
image frame
current image
search window
probability distribution
Prior art date
Application number
PCT/CN2018/123511
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 WO2020029518A1 publication Critical patent/WO2020029518A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/181Segmentation; Edge detection involving edge growing; involving edge linking
    • 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
    • G06T7/248Analysis of motion using feature-based methods, e.g. the tracking of corners or segments involving reference images or patches
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/76Television signal recording
    • 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/30232Surveillance
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N7/00Television systems
    • H04N7/18Closed-circuit television [CCTV] systems, i.e. systems in which the video signal is not broadcast

Definitions

  • the present application relates to the technical field of surveillance video processing, and in particular, to a surveillance video processing method, device, and computer-readable medium.
  • the existing surveillance video processing is to monitor and save all the pictures captured by the camera, and then perform corresponding processing on the saved surveillance video, such as compressing and blurring the saved surveillance video to save storage.
  • An embodiment of the present application provides a monitoring video processing method, which can effectively detect and track moving object video segments in which a moving object exists in the monitoring video, and only save the monitoring video in which the moving object exists during the process of saving the monitoring video. Fragments, saving storage space.
  • an embodiment of the present application provides a monitoring video processing method, which includes:
  • a video image frame where the moving object exists and a moving track of the moving object are saved.
  • a video image frame where the moving object exists and a moving track of the moving object are saved.
  • an embodiment of the present application provides a monitoring video processing apparatus, where the monitoring video processing apparatus includes a unit for executing the method of the first aspect.
  • an embodiment of the present application provides another monitoring video processing apparatus, including a processor, an input device, an output device, and a memory, and the processor, the input device, the output device, and the memory are connected to each other, where the memory
  • a computer program for storing a monitoring video processing device to execute the above method the computer program includes program instructions, and the processor is configured to call the program instructions to execute the method of the first aspect.
  • an embodiment of the present application provides a computer-readable storage medium.
  • the computer storage medium stores a computer program, where the computer program includes program instructions, and the program instructions cause the processing when executed by a processor.
  • the processor performs the method of the first aspect.
  • a video image frame of a monitoring video is acquired, and an inter-frame difference algorithm is used to determine whether a moving object exists in the current image frame in the video image frame; if it exists, extract the moving object in the current image frame. Outline. Then, the moving trajectory of the moving object is tracked according to the contour of the moving object in combination with the Camshift algorithm. Finally, the video image frame where the moving object exists and the moving track of the moving object are saved.
  • FIG. 1 is a schematic flowchart of a monitoring video processing method according to an embodiment of the present application
  • FIG. 2 is a schematic flowchart of another monitoring video processing method according to an embodiment of the present application.
  • FIG. 3 is a schematic flowchart of another monitoring video processing method according to an embodiment of the present application.
  • FIG. 4 is a schematic block diagram of a monitoring video processing apparatus according to an embodiment of the present application.
  • FIG. 5 is a schematic block diagram of a monitoring video processing apparatus according to another embodiment of the present application.
  • the existing video surveillance all the pictures captured by the camera are monitored, and then all the pictures monitored are packaged and compressed and uploaded to the server.
  • the current video surveillance methods have the following disadvantages: in the existing video surveillance methods, there is no behavior trajectory tracking of moving objects. If the monitoring picture remains stationary for a long time, these stationary pictures are not what we want to monitor. Screens, but the monitoring device will also save these screens to the server, causing unnecessary waste of storage space.
  • FIG. 1 is a schematic flowchart of a monitoring video processing method according to an embodiment of the present application. As shown in the figure, the method may include:
  • 101 Obtain a video image frame of a monitoring video, and use an inter-frame difference algorithm to determine whether there is a moving object in the current image frame in the video image frame. If a moving object exists in the current image frame, extract the moving object in the current image frame. Outline.
  • an inter-frame difference algorithm is mainly used to detect a moving object in a surveillance video. Specifically, after acquiring the video image frame of the surveillance video, an inter-frame difference algorithm is used to determine whether there is a moving object in the current image frame in the video image frame. If there is no moving object in the current image frame, the current image frame is not detected. For any operation, if there is a moving object in the current image frame, extract the contour of the moving object in the current image frame.
  • the above-mentioned surveillance video may be a surveillance video that has been temporarily stored in the memory, or may be a surveillance video that the camera is monitoring in real time.
  • the above-mentioned surveillance video is a surveillance video temporarily stored in the memory, the entire surveillance video is detected for a moving object, and when a moving object is detected, the moving object is tracked.
  • the surveillance video is a surveillance video that the camera is monitoring in real time
  • the real-time detection method is used to detect the moving object in the surveillance video, and when the moving object is detected, the moving object is tracked.
  • the above-mentioned inter-frame difference algorithm is a method for determining a change region in an image by using inter-frame differences that are continuous or separated by a certain number of frames, so as to detect a moving object.
  • the inter-frame difference algorithm performs a difference operation on two consecutive frames or multiple frames of images, then binarizes and filters the difference images, detects possible motion areas, and detects moving objects in the images.
  • a two-frame difference algorithm may be used to detect whether a moving object exists in the foregoing image frame.
  • preprocessing the image frame includes: performing grayscale processing on the image frame. Specifically, two consecutive image frames are extracted from the foregoing image frames, and the current image frame is defined as the kth frame. When extracting the image frames, the kth frame and the k-1th image frame are selected. Then, the two extracted color images are converted into grayscale images. Specifically, formula (1) is used to replace the RGB values in the images, and then the grayscale images of the two selected image frames are obtained.
  • the grayscale difference of the stationary object on the difference image will be small, and the outline of the moving object, especially the moving object Due to the presence of grayscale changes, the presence of moving objects in the monitoring screen can be determined based on the difference image, and the position, contour, and moving path of the moving objects can be roughly calculated.
  • Record the previous image frame as F k-1 and the current image frame as F k-1 .
  • the gray values of the corresponding pixel points of the two image frames are recorded as F k-1 (x, y) and F k (x, y).
  • the binarization threshold T is set, and the pixels are binarized one by one according to the formula (3) to obtain a binarized image R k .
  • the point with a gray value of 255 is the foreground (moving object) point
  • the point with a gray value of 0 is the background point
  • the connectivity analysis of the image R k can finally obtain an image R k containing a complete moving object .
  • the current image frame has not changed from the previous graphic frame, that is, there is no moving object in the current image frame, so The current image frame is regarded as an invalid image frame, and the current image frame is not saved. If there are pixels in the difference image that are larger than the binarization threshold, it is determined that the current image frame has changed from the previous graphics frame, that is, there is a moving object in the current image frame, so the current image frame is regarded as valid An image frame, and obtain position and contour information of the moving object according to the image R k of the complete moving object.
  • a three-frame difference algorithm may be used to detect whether a moving object exists in the foregoing image frame.
  • the current image frame is defined as the k-th frame, and three consecutive image frames are selected as k-2, k-1, and k frames, and then preprocessed.
  • the processing process is similar to the two-difference algorithm. Not to go into details.
  • the absolute values of the grayscale differences of the k-2nd and k-1th image frames and the grayscales of the k-1th and kth image frames are obtained, respectively.
  • the absolute value of the difference is used to obtain two difference images, and then the difference image is binarized to obtain two binarized images. Finally, the two binarized images are ANDed to obtain the final binarized image.
  • the specific operation process is similar to the two-frame difference algorithm, and is not described in detail.
  • the obtained binarized image is usually not always the contour of the moving target due to the interference of noise and slight changes in the background. Do some processing on the image to get the complete area of the moving object.
  • a basic morphological algorithm is used to denoise the binary image, and finally a clear binary image of a moving object is obtained.
  • the movement trajectory of the moving object is tracked by using the Camshift algorithm and the outline information of the moving object.
  • Camshift is based on the color information of moving objects in the video image.
  • Mean shift is performed on each frame of the input image, and the target center of the previous frame and the search window size (kernel function bandwidth) are used as the next frame.
  • the center of the algorithm and the initial value of the search window size Iterating this way, you can track the target. Because the position and size of the search window are set to the position and size of the current center of the moving target before each search, and the moving target is usually near this area, the search time is shortened.
  • step (5) In the next frame of video image, initialize the position and size of the search window with the values obtained in step (4), skip to step (3) and continue running.
  • the traditional Camshift algorithm needs to manually select the tracked moving object to track the moving object.
  • the detection result of the inter-frame difference algorithm is used to track a moving object.
  • the tracking the moving trajectory of the moving object according to the contour of the moving object in combination with the Camshift algorithm specifically includes:
  • 1021 Initialize the size and position of the search window in the current image frame according to the contour of the moving object.
  • the contour of the moving object is obtained according to the contour of the moving object. Circumscribed rectangle and position. Then, the size and position of the search window in the current image frame are initialized according to the circumscribed rectangle and position.
  • the image is first converted from RGB space to HSI space. Then make a histogram of the H components, which represents the probability of the occurrence of different H component values or the number of pixels, that is, you can find the probability of the H component size h or the number of pixels, and you get the color probability. Lookup table. By replacing the value of each pixel in the image with the probability of its color appearing, the color probability distribution map is obtained. This process is called back projection.
  • the color probability distribution map is a grayscale image.
  • the color probability distribution of moving objects in the search window needs to be calculated in order to obtain the probability distribution map of the moving objects in the search window.
  • a color histogram in the target area is calculated.
  • the input image is converted to the HSI color space (or a color space similar to HIS)
  • the target area is the initial set search window range
  • the hue H component is separated for the hue histogram calculation of the area.
  • the color histogram of the moving object is obtained, the probability distribution map I (x, y) is normalized, and it is used as a lookup table.
  • Each pixel on the H-channel image is corresponding to its pixel value. Probability instead, get a probabilistic projection map.
  • the median filtering downsampling can be used to remove noise from the above probability distribution image.
  • 1023 Calculate the position and size of the centroid of the moving object in the current image frame according to the probability distribution map and the meanshift algorithm.
  • the position of the center of mass of the search window is calculated. Specifically, the zero-order moment and the first-order moment of the pixels in the search window are calculated to find the position of the centroid of the search window.
  • the zero-order moment is calculated by using formula (4);
  • centroid (x c , y c ) of the search window is:
  • the center of the search window moves to the center of mass. If the moving distance is greater than the set threshold, recalculate the center of mass of the adjusted window and perform a new round of window position and size adjustment. Until the moving distance between the center of the window and the center of mass is less than the threshold, or the number of iterations reaches a certain maximum, the convergence condition is considered to be satisfied. At this time, the center position and size of the window are the center of mass and position of the moving object in the current frame.
  • the position and size of the centroid of the moving object in the current image frame are obtained, the position and size of the centroid of the moving object in the current image frame are saved. Then, the next image frame is used as the current image frame and the step of calculating the color probability distribution of the moving objects in the search window to obtain the probability distribution map of the search window is triggered.
  • an inter-frame difference algorithm is used to detect whether there is a moving object in the video image frame.
  • the detected moving object is tracked by using the Camshift algorithm.
  • the moving object disappears from the video image frame, it is determined that the tracking ends.
  • the video image frames in which the moving object exists are stored in the memory or uploaded to the server for storage, and for the video image frames in which there is no moving object, the video image frames are not processed. save.
  • the video image frame of the surveillance video is obtained, and an inter-frame difference algorithm is used to determine whether there is a moving object in the current image frame in the video image frame; if it exists, the movement in the current image frame is extracted The outline of the object. Then, the moving trajectory of the moving object is tracked according to the contour of the moving object in combination with the Camshift algorithm. Finally, the video image frame where the moving object exists and the moving track of the moving object are saved.
  • FIG. 2 is a schematic flowchart of another monitoring video processing method provided by an embodiment of the present application. As shown in the figure, the method may include:
  • the current image frame is defined as the k-th frame
  • the previous image frame is defined as the k-1 frame.
  • the current image frame and the previous image frame need to be denoised and grayed.
  • step 203 Determine whether there is a moving object. If there is a moving object, step 204 is performed. If there is no moving object, return to step 202 to obtain the next image frame.
  • step 204 it is determined whether there is an area where the difference image D k (x, y)> T exists in the difference image. If yes, it is determined that there is a moving object in the k-th image frame, and step 204 is continued. If not, the k-th is determined. If there is no moving object in the frame image frame, the next image frame is continuously acquired, where T is a binarization threshold.
  • the contour and position information of the moving object is extracted according to the binarized image after processing.
  • step 212 Determine whether to converge according to the meanshift algorithm. If it converges, use the adjusted center position and size of the search window as the position and size of the search window in the next image frame to initialize. If it does not converge, return to step 210.
  • the video image frame of the monitoring video is obtained, and an inter-frame difference algorithm is used to determine whether there is a moving object in the current image frame in the video image frame; if it exists, the movement in the current image frame is extracted. The outline of the object. Then, the moving trajectory of the moving object is tracked according to the contour of the moving object in combination with the Camshift algorithm. Finally, the video image frame where the moving object exists and the moving track of the moving object are saved.
  • FIG. 3 is a schematic flowchart of another monitoring video processing method according to an embodiment of the present application. As shown in the figure, the method may include:
  • the current image frame is defined as the k-th image frame, and the first two image frames are the k-1th image frame and the k-2th image frame, respectively.
  • the current image frame and the previous image frame need to be denoised and grayed out.
  • step 204 Determine whether there is a moving object. If there is a moving object, step 204 is performed. If there is no moving object, return to step 202 to obtain the next image frame.
  • step 204 it is determined whether there is an area of the difference image Dk (x, y)> T in the difference image. If yes, it is determined that there is a moving object in the k-th image frame, and step 204 is continued, and if not, the k-th frame is determined. If there is no moving object in the image frame, the next image frame is obtained, where T is the binarization threshold.
  • the contour and position information of the moving object is extracted according to the binarized image after processing.
  • 307 Initialize the size and position of the search window according to the outline and position information of the moving object.
  • 311 Calculate the zero-order moment and the first-order moment of the pixels in the window according to the probability distribution map, the position of the search window, and the size of the search window to obtain the centroid position of the search window.
  • 312 Adjust the center position and size of the search window according to the centroid position.
  • step 313 Determine whether to converge according to the meanshift algorithm. If it converges, use the center position and size of the adjusted search window as the position and size of the search window in the next image frame to initialize. If it does not converge, return to step 311.
  • the video image frame of the surveillance video is obtained, and an inter-frame difference algorithm is used to determine whether there is a moving object in the current image frame in the video image frame; if it exists, the movement in the current image frame is extracted The outline of the object. Then, the moving trajectory of the moving object is tracked according to the contour of the moving object in combination with the Camshift algorithm. Finally, the video image frame where the moving object exists and the moving track of the moving object are saved.
  • FIG. 4 is a schematic block diagram of a monitoring video processing apparatus according to an embodiment of the present application.
  • the monitoring video processing apparatus of this embodiment includes: an obtaining unit 401, a judging unit 402, an extracting unit 403, a tracking unit 404, and a saving unit 405.
  • the acquiring unit 401 is configured to acquire a video image frame of a surveillance video.
  • the determining unit 402 is configured to determine whether a moving object exists in a current image frame in the video image frame by using an inter-frame difference algorithm.
  • the extraction unit 403 is configured to extract a contour of the moving object in the current image frame when the determining unit 402 determines that a moving object exists.
  • the tracking unit 404 is configured to track a moving trajectory of the moving object according to a contour of the moving object in combination with a Camshift algorithm.
  • the storage unit 405 is configured to store a video image frame in which the moving object exists and a movement track of the moving object.
  • the monitoring video processing device further includes:
  • the processing unit 406 is configured to pre-process the video image frame, and the pre-processing includes graying processing.
  • the foregoing determining unit includes:
  • the first calculation unit 407 is configured to perform a difference operation between the current image frame and a previous image frame of the current image frame to obtain a difference image.
  • a determining unit 408 is configured to determine that a moving object exists in an image frame when an area in which a gray value of a pixel is greater than a binarization threshold exists in the difference image.
  • the foregoing determining unit includes:
  • the first calculation unit 407 is configured to perform a difference operation between the current picture frame and the first two image frames of the current picture frame to obtain a difference image.
  • a determining unit 408 is configured to determine that a moving object exists in an image frame when an area in which a gray value of a pixel is greater than a binarization threshold exists in the difference image.
  • the above-mentioned extraction unit 403 includes:
  • a binarizing unit 409 is configured to binarize the difference image to obtain a binarized image according to the binarization threshold.
  • the extraction unit is used for 403, and extracts the contour and position of the moving object according to the binary image.
  • the processing unit 406 is further configured to perform noise processing on the binary image using a basic morphological algorithm.
  • the tracking unit 404 includes:
  • the initial unit 410 is configured to initialize the size and position of the search window in the current image frame according to the contour of the moving object.
  • the second calculation unit 411 is configured to calculate a color probability distribution of a moving object in the search window to obtain a probability distribution map of the search window.
  • the second calculation unit 411 is further configured to calculate, according to the probability distribution map and the meanshift algorithm, the position and size of the centroid of the moving object in the current image frame.
  • the initialization unit 410 is further configured to initialize the size and position of a search window in the next image frame according to the centroid position and size of the moving object in the current image frame, use the next image frame as the current image frame, and trigger The step of calculating a color probability distribution of a moving object in the search window to obtain a probability distribution map of the search window.
  • the second calculation unit is configured to convert the current image frame from RGB space to HSI space; and calculate a histogram of the current image frame according to the H component in the HIS space of the current image frame Figure; calculating the probability distribution map of the search window according to the histogram.
  • the processing unit 406 is further configured to perform desalination processing on the probability distribution map of the search window by using a median filtering method.
  • the video image frame of the surveillance video is obtained, and an inter-frame difference algorithm is used to determine whether there is a moving object in the current image frame in the video image frame; if it exists, the movement in the current image frame is extracted The outline of the object. Then, the moving trajectory of the moving object is tracked according to the contour of the moving object in combination with the Camshift algorithm. Finally, the video image frame where the moving object exists and the moving track of the moving object are saved.
  • FIG. 5 is a schematic block diagram of a monitoring video processing apparatus according to another embodiment of the present application.
  • the monitoring video processing apparatus in this embodiment as shown in the figure may include: one or more processors 501; one or more input devices 502, one or more output devices 503, and a memory 504.
  • the processor 501, the input device 502, the output device 503, and the memory 504 are connected through a bus 505.
  • the memory 502 is configured to store a computer program, and the computer program includes program instructions, and the processor 501 is configured to execute the program instructions stored in the memory 502.
  • the processor 501 is configured to call the above program instructions for execution: obtaining a video image frame of a surveillance video, and using an inter-frame difference algorithm to determine whether a moving object exists in the current image frame in the video image frame; For moving objects, extract the contours of the moving objects in the current image frame; track the moving trajectories of the moving objects based on the contours of the moving objects in combination with the Camshift algorithm; save the video image frames of the moving objects and the Move track.
  • the processor 501 may be a central processing unit (CPU), and the processor may also be another general-purpose processor or a digital signal processor (DSP).
  • DSP digital signal processor
  • ASIC Application Specific Integrated Circuit
  • FPGA Field-Programmable Gate Array
  • a general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • the input device 502 may include a touch panel, a fingerprint sensor (for collecting fingerprint information and orientation information of a user), a microphone, and the like, and the output device 503 may include a display (LCD, etc.), a speaker, and the like.
  • a fingerprint sensor for collecting fingerprint information and orientation information of a user
  • a microphone for collecting fingerprint information and orientation information of a user
  • the output device 503 may include a display (LCD, etc.), a speaker, and the like.
  • the memory 504 may include a read-only memory and a random access memory, and provide instructions and data to the processor 501.
  • a portion of the storage 504 may also include non-volatile random access memory.
  • the memory 504 may also store information of a device type.
  • the processor 501, input device 502, and output device 503 described in the embodiments of the present application may execute the first, second, and third embodiments of a monitoring video processing method provided by the embodiments of the present application.
  • the implementation manner described in the embodiment may also be implemented as the implementation manner of the monitoring video processing apparatus described in the embodiment of the present application, and details are not described herein again.
  • a computer-readable storage medium stores a computer program.
  • the computer program includes program instructions.
  • the program instructions are implemented by a processor to implement: For video image frames, use an inter-frame difference algorithm to determine whether there are moving objects in the current image frame in the video image frame; if there are moving objects in the current image frame, extract the outline of the moving object in the current image frame; The contour of the moving object is combined with the Camshift algorithm to track the moving trajectory of the moving object; a video image frame in which the moving object is stored and the moving trajectory of the moving object are stored.
  • the computer-readable storage medium may be an internal storage unit of the monitoring video processing apparatus in any one of the foregoing embodiments, such as a hard disk or a memory of the monitoring video processing apparatus.
  • the computer-readable storage medium may also be an external storage device of the surveillance video processing device, such as a plug-in hard disk, a Smart Media Card (SMC), and a secure digital (Secure Digital, SD) card, flash card, etc.
  • the computer-readable storage medium may further include both an internal storage unit and an external storage device of the monitoring video processing apparatus.
  • the computer-readable storage medium is used to store the computer program and other programs and data required by the monitoring video processing device.
  • the computer-readable storage medium described above may also be used to temporarily store data that has been or will be output.
  • the disclosed monitoring video processing apparatus and method may be implemented in other ways.
  • the device embodiments described above are merely schematic.
  • the division of the above units is only a logical function division.
  • multiple units or components may be combined or may be combined. Integration into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may also be electrical, mechanical or other forms of connection.
  • the units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, which may be located in one place, or may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions in the embodiments of the present application.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the above integrated unit may be implemented in the form of hardware or in the form of software functional unit.
  • the technical solution of this application is essentially a part that contributes to the existing technology, or all or part of the technical solution may be embodied in the form of a software product, which is stored in a storage medium
  • a computer device which may be a personal computer, a server, or a network device, etc.
  • the foregoing storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disks or optical disks and other media that can store program codes .

Landscapes

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

Abstract

Disclosed in the embodiments of the present application are a monitoring video processing method, a monitoring video processing device and a computer readable medium. The method comprises: acquiring video image frames of a monitoring video, and using an inter-frame differential algorithm to determine whether a moving object is present in a current image frame among the video image frames; if a moving object is present in the current image frame, extracting the contour of the moving object in the current image frame; then tracking a moving trajectory of the moving object according to the contour of the moving object in combination with the Camshift algorithm; finally, saving video image frames in which the moving object is present as well as the moving trajectory of the moving object. By means of the embodiments of the present application, it is possible to effectively detect a video segment in which a moving object is present in a monitoring video and track the moving object, and only save a monitoring video segment in which the moving object is present during the process of saving the monitoring video, thereby saving storage space.

Description

一种监控视频处理方法、装置及计算机可读介质Monitoring video processing method, device and computer-readable medium
本申请要求于2018年8月10日提交中国专利局、申请号为2018109082310、申请名称为“一种监控视频处理方法、装置及计算机可读介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed on August 10, 2018 with the Chinese Patent Office, application number 2018109082310, and application name "A Surveillance Video Processing Method, Apparatus, and Computer-readable Media", all of which passed Citations are incorporated in this application.
技术领域Technical field
本申请涉及监控视频处理技术领域,尤其涉及一种监控视频处理方法、装置及计算机可读介质。The present application relates to the technical field of surveillance video processing, and in particular, to a surveillance video processing method, device, and computer-readable medium.
背景技术Background technique
对于监控视频来说,监控视频中真正有用的是发生变化、存在移动物体的监控画面,而对于长时间保持不变的监控画面没有任何价值。因此在智能型监控视频处理系统应用中,移动物体图像的检测和轨迹跟踪是视屏监控系统中的核心技术。然而,现有的监控视频处理都是均是将摄像头拍摄到的所有画面都进行监控并保存,然后再对保存的监控视屏进行相应的处理,例如对保存的监控视频进行压缩、模糊处理以便节省存储空间。For surveillance video, what is really useful in surveillance video is the surveillance picture that has changed and there are moving objects, but it has no value for the surveillance picture that remains unchanged for a long time. Therefore, in the application of intelligent surveillance video processing systems, the detection and trajectory tracking of moving object images are the core technologies in video surveillance systems. However, the existing surveillance video processing is to monitor and save all the pictures captured by the camera, and then perform corresponding processing on the saved surveillance video, such as compressing and blurring the saved surveillance video to save storage.
现有的监控视频处理方法中,没有对移动物体进行行为轨迹跟踪,如果监控画面长时间静止不变,这些静止不变的画面并不是我们想要监控的画面,但是监控设备也依旧将这些画面保存到服务器中,从而造成了不必要的存储空间浪费。In the existing surveillance video processing methods, there is no behavior trajectory tracking for moving objects. If the surveillance picture remains stationary for a long time, these stationary pictures are not the pictures we want to monitor, but the monitoring equipment still keeps these pictures Saved to the server, causing unnecessary waste of storage space.
发明内容Summary of the invention
本申请实施例提供一种监控视频处理方法,可有效的对监控视频中存在移动物体的视频片段进行检测并对移动物体进行跟踪,且在保存监控视频的过程中只保存存在移动物体的监控视频片段,节省了存储空间。An embodiment of the present application provides a monitoring video processing method, which can effectively detect and track moving object video segments in which a moving object exists in the monitoring video, and only save the monitoring video in which the moving object exists during the process of saving the monitoring video. Fragments, saving storage space.
第一方面,本申请实施例提供了一种监控视频处理方法,该方法包括:In a first aspect, an embodiment of the present application provides a monitoring video processing method, which includes:
获取监控视频的视频图像帧,利用帧间差分算法判断所述视频图像帧中的当前图像帧中是否存在移动物体;Acquiring a video image frame of a monitoring video, and determining whether a moving object exists in a current image frame in the video image frame by using an inter-frame difference algorithm;
若当前图像帧中存在移动物体,则提取所述当前图像帧中所述移动物体的轮廓;If there is a moving object in the current image frame, extracting the outline of the moving object in the current image frame;
根据所述移动物体的轮廓结合Camshift算法对所述移动物体的移动轨迹进行跟踪;Track the moving trajectory of the moving object in combination with the Camshift algorithm according to the outline of the moving object;
保存存在所述移动物体的视频图像帧和所述移动物体的移动轨迹。A video image frame where the moving object exists and a moving track of the moving object are saved.
获取监控视频的视频图像帧,利用帧间差分算法判断所述视频图像帧中的当前图像帧中是否存在移动物体;Acquiring a video image frame of a monitoring video, and determining whether a moving object exists in a current image frame in the video image frame by using an inter-frame difference algorithm;
若存在,则提取所述当前图像帧中所述移动物体的轮廓;If it exists, extract the outline of the moving object in the current image frame;
根据针对所述移动物体的轮廓结合Camshift算法对所述移动物体的移动轨迹进行跟踪;Track the moving trajectory of the moving object according to the contour of the moving object in combination with the Camshift algorithm;
保存存在所述移动物体的视频图像帧和所述移动物体的移动轨迹。A video image frame where the moving object exists and a moving track of the moving object are saved.
第二方面,本申请实施例提供了一种监控视频处理装置,该监控视频处理装置包括用于执行所述第一方面的方法的单元。In a second aspect, an embodiment of the present application provides a monitoring video processing apparatus, where the monitoring video processing apparatus includes a unit for executing the method of the first aspect.
第三方面,本申请实施例提供了另一种监控视频处理装置,包括处理器、输入设备、输出设备和存储器,所述处理器、输入设备、输出设备和存储器相互连接,其中,所述存储器用于存储支持监控视频处理装置执行上述方法的计算机程序,所述计算机程序包括程序指令,所述处理器被配置用于调用所述程序指令,执行上述第一方面的方法。According to a third aspect, an embodiment of the present application provides another monitoring video processing apparatus, including a processor, an input device, an output device, and a memory, and the processor, the input device, the output device, and the memory are connected to each other, where the memory A computer program for storing a monitoring video processing device to execute the above method, the computer program includes program instructions, and the processor is configured to call the program instructions to execute the method of the first aspect.
第四方面,本申请实施例提供了一种计算机可读存储介质,所述计算机存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令当被处理器执行时使所述处理器执行上述第一方面的方法。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium. The computer storage medium stores a computer program, where the computer program includes program instructions, and the program instructions cause the processing when executed by a processor. The processor performs the method of the first aspect.
本申请实施例通过获取监控视频的视频图像帧,利用帧间差分算法判断所述视频图像帧中的当前图像帧中是否存在移动物体;若存在,则提取所述当前图像帧中所述移动物体的轮廓。然后根据所述移动物体的轮廓结合Camshift算法对所述移动物体的移动轨迹进行跟踪。最后将存在所述移动物体的视频图像帧和所述移动物体的移动轨迹保存起来。通过本申请实施例,可有效的对监控视频中存在移动物体的视频片段进行检测并对移动物体进行跟踪,且在保存监控视频的过程中只保存存在移动物体的监控视频片段,节省了存储空间。In the embodiment of the present application, a video image frame of a monitoring video is acquired, and an inter-frame difference algorithm is used to determine whether a moving object exists in the current image frame in the video image frame; if it exists, extract the moving object in the current image frame. Outline. Then, the moving trajectory of the moving object is tracked according to the contour of the moving object in combination with the Camshift algorithm. Finally, the video image frame where the moving object exists and the moving track of the moving object are saved. Through the embodiments of the present application, it is possible to effectively detect and track a moving object video segment in a monitoring video, and only save the monitoring video segment having a moving object in the process of saving the monitoring video, thereby saving storage space. .
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1是本申请实施例提供的一种监控视频处理方法的示意流程图;FIG. 1 is a schematic flowchart of a monitoring video processing method according to an embodiment of the present application; FIG.
图2是本申请实施例提供的另一种监控视频处理方法的示意流程图;2 is a schematic flowchart of another monitoring video processing method according to an embodiment of the present application;
图3是本申请实施例提供的另一种监控视频处理方法的示意流程图;FIG. 3 is a schematic flowchart of another monitoring video processing method according to an embodiment of the present application; FIG.
图4是本申请实施例提供的一种监控视频处理装置的示意框图;4 is a schematic block diagram of a monitoring video processing apparatus according to an embodiment of the present application;
图5是本申请另一实施例提供的一种监控视频处理装置示意框图。FIG. 5 is a schematic block diagram of a monitoring video processing apparatus according to another 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.
应当理解,当在本说明书和所附权利要求书中使用时,术语“包括”和“包含”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。It should be understood that when used in this specification and the appended claims, the terms "including" and "comprising" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude one or The presence or addition of a number of other features, wholes, steps, operations, elements, components, and / or sets thereof.
对于监控视频来说,监控视频中真正有用的是发生变化、存在移动物体的监控画面,而对于长时间保持不变的监控画面没有任何价值。因此在智能型监控视频处理系统应用中,移动物体图像的检测和轨迹跟踪是视屏监控系统中的核心技术。For surveillance video, what is really useful in surveillance video is the surveillance picture that has changed and there are moving objects, but it has no value for the surveillance picture that remains unchanged for a long time. Therefore, in the application of intelligent surveillance video processing systems, the detection and trajectory tracking of moving object images are the core technologies in video surveillance systems.
现有的视频监控都是均是将摄像头拍摄到的所有画面都进行监控,然后将监控到的所有画面打包压缩上传服务器。但对于目前的视频监控方法存在以下缺点:现有的视频监控方法中,没有对移动物体进行行为轨迹跟踪,如果监控画面长时间静止不变,这些静止不变的画面并不是我们想要监控的画面,但是监控设备也会将这些画面保存到服务器中,从而造成了不必要的存储空间浪费。In the existing video surveillance, all the pictures captured by the camera are monitored, and then all the pictures monitored are packaged and compressed and uploaded to the server. However, the current video surveillance methods have the following disadvantages: in the existing video surveillance methods, there is no behavior trajectory tracking of moving objects. If the monitoring picture remains stationary for a long time, these stationary pictures are not what we want to monitor. Screens, but the monitoring device will also save these screens to the server, causing unnecessary waste of storage space.
参见图1,图1是本申请实施例提供的一种监控视频处理方法的示意流程图,如图所示该方法可包括:Referring to FIG. 1, FIG. 1 is a schematic flowchart of a monitoring video processing method according to an embodiment of the present application. As shown in the figure, the method may include:
101:获取监控视频的视频图像帧,利用帧间差分算法判断上述视频图像帧中的当前图像帧中是否存在移动物体,若当前图像帧中存在移动物体,则提取上述当前图像帧中上述移动物体的轮廓。101: Obtain a video image frame of a monitoring video, and use an inter-frame difference algorithm to determine whether there is a moving object in the current image frame in the video image frame. If a moving object exists in the current image frame, extract the moving object in the current image frame. Outline.
在本申请实施例中,主要利用帧间差分算法来检测监控视频中的移动物体。具体的,在获取监控视频的视频图像帧之后,利用帧间差分算法来判断上述视频图像帧中的当前图像帧中是否存在移动物体,若当前图像帧中不存在移动物体,则不对当前图像帧作任何操作,若当前图像帧中存在移动物体,则提取上述当前图像帧中上述移动物体的轮廓。In the embodiment of the present application, an inter-frame difference algorithm is mainly used to detect a moving object in a surveillance video. Specifically, after acquiring the video image frame of the surveillance video, an inter-frame difference algorithm is used to determine whether there is a moving object in the current image frame in the video image frame. If there is no moving object in the current image frame, the current image frame is not detected. For any operation, if there is a moving object in the current image frame, extract the contour of the moving object in the current image frame.
其中,上述监控视频可以是已经临时保存在内存中的监控视频,也可以是摄像头正在实时监控的监控视频。当上述监控视频为临时保存在内存中的监控视频时,则对整个监控视频进行移动物体的检测,当检测到移动物体时就对移动物体进行跟踪。当上述监控视频为摄像头正在实时监控的监控视频时,则采 用实时的检测方式对上述监控视频进行移动物体的检测,当检测到移动物体时就对移动物体进行跟踪。The above-mentioned surveillance video may be a surveillance video that has been temporarily stored in the memory, or may be a surveillance video that the camera is monitoring in real time. When the above-mentioned surveillance video is a surveillance video temporarily stored in the memory, the entire surveillance video is detected for a moving object, and when a moving object is detected, the moving object is tracked. When the surveillance video is a surveillance video that the camera is monitoring in real time, the real-time detection method is used to detect the moving object in the surveillance video, and when the moving object is detected, the moving object is tracked.
其中,上述帧间差分算法是一种利用连续或相隔一定帧数的帧间差分来确定图像中的变化区域,从而进行运动物体的检测的方法。通常帧间差分算法将连续的两帧图像或多帧图像进行差分运算,然后对差分图像进行二值化并滤波,将可能的运动区域检测出来,从而检测出图像中的移动物体。The above-mentioned inter-frame difference algorithm is a method for determining a change region in an image by using inter-frame differences that are continuous or separated by a certain number of frames, so as to detect a moving object. Usually, the inter-frame difference algorithm performs a difference operation on two consecutive frames or multiple frames of images, then binarizes and filters the difference images, detects possible motion areas, and detects moving objects in the images.
作为一种可选的实施方式,可以采用二帧差分算法来检测上述图像帧中是否存在移动物体。首先,在获取到上述监控视频的图像帧之后,对上述图像进行预处理。其中,对上述图像帧进行预处理包括:对上述图像帧进行灰度化处理。具体的,从上述图像帧中提取连续两帧图像帧,定义当前图像帧为第k帧,提取图像帧时,选取第k帧和第k-1帧图像帧。然后把提取出来的两帧彩色图像转化为灰度图像,具体采用公式(1)替换掉图像中的RGB值,然后得到选取的两帧图像帧的灰度图像。As an optional implementation manner, a two-frame difference algorithm may be used to detect whether a moving object exists in the foregoing image frame. First, after obtaining the image frame of the monitoring video, the image is pre-processed. Wherein, preprocessing the image frame includes: performing grayscale processing on the image frame. Specifically, two consecutive image frames are extracted from the foregoing image frames, and the current image frame is defined as the kth frame. When extracting the image frames, the kth frame and the k-1th image frame are selected. Then, the two extracted color images are converted into grayscale images. Specifically, formula (1) is used to replace the RGB values in the images, and then the grayscale images of the two selected image frames are obtained.
Y=0.299*R+0.587*G+0.114*B    (1);Y = 0.299 * R + 0.587 * G + 0.114 * B (1);
得到两帧图像帧的灰度图像之后,求取两帧图像灰度差的绝对值,则静止的物体在差值图像上的灰度差值会很小,而移动物体特别是移动物体的轮廓处由于存在灰度变化将会较大,这样就能根据就差值图像来判断监控画面中是否存在移动物体并大致计算出移动物体的位置、轮廓和移动路径等。记前一图像帧为F k-1和当前图像帧为F k-1,两帧图像帧对应像素点的灰度值记为F k-1(x,y)和F k(x,y),然后按照(2)两帧图像帧对应像素点的灰度值进行相减,并取其绝对值,得到差分图像D k(x,y)如下式: After obtaining the grayscale images of two image frames, find the absolute value of the grayscale difference between the two frames, then the grayscale difference of the stationary object on the difference image will be small, and the outline of the moving object, especially the moving object Due to the presence of grayscale changes, the presence of moving objects in the monitoring screen can be determined based on the difference image, and the position, contour, and moving path of the moving objects can be roughly calculated. Record the previous image frame as F k-1 and the current image frame as F k-1 . The gray values of the corresponding pixel points of the two image frames are recorded as F k-1 (x, y) and F k (x, y). , And then subtract (2) the gray values of the corresponding pixel points of the two image frames and take the absolute value to obtain the differential image D k (x, y) as follows:
D k(x,y)=|F k-1(x,y)-F k(x,y)|    (2); D k (x, y) = | F k-1 (x, y) -F k (x, y) | (2);
设定二值化阈值T,按照(3)式逐个对像素点进行二值化处理,得到二值化化图像R k。其中,灰度值为255的点即为前景(移动物体)点,灰度值为0的点即为背景点;对图像R k进行连通性分析,最终可得到含有完整移动物体的图像R kThe binarization threshold T is set, and the pixels are binarized one by one according to the formula (3) to obtain a binarized image R k . Among them, the point with a gray value of 255 is the foreground (moving object) point, and the point with a gray value of 0 is the background point; the connectivity analysis of the image R k can finally obtain an image R k containing a complete moving object .
Figure PCTCN2018123511-appb-000001
Figure PCTCN2018123511-appb-000001
若上述差分图像中所有的像素点(x,y)都小于二值化阈值时,则确定当前图像帧相对于前一图形帧没有发生变化,即当前图像帧中不存在移动的物体,因此将当前图像帧作为无效的图像帧,不对当前图像帧进行保存。若上述差值图像中存在大于上述二值化阈值的像素点时,则确定当前图像帧相对 于前一图形帧发生了变化,即当前图像帧中存在移动的物体,因此将当前图像帧作为有效图像帧,并根据上述完整移动物体的图像R k得到移动物体的位置和轮廓信息。 If all the pixels (x, y) in the above difference image are smaller than the binarization threshold, it is determined that the current image frame has not changed from the previous graphic frame, that is, there is no moving object in the current image frame, so The current image frame is regarded as an invalid image frame, and the current image frame is not saved. If there are pixels in the difference image that are larger than the binarization threshold, it is determined that the current image frame has changed from the previous graphics frame, that is, there is a moving object in the current image frame, so the current image frame is regarded as valid An image frame, and obtain position and contour information of the moving object according to the image R k of the complete moving object.
作为另一种可选的实施方式,可以采用三帧差分算法来检测上述图像帧中是否存在移动物体。首先,定义当前图像帧为第k帧,选取连续三帧图像帧分为为第k-2帧、第k-1帧和第k帧,然后对其进行预处理,处理过程和二差分算法类似,不在赘述。As another optional implementation manner, a three-frame difference algorithm may be used to detect whether a moving object exists in the foregoing image frame. First, the current image frame is defined as the k-th frame, and three consecutive image frames are selected as k-2, k-1, and k frames, and then preprocessed. The processing process is similar to the two-difference algorithm. Not to go into details.
得到连续三帧图像帧的灰度图像之后,分别求取第k-2帧和第k-1帧图像帧的灰度差的绝对值以及第k-1帧和第k帧图像帧的灰度差绝对值,得到两个差分图像,然后将差分图像二值化得到两个二值化图像。最后将两个二值化图像做“与”运算得到最终的二值化图像。具体操作过程和二帧差分算法类似,不在赘述。After obtaining the grayscale images of three consecutive image frames, the absolute values of the grayscale differences of the k-2nd and k-1th image frames and the grayscales of the k-1th and kth image frames are obtained, respectively. The absolute value of the difference is used to obtain two difference images, and then the difference image is binarized to obtain two binarized images. Finally, the two binarized images are ANDed to obtain the final binarized image. The specific operation process is similar to the two-frame difference algorithm, and is not described in detail.
作为一种可选的实施方式,经过差分算法得到二值化图像之后,获得的二值化图像通常由于噪声和背景细微变化的干扰往往不一定都是运动目标的文正轮廓,因此要对二值化图像做一些处理,来得到完整的移动物体的区域。在本申请实施例中,采用形态学基本算法来对二值化图像进行去噪,最后得到移动物体清晰的二值图像。具体的,主要采用形态学基本方法有腐蚀、膨胀、开操作和操作四种。上述四种操作属于公知常识,因此不再赘述。As an optional implementation manner, after obtaining a binarized image through a difference algorithm, the obtained binarized image is usually not always the contour of the moving target due to the interference of noise and slight changes in the background. Do some processing on the image to get the complete area of the moving object. In the embodiment of the present application, a basic morphological algorithm is used to denoise the binary image, and finally a clear binary image of a moving object is obtained. Specifically, there are four basic methods of morphology: corrosion, swelling, open operation, and operation. The above four operations are common knowledge, so they will not be described again.
102:根据针对上述移动物体的轮廓结合Camshift算法对上述移动物体的移动轨迹进行跟踪。102: Track the moving trajectory of the moving object according to the contour of the moving object in combination with the Camshift algorithm.
在本申请实施自理中,当判断出上述监控视频画面中存在移动物体,并提取了移动物体的轮廓之后,通过Camshift算法以及移动物体的轮廓信息来对移动物体的移动轨迹进行跟踪。Camshift是以视频图像中运动物体的颜色信息作为特征,对输入图像的每一帧分别作Mean Shift运算,并将上一帧的目标中心和搜索窗口大小(核函数带宽)作为下一帧Mean shift算法的中心和搜索窗口大小的初始值,如此迭代下去,就可以实现对目标的跟踪。因为在每次搜索前将搜索窗口的位置和大小设置为运动目标当前中心的位置和大小,而运动目标通常在这区域附近,缩短了搜索时间。In the implementation of this application, when it is determined that a moving object exists in the surveillance video frame, and the outline of the moving object is extracted, the movement trajectory of the moving object is tracked by using the Camshift algorithm and the outline information of the moving object. Camshift is based on the color information of moving objects in the video image. Mean shift is performed on each frame of the input image, and the target center of the previous frame and the search window size (kernel function bandwidth) are used as the next frame. The center of the algorithm and the initial value of the search window size. Iterating this way, you can track the target. Because the position and size of the search window are set to the position and size of the current center of the moving target before each search, and the moving target is usually near this area, the search time is shortened.
其中,通过Camshift算法对移动物体的移动轨迹进行跟踪的具体步骤如下:The specific steps for tracking the trajectory of a moving object by using the Camshift algorithm are as follows:
1)将整个监控画面设置为搜索区域;1) Set the entire monitoring screen as the search area;
2)初始化搜索窗口的大小和位置;2) Initialize the size and position of the search window;
3)计算搜索窗口内的颜色概率分布(反向投影);3) Calculate the color probability distribution (back projection) in the search window;
4)运行Meanshift算法,获得搜索窗口新的大小和位置;4) Run the Meanshift algorithm to get the new size and position of the search window;
5)在下一帧视频图像中,用步骤(4)获得的值初始化搜索窗口的位置和大小,跳转到步骤(3)继续运行。5) In the next frame of video image, initialize the position and size of the search window with the values obtained in step (4), skip to step (3) and continue running.
传统的Camshift算法需要手动的选取被跟踪的移动物体来对移动物体进行跟踪。在本申请实施中,结合帧间差分算法的检测结果来对移动物体进行跟踪。The traditional Camshift algorithm needs to manually select the tracked moving object to track the moving object. In the implementation of this application, the detection result of the inter-frame difference algorithm is used to track a moving object.
在本申请实施例中,上述根据上述移动物体的轮廓结合Camshift算法对上述移动物体的移动轨迹进行跟踪,具体包括:In the embodiment of the present application, the tracking the moving trajectory of the moving object according to the contour of the moving object in combination with the Camshift algorithm specifically includes:
1021:根据上述移动物体的轮廓初始化当前图像帧中搜索窗口的大小和位置。1021: Initialize the size and position of the search window in the current image frame according to the contour of the moving object.
在本申请实施例中,在根据帧间差分算法检测出当前图像帧中存在移动物体,并根据检测结果的二值图像得到移动物体的轮廓之后,根据上述移动物体的轮廓得到上述移动物体轮廓的外接矩形和位置。然后根据上述外接矩形和位置来初始化当前图像帧中的搜索窗口的大小和位置。In the embodiment of the present application, after detecting the presence of a moving object in the current image frame according to the inter-frame difference algorithm, and obtaining the contour of the moving object according to the binary image of the detection result, the contour of the moving object is obtained according to the contour of the moving object. Circumscribed rectangle and position. Then, the size and position of the search window in the current image frame are initialized according to the circumscribed rectangle and position.
1022:计算上述搜索窗口内移动物体的颜色概率分布得到上述搜索窗口的概率分布图。1022: Calculate a color probability distribution of a moving object in the search window to obtain a probability distribution map of the search window.
由于RGB颜色空间对光照亮度变化较为敏感,为了减少此变化对跟踪效果的影响,首先将图像从RGB空间转换到HSI空间。然后对其中的H分量作直方图,在直方图中代表了不同H分量值出现的概率或者像素个数,就是说可以查找出H分量大小为h的概率或者像素个数,即得到了颜色概率查找表。将图像中每个像素的值用其颜色出现的概率对替换,就得到了颜色概率分布图。这个过程就叫反向投影(Back projection),颜色概率分布图是一个灰度图像。Since the RGB color space is more sensitive to changes in light brightness, in order to reduce the effect of this change on the tracking effect, the image is first converted from RGB space to HSI space. Then make a histogram of the H components, which represents the probability of the occurrence of different H component values or the number of pixels, that is, you can find the probability of the H component size h or the number of pixels, and you get the color probability. Lookup table. By replacing the value of each pixel in the image with the probability of its color appearing, the color probability distribution map is obtained. This process is called back projection. The color probability distribution map is a grayscale image.
在本申请实施例中,当初始化当前图像帧中的搜索窗口的大小和位置之后,需要计算搜索窗口内移动物体的颜色概率分布,以便的到上述搜索窗口内移动物体的概率分布图。In the embodiment of the present application, after the size and position of the search window in the current image frame is initialized, the color probability distribution of moving objects in the search window needs to be calculated in order to obtain the probability distribution map of the moving objects in the search window.
具体的,计算目标区域内的颜色直方图。通常是将输入图像转换到HSI颜色空间(或与HIS类似的颜色空间),目标区域为初始设定的搜索窗口范围,分离出色调H分量做该区域的色调直方图计算。这样即得到上述移动物体的颜色直方图,归一化得到概率分布图I(x,y),并将其作为查找表,将H通道图像上的每一个像素点用它的像素值所对应的概率代替,得到概率投影图。Specifically, a color histogram in the target area is calculated. Usually, the input image is converted to the HSI color space (or a color space similar to HIS), the target area is the initial set search window range, and the hue H component is separated for the hue histogram calculation of the area. In this way, the color histogram of the moving object is obtained, the probability distribution map I (x, y) is normalized, and it is used as a lookup table. Each pixel on the H-channel image is corresponding to its pixel value. Probability instead, get a probabilistic projection map.
作为一种可选的实施方式,在得到搜索窗口中移动物体的颜色概率分布图像后,由于搜索窗口中包含的并不全是移动物体的像素点,所以上述颜色概率分布图图像中存在噪声和干扰。因此在得到搜索窗口中的颜色概率分布图之后需要对其进行去噪声处理,在申请实施中,可以采用中值滤波向下采样对上述 概率分布图像进行噪声去除。As an optional implementation manner, after obtaining the color probability distribution image of the moving object in the search window, since not all pixels of the moving object are included in the search window, noise and interference exist in the color probability distribution image. Therefore, after the color probability distribution map in the search window is obtained, it needs to be denoised. In the implementation of the application, the median filtering downsampling can be used to remove noise from the above probability distribution image.
1023:根据上述概率分布图和meanshift算法计算得到上述移动物体在上述当前图像帧中的质心位置和大小。1023: Calculate the position and size of the centroid of the moving object in the current image frame according to the probability distribution map and the meanshift algorithm.
根据上述搜索窗口的大小和位置,计算搜索窗口的质心位置。具体的,计算搜索窗口内像素的零阶矩和一阶矩来找到搜索窗口的质心所在的位置。设(x,y)为搜索窗口内像素点的位置,I(x,y)是概率分布图中该像素点(x,y)处的像素值。According to the size and position of the search window, the position of the center of mass of the search window is calculated. Specifically, the zero-order moment and the first-order moment of the pixels in the search window are calculated to find the position of the centroid of the search window. Let (x, y) be the position of a pixel in the search window, and I (x, y) be the pixel value at that pixel (x, y) in the probability distribution map.
其中,零阶矩使用(4)式计算得到;Among them, the zero-order moment is calculated by using formula (4);
M 00=Σ xΣ yI(x,y)    (4); M 00 = Σ x Σ y I (x, y) (4);
一阶矩使用(5)和(6)式计算得到;First-order moments are calculated using equations (5) and (6);
M 10=Σ xΣ yxI(x,y)    (5); M 10 = Σ x Σ y xI (x, y) (5);
M 01=Σ xΣ yyI(x,y)    (6); M 01 = Σ x Σ y yI (x, y) (6);
搜索窗口的质心(x c,y c)为: The centroid (x c , y c ) of the search window is:
x c=M 10/M 00    (7); x c = M 10 / M 00 (7);
y c=M 01/M 00    (8); y c = M 01 / M 00 (8);
然后调整搜索窗口的大小;Then adjust the size of the search window;
宽度:
Figure PCTCN2018123511-appb-000002
长度:为1.2s。
width:
Figure PCTCN2018123511-appb-000002
Length: 1.2s.
接下来,移动搜索窗的中心到质心,如果移动距离大于设定的阈值,则重新计算调整后的窗口质心,进行新一轮的窗口位置和尺寸调整。直到窗口中心与质心之间的移动距离小于阈值,或者迭代次数达到某一最大值,认为收敛条件满足,此时,窗口的中心位置和大小为移动物体在当前帧中的质心位置和大小。Next, move the center of the search window to the center of mass. If the moving distance is greater than the set threshold, recalculate the center of mass of the adjusted window and perform a new round of window position and size adjustment. Until the moving distance between the center of the window and the center of mass is less than the threshold, or the number of iterations reaches a certain maximum, the convergence condition is considered to be satisfied. At this time, the center position and size of the window are the center of mass and position of the moving object in the current frame.
1024:根据上述移动物体在上述当前图像帧中的质心位置和大小初始化下一帧图像帧中搜索窗口的大小和位置,将所述下一图像帧作为当前图像帧并触发计算所述搜索窗口内移动物体的颜色概率分布得到所述搜索窗口的概率分布图的步骤。1024: Initialize the size and position of the search window in the next image frame according to the centroid position and size of the moving object in the current image frame, use the next image frame as the current image frame, and trigger the calculation of the search window. The step of obtaining the probability distribution map of the search window by color probability distribution of the moving object.
在本申请实施例中,当得到上述移动物体在当前图像帧中的质心位置和大小之后,保存上述移动物体在当前图像帧中的质心位置和大小。然后,将下一图像帧作为当前图像帧并触发计算所述搜索窗口内移动物体的颜色概率分布得到所述搜索窗口的概率分布图的步骤。具体的,在下一图像帧中,使用上述移动物体在前一图像帧中的质心位置和大小作为输入来初始化下一图像帧中的搜索窗口的大小和位置,重复上述在当前图像帧中计算质心位置和大小的步骤, 以便获得下一图像帧中上述移动物体的质心位置和大小,从而达到跟踪上述移动物体的目的。In the embodiment of the present application, after the position and size of the centroid of the moving object in the current image frame are obtained, the position and size of the centroid of the moving object in the current image frame are saved. Then, the next image frame is used as the current image frame and the step of calculating the color probability distribution of the moving objects in the search window to obtain the probability distribution map of the search window is triggered. Specifically, in the next image frame, using the position and size of the centroid of the moving object in the previous image frame as input to initialize the size and position of the search window in the next image frame, and repeating the above calculation of the centroid in the current image frame The position and size steps, so as to obtain the position and size of the centroid of the moving object in the next image frame, so as to achieve the purpose of tracking the moving object.
103:保存存在上述移动物体的视频图像帧和上述移动物体的移动轨迹。103: Save the video image frame in which the moving object exists and the moving track of the moving object.
在本申请实施例中,使用帧间差分算法来检测视频图像帧中是否存在移动物体,当检测到当前图像帧中存在移动物体时,则采用Camshift算法对被检测到的移动物体进行跟踪,一直到上述移动物体从视频图像帧中消失,则确定跟踪结束。在跟踪上述移动物体的过程中或者在确定跟踪结束之后,将上述存在移动物体的视频图像帧保存在内存中或者上传至服务器进行保存,而对于不存在移动物体的视频图像帧,则不对其进行保存。In the embodiment of the present application, an inter-frame difference algorithm is used to detect whether there is a moving object in the video image frame. When a moving object is detected in the current image frame, the detected moving object is tracked by using the Camshift algorithm. When the moving object disappears from the video image frame, it is determined that the tracking ends. During the process of tracking the moving object or after determining that the tracking is finished, the video image frames in which the moving object exists are stored in the memory or uploaded to the server for storage, and for the video image frames in which there is no moving object, the video image frames are not processed. save.
可以看出,本申请实施例通过获取监控视频的视频图像帧,利用帧间差分算法判断上述视频图像帧中的当前图像帧中是否存在移动物体;若存在,则提取上述当前图像帧中上述移动物体的轮廓。然后根据上述移动物体的轮廓结合Camshift算法对上述移动物体的移动轨迹进行跟踪。最后将存在上述移动物体的视频图像帧和上述移动物体的移动轨迹保存起来。通过本申请实施例,可有效的对监控视频中存在移动物体的视频片段进行检测并对移动物体进行跟踪,且在保存监控视频的过程中只保存存在移动物体的监控视频片段,节省了存储空间。It can be seen that in the embodiment of the present application, the video image frame of the surveillance video is obtained, and an inter-frame difference algorithm is used to determine whether there is a moving object in the current image frame in the video image frame; if it exists, the movement in the current image frame is extracted The outline of the object. Then, the moving trajectory of the moving object is tracked according to the contour of the moving object in combination with the Camshift algorithm. Finally, the video image frame where the moving object exists and the moving track of the moving object are saved. Through the embodiments of the present application, it is possible to effectively detect and track a moving object video segment in a monitoring video, and only save the monitoring video segment having a moving object in the process of saving the monitoring video, thereby saving storage space. .
参见图2,图2是本申请实施例提供的另一种监控视频处理方法的示意流程图,如图所示该方法可包括:Referring to FIG. 2, FIG. 2 is a schematic flowchart of another monitoring video processing method provided by an embodiment of the present application. As shown in the figure, the method may include:
201:获取监控视频的当前图像帧和前一图像帧。201: Obtain the current image frame and the previous image frame of the surveillance video.
其中,定义当前图像帧为第k帧,前一图像帧为第k-1帧。Wherein, the current image frame is defined as the k-th frame, and the previous image frame is defined as the k-1 frame.
202:计算当前图像帧和前一图像帧的差分图像D k(x,y)。 202: Calculate a difference image D k (x, y) between the current image frame and the previous image frame.
其中,在得到当前图像帧和前一帧的差分图像D k(x,y)之前,需要将当前图像帧和前一图像帧进行去噪和灰度化处理。 Before the difference image D k (x, y) of the current image frame and the previous frame is obtained, the current image frame and the previous image frame need to be denoised and grayed.
203:判断是否存在移动物体,若存在移动物体,则执行步骤204,若不存在移动物体,则返回步骤202获取下一图像帧。203: Determine whether there is a moving object. If there is a moving object, step 204 is performed. If there is no moving object, return to step 202 to obtain the next image frame.
具体的,判断差分图像中是否存在差分图像D k(x,y)>T的区域,若是,则确定第k帧图像帧中存在移动的物体,继续执行步骤204,若否,则确定第k帧图像帧中不存在移动的物体,则继续获取下一帧图像帧,其中T为二值化阈值。 Specifically, it is determined whether there is an area where the difference image D k (x, y)> T exists in the difference image. If yes, it is determined that there is a moving object in the k-th image frame, and step 204 is continued. If not, the k-th is determined. If there is no moving object in the frame image frame, the next image frame is continuously acquired, where T is a binarization threshold.
204:将差分图像D k(x,y)二值化得到二值化图像R k(x,y)。 204: Binarize the difference image D k (x, y) to obtain a binarized image R k (x, y).
205:根据二值化图像提取移动物体的轮廓和位置信息。205: Extract the outline and position information of the moving object based on the binarized image.
在得到二值化图像R k(x,y)之后,需要对移动区域进行移动物体分割。获得 的二值化图像通常由于噪声和背景细微变化的干扰往往不一定都是运动目标的文正轮廓,因此要对二值化图像做一些处理,来得到完整的移动物体的区域。在本申请实施例中,采用形态学基本算法来对二值化图像进行去噪,最后得到移动物体清晰的二值图像。具体的,主要采用形态学基本方法有腐蚀、膨胀、开操作和操作四种。上述四种操作属于公知常识,因此不再赘述。 After obtaining the binarized image R k (x, y), it is necessary to perform moving object segmentation on the moving region. The obtained binarized image is usually not always the contour of the moving target due to the interference of noise and slight changes in the background. Therefore, some processing is required on the binarized image to obtain the complete area of the moving object. In the embodiment of the present application, a basic morphological algorithm is used to denoise the binary image, and finally a clear binary image of a moving object is obtained. Specifically, there are four basic methods of morphology: corrosion, swelling, open operation, and operation. The above four operations are common knowledge, so they will not be described again.
在本申请实施例中,对上述二值化图像进行处理之后,根据处理之后的二值化图像提取移动物体的轮廓和位置信息。In the embodiment of the present application, after the above-mentioned binarized image is processed, the contour and position information of the moving object is extracted according to the binarized image after processing.
206:根据移动物体的轮廓和位置信息初始化搜索窗口的大小和位置。206: Initialize the size and position of the search window according to the outline and position information of the moving object.
207:将当前图像帧转化为HIS图像。207: Convert the current image frame into a HIS image.
208:计算搜索窗口内移动物体的色调H的直方图。208: Calculate a histogram of the hue H of the moving object in the search window.
209:将直方图作反向投影,得到移动物体的概率分布图I(x,y)。209: Back-project the histogram to obtain a probability distribution map I (x, y) of the moving object.
210:根据概率分布图、搜索窗口的位置以及搜索窗口的大小计算窗口内像素的零阶矩和一阶矩,得到搜索窗口的质心位置。210: Calculate the zero-order moment and the first-order moment of the pixels in the window according to the probability distribution map, the position of the search window, and the size of the search window to obtain the centroid position of the search window.
211:根据上述质心位置调整搜索窗口的中心位置和大小。211: Adjust the center position and size of the search window according to the centroid position.
212:根据meanshift算法判断是否收敛,若收敛,则将调整后的搜索窗口的中心位置和大小作为初始化下一图像帧中搜索窗口的位置和大小,若不收敛,则回到步骤210。212: Determine whether to converge according to the meanshift algorithm. If it converges, use the adjusted center position and size of the search window as the position and size of the search window in the next image frame to initialize. If it does not converge, return to step 210.
213:判断移动物体的跟踪是否结束,若跟踪结束,则保存存在移动物体的图像帧和移动物体的移动轨迹。213: Determine whether the tracking of the moving object is ended, and if the tracking is ended, save the image frame of the moving object and the moving track of the moving object.
可以看出,本申请实施例通过获取监控视频的视频图像帧,利用帧间差分算法判断上述视频图像帧中的当前图像帧中是否存在移动物体;若存在,则提取上述当前图像帧中上述移动物体的轮廓。然后根据上述移动物体的轮廓结合Camshift算法对上述移动物体的移动轨迹进行跟踪。最后将存在上述移动物体的视频图像帧和上述移动物体的移动轨迹保存起来。通过本申请实施例,可有效的对监控视频中存在移动物体的视频片段进行检测并对移动物体进行跟踪,且在保存监控视频的过程中只保存存在移动物体的监控视频片段,节省了存储空间。It can be seen that in the embodiment of the present application, the video image frame of the monitoring video is obtained, and an inter-frame difference algorithm is used to determine whether there is a moving object in the current image frame in the video image frame; if it exists, the movement in the current image frame is extracted. The outline of the object. Then, the moving trajectory of the moving object is tracked according to the contour of the moving object in combination with the Camshift algorithm. Finally, the video image frame where the moving object exists and the moving track of the moving object are saved. Through the embodiments of the present application, it is possible to effectively detect and track a moving object video segment in a monitoring video, and only save the monitoring video segment having a moving object in the process of saving the monitoring video, thereby saving storage space. .
参见图3,图3是本申请实施例提供的另一种监控视频处理方法的示意流程图,如图所示该方法可包括:Referring to FIG. 3, FIG. 3 is a schematic flowchart of another monitoring video processing method according to an embodiment of the present application. As shown in the figure, the method may include:
301:获取监控视频的当前图像帧和前两帧图像帧。301: Obtain the current image frame and the first two image frames of the surveillance video.
其中,定义当前图像帧为第k帧图像帧,前两帧图像帧分别为第k-1帧图像帧和第k-2帧图像帧。The current image frame is defined as the k-th image frame, and the first two image frames are the k-1th image frame and the k-2th image frame, respectively.
302:计算当前图像帧和前一图像帧的差分图像Dk1(x,y),以及前两帧图像帧的差分图像Dk2(x,y)。302: Calculate the difference image Dk1 (x, y) of the current image frame and the previous image frame, and the difference image Dk2 (x, y) of the previous two image frames.
其中,在得到差分图像之前,需要将当前图像帧和前一图像帧进行去噪和灰度化处理。Before obtaining a differential image, the current image frame and the previous image frame need to be denoised and grayed out.
303:将两幅差分图像做“与操作”得到最终的差分图Dk(x,y)。303: Perform an AND operation on the two difference images to obtain a final difference map Dk (x, y).
304:判断是否存在移动物体,若存在移动物体,则执行步骤204,若不存在移动物体,则返回步骤202获取下一图像帧。304: Determine whether there is a moving object. If there is a moving object, step 204 is performed. If there is no moving object, return to step 202 to obtain the next image frame.
具体的,判断差分图像中是否存在差分图像Dk(x,y)>T的区域,若是,则确定第k帧图像帧中存在移动的物体,继续执行步骤204,若否,则确定第k帧图像帧中不存在移动的物体,则继续获取下一帧图像帧,其中T为二值化阈值。Specifically, it is determined whether there is an area of the difference image Dk (x, y)> T in the difference image. If yes, it is determined that there is a moving object in the k-th image frame, and step 204 is continued, and if not, the k-th frame is determined. If there is no moving object in the image frame, the next image frame is obtained, where T is the binarization threshold.
305:将差分图像Dk(x,y)二值化得到二值化图像Rk(x,y)。305: Binarize the difference image Dk (x, y) to obtain a binarized image Rk (x, y).
306:根据二值化图像提取移动物体的轮廓和位置信息。306: Extract contour and position information of the moving object according to the binarized image.
在得到二值化图像Rk(x,y)之后,需要对移动区域进行移动物体分割。获得的二值化图像通常由于噪声和背景细微变化的干扰往往不一定都是运动目标的文正轮廓,因此要对二值化图像做一些处理,来得到完整的移动物体的区域。在本申请实施例中,采用形态学基本算法来对二值化图像进行去噪,最后得到移动物体清晰的二值图像。具体的,主要采用形态学基本方法有腐蚀、膨胀、开操作和操作四种。上述四种操作属于公知常识,因此不再赘述。After obtaining the binarized image Rk (x, y), it is necessary to perform moving object segmentation on the moving region. The obtained binarized image is usually not always the contour of the moving target due to the interference of noise and slight changes in the background. Therefore, some processing is required on the binarized image to obtain the complete area of the moving object. In the embodiment of the present application, a basic morphological algorithm is used to denoise the binary image, and finally a clear binary image of a moving object is obtained. Specifically, there are four basic methods of morphology: corrosion, swelling, open operation, and operation. The above four operations are common knowledge, so they will not be described again.
在本申请实施例中,对上述二值化图像进行处理之后,根据处理之后的二值化图像提取移动物体的轮廓和位置信息。In the embodiment of the present application, after the above-mentioned binarized image is processed, the contour and position information of the moving object is extracted according to the binarized image after processing.
307:根据移动物体的轮廓和位置信息初始化搜索窗口的大小和位置。307: Initialize the size and position of the search window according to the outline and position information of the moving object.
308:将当前图像帧转化为HIS图像。308: Convert the current image frame into a HIS image.
309:计算搜索窗口内移动物体的色调H的直方图。309: Calculate a histogram of the hue H of the moving object in the search window.
310:将直方图作反向投影,得到移动物体的概率分布图I(x,y)。310: Back-project the histogram to obtain a probability distribution map I (x, y) of the moving object.
311:根据概率分布图、搜索窗口的位置以及搜索窗口的大小计算窗口内像素的零阶矩和一阶矩,得到搜索窗口的质心位置。311: Calculate the zero-order moment and the first-order moment of the pixels in the window according to the probability distribution map, the position of the search window, and the size of the search window to obtain the centroid position of the search window.
312:根据上述质心位置调整搜索窗口的中心位置和大小。312: Adjust the center position and size of the search window according to the centroid position.
313:根据meanshift算法判断是否收敛,若收敛,则将调整后的搜索窗口的中心位置和大小作为初始化下一图像帧中搜索窗口的位置和大小,若不收敛,则回到步骤311。313: Determine whether to converge according to the meanshift algorithm. If it converges, use the center position and size of the adjusted search window as the position and size of the search window in the next image frame to initialize. If it does not converge, return to step 311.
314:判断移动物体的跟踪是否结束,若跟踪结束,则保存存在移动物体的图像帧和移动物体的移动轨迹。314: Determine whether the tracking of the moving object is ended, and if the tracking is ended, save the image frame of the moving object and the moving track of the moving object.
可以看出,本申请实施例通过获取监控视频的视频图像帧,利用帧间差分算法判断上述视频图像帧中的当前图像帧中是否存在移动物体;若存在,则提取上述当前图像帧中上述移动物体的轮廓。然后根据上述移动物体的轮廓结合Camshift算法对上述移动物体的移动轨迹进行跟踪。最后将存在上述移动物体的视频图像帧和上述移动物体的移动轨迹保存起来。通过本申请实施例,可有效的对监控视频中存在移动物体的视频片段进行检测并对移动物体进行跟踪,且在保存监控视频的过程中只保存存在移动物体的监控视频片段,节省了存储空间。It can be seen that in the embodiment of the present application, the video image frame of the surveillance video is obtained, and an inter-frame difference algorithm is used to determine whether there is a moving object in the current image frame in the video image frame; if it exists, the movement in the current image frame is extracted The outline of the object. Then, the moving trajectory of the moving object is tracked according to the contour of the moving object in combination with the Camshift algorithm. Finally, the video image frame where the moving object exists and the moving track of the moving object are saved. Through the embodiments of the present application, it is possible to effectively detect and track a moving object video segment in a monitoring video, and only save the monitoring video segment having a moving object in the process of saving the monitoring video, thereby saving storage space. .
本申请实施例还提供一种监控视频处理装置,该监控视频处理装置用于执行前述任一项上述的方法的单元。具体地,参见图4,图4是本申请实施例提供的一种监控视频处理装置的示意框图。本实施例的监控视频处理装置包括:获取单元401、判断单元402、提取单元403、跟踪单元404、保存单元405。An embodiment of the present application further provides a monitoring video processing apparatus, where the monitoring video processing apparatus is configured to execute any one of the foregoing methods. Specifically, referring to FIG. 4, FIG. 4 is a schematic block diagram of a monitoring video processing apparatus according to an embodiment of the present application. The monitoring video processing apparatus of this embodiment includes: an obtaining unit 401, a judging unit 402, an extracting unit 403, a tracking unit 404, and a saving unit 405.
上述获取单元401,用于获取监控视频的视频图像帧。The acquiring unit 401 is configured to acquire a video image frame of a surveillance video.
上述判断单元402,用于利用帧间差分算法判断上述视频图像帧中的当前图像帧中是否存在移动物体。The determining unit 402 is configured to determine whether a moving object exists in a current image frame in the video image frame by using an inter-frame difference algorithm.
上述提取单元403,用于在上述判断单元402判断为存在移动物体的情况下,提取上述当前图像帧中上述移动物体的轮廓。The extraction unit 403 is configured to extract a contour of the moving object in the current image frame when the determining unit 402 determines that a moving object exists.
上述跟踪单元404,用于根据针对上述移动物体的轮廓结合Camshift算法对上述移动物体的移动轨迹进行跟踪。The tracking unit 404 is configured to track a moving trajectory of the moving object according to a contour of the moving object in combination with a Camshift algorithm.
上述保存单元405,用于保存存在上述移动物体的视频图像帧和上述移动物体的移动轨迹。The storage unit 405 is configured to store a video image frame in which the moving object exists and a movement track of the moving object.
作为一种可选的实施方式,上述监控视频处理装置,还包括:As an optional implementation manner, the monitoring video processing device further includes:
处理单元406,用于对上述视频图像帧进行预处理,上述预处理包括灰度化处理。The processing unit 406 is configured to pre-process the video image frame, and the pre-processing includes graying processing.
作为一种可选的实施方式,上述判断单元包括:As an optional implementation manner, the foregoing determining unit includes:
第一计算单元407,用于将上述当前图帧和上述当前图像帧的前一图像帧做差分运算,得到差分图像。The first calculation unit 407 is configured to perform a difference operation between the current image frame and a previous image frame of the current image frame to obtain a difference image.
确定单元408,用于在上述差分图像中存在像素点灰度值大于二值化阈值的区域时,确定图像帧中存在移动物体。A determining unit 408 is configured to determine that a moving object exists in an image frame when an area in which a gray value of a pixel is greater than a binarization threshold exists in the difference image.
作为一种可选的实施方式,上述判断单元包括:As an optional implementation manner, the foregoing determining unit includes:
第一计算单元407,用于将上述当前图帧和上述当前图像帧的前两帧图像帧做差分运算,得到差分图像。The first calculation unit 407 is configured to perform a difference operation between the current picture frame and the first two image frames of the current picture frame to obtain a difference image.
确定单元408,用于在上述差分图像中存在像素点灰度值大于二值化阈值的区域时,确定图像帧中存在移动物体。A determining unit 408 is configured to determine that a moving object exists in an image frame when an area in which a gray value of a pixel is greater than a binarization threshold exists in the difference image.
作为一种可选的实施方式,上述提取单元403包括:As an optional implementation manner, the above-mentioned extraction unit 403 includes:
二值化单元409,用于根据上述二值化阈值将上述差分图像二值化得到二值化图像。A binarizing unit 409 is configured to binarize the difference image to obtain a binarized image according to the binarization threshold.
上述提取单元用于403,根据上述二值化图像提取上述移动物体的轮廓和位置。The extraction unit is used for 403, and extracts the contour and position of the moving object according to the binary image.
作为一种可选的实施方式,上述处理单元406,还用于使用形态学基本算法对上述二值化图像进行噪声处理。As an optional implementation manner, the processing unit 406 is further configured to perform noise processing on the binary image using a basic morphological algorithm.
作为一种可选的实施方式,上述跟踪单元404包括:As an optional implementation manner, the tracking unit 404 includes:
初始单元410,用于根据上述移动物体的轮廓初始化当前图像帧中搜索窗口的大小和位置。The initial unit 410 is configured to initialize the size and position of the search window in the current image frame according to the contour of the moving object.
第二计算单元411,用于计算上述搜索窗口内移动物体的颜色概率分布得到上述搜索窗口的概率分布图。The second calculation unit 411 is configured to calculate a color probability distribution of a moving object in the search window to obtain a probability distribution map of the search window.
上述第二计算单元411,还用于根据上述概率分布图和meanshift算法计算得到上述移动物体在上述当前图像帧中的质心位置和大小。The second calculation unit 411 is further configured to calculate, according to the probability distribution map and the meanshift algorithm, the position and size of the centroid of the moving object in the current image frame.
上述初始化单元410,还用于根据上述移动物体在上述当前图像帧中的质心位置和大小初始化下一帧图像帧中搜索窗口的大小和位置,将所述下一图像帧作为当前图像帧并触发计算所述搜索窗口内移动物体的颜色概率分布得到所述搜索窗口的概率分布图的步骤。The initialization unit 410 is further configured to initialize the size and position of a search window in the next image frame according to the centroid position and size of the moving object in the current image frame, use the next image frame as the current image frame, and trigger The step of calculating a color probability distribution of a moving object in the search window to obtain a probability distribution map of the search window.
作为一种可选的实施方式,所述第二计算单元,用于将所述当前图像帧从RGB空间转换到HSI空间;根据当前图像帧的HIS空间中的H分量计算出当前图像帧的直方图;根据所述直方图计算所述搜索窗口的概率分布图。As an optional implementation manner, the second calculation unit is configured to convert the current image frame from RGB space to HSI space; and calculate a histogram of the current image frame according to the H component in the HIS space of the current image frame Figure; calculating the probability distribution map of the search window according to the histogram.
作为一种可选的实施方式,上述处理单元406,还用于采用中值滤波的方法对上述搜索窗口的概率分布图进行去燥处理。As an optional implementation manner, the processing unit 406 is further configured to perform desalination processing on the probability distribution map of the search window by using a median filtering method.
可以看出,本申请实施例通过获取监控视频的视频图像帧,利用帧间差分算法判断上述视频图像帧中的当前图像帧中是否存在移动物体;若存在,则提取上述当前图像帧中上述移动物体的轮廓。然后根据上述移动物体的轮廓结合Camshift算法对上述移动物体的移动轨迹进行跟踪。最后将存在上述移动物体的视频图像帧和上述移动物体的移动轨迹保存起来。通过本申请实施例,可有效的对监控视频中存在移动物体的视频片段进行检测并对移动物体进行跟踪,且在保存监控视频的过程中只保存存在移动物体的监控视频片段,节省了存储空 间。It can be seen that in the embodiment of the present application, the video image frame of the surveillance video is obtained, and an inter-frame difference algorithm is used to determine whether there is a moving object in the current image frame in the video image frame; if it exists, the movement in the current image frame is extracted The outline of the object. Then, the moving trajectory of the moving object is tracked according to the contour of the moving object in combination with the Camshift algorithm. Finally, the video image frame where the moving object exists and the moving track of the moving object are saved. Through the embodiments of the present application, it is possible to effectively detect and track a moving object video segment in a monitoring video, and only save the monitoring video segment having a moving object in the process of saving the monitoring video, thereby saving storage space. .
参见图5,图5是本申请另一实施例提供的一种监控视频处理装置示意框图。如图所示的本实施例中的监控视频处理装置可以包括:一个或多个处理器501;一个或多个输入设备502,一个或多个输出设备503和存储器504。上述处理器501、输入设备502、输出设备503和存储器504通过总线505连接。存储器502用于存储计算机程序,上述计算机程序包括程序指令,处理器501用于执行存储器502存储的程序指令。其中,处理器501被配置用于调用上述程序指令执行:获取监控视频的视频图像帧,利用帧间差分算法判断上述视频图像帧中的当前图像帧中是否存在移动物体;若当前图像帧中存在移动物体,则提取上述当前图像帧中上述移动物体的轮廓;根据针对上述移动物体的轮廓结合Camshift算法对上述移动物体的移动轨迹进行跟踪;保存存在上述移动物体的视频图像帧和上述移动物体的移动轨迹。Referring to FIG. 5, FIG. 5 is a schematic block diagram of a monitoring video processing apparatus according to another embodiment of the present application. The monitoring video processing apparatus in this embodiment as shown in the figure may include: one or more processors 501; one or more input devices 502, one or more output devices 503, and a memory 504. The processor 501, the input device 502, the output device 503, and the memory 504 are connected through a bus 505. The memory 502 is configured to store a computer program, and the computer program includes program instructions, and the processor 501 is configured to execute the program instructions stored in the memory 502. Wherein, the processor 501 is configured to call the above program instructions for execution: obtaining a video image frame of a surveillance video, and using an inter-frame difference algorithm to determine whether a moving object exists in the current image frame in the video image frame; For moving objects, extract the contours of the moving objects in the current image frame; track the moving trajectories of the moving objects based on the contours of the moving objects in combination with the Camshift algorithm; save the video image frames of the moving objects and the Move track.
应当理解,在本申请实施例中,所称处理器501可以是中央处理单元(Central Processing Unit,CPU),该处理器还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。It should be understood that, in the embodiment of the present application, the processor 501 may be a central processing unit (CPU), and the processor may also be another general-purpose processor or a digital signal processor (DSP). Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
输入设备502可以包括触控板、指纹采传感器(用于采集用户的指纹信息和指纹的方向信息)、麦克风等,输出设备503可以包括显示器(LCD等)、扬声器等。The input device 502 may include a touch panel, a fingerprint sensor (for collecting fingerprint information and orientation information of a user), a microphone, and the like, and the output device 503 may include a display (LCD, etc.), a speaker, and the like.
该存储器504可以包括只读存储器和随机存取存储器,并向处理器501提供指令和数据。存储504的一部分还可以包括非易失性随机存取存储器。例如,存储器504还可以存储设备类型的信息。The memory 504 may include a read-only memory and a random access memory, and provide instructions and data to the processor 501. A portion of the storage 504 may also include non-volatile random access memory. For example, the memory 504 may also store information of a device type.
具体实现中,本申请实施例中所描述的处理器501、输入设备502、输出设备503可执行本申请实施例提供的一种监控视频处理方法的第一实施例、第二实施例和第三实施例中所描述的实现方式,也可执行本申请实施例所描述的监控视频处理装置的实现方式,在此不再赘述。In specific implementation, the processor 501, input device 502, and output device 503 described in the embodiments of the present application may execute the first, second, and third embodiments of a monitoring video processing method provided by the embodiments of the present application. The implementation manner described in the embodiment may also be implemented as the implementation manner of the monitoring video processing apparatus described in the embodiment of the present application, and details are not described herein again.
在本申请的另一实施例中提供一种计算机可读存储介质,上述计算机可读存储介质存储有计算机程序,上述计算机程序包括程序指令,上述程序指令被处理器执行时实现:获取监控视频的视频图像帧,利用帧间差分算法判断上述视频图像帧中的当前图像帧中是否存在移动物体;若当前图像帧中存在移动物 体,则提取上述当前图像帧中上述移动物体的轮廓;根据针对上述移动物体的轮廓结合Camshift算法对上述移动物体的移动轨迹进行跟踪;保存存在上述移动物体的视频图像帧和上述移动物体的移动轨迹。In another embodiment of the present application, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program. The computer program includes program instructions. The program instructions are implemented by a processor to implement: For video image frames, use an inter-frame difference algorithm to determine whether there are moving objects in the current image frame in the video image frame; if there are moving objects in the current image frame, extract the outline of the moving object in the current image frame; The contour of the moving object is combined with the Camshift algorithm to track the moving trajectory of the moving object; a video image frame in which the moving object is stored and the moving trajectory of the moving object are stored.
上述计算机可读存储介质可以是前述任一实施例上述的监控视频处理装置的内部存储单元,例如监控视频处理装置的硬盘或内存。上述计算机可读存储介质也可以是上述监控视频处理装置的外部存储设备,例如上述监控视频处理装置上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,上述计算机可读存储介质还可以既包括上述监控视频处理装置的内部存储单元也包括外部存储设备。上述计算机可读存储介质用于存储上述计算机程序以及上述监控视频处理装置所需的其他程序和数据。上述计算机可读存储介质还可以用于暂时地存储已经输出或者将要输出的数据。The computer-readable storage medium may be an internal storage unit of the monitoring video processing apparatus in any one of the foregoing embodiments, such as a hard disk or a memory of the monitoring video processing apparatus. The computer-readable storage medium may also be an external storage device of the surveillance video processing device, such as a plug-in hard disk, a Smart Media Card (SMC), and a secure digital (Secure Digital, SD) card, flash card, etc. Further, the computer-readable storage medium may further include both an internal storage unit and an external storage device of the monitoring video processing apparatus. The computer-readable storage medium is used to store the computer program and other programs and data required by the monitoring video processing device. The computer-readable storage medium described above may also be used to temporarily store data that has been or will be output.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art may realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the hardware and software, Interchangeability. In the above description, the composition and steps of each example have been described generally in terms of functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的端设备和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working processes of the above-mentioned end devices and units can refer to the corresponding processes in the foregoing method embodiments, and are not repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的监控视频处理装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,上述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口、装置或单元的间接耦合或通信连接,也可以是电的,机械的或其它的形式连接。In the several embodiments provided in this application, it should be understood that the disclosed monitoring video processing apparatus and method may be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the above units is only a logical function division. In actual implementation, there may be another division manner. For example, multiple units or components may be combined or may be combined. Integration into another system, or some features can be ignored or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may also be electrical, mechanical or other forms of connection.
上述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部 单元来实现本申请实施例方案的目的。The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, which may be located in one place, or may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions in the embodiments of the present application.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以是两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist separately physically, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional unit.
上述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分,或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例上述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。When the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application is essentially a part that contributes to the existing technology, or all or part of the technical solution may be embodied in the form of a software product, which is stored in a storage medium Included are several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the above method in each embodiment of the present application. The foregoing storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disks or optical disks and other media that can store program codes .
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。The above is only a specific implementation of this application, but the scope of protection of this application is not limited to this. Any person skilled in the art can easily think of various equivalents within the technical scope disclosed in this application. Modifications or replacements, and these modifications or replacements should be covered by the protection scope of this application. Therefore, the protection scope of this application shall be subject to the protection scope of the claims.

Claims (20)

  1. 一种监控视频处理方法,其特征在于,包括:A monitoring video processing method, comprising:
    获取监控视频的视频图像帧,利用帧间差分算法判断所述视频图像帧中的当前图像帧中是否存在移动物体;Acquiring a video image frame of a monitoring video, and determining whether a moving object exists in a current image frame in the video image frame by using an inter-frame difference algorithm;
    若当前图像帧中存在移动物体,则提取所述当前图像帧中所述移动物体的轮廓;If there is a moving object in the current image frame, extracting the outline of the moving object in the current image frame;
    根据针对所述移动物体的轮廓结合Camshift算法对所述移动物体的移动轨迹进行跟踪;Track the moving trajectory of the moving object according to the contour of the moving object in combination with the Camshift algorithm;
    保存存在所述移动物体的视频图像帧和所述移动物体的移动轨迹。A video image frame where the moving object exists and a moving track of the moving object are saved.
  2. 根据权利要求1所述的方法,其特征在于,在所述利用帧间差分算法判断所述视频图像帧中的当前图像帧中是否存在移动物体之前,所述方法还包括:The method according to claim 1, wherein before the judging whether a moving object exists in a current image frame in the video image frame by using the inter-frame difference algorithm, the method further comprises:
    对所述视频图像帧进行预处理,所述预处理包括灰度化处理。Pre-processing the video image frame, the pre-processing includes graying processing.
  3. 根据权利要求1所述的方法,其特征在于,所述利用帧间差分算法判断所述视频图像帧中的当前图像帧中是否存在移动物体包括:The method according to claim 1, wherein the determining whether a moving object exists in a current image frame in the video image frame by using an inter-frame difference algorithm comprises:
    将所述当前图帧和所述当前图像帧的前一图像帧做差分运算;Performing a difference operation between the current image frame and a previous image frame of the current image frame;
    判断所述差分图像中是否存在像素点灰度值大于二值化阈值的区域;Judging whether there is an area in the difference image where the gray value of the pixel is greater than the binarization threshold;
    若所述差分图像中存在相熟点灰度值大于二值化阈值的区域,则确定图像帧中存在移动物体。If there is an area in the difference image where the gray value of the familiar point is greater than the binarization threshold, it is determined that a moving object exists in the image frame.
  4. 根据权利要求1所述的方法,其特征在于,所述利用帧间差分算法判断所述视频图像帧中的当前图像帧中是否存在移动物体包括:The method according to claim 1, wherein the determining whether a moving object exists in a current image frame in the video image frame by using an inter-frame difference algorithm comprises:
    将所述当前图帧和所述当前图像帧的前两帧图像帧做差分运算,得到差分图像;Performing a differential operation on the current image frame and the first two image frames of the current image frame to obtain a differential image;
    判断所述差分图像中是否存在像素点灰度值大于二值化阈值的区域;Judging whether there is an area in the difference image where the gray value of the pixel is greater than the binarization threshold;
    若所述差分图像中存在相熟点灰度值大于二值化阈值的区域,则确定图像帧中存在移动物体。If there is an area in the difference image where the gray value of the familiar point is greater than the binarization threshold, it is determined that a moving object exists in the image frame.
  5. 根据权利要求3或4任一项所述的方法,其特征在于,所述提取所述当前图像帧中所述移动物体的轮廓包括:The method according to any one of claims 3 or 4, wherein the extracting a contour of the moving object in the current image frame comprises:
    根据所述二值化阈值将所述差分图像二值化得到二值化图像;Binarizing the difference image according to the binarization threshold to obtain a binarized image;
    根据所述二值化图像提取所述移动物体的轮廓和位置。An outline and a position of the moving object are extracted according to the binarized image.
  6. 根据权利要求5所述的方法,其特征在于,在所述根据所述二值化阈值 将所述差分图像二值化得到二值化图像之后,在所述根据所述二值化图像提取所述移动物体的轮廓和位置之前,所述方法还包括:The method according to claim 5, wherein after the binarizing the differential image according to the binarization threshold to obtain a binarized image, the method extracts the image based on the binarized image. Before describing the outline and position of the moving object, the method further includes:
    使用形态学基本算法对所述二值化图像进行噪声处理。Noise processing is performed on the binarized image using a basic morphological algorithm.
  7. 根据权利要求1所述的方法,其特征在于,所述根据所述移动物体的轮廓结合Camshift算法对所述移动物体的移动轨迹进行跟踪包括:The method according to claim 1, wherein tracking the moving trajectory of the moving object according to the contour of the moving object in combination with the Camshift algorithm comprises:
    根据所述移动物体的轮廓初始化当前图像帧中搜索窗口的大小和位置;Initialize the size and position of the search window in the current image frame according to the outline of the moving object;
    计算所述搜索窗口内移动物体的颜色概率分布得到所述搜索窗口的概率分布图;Calculating a color probability distribution of a moving object in the search window to obtain a probability distribution map of the search window;
    根据所述概率分布图和meanshift算法计算得到所述移动物体在所述当前图像帧中的质心位置和大小;Obtain the position and size of the centroid of the moving object in the current image frame according to the probability distribution map and the meanshift algorithm;
    根据所述移动物体在所述当前图像帧中的质心位置和大小初始化下一帧图像帧中搜索窗口的大小和位置,将所述下一图像帧作为当前图像帧并触发计算所述搜索窗口内移动物体的颜色概率分布得到所述搜索窗口的概率分布图的步骤。Initialize the size and position of the search window in the next image frame according to the position and size of the centroid of the moving object in the current image frame, use the next image frame as the current image frame and trigger the calculation of the search window The step of obtaining the probability distribution map of the search window by color probability distribution of the moving object.
  8. 根据权利要求6所述的方法,其特征在于,所述计算所述搜索窗口内移动物体的颜色概率分布得到所述搜索窗口的概率分布图,包括:The method according to claim 6, wherein the calculating a color probability distribution of a moving object in the search window to obtain a probability distribution map of the search window comprises:
    将所述当前图像帧从RGB空间转换到HSI空间;Converting the current image frame from RGB space to HSI space;
    根据当前图像帧的HIS空间中的H分量计算出当前图像帧的直方图;Calculate a histogram of the current image frame according to the H component in the HIS space of the current image frame;
    根据所述直方图计算所述搜索窗口的概率分布图。Calculate a probability distribution map of the search window according to the histogram.
  9. 根据权利要求6所述的方法,其特征在于,在所述计算所述搜索窗口内移动物体的颜色概率分布得到所述搜索窗口的概率分布图之后,在所述根据所述概率分布图和meanshift算法计算得到所述移动物体在所述当前图像帧中的质心位置和大小之前,所述方法还包括:The method according to claim 6, characterized in that, after the color probability distribution of the moving object in the search window is calculated to obtain the probability distribution map of the search window, the method according to the probability distribution map and meanshift Before the algorithm calculates the position and size of the centroid of the moving object in the current image frame, the method further includes:
    采用中值滤波的方法对所述搜索窗口的概率分布图进行去燥处理。The median filtering method is used to perform desalination processing on the probability distribution map of the search window.
  10. 一种监控视频处理装置,其特征在于,包括:A monitoring video processing device, comprising:
    获取单元,用于获取监控视频的视频图像帧;An obtaining unit for obtaining a video image frame of a surveillance video;
    判断单元,用于利用帧间差分算法判断所述视频图像帧中的当前图像帧中是否存在移动物体;A judging unit, configured to judge whether a moving object exists in a current image frame in the video image frame by using an inter-frame difference algorithm;
    提取单元,用于在所述判断单元判断为存在移动物体的情况下,提取所述当前图像帧中所述移动物体的轮廓;An extracting unit, configured to extract a contour of the moving object in the current image frame if the determining unit determines that there is a moving object;
    跟踪单元,用于根据针对所述移动物体的轮廓结合Camshift算法对所述移动物体的移动轨迹进行跟踪;A tracking unit, configured to track a moving trajectory of the moving object according to a contour of the moving object in combination with a Camshift algorithm;
    保存单元,用于保存存在所述移动物体的视频图像帧和所述移动物体的移动轨迹。The saving unit is configured to save a video image frame in which the moving object exists and a moving track of the moving object.
  11. 根据权利要求10所述的监控视频处理装置,其特征在于,所述监控视频处理装置,还包括:The monitoring video processing device according to claim 10, wherein the monitoring video processing device further comprises:
    处理单元,用于对所述视频图像帧进行预处理,所述预处理包括灰度化处理。A processing unit, configured to perform preprocessing on the video image frame, where the preprocessing includes graying processing.
  12. 根据权利要求10所述的监控视频处理装置,其特征在于,所述判断单元包括:The monitoring video processing device according to claim 10, wherein the determining unit comprises:
    第一计算单元,用于将所述当前图帧和所述当前图像帧的前一图像帧做差分运算,得到差分图像;A first calculation unit, configured to perform a difference operation between the current image frame and a previous image frame of the current image frame to obtain a differential image;
    确定单元,用于在所述差分图像中存在像素点灰度值大于二值化阈值的区域时,确定图像帧中存在移动物体。A determining unit, configured to determine that a moving object exists in an image frame when an area where a gray value of a pixel is greater than a binarization threshold exists in the difference image.
  13. 根据权利要求10所述的监控视频处理装置,其特征在于,所述判断单元包括:The monitoring video processing device according to claim 10, wherein the determining unit comprises:
    第一计算单元,用于将所述当前图帧和所述当前图像帧的前两帧图像帧做差分运算,得到差分图像;A first calculation unit, configured to perform a difference operation between the current image frame and the first two image frames of the current image frame to obtain a difference image;
    确定单元,用于在所述差分图像中存在像素点灰度值大于二值化阈值的区域时,确定图像帧中存在移动物体。A determining unit, configured to determine that a moving object exists in an image frame when an area where a gray value of a pixel is greater than a binarization threshold exists in the difference image.
  14. 根据权利要求12或13任一项所述的监控视频处理装置,其特征在于,所述提取单元包括:The monitoring video processing device according to any one of claims 12 or 13, wherein the extraction unit comprises:
    二值化单元,用于根据所述二值化阈值将所述差分图像二值化得到二值化图像;A binarization unit, configured to binarize the difference image to obtain a binarized image according to the binarization threshold;
    所述提取单元,用于根据所述二值化图像提取所述移动物体的轮廓和位置。The extraction unit is configured to extract a contour and a position of the moving object according to the binary image.
  15. 根据权利要求14所述的监控视频处理装置,其特征在于,所述处理单元,还用于使用形态学基本算法对所述二值化图像进行噪声处理。The monitoring video processing device according to claim 14, wherein the processing unit is further configured to perform noise processing on the binary image using a basic morphological algorithm.
  16. 根据权利要求10所述的监控视频处理装置,其特征在于,所述跟踪单元包括:The monitoring video processing device according to claim 10, wherein the tracking unit comprises:
    初始单元,用于根据所述移动物体的轮廓初始化当前图像帧中搜索窗口的大小和位置;An initial unit, configured to initialize the size and position of a search window in the current image frame according to the outline of the moving object;
    第二计算单元,用于计算所述搜索窗口内移动物体的颜色概率分布得到所述搜索窗口的概率分布图;A second calculation unit, configured to calculate a color probability distribution of a moving object in the search window to obtain a probability distribution map of the search window;
    所述第二计算单元,还用于根据所述概率分布图和meanshift算法计算得到 所述移动物体在所述当前图像帧中的质心位置和大小;The second calculation unit is further configured to calculate, according to the probability distribution map and the meanshift algorithm, the position and size of the centroid of the moving object in the current image frame;
    所述初始化单元,还用于根据所述移动物体在所述当前图像帧中的质心位置和大小初始化下一帧图像帧中搜索窗口的大小和位置,将所述下一图像帧作为当前图像帧并触发计算所述搜索窗口内移动物体的颜色概率分布得到所述搜索窗口的概率分布图的步骤。The initialization unit is further configured to initialize the size and position of a search window in the next image frame according to the position and size of the centroid of the moving object in the current image frame, and use the next image frame as the current image frame. And a step of calculating a color probability distribution of a moving object in the search window to obtain a probability distribution map of the search window is triggered.
  17. 根据权利要求16所述的监控视频处理装置,其特征在于,所述第二计算单元,用于将所述当前图像帧从RGB空间转换到HSI空间;根据当前图像帧的HIS空间中的H分量计算出当前图像帧的直方图;根据所述直方图计算所述搜索窗口的概率分布图。The monitoring video processing device according to claim 16, wherein the second calculation unit is configured to convert the current image frame from RGB space to HSI space; and according to the H component in the HIS space of the current image frame A histogram of the current image frame is calculated; a probability distribution map of the search window is calculated according to the histogram.
  18. 根据权利要求16所述的监控视频处理装置,其特征在于,所述处理单元,还用于采用中值滤波的方法对所述搜索窗口的概率分布图进行去燥处理。The monitoring video processing device according to claim 16, wherein the processing unit is further configured to perform desalination processing on the probability distribution map of the search window by using a median filtering method.
  19. 一种监控视频处理装置,其特征在于,包括处理器、输入设备、输出设备和存储器,所述处理器、输入设备、输出设备和存储器相互连接,其中,所述存储器用于存储计算机程序,所述计算机程序包括程序指令,所述处理器被配置用于调用所述程序指令,执行如权利要求1-7任一项所述的方法。A monitoring video processing device is characterized in that it comprises a processor, an input device, an output device, and a memory. The processor, the input device, the output device, and the memory are connected to each other. The memory is used to store a computer program. The computer program includes program instructions, and the processor is configured to call the program instructions to execute the method according to any one of claims 1-7.
  20. 一种计算机可读存储介质,其特征在于,所述计算机存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令当被处理器执行时使所述处理器执行如权利要求1-7任一项所述的方法。A computer-readable storage medium, characterized in that the computer storage medium stores a computer program, wherein the computer program includes program instructions, and the program instructions, when executed by a processor, cause the processor to execute the program according to claim 1 -7 Any of the methods.
PCT/CN2018/123511 2018-08-10 2018-12-25 Monitoring video processing method, device and computer readable medium WO2020029518A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810908231.0A CN109118510A (en) 2018-08-10 2018-08-10 A kind of monitor video processing method, device and computer-readable medium
CN201810908231.0 2018-08-10

Publications (1)

Publication Number Publication Date
WO2020029518A1 true WO2020029518A1 (en) 2020-02-13

Family

ID=64851773

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/123511 WO2020029518A1 (en) 2018-08-10 2018-12-25 Monitoring video processing method, device and computer readable medium

Country Status (2)

Country Link
CN (1) CN109118510A (en)
WO (1) WO2020029518A1 (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109815898A (en) * 2019-01-24 2019-05-28 广州市天河区保安服务公司 Urban district monitoring image acquisition and storage method and system
CN110334635B (en) * 2019-06-28 2021-08-31 Oppo广东移动通信有限公司 Subject tracking method, apparatus, electronic device and computer-readable storage medium
CN110415295B (en) * 2019-07-03 2024-02-27 平安科技(深圳)有限公司 Image data processing method and image data processing apparatus
CN112700467A (en) * 2019-10-22 2021-04-23 株洲中车时代电气股份有限公司 Figure tracking method and system based on motion trail
CN112712543A (en) * 2019-10-25 2021-04-27 北京京东振世信息技术有限公司 Article transport trajectory detection method, article transport trajectory detection device, and storage medium
CN110913181A (en) * 2019-12-06 2020-03-24 太原师范学院 Warehouse video monitoring system based on edge calculation
CN111107314A (en) * 2019-12-06 2020-05-05 江苏苏宁物流有限公司 Warehouse logistics monitoring method and system
CN111368785B (en) * 2020-03-17 2023-08-25 广东智媒云图科技股份有限公司 Camera shielding judgment method, device, equipment and storage medium
CN112492196B (en) * 2020-10-29 2022-01-07 贝壳技术有限公司 Live broadcast in-process anchor tracking method, device and system
CN112969037B (en) * 2021-02-26 2022-03-15 北京卓视智通科技有限责任公司 Video image lateral fusion splicing method, electronic equipment and storage medium
CN113158926B (en) * 2021-04-26 2022-04-15 广东博智林机器人有限公司 High-altitude parabolic track distinguishing method, device, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110142283A1 (en) * 2009-12-10 2011-06-16 Chung-Hsien Huang Apparatus and method for moving object detection
CN102903119A (en) * 2012-05-22 2013-01-30 北京国铁华晨通信信息技术有限公司 Target tracking method and target tracking device
CN103262121A (en) * 2010-12-20 2013-08-21 国际商业机器公司 Detection and tracking of moving objects
CN105427346A (en) * 2015-12-01 2016-03-23 中国农业大学 Motion target tracking method and system
CN107705322A (en) * 2017-09-27 2018-02-16 中北大学 Motion estimate tracking and system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106937090A (en) * 2017-04-01 2017-07-07 广东浪潮大数据研究有限公司 The method and device of a kind of video storage

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110142283A1 (en) * 2009-12-10 2011-06-16 Chung-Hsien Huang Apparatus and method for moving object detection
CN103262121A (en) * 2010-12-20 2013-08-21 国际商业机器公司 Detection and tracking of moving objects
CN102903119A (en) * 2012-05-22 2013-01-30 北京国铁华晨通信信息技术有限公司 Target tracking method and target tracking device
CN105427346A (en) * 2015-12-01 2016-03-23 中国农业大学 Motion target tracking method and system
CN107705322A (en) * 2017-09-27 2018-02-16 中北大学 Motion estimate tracking and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
LI, NAIAN ET AL.: "Design and Implement Real-time Object Detection and Tracking System", vol. 1, no. 31, pages 20160131 *

Also Published As

Publication number Publication date
CN109118510A (en) 2019-01-01

Similar Documents

Publication Publication Date Title
WO2020029518A1 (en) Monitoring video processing method, device and computer readable medium
WO2022088620A1 (en) State detection method and apparatus for camera lens, device and storage medium
WO2018099136A1 (en) Method and device for denoising image with low illumination, and storage medium
WO2022027931A1 (en) Video image-based foreground detection method for vehicle in motion
EP3644599B1 (en) Video processing method and apparatus, electronic device, and storage medium
CN104966266B (en) The method and system of automatic fuzzy physical feeling
Huerta et al. Chromatic shadow detection and tracking for moving foreground segmentation
JP7449507B2 (en) Method of generating a mask for a camera stream, computer program product and computer readable medium
WO2023103298A1 (en) Shielding detection method and apparatus, and electronic device, storage medium and computer program product
WO2020173024A1 (en) Multi-gesture precise segmentation method for smart home scenario
KR20210157194A (en) Crop growth measurement device using image processing and method thereof
Abdusalomov et al. An improvement for the foreground recognition method using shadow removal technique for indoor environments
CN114973057A (en) Video image detection method based on artificial intelligence and related equipment
Patro Design and implementation of novel image segmentation and BLOB detection algorithm for real-time video surveillance using DaVinci processor
Hu et al. Video object segmentation in rainy situations based on difference scheme with object structure and color analysis
CN112883940A (en) Silent in-vivo detection method, silent in-vivo detection device, computer equipment and storage medium
US11195298B2 (en) Information processing apparatus, system, method for controlling information processing apparatus, and non-transitory computer readable storage medium
Min et al. Noise reduction in high dynamic range images
US10916016B2 (en) Image processing apparatus and method and monitoring system
Jyothirmai et al. Enhancing shadow area using RGB color space
Park et al. Image enhancement for extremely low light conditions
CN112085002A (en) Portrait segmentation method, portrait segmentation device, storage medium and electronic equipment
JP2017512398A (en) Method and apparatus for presenting video
Rabha Background modelling by codebook technique for automated video surveillance with shadow removal
JP2002312787A (en) Image processor, image processing method, recording medium and program

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

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18929639

Country of ref document: EP

Kind code of ref document: A1