CN111476065A - Target tracking method and device, computer equipment and storage medium - Google Patents
Target tracking method and device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN111476065A CN111476065A CN201910065114.7A CN201910065114A CN111476065A CN 111476065 A CN111476065 A CN 111476065A CN 201910065114 A CN201910065114 A CN 201910065114A CN 111476065 A CN111476065 A CN 111476065A
- Authority
- CN
- China
- Prior art keywords
- target
- tracking
- tracked
- pixel value
- tracking area
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 60
- 239000000284 extract Substances 0.000 claims abstract description 13
- 238000012545 processing Methods 0.000 claims description 28
- 230000033001 locomotion Effects 0.000 claims description 26
- 239000011159 matrix material Substances 0.000 claims description 15
- 238000001914 filtration Methods 0.000 claims description 10
- 230000000717 retained effect Effects 0.000 claims description 2
- 238000010586 diagram Methods 0.000 description 12
- 238000004891 communication Methods 0.000 description 8
- 230000006870 function Effects 0.000 description 4
- 230000008569 process Effects 0.000 description 4
- 230000005540 biological transmission Effects 0.000 description 2
- 230000001413 cellular effect Effects 0.000 description 2
- 238000004590 computer program Methods 0.000 description 2
- 238000000605 extraction Methods 0.000 description 2
- 238000003062 neural network model Methods 0.000 description 2
- 238000012549 training Methods 0.000 description 2
- 230000009466 transformation Effects 0.000 description 2
- 101100149023 Bacillus subtilis (strain 168) secA gene Proteins 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000037237 body shape Effects 0.000 description 1
- 238000012512 characterization method Methods 0.000 description 1
- 238000013527 convolutional neural network Methods 0.000 description 1
- 238000012937 correction Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000005286 illumination Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000002245 particle Substances 0.000 description 1
- 230000004044 response Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
- G06V20/40—Scenes; Scene-specific elements in video content
- G06V20/41—Higher-level, semantic clustering, classification or understanding of video scenes, e.g. detection, labelling or Markovian modelling of sport events or news items
- G06V20/42—Higher-level, semantic clustering, classification or understanding of video scenes, e.g. detection, labelling or Markovian modelling of sport events or news items of sport video content
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/20—Analysis of motion
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10016—Video; Image sequence
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V2201/00—Indexing scheme relating to image or video recognition or understanding
- G06V2201/07—Target detection
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Theoretical Computer Science (AREA)
- Computational Linguistics (AREA)
- Software Systems (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Analysis (AREA)
Abstract
Description
技术领域technical field
本发明实施例涉及视频检测领域,尤其是一种目标跟踪方法、装置、计算机设备及存储介质。Embodiments of the present invention relate to the field of video detection, and in particular, to a target tracking method, device, computer equipment, and storage medium.
背景技术Background technique
今年来,相关滤波的目标跟踪算法由于其具有实时跟踪、精度相对较高、硬件要求较低等特点备受欢迎。并且基于相关滤波的目标跟踪算法如KCF等具有实时跟踪的特点。In recent years, the target tracking algorithm of correlation filtering has been very popular due to its characteristics of real-time tracking, relatively high accuracy, and low hardware requirements. And the target tracking algorithm based on correlation filtering such as KCF has the characteristics of real-time tracking.
但是,在有些场景下,基于相关滤波的目标跟踪算法的跟踪速度小,不能满足实际要求,进而影响到其的应用范围。However, in some scenarios, the tracking speed of the target tracking algorithm based on correlation filtering is small, which cannot meet the actual requirements, thereby affecting its application range.
发明内容SUMMARY OF THE INVENTION
本发明实施例提供一种目标跟踪方法、装置、计算机设备及存储介质。Embodiments of the present invention provide a target tracking method, apparatus, computer equipment, and storage medium.
为解决上述技术问题,本发明创造的实施例采用的一个技术方案是:提供一种目标跟踪方法,包括下述步骤:In order to solve the above-mentioned technical problems, a technical solution adopted by the embodiment of the present invention is to provide a target tracking method, comprising the following steps:
获取待跟踪目标的跟踪区域;Obtain the tracking area of the target to be tracked;
将所述跟踪区域内的像素值缩小至预设像素值,并从缩小后的跟踪区域中提取待跟踪目标的特征;reducing the pixel value in the tracking area to a preset pixel value, and extracting the feature of the target to be tracked from the reduced tracking area;
通过预设的目标跟踪算法对所述特征进行跟踪。The features are tracked by a preset target tracking algorithm.
可选地,所述获取待跟踪目标的跟踪区域包括:Optionally, the obtaining the tracking area of the target to be tracked includes:
从需要进行目标跟踪处理的视频中提取视频帧;Extract video frames from videos that need to be tracked;
从所述视频帧中获取所述待跟踪目标的边框;Obtain the frame of the target to be tracked from the video frame;
获取所述视频帧中待跟踪目标的运动速度,并根据所述运动速度确定所述待跟踪目标的跟踪区域。The movement speed of the target to be tracked in the video frame is acquired, and the tracking area of the target to be tracked is determined according to the movement speed.
可选地,所述根据所述运动速度确定所述待跟踪目标的跟踪区域,包括:Optionally, the determining the tracking area of the target to be tracked according to the motion speed includes:
确定所述待跟踪目标的运动速度符合的速度范围;Determine the speed range that the motion speed of the target to be tracked conforms to;
在预设的信息表中查找所述速度范围对应的放大倍数;Find the magnification corresponding to the speed range in the preset information table;
以所述待跟踪目标为中心,按照所述放大倍数将所述边界进行放大,并将放大后的区域作为所述跟踪区域。Taking the target to be tracked as the center, the boundary is enlarged according to the magnification factor, and the enlarged area is used as the tracking area.
可选地,所述将所述跟踪区域内的像素值缩小至预设像素值,包括:Optionally, the reducing the pixel value in the tracking area to a preset pixel value includes:
获取所述跟踪区域当前的像素值;obtain the current pixel value of the tracking area;
判断所述像素值是否大于预设像素值;determining whether the pixel value is greater than a preset pixel value;
当所述像素值大于预设像素值时,将所述跟踪区域的像素值缩小至所述预设像素值。When the pixel value is greater than a preset pixel value, the pixel value of the tracking area is reduced to the preset pixel value.
可选地,所述从缩小的跟踪区域中提取待跟踪目标的特征,包括:Optionally, the feature of extracting the target to be tracked from the reduced tracking area includes:
获取所述跟踪区域的水平梯度图像和垂直梯度图像;obtaining a horizontal gradient image and a vertical gradient image of the tracking area;
根据所述水平梯度图像和所述垂直梯度图像得到梯度幅值图像矩阵,并计算梯度幅值图像矩阵中每个图像的梯度幅值积分图;Obtain a gradient magnitude image matrix according to the horizontal gradient image and the vertical gradient image, and calculate the gradient magnitude integral map of each image in the gradient magnitude image matrix;
将每个图像的梯度幅值积分图进行加法运算得到所述待跟踪目标的方向梯度直方图特征。The gradient magnitude integral map of each image is added to obtain the directional gradient histogram feature of the target to be tracked.
可选地,所述通过预设的目标跟踪算法对特征进行跟踪,包括:Optionally, the feature is tracked by a preset target tracking algorithm, including:
通过相关滤波算法以所述特征为跟踪目标在第一视频帧组中进行跟踪;Using the feature as a tracking target to track in the first video frame group through a correlation filtering algorithm;
从第二视频帧组中的首帧中获取所述待跟踪目标的特征;Obtain the feature of the target to be tracked from the first frame in the second video frame group;
以获取的特征在所述第二视频帧组中进行跟踪,其中,所述第一视频帧组与所述第二视频帧组连续。Tracking is performed in the second video frame group with the acquired feature, wherein the first video frame group is continuous with the second video frame group.
可选地,所述判断所述像素值是否大于预设像素值之后,还包括;Optionally, after judging whether the pixel value is greater than a preset pixel value, the method further includes;
当所述像素值小于预设像素值时,保留所述跟踪区域的像素值。When the pixel value is smaller than a preset pixel value, the pixel value of the tracking area is retained.
为解决上述技术问题,本发明实施例还提供一种目标跟踪装置,包括:To solve the above technical problems, an embodiment of the present invention also provides a target tracking device, including:
获取模块,用于获取待跟踪目标的跟踪区域;The acquisition module is used to acquire the tracking area of the target to be tracked;
处理模块,用于将所述跟踪区域内的像素值缩小至预设像素值,并从缩小后的跟踪区域中提取待跟踪目标的特征;a processing module for reducing the pixel value in the tracking area to a preset pixel value, and extracting the feature of the target to be tracked from the reduced tracking area;
执行模块,用于通过预设的目标跟踪算法对所述特征进行跟踪。The execution module is used for tracking the feature through a preset target tracking algorithm.
可选地,所述获取模块包括:Optionally, the obtaining module includes:
第一获取子模块,用于从需要进行目标跟踪处理的视频中提取视频帧;The first acquisition sub-module is used to extract video frames from the video that needs to be processed by target tracking;
第二获取子模块,用于从所述视频帧中获取所述待跟踪目标的边框;The second acquisition submodule is used to acquire the frame of the target to be tracked from the video frame;
第三获取子模块,用于获取所述视频帧中待跟踪目标的运动速度,并根据所述运动速度确定所述待跟踪目标的跟踪区域。The third acquisition sub-module is configured to acquire the motion speed of the target to be tracked in the video frame, and determine the tracking area of the target to be tracked according to the motion speed.
可选地,所述第三获取子模块包括:Optionally, the third acquisition submodule includes:
第一处理子模块,用于确定所述待跟踪目标的运动速度符合的速度范围;a first processing submodule, used to determine a speed range that the motion speed of the target to be tracked conforms to;
第二处理子模块,用于在预设的信息表中查找所述速度范围对应的放大倍数;a second processing submodule, configured to look up the magnification corresponding to the speed range in a preset information table;
第一执行子模块,用于以所述待跟踪目标为中心,按照所述放大倍数将所述边界进行放大,并将放大后的区域作为所述跟踪区域。The first execution sub-module is configured to take the target to be tracked as the center, amplify the boundary according to the magnification factor, and use the enlarged area as the tracking area.
可选地,所述处理模块包括:Optionally, the processing module includes:
第四获取子模块,用于获取所述跟踪区域当前的像素值;The fourth acquisition sub-module is used to acquire the current pixel value of the tracking area;
第三处理子模块,用于判断所述像素值是否大于预设像素值;a third processing submodule, configured to determine whether the pixel value is greater than a preset pixel value;
第二执行子模块,用于当所述像素值大于预设像素值时,将所述跟踪区域的像素值缩小至所述预设像素值。The second execution sub-module is configured to reduce the pixel value of the tracking area to the preset pixel value when the pixel value is greater than the preset pixel value.
可选地,所述处理模块包括:Optionally, the processing module includes:
第五获取子模块,用于获取所述跟踪区域的水平梯度图像和垂直梯度图像;The fifth acquisition submodule is used to acquire the horizontal gradient image and the vertical gradient image of the tracking area;
第四处理子模块,用于根据所述水平梯度图像和所述垂直梯度图像得到梯度幅值图像矩阵,并计算梯度幅值图像矩阵中每个图像的梯度幅值积分图;The fourth processing submodule is used to obtain a gradient magnitude image matrix according to the horizontal gradient image and the vertical gradient image, and calculate the gradient magnitude integral map of each image in the gradient magnitude image matrix;
第三执行子模块,用于将每个图像的梯度幅值积分图进行加法运算得到所述待跟踪目标的方向梯度直方图特征。The third execution sub-module is used for adding the gradient magnitude integral map of each image to obtain the directional gradient histogram feature of the target to be tracked.
可选地,所述执行模块包括:Optionally, the execution module includes:
第五处理子模块,用于通过相关滤波算法以所述特征为跟踪目标在第一视频帧组中进行跟踪;The fifth processing submodule is used for tracking in the first video frame group with the feature as a tracking target through a correlation filtering algorithm;
第六获取子模块,用于从第二视频帧组中的首帧中获取所述待跟踪目标的特征;The sixth acquisition submodule is used to acquire the feature of the target to be tracked from the first frame in the second video frame group;
第四执行子模块,用于以获取的特征在所述第二视频帧组中进行跟踪,其中,所述第一视频帧组与所述第二视频帧组连续。The fourth execution sub-module is used for tracking in the second video frame group with the acquired feature, wherein the first video frame group is continuous with the second video frame group.
可选地,还包括;Optionally, also include;
第六处理子模块,用于当所述像素值小于预设像素值时,保留所述跟踪区域的像素值。The sixth processing submodule is configured to retain the pixel value of the tracking area when the pixel value is smaller than a preset pixel value.
为解决上述技术问题,本发明实施例还提供一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述处理器执行上述所述目标跟踪方法的步骤。To solve the above technical problem, an embodiment of the present invention further provides a computer device, including a memory and a processor, the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, all The processor executes the steps of the target tracking method described above.
为解决上述技术问题,本发明实施例还提供一种存储有计算机可读指令的存储介质,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行上述所述目标跟踪方法的步骤。In order to solve the above technical problem, an embodiment of the present invention further provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the above-mentioned Describe the steps of the target tracking method.
本发明实施例的有益效果是:通过将跟踪区域内的像素值缩小至预设像素值,并从缩小的跟踪区域中提取待跟踪目标,该方法中将跟踪区域缩小像素值后提取特征,可以避免其它因素的干扰,准确、快速的提取到待跟踪目标的特征,进而提高跟踪速度。The beneficial effect of the embodiment of the present invention is: by reducing the pixel value in the tracking area to a preset pixel value, and extracting the target to be tracked from the reduced tracking area, in this method, the pixel value of the tracking area is reduced and then the feature is extracted, which can Avoid the interference of other factors, accurately and quickly extract the characteristics of the target to be tracked, thereby improving the tracking speed.
附图说明Description of drawings
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the embodiments of the present invention more clearly, the following briefly introduces the accompanying drawings used in the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those skilled in the art, other drawings can also be obtained from these drawings without creative effort.
图1为本发明实施例提供的目标跟踪方法的基本流程示意图;FIG. 1 is a schematic flowchart of a basic flow of a target tracking method provided by an embodiment of the present invention;
图2为本发明实施例提供的一种获取跟踪区域的方法的基本流程示意图;2 is a schematic diagram of a basic flow of a method for acquiring a tracking area provided by an embodiment of the present invention;
图3为本发明实施例提供的一种根据运动速度确定边界的放大倍数得到待跟踪目标的跟踪区域的方法的基本流程示意图;3 is a schematic flow chart of a method for obtaining a tracking area of a target to be tracked by determining a magnification of a boundary according to a motion speed according to an embodiment of the present invention;
图4为本发明实施例提供的一种将跟踪区域内的像素值缩小至预设像素值的方法的基本流程示意图;4 is a schematic flowchart of a basic flow of a method for reducing pixel values in a tracking area to a preset pixel value according to an embodiment of the present invention;
图5为本发明实施例提供的一种从缩小的跟踪区域中提取待跟踪目标的特征的方法的基本流程示意图;5 is a schematic flowchart of a basic flow of a method for extracting features of a target to be tracked from a reduced tracking area provided by an embodiment of the present invention;
图6为本发明实施例提供的一种通过预设的目标跟踪算法对特征进行跟踪的方法的基本流程示意图;FIG. 6 is a basic flowchart of a method for tracking a feature by using a preset target tracking algorithm according to an embodiment of the present invention;
图7为本发明实施例提供的一种目标跟踪装置基本结构框图;FIG. 7 is a basic structural block diagram of a target tracking apparatus provided by an embodiment of the present invention;
图8为本发明实施例提供的计算机设备基本结构框图。FIG. 8 is a basic structural block diagram of a computer device provided by an embodiment of the present invention.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本发明方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述。In order for those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
在本发明的说明书和权利要求书及上述附图中的描述的一些流程中,包含了按照特定顺序出现的多个操作,但是应该清楚了解,这些操作可以不按照其在本文中出现的顺序来执行或并行执行,操作的序号如101、102等,仅仅是用于区分开各个不同的操作,序号本身不代表任何的执行顺序。另外,这些流程可以包括更多或更少的操作,并且这些操作可以按顺序执行或并行执行。需要说明的是,本文中的“第一”、“第二”等描述,是用于区分不同的消息、设备、模块等,不代表先后顺序,也不限定“第一”和“第二”是不同的类型。In some of the processes described in the description and claims of the present invention and the above-mentioned drawings, various operations are included in a specific order, but it should be clearly understood that these operations may not be in accordance with the order in which they appear herein. For execution or parallel execution, the sequence numbers of the operations, such as 101, 102, etc., are only used to distinguish different operations, and the sequence numbers themselves do not represent any execution order. Additionally, these flows may include more or fewer operations, and these operations may be performed sequentially or in parallel. It should be noted that the descriptions such as "first" and "second" in this document are used to distinguish different messages, devices, modules, etc., and do not represent a sequence, nor do they limit "first" and "second" are different types.
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts shall fall within the protection scope of the present invention.
实施例Example
本技术领域技术人员可以理解,这里所使用的“终端”、“终端设备”既包括无线信号接收器的设备,其仅具备无发射能力的无线信号接收器的设备,又包括接收和发射硬件的设备,其具有能够在双向通信链路上,执行双向通信的接收和发射硬件的设备。这种设备可以包括:蜂窝或其他通信设备,其具有单线路显示器或多线路显示器或没有多线路显示器的蜂窝或其他通信设备;PCS(Personal Communications Service,个人通信系统),其可以组合语音、数据处理、传真和/或数据通信能力;PDA(Personal Digital Assistant,个人数字助理),其可以包括射频接收器、寻呼机、互联网/内联网访问、网络浏览器、记事本、日历和/或GPS(Global Positioning System,全球定位系统)接收器;常规膝上型和/或掌上型计算机或其他设备,其具有和/或包括射频接收器的常规膝上型和/或掌上型计算机或其他设备。这里所使用的“终端”、“终端设备”可以是便携式、可运输、安装在交通工具(航空、海运和/或陆地)中的,或者适合于和/或配置为在本地运行,和/或以分布形式,运行在地球和/或空间的任何其他位置运行。这里所使用的“终端”、“终端设备”还可以是通信终端、上网终端、音乐/视频播放终端,例如可以是PDA、MID(Mobile Internet Device,移动互联网设备)和/或具有音乐/视频播放功能的移动电话,也可以是智能电视、机顶盒等设备。Those skilled in the art can understand that the "terminal" and "terminal device" used here include both a wireless signal receiver device that only has a wireless signal receiver without transmission capability, and a device that includes receiving and transmitting hardware. A device having receive and transmit hardware capable of performing two-way communications over a two-way communication link. Such equipment may include: cellular or other communication equipment, which has a single-line display or a multi-line display or a cellular or other communication device without a multi-line display; PCS (Personal Communications Service), which can combine voice, data Processing, fax and/or data communication capabilities; PDA (Personal Digital Assistant), which may include a radio frequency receiver, pager, Internet/Intranet access, web browser, notepad, calendar and/or GPS (Global Positioning System) receiver; conventional laptop and/or palmtop computer or other device having and/or including a conventional laptop and/or palmtop computer or other device with a radio frequency receiver. As used herein, "terminal", "terminal equipment" may be portable, transportable, mounted in a vehicle (air, marine and/or land), or adapted and/or configured to operate locally, and/or In distributed form, run at any other location on Earth and/or in space. The "terminal" and "terminal device" used here can also be a communication terminal, an Internet terminal, and a music/video playing terminal, such as a PDA, a MID (Mobile Internet Device) and/or a music/video playing terminal. It can also be a smart TV, a set-top box and other devices.
本实施方式中的客户终端即为上述的终端。The client terminal in this embodiment is the above-mentioned terminal.
具体地,请参阅图1,图1为本实施例目标跟踪方法的基本流程示意图。Specifically, please refer to FIG. 1 , which is a schematic diagram of a basic flow of the target tracking method according to this embodiment.
如图1所示,目标跟踪方法包括下述步骤:As shown in Figure 1, the target tracking method includes the following steps:
S1100、获取待跟踪目标的跟踪区域;S1100, acquiring the tracking area of the target to be tracked;
跟踪区域为需要进行目标跟踪处理的视频中的视频帧中确定的待跟踪目标所在的区域。通常情况下,跟踪区域为将跟踪目标包含在内的预设形状的区域,例如,包含跟踪目标的矩形区域,正方形区域等。其中,需要进行目标跟踪处理的视频可以为在需要监控目标的应用场景中获取到的视频,例如,在安防应用中需要对人进行监控,则利用摄像机对应用环境下录制的视频。需要说明的是,待跟踪的目标可以为设定的各种类型的对象,例如,人和物,例如,对保密环境进行监控,并在监控的视频中对监控到的人进行跟踪。The tracking area is the area where the target to be tracked determined in the video frame in the video to be subjected to target tracking processing is located. Generally, the tracking area is an area with a preset shape including the tracking target, for example, a rectangular area including the tracking target, a square area, and the like. The video that needs to be processed for target tracking may be the video obtained in the application scenario where the target needs to be monitored. For example, in a security application, people need to be monitored, and a video camera is used to record the video in the application environment. It should be noted that the target to be tracked can be various types of objects, such as people and things, for example, monitoring a confidential environment, and tracking the monitored person in the monitored video.
本实施例中,在获取跟踪区域时,首先从视频中提取视频帧,并通过预设的识别模型在视频帧中识别待跟踪的目标,将该目标所在的预设的尺寸比例的区域作为目标区域。In this embodiment, when acquiring the tracking area, first extract the video frame from the video, identify the target to be tracked in the video frame through the preset recognition model, and use the area with the preset size ratio where the target is located as the target area.
需要说明的是,识别模型为利用样本数据预先对神经网络模型进行训练得到的模型。例如,当待跟踪的目标是人时,可以将各类形态的人的图像,例如,人脸,人体形态等作为样本数据,并通过此类样本数据对神经网络模型算法进行训练。It should be noted that the recognition model is a model obtained by pre-training the neural network model with sample data. For example, when the target to be tracked is a person, images of various types of people, such as human faces, human body shapes, etc., can be used as sample data, and the neural network model algorithm can be trained through such sample data.
在一些实施方式中,在确定待跟踪目标所在的跟踪区域时,以识别的待跟踪的目标为中心,将包括该目标在内的预设比例的尺寸的形状作为跟踪区域,例如,以包含待跟踪的目标的最小的矩形所在的区域作为跟踪区域或者以待跟踪的目标的外接圆作为跟踪区域。In some embodiments, when determining the tracking area where the target to be tracked is located, the identified target to be tracked is taken as the center, and a shape with a size of a preset proportion including the target is used as the tracking area. The area where the smallest rectangle of the tracked target is located is used as the tracking area or the circumscribed circle of the target to be tracked is used as the tracking area.
S1200、将跟踪区域内的像素值缩小至预设像素值,并从缩小的跟踪区域中提取待跟踪目标的特征;S1200, reducing the pixel value in the tracking area to a preset pixel value, and extracting the feature of the target to be tracked from the reduced tracking area;
本实施例中,获取跟踪区域的像素尺寸,并将该像素尺寸与预设的像素值进行比对,当该跟踪区域的像素尺寸大于预设像素值时,将该跟踪区域的像素尺寸缩小至预设像素值。In this embodiment, the pixel size of the tracking area is acquired, and the pixel size is compared with the preset pixel value. When the pixel size of the tracking area is larger than the preset pixel value, the pixel size of the tracking area is reduced to Default pixel value.
在实际应用中,对视频中的目标进行跟踪时,由于跟踪速度偏低其应用受到了限制,因此,为了提高跟踪速度本实施例中将跟踪区域的像素值缩小,并从缩小的跟踪区域中提取目标的特征来对特征进行跟踪,可以提高跟踪速度。优选地,预设像素值可以为30*30。在其它实施例方式中,还可以针对目标的速度大小设定合适的像素值。In practical applications, when tracking the target in the video, the application is limited due to the low tracking speed. Therefore, in order to improve the tracking speed, in this embodiment, the pixel value of the tracking area is reduced, and the pixel value of the tracking area is reduced from the reduced tracking area. Extracting the features of the target to track the features can improve the tracking speed. Preferably, the preset pixel value may be 30*30. In other embodiments, an appropriate pixel value may also be set for the speed of the target.
在一些实施方式中,提取跟踪区域的特征时,可以提取直方图特征,例如,从视频帧进行灰度处理,将灰度值从0-255等分为8个区间,遍历图像中的每个像素,统计分别落入每个区间的像素个数,最后将8个区间的像素个数除以像素总和,并进行归一化,从而得到直方图特征。In some embodiments, when extracting the features of the tracking area, the histogram features can be extracted, for example, grayscale processing is performed from the video frame, the grayscale value is divided into 8 intervals from 0-255, and each Pixels, count the number of pixels that fall into each interval, and finally divide the number of pixels in the 8 intervals by the sum of the pixels, and normalize them to obtain the histogram feature.
在另外一些实施方式中,还可以提取局部二值模式特征(Local Binary Pattern,LBP),即,以跟踪区域图像中心像素为阈值,将相邻的8个像素的灰度值与中心像素进行比较,若周围像素值大于中心像素值,则该像素点的位置被标记为1,否则为0,如此,可以产生8位二进制数,即得到该跟踪区域图像中心像素点的LBP特征。In some other implementations, local binary pattern features (Local Binary Pattern, LBP) can also be extracted, that is, the center pixel of the image in the tracking area is used as a threshold, and the gray values of 8 adjacent pixels are compared with the center pixel. , if the surrounding pixel value is greater than the central pixel value, the position of the pixel is marked as 1, otherwise it is 0. In this way, an 8-bit binary number can be generated, that is, the LBP feature of the center pixel of the tracking area image is obtained.
S1300、通过预设的目标跟踪算法对特征进行跟踪。S1300. Track the feature by using a preset target tracking algorithm.
预设的目标跟踪算法包括:基于相关滤波的跟踪算法,例如,卡拉曼滤波跟踪算法和粒子滤波跟踪算法。The preset target tracking algorithms include: correlation filtering-based tracking algorithms, such as Karaman filter tracking algorithm and particle filter tracking algorithm.
在一些实施方式中,为了提高跟踪的精确度,可以按照视频帧的个数对特征进行更新,例如,每隔3-5帧重新从跟踪区域中提取特征,并作为更新后的特征,并通过上述列举的相关滤波的跟踪算法对特征进行跟踪。In some embodiments, in order to improve the tracking accuracy, the features can be updated according to the number of video frames, for example, features are extracted from the tracking area every 3-5 frames, and used as the updated features, and passed through The correlation filtering tracking algorithms listed above track the features.
上述目标跟踪方法中,通过将跟踪区域内的像素值缩小至预设像素值,并从缩小的跟踪区域中提取待跟踪目标,该方法中将跟踪区域缩小像素值后提取特征,可以避免其它因素的干扰,准确、快速的提取到待跟踪目标的特征,进而提高跟踪速度。In the above target tracking method, by reducing the pixel value in the tracking area to a preset pixel value, and extracting the target to be tracked from the reduced tracking area, in this method, the pixel value of the tracking area is reduced to extract features, which can avoid other factors. It can accurately and quickly extract the features of the target to be tracked, thereby improving the tracking speed.
在实际应用中,当视频中目标的运动速度过快时,会出现无法及时跟踪到目标的情况,即跟踪速度过慢的问题。因此,为了解决这个问题,本发明实施例还提供了一种获取跟踪区域的方法,如图2所示,图2为本发明实施例提供的一种获取跟踪区域的方法的基本流程示意图。In practical applications, when the moving speed of the target in the video is too fast, there will be a situation that the target cannot be tracked in time, that is, the tracking speed is too slow. Therefore, in order to solve this problem, an embodiment of the present invention also provides a method for acquiring a tracking area, as shown in FIG. 2 , which is a schematic flowchart of a basic flow of a method for acquiring a tracking area provided by an embodiment of the present invention.
具体地,如图2所示,步骤S1100包括下述步骤:Specifically, as shown in FIG. 2, step S1100 includes the following steps:
S1110、从需要进行目标跟踪处理的视频中提取视频帧;S1110, extracting video frames from the video that needs to be subjected to target tracking processing;
S1120、从视频帧中获取待跟踪目标的边框;S1120, obtaining the frame of the target to be tracked from the video frame;
需要进行目标跟踪处理的视频可以为在需要监控目标的应用场景中获取到的视频,例如,在安防应用中需要对人进行监控,则利用摄像机对应用环境下录制的视频。The video that needs to be processed by target tracking can be the video obtained in the application scenario where the target needs to be monitored. For example, in a security application, people need to be monitored, and a video camera is used to record the video in the application environment.
本实施例在获取视频中按照播放顺序依次提取每一帧视频帧,利用目标识别模型判断每一帧视频帧中是否存在待跟踪目标,并提取视频中首次识别到待跟踪目标的视频帧。In this embodiment, each video frame is sequentially extracted according to the playback order in the acquired video, the target recognition model is used to determine whether there is a target to be tracked in each video frame, and the video frame in which the target to be tracked for the first time is extracted is extracted.
需要说明的是,目标识别模型可以为预先通过待跟踪目标的样本数据对卷积神经网络算法训练至收敛的模型。目标识别模型还可以为特征提取模型,例如,从视频帧中提取待跟踪目标的特征,并将该特征与下一帧视频帧中提取的特征进行比对,比对一致,则作为待跟踪目标。It should be noted that the target recognition model may be a model that has been pre-trained to the convergence of the convolutional neural network algorithm through sample data of the target to be tracked. The target recognition model can also be a feature extraction model. For example, the feature of the target to be tracked is extracted from the video frame, and the feature is compared with the feature extracted from the next video frame. If the comparison is consistent, it is regarded as the target to be tracked. .
本实施例中,利用目标识别模型识别视频帧中的待跟踪目标,并获取当前识别到的待跟踪的边框的坐标和尺寸。其中,待跟踪目标的边框为预先设置的可以将待跟踪目标包括在内的区域的边界,本实施例中,边框为待跟踪目标的最小区域的边界,优选为矩形。In this embodiment, the target recognition model is used to identify the target to be tracked in the video frame, and the coordinates and size of the currently identified frame to be tracked are acquired. The frame of the target to be tracked is a preset boundary of an area that can include the target to be tracked. In this embodiment, the frame is the boundary of the smallest area of the target to be tracked, preferably a rectangle.
S1130、获取视频帧中待跟踪目标的运动速度,并根据运动速度确定待跟踪目标的跟踪区域。S1130: Acquire the motion speed of the target to be tracked in the video frame, and determine the tracking area of the target to be tracked according to the motion speed.
采用预设的应用软件,例如,Adobe Premiere Pro Cs,将视频帧输入到软件中,计算待跟踪目标的运动速度。Using preset application software, such as Adobe Premiere Pro Cs, input the video frames into the software to calculate the motion speed of the target to be tracked.
在实际应用中,当待跟踪目标运动速度较快时,容易出现跟踪速度跟不上运动速度的情况,即跟踪速度较慢的问题,本发明实施例中,按照待跟踪目标运动速度的范围预设有多个放大倍数,当运动速度较快时,设定较大的放大倍数,将边框进行放大,可以得到包含待跟踪目标在内的较大区域,如此,即时待跟踪目标的速度较大,仍然可以及时跟踪到目标。当运动速度较小时,设定较小的放大速度也可以跟踪到目标。In practical applications, when the moving speed of the target to be tracked is fast, the situation that the tracking speed cannot keep up with the moving speed easily occurs, that is, the problem that the tracking speed is slow. There are multiple magnifications. When the movement speed is fast, set a larger magnification and enlarge the frame to obtain a larger area including the target to be tracked. In this way, the speed of the target to be tracked is faster. , the target can still be tracked in time. When the movement speed is small, setting a small zoom-in speed can also track the target.
本发明实施例还提供一种根据运动速度确定边界的放大倍数得到待跟踪目标的跟踪区域的方法,如图3所示,图3为本发明实施例提供的一种根据运动速度确定边界的放大倍数得到待跟踪目标的跟踪区域的方法的基本流程示意图。An embodiment of the present invention further provides a method for obtaining a tracking area of a target to be tracked by determining the magnification of the boundary according to the moving speed, as shown in FIG. A schematic diagram of the basic flow of the method for obtaining the tracking area of the target to be tracked by multiples.
具体地,如图3所示,步骤S1130包括下述步骤:Specifically, as shown in FIG. 3, step S1130 includes the following steps:
S1131、确定待跟踪目标的运动速度符合的速度范围;S1131. Determine the speed range that the motion speed of the target to be tracked conforms to;
S1132、在预设的信息表中查找该速度范围对应的放大倍数;S1132, looking up the magnification corresponding to the speed range in a preset information table;
本发明实施例中预设有多个速度范围,当获取到运动速度后将运动速度与预设的多个速度范围进行比对,并获取到与该运动速度匹配的速度范围。预设的信息表记载了速度范围与放大倍数的对应关系。In the embodiment of the present invention, a plurality of speed ranges are preset, and after the motion speed is obtained, the motion speed is compared with the preset multiple speed ranges, and a speed range matching the motion speed is obtained. The preset information table records the corresponding relationship between the speed range and the magnification.
例如,获取到的待跟踪目标的运动速度为1.5,预设的多个速度为范围0-1,1-2,2-3,信息表中速度范围0-1对应1.5倍,1-2对应2倍,2-3对应2.5倍。则通过运动速度1.5可以确定符合的速度范围为1-2,通过信息表确定1-2对应的放大倍数为2倍。For example, the acquired motion speed of the target to be tracked is 1.5, the preset multiple speeds are in the range of 0-1, 1-2, 2-3, the speed range 0-1 in the information table corresponds to 1.5 times, and 1-2 corresponds to 2 times, 2-3 corresponds to 2.5 times. Then, it can be determined that the corresponding speed range is 1-2 through the motion speed of 1.5, and the magnification corresponding to 1-2 is determined to be 2 times through the information table.
需要说明的是,放大倍数为边框尺寸的放大倍数。It should be noted that the magnification is the magnification of the frame size.
S1133、以待跟踪目标为中心,按照放大倍数将边界进行放大,并将放大后的区域作为跟踪区域。S1133 , taking the target to be tracked as the center, enlarging the boundary according to the magnification factor, and using the enlarged area as the tracking area.
在放大边界时,将待跟踪目标的中心的坐标固定,按照放大倍数将边框尺寸进行放大,并将放大后的区域作为跟踪区域。When enlarging the boundary, fix the coordinates of the center of the target to be tracked, enlarge the frame size according to the magnification factor, and use the enlarged area as the tracking area.
本发明实施例提供一种将跟踪区域内的像素值缩小至预设像素值的方法,如图4所示,图4为本发明实施例提供的一种将跟踪区域内的像素值缩小至预设像素值的方法的基本流程示意图。An embodiment of the present invention provides a method for reducing pixel values in a tracking area to a preset pixel value. As shown in FIG. 4 , FIG. 4 is a method for reducing pixel values in a tracking area to a predetermined value according to an embodiment of the present invention. A schematic diagram of the basic flow of the method for setting pixel values.
具体地,如图4所示,步骤S1200包括下述步骤:Specifically, as shown in FIG. 4, step S1200 includes the following steps:
S1211、获取跟踪区域当前的像素值;S1211, obtaining the current pixel value of the tracking area;
在获取跟踪区域的像素值时可以采用指针操作的方式,双重循环遍历跟踪区域中所有的像素值。实现代码如下:When acquiring the pixel value of the tracking area, a pointer operation method can be used to traverse all the pixel values in the tracking area in a double loop. The implementation code is as follows:
For(int i=0;<rowNumber;i++)//行循环For(int i=0; <rowNumber; i++)//Row loop
{{
Uchar*data=outputimager.ptr<uchar>(i);//获取第i行的首地址Uchar*data=outputimager.ptr<uchar>(i);//Get the first address of the i-th line
For(int j=0;j<colNumber;j++>)//列循环For(int j=0; j<colNumber; j++>)//column loop
{{
//【开始处理每个像素】//[Start processing each pixel]
Data[j]=data[j]/div*div+div/2;Data[j]=data[j]/div*div+div/2;
//[处理结束]//[Processing ends]
}//行处理结束}//End of line processing
}}
S1212、判断像素值是否大于预设像素值;S1212, judging whether the pixel value is greater than the preset pixel value;
S1213、当像素值大于预设像素值时,将跟踪区域的像素值缩小至预设像素值;S1213. When the pixel value is greater than the preset pixel value, reduce the pixel value of the tracking area to the preset pixel value;
当获取到跟踪区域的像素值后,将获取到的像素值与预设像素值进行比对。优选地,预设的像素值可以设定为30*30。当大于30*30时,将跟踪区域的像素值缩小至30*30。After acquiring the pixel value of the tracking area, the acquired pixel value is compared with the preset pixel value. Preferably, the preset pixel value can be set to 30*30. When it is larger than 30*30, reduce the pixel value of the tracking area to 30*30.
S1214、当像素值小于或等于预设像素值时,保留跟踪区域的像素值。S1214. When the pixel value is less than or equal to the preset pixel value, retain the pixel value of the tracking area.
通过将跟踪区域的像素值进行缩小,一方面可以消除跟踪区域中其它因素的干扰便于获取待跟踪目标的特征,提高目标跟踪的准确性,另一方面由于像素较低,还可以提高跟踪目标的速度。By reducing the pixel value of the tracking area, on the one hand, the interference of other factors in the tracking area can be eliminated, so that the characteristics of the target to be tracked can be obtained, and the accuracy of target tracking can be improved. speed.
本发明实施例提供一种从缩小的跟踪区域中提取待跟踪目标的特征的方法,如图5所示,图5为本发明实施例提供的一种从缩小的跟踪区域中提取待跟踪目标的特征的方法的基本流程示意图。An embodiment of the present invention provides a method for extracting features of a target to be tracked from a reduced tracking area. As shown in FIG. 5 , FIG. 5 is a method for extracting a target to be tracked from a reduced tracking area provided by an embodiment of the present invention. Schematic diagram of the basic flow of the method of characterization.
具体地,如图5所示,步骤S1200包括下述步骤:Specifically, as shown in Figure 5, step S1200 includes the following steps:
S1221、获取跟踪区域的水平梯度图像和垂直梯度图像;S1221, acquiring a horizontal gradient image and a vertical gradient image of the tracking area;
首先,对跟踪区域的图像进行归一。即,转换为灰度图,利用Gamma校正法对跟踪区域的图像进行颜色空间的标准化,目的是调节图像的对比度,降低图像局部的阴影和光照变化造成的影响,同时抑制噪音的干扰。First, the images of the tracking area are normalized. That is, convert it into a grayscale image, and use the Gamma correction method to standardize the color space of the image in the tracking area. The purpose is to adjust the contrast of the image, reduce the influence of local shadows and illumination changes in the image, and suppress the interference of noise.
计算校正过的跟踪区域的图像的水平梯度图像和垂直梯度图像。并通过计算得到的水平梯度图像和垂直梯度图像计算每个像素位置的梯度方向值,如此不仅可以捕获到轮廓、人影和纹理信息,还能进一步弱化光照的影响。Calculate the horizontal gradient image and vertical gradient image of the image of the corrected tracking area. And the gradient direction value of each pixel position is calculated through the calculated horizontal gradient image and vertical gradient image, so that not only can the contour, silhouette and texture information be captured, but also the influence of lighting can be further weakened.
假设Gx(x,y)为水平梯度图像,Gy(x,y)为垂直梯度图像。Suppose G x (x, y) is a horizontal gradient image and G y (x, y) is a vertical gradient image.
则Gx(x,y)=H(x+1,y)-H(x-1,y);Then G x (x,y)=H(x+1,y)-H(x-1,y);
Gy(x,y)=H(x,y+1)-H(x,y-1);G y (x,y)=H(x,y+1)-H(x,y-1);
其中,Gx(x,y),Gy(x,y),H(x,y)分别表示输入图像的像素点(x,y)处的水平方向梯度、垂直方向梯度和像素值。Among them, G x (x, y), G y (x, y), H (x, y) represent the horizontal gradient, vertical gradient and pixel value at the pixel point (x, y) of the input image, respectively.
S1222、根据水平梯度图像和垂直梯度图像得到梯度幅值图像矩阵,并计算梯度幅值图像矩阵中每个图像的梯度幅值积分图;S1222, obtain a gradient magnitude image matrix according to the horizontal gradient image and the vertical gradient image, and calculate the gradient magnitude integral map of each image in the gradient magnitude image matrix;
利用cartToPolar函数计算上述水平梯度图像和垂直梯度图像所对应的角度矩阵图像angleMat和梯度幅值矩阵图像magnMat,将角度矩阵图像中的像素强度值归一化为强度范围在[0,9)这9个范围,每一个范围表示方向梯度直方图(HOG)的一个bin。以角度为索引,将梯度幅值图像矩阵按照9个方向拆分为9幅梯度幅值图像矩阵,根据9个角度,每个角度对应的梯度幅值图像矩阵,并利用OpenCv中的积分函数integral分别计算9幅图像对应的积分图像。Use the cartToPolar function to calculate the angle matrix image angleMat and the gradient magnitude matrix image magnMat corresponding to the above-mentioned horizontal gradient image and vertical gradient image, and normalize the pixel intensity values in the angle matrix image to the intensity range of [0,9) these 9 range, each range represents a bin of the histogram of oriented gradients (HOG). Using the angle as an index, the gradient magnitude image matrix is divided into 9 gradient magnitude image matrices according to 9 directions, and according to the 9 angles, the gradient magnitude image matrix corresponding to each angle is used, and the integral function integral in OpenCv is used. The integral images corresponding to the 9 images are calculated respectively.
S1223、将每个图像的梯度幅值积分图进行加法运算得到待跟踪目标的方向梯度直方图特征。S1223: Perform an addition operation on the gradient magnitude integral map of each image to obtain the directional gradient histogram feature of the target to be tracked.
采用cacHOGCell函数对每个图像的梯度幅值积分图进行加法运算得到每个图像的方向梯度直方图特征,并将每个图像的方向梯度直方图特征进行收尾相接得到待跟踪目标的方向梯度直方图特征。The cachHOGCell function is used to add the gradient magnitude integral map of each image to obtain the directional gradient histogram feature of each image, and the directional gradient histogram feature of each image is finalized to obtain the directional gradient histogram of the target to be tracked. graph features.
本发明实施例提供一种通过预设的目标跟踪算法对特征进行跟踪的方法,如图6所示,图6为本发明实施例提供的一种通过预设的目标跟踪算法对特征进行跟踪的方法的基本流程示意图。An embodiment of the present invention provides a method for tracking features by using a preset target tracking algorithm. As shown in FIG. 6 , FIG. 6 is a method for tracking features by using a preset target tracking algorithm provided by an embodiment of the present invention. Schematic diagram of the basic flow of the method.
具体地,如图6所示,步骤S1300包括下述步骤:Specifically, as shown in FIG. 6, step S1300 includes the following steps:
S1310、通过相关滤波算法以特征为跟踪目标在第一视频帧组中进行跟踪;S1310, using the feature as a tracking target to track in the first video frame group through a correlation filtering algorithm;
第一视频帧组为从待跟踪视频中提取的预设个数的多个视频帧。首先,将第一视频帧组的第一帧输入到终端或者服务器中,从待跟踪目标所在的区域中提取特征,进行训练得到相关滤波器。之后,对于第一视频帧组中的其它视频帧,先裁剪之前预测的区域,进行特征提取,将这些特征做FFT(傅里叶)转换,然后与相关滤波器相乘,将得到的结果做IFFT(反傅里叶)转换,第一视频帧组中其它视频帧中响应点最大的区域即为要跟踪的位置。The first video frame group is a preset number of video frames extracted from the video to be tracked. First, input the first frame of the first video frame group into the terminal or server, extract features from the area where the target to be tracked is located, and perform training to obtain a correlation filter. After that, for other video frames in the first video frame group, first crop the previously predicted area, perform feature extraction, perform FFT (Fourier) transformation on these features, and then multiply with the correlation filter, and the obtained result is done as IFFT (inverse Fourier) transformation, the area with the largest response point in other video frames in the first video frame group is the position to be tracked.
S1320、从第二视频帧组中的首帧中获取待跟踪目标的特征;S1320, obtain the feature of the target to be tracked from the first frame in the second video frame group;
S1330、以获取的特征在第二视频帧组中进行跟踪,其中,第一视频帧组与第二视频帧组连续。S1330. Use the acquired feature to perform tracking in the second video frame group, where the first video frame group is continuous with the second video frame group.
第二视频帧组与第一视频帧组连续且包含多个视频帧,其中,第二视频帧组与第一视频帧组中的帧数相同。本实施例中,为了提高跟踪的准确度,在跟踪过程中,在对第一视频帧组完成跟踪后,重新从第二视频帧组中的首帧中提取待跟踪目标的特征,并利用该特征重新训练相关滤波器,以对相关滤波器进行更新,便于预测后续视频帧的待跟踪目标。The second video frame group is continuous with the first video frame group and includes a plurality of video frames, wherein the second video frame group and the first video frame group have the same number of frames. In this embodiment, in order to improve the tracking accuracy, in the tracking process, after the tracking of the first video frame group is completed, the features of the target to be tracked are extracted from the first frame in the second video frame group again, and the The feature retrains the correlation filter to update the correlation filter for predicting the target to be tracked in subsequent video frames.
在一些实施方式中,还包括第三视频帧组、第四视频帧组…,即以预设个数的视频帧为周期提取待跟踪目标的特征,更新相关滤波器。In some embodiments, a third video frame group, a fourth video frame group, . . . are also included, that is, the feature of the target to be tracked is extracted with a preset number of video frames as a period, and the correlation filter is updated.
为解决上述技术问题本发明实施例还提供一种目标跟踪装置。具体请参阅图7,图7为本实施例目标跟踪装置基本结构框图。In order to solve the above technical problem, the embodiments of the present invention further provide a target tracking device. Please refer to FIG. 7 for details. FIG. 7 is a block diagram of the basic structure of the target tracking apparatus according to this embodiment.
如图7所示,一种目标跟踪装置,包括:获取模块2100、处理模块2200和执行模块2300。其中,获取模块2100,用于获取待跟踪目标的跟踪区域;处理模块2200,用于将所述跟踪区域内的像素值缩小至预设像素值,并从缩小后的跟踪区域中提取待跟踪目标的特征;执行模块2300,用于通过预设的目标跟踪算法对所述特征进行跟踪。As shown in FIG. 7 , a target tracking apparatus includes: an
上述目标跟踪装置通过将跟踪区域内的像素值缩小至预设像素值,并从缩小的跟踪区域中提取待跟踪目标,该方法中将跟踪区域缩小像素值后提取特征,可以避免其它因素的干扰,准确、快速的提取到待跟踪目标的特征,进而提高跟踪速度。The above-mentioned target tracking device reduces the pixel value in the tracking area to a preset pixel value, and extracts the target to be tracked from the reduced tracking area. In this method, the pixel value of the tracking area is reduced to extract features, which can avoid the interference of other factors. , to accurately and quickly extract the features of the target to be tracked, thereby improving the tracking speed.
在一些实施方式中,所述获取模块包括:第一获取子模块,用于从需要进行目标跟踪处理的视频中提取视频帧;第二获取子模块,用于从所述视频帧中获取所述待跟踪目标的边框;第三获取子模块,用于获取所述视频帧中待跟踪目标的运动速度,并根据所述运动速度确定所述待跟踪目标的跟踪区域。In some implementations, the acquisition module includes: a first acquisition sub-module for extracting video frames from videos that need to be processed for target tracking; a second acquisition sub-module for acquiring the video frames from the video frames The frame of the target to be tracked; the third acquisition sub-module is configured to acquire the motion speed of the target to be tracked in the video frame, and determine the tracking area of the target to be tracked according to the motion speed.
在一些实施方式中,所述第三获取子模块包括:第一处理子模块,用于确定所述待跟踪目标的运动速度符合的速度范围;第二处理子模块,用于在预设的信息表中查找所述速度范围对应的放大倍数;第一执行子模块,用于以所述待跟踪目标为中心,按照所述放大倍数将所述边界进行放大,并将放大后的区域作为所述跟踪区域。In some embodiments, the third acquisition sub-module includes: a first processing sub-module for determining a speed range within which the motion speed of the target to be tracked conforms; a second processing sub-module for Find the magnification corresponding to the speed range in the table; the first execution sub-module is used to take the target to be tracked as the center, amplify the boundary according to the magnification, and use the magnified area as the tracking area.
在一些实施方式中,所述处理模块包括:第四获取子模块,用于获取所述跟踪区域当前的像素值;第三处理子模块,用于判断所述像素值是否大于预设像素值;第二执行子模块,用于当所述像素值大于预设像素值时,将所述跟踪区域的像素值缩小至所述预设像素值。In some embodiments, the processing module includes: a fourth acquisition sub-module for acquiring the current pixel value of the tracking area; a third processing sub-module for judging whether the pixel value is greater than a preset pixel value; The second execution sub-module is configured to reduce the pixel value of the tracking area to the preset pixel value when the pixel value is greater than the preset pixel value.
在一些实施方式中,所述处理模块包括:第五获取子模块,用于获取所述跟踪区域的水平梯度图像和垂直梯度图像;第四处理子模块,用于根据所述水平梯度图像和所述垂直梯度图像得到梯度幅值图像矩阵,并计算梯度幅值图像矩阵中每个图像的梯度幅值积分图;第三执行子模块,用于将每个图像的梯度幅值积分图进行加法运算得到所述待跟踪目标的方向梯度直方图特征。In some embodiments, the processing module includes: a fifth acquisition sub-module for acquiring a horizontal gradient image and a vertical gradient image of the tracking area; a fourth processing sub-module for acquiring the horizontal gradient image and the The vertical gradient image is described to obtain the gradient magnitude image matrix, and the gradient magnitude integral map of each image in the gradient magnitude image matrix is calculated; the third execution sub-module is used to add the gradient magnitude integral map of each image. The directional gradient histogram feature of the target to be tracked is obtained.
在一些实施方式中,所述执行模块包括:第五处理子模块,用于通过相关滤波算法以所述特征为跟踪目标在第一视频帧组中进行跟踪;第六获取子模块,用于从第二视频帧组中的首帧中获取所述待跟踪目标的特征;第四执行子模块,用于以获取的特征在所述第二视频帧组中进行跟踪,其中,所述第一视频帧组与所述第二视频帧组连续。In some embodiments, the execution module includes: a fifth processing sub-module, configured to use the feature as a tracking target to track in the first video frame group through a correlation filtering algorithm; a sixth acquisition sub-module, configured to obtain data from The feature of the target to be tracked is acquired from the first frame in the second video frame group; the fourth execution sub-module is used for tracking in the second video frame group with the acquired feature, wherein the first video The frame group is contiguous with the second video frame group.
在一些实施方式中,还包括;第六处理子模块,用于当所述像素值小于预设像素值时,保留所述跟踪区域的像素值。In some embodiments, the method further includes: a sixth processing sub-module, configured to retain the pixel value of the tracking area when the pixel value is smaller than a preset pixel value.
为解决上述技术问题,本发明实施例还提供计算机设备。具体请参阅图8,图8为本实施例计算机设备基本结构框图。To solve the above technical problems, the embodiments of the present invention further provide computer equipment. For details, please refer to FIG. 8 , which is a block diagram of a basic structure of a computer device according to this embodiment.
如图8所示,计算机设备的内部结构示意图。如图8所示,该计算机设备包括通过系统总线连接的处理器、非易失性存储介质、存储器和网络接口。其中,该计算机设备的非易失性存储介质存储有操作系统、数据库和计算机可读指令,数据库中可存储有控件信息序列,该计算机可读指令被处理器执行时,可使得处理器实现一种目标跟踪方法。该计算机设备的处理器用于提供计算和控制能力,支撑整个计算机设备的运行。该计算机设备的存储器中可存储有计算机可读指令,该计算机可读指令被处理器执行时,可使得处理器执行一种目标跟踪方法。该计算机设备的网络接口用于与终端连接通信。本领域技术人员可以理解,图8中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。As shown in FIG. 8 , a schematic diagram of the internal structure of the computer equipment. As shown in FIG. 8, the computer device includes a processor, a non-volatile storage medium, a memory, and a network interface connected through a system bus. Wherein, the non-volatile storage medium of the computer device stores an operating system, a database and computer-readable instructions, and the database may store a sequence of control information. When the computer-readable instructions are executed by the processor, the processor can realize a A target tracking method. The processor of the computer equipment is used to provide computing and control capabilities and support the operation of the entire computer equipment. Computer readable instructions may be stored in the memory of the computer device, and when executed by the processor, the computer readable instructions may cause the processor to perform a target tracking method. The network interface of the computer equipment is used for communication with the terminal connection. Those skilled in the art can understand that the structure shown in FIG. 8 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer equipment to which the solution of the present application is applied. Include more or fewer components than shown in the figures, or combine certain components, or have a different arrangement of components.
本实施方式中处理器用于执行图7中获取模块2100、处理模块2200和执行模块2300的具体内容,存储器存储有执行上述模块所需的程序代码和各类数据。网络接口用于向用户终端或服务器之间的数据传输。本实施方式中的存储器存储有目标跟踪方法中执行所有子模块所需的程序代码及数据,服务器能够调用服务器的程序代码及数据执行所有子模块的功能。In this embodiment, the processor is used to execute the specific content of the
计算机设备通过将跟踪区域内的像素值缩小至预设像素值,并从缩小的跟踪区域中提取待跟踪目标,该方法中将跟踪区域缩小像素值后提取特征,可以避免其它因素的干扰,准确、快速的提取到待跟踪目标的特征,进而提高跟踪速度。The computer equipment reduces the pixel value in the tracking area to a preset pixel value, and extracts the target to be tracked from the reduced tracking area. In this method, the pixel value of the tracking area is reduced to extract features, which can avoid the interference of other factors and accurately. , Quickly extract the features of the target to be tracked, thereby improving the tracking speed.
本发明还提供一种存储有计算机可读指令的存储介质,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行上述任一实施例所述目标跟踪方法的步骤。The present invention further provides a storage medium storing computer-readable instructions, which, when executed by one or more processors, cause one or more processors to execute the target tracking method described in any of the foregoing embodiments A step of.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,该计算机程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,前述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等非易失性存储介质,或随机存储记忆体(Random Access Memory,RAM)等。Those of ordinary skill in the art can understand that the realization of all or part of the processes in the methods of the above embodiments can be accomplished by instructing relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the program is During execution, it may include the processes of the embodiments of the above-mentioned methods. The aforementioned storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM).
应该理解的是,虽然附图的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,其可以以其他的顺序执行。而且,附图的流程图中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,其执行顺序也不必然是依次进行,而是可以与其他步骤或者其他步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the various steps in the flowchart of the accompanying drawings are sequentially shown in the order indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless explicitly stated herein, the execution of these steps is not strictly limited to the order and may be performed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but may be executed at different times, and the execution sequence is also It does not have to be performed sequentially, but may be performed alternately or alternately with other steps or at least a portion of sub-steps or stages of other steps.
以上所述仅是本发明的部分实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。The above are only some embodiments of the present invention. It should be pointed out that for those skilled in the art, without departing from the principles of the present invention, several improvements and modifications can be made. It should be regarded as the protection scope of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910065114.7A CN111476065A (en) | 2019-01-23 | 2019-01-23 | Target tracking method and device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910065114.7A CN111476065A (en) | 2019-01-23 | 2019-01-23 | Target tracking method and device, computer equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111476065A true CN111476065A (en) | 2020-07-31 |
Family
ID=71743496
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910065114.7A Pending CN111476065A (en) | 2019-01-23 | 2019-01-23 | Target tracking method and device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111476065A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112308871A (en) * | 2020-10-30 | 2021-02-02 | 地平线(上海)人工智能技术有限公司 | Method and device for determining motion speed of target point in video |
CN113223057A (en) * | 2021-06-04 | 2021-08-06 | 北京奇艺世纪科技有限公司 | Face tracking method and device, electronic equipment and storage medium |
CN113781416A (en) * | 2021-08-30 | 2021-12-10 | 武汉理工大学 | A kind of conveyor belt tear detection method, device and electronic equipment |
CN114500873A (en) * | 2021-12-31 | 2022-05-13 | 浙江大华技术股份有限公司 | Tracking shooting system |
Citations (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030035051A1 (en) * | 2001-08-07 | 2003-02-20 | Samsung Electronics Co., Ltd. | Device for and method of automatically tracking a moving object |
CN1988653A (en) * | 2005-12-21 | 2007-06-27 | 中国科学院自动化研究所 | Night target detecting and tracing method based on visual property |
CN102136147A (en) * | 2011-03-22 | 2011-07-27 | 深圳英飞拓科技股份有限公司 | Target detecting and tracking method, system and video monitoring device |
JP2011196940A (en) * | 2010-03-23 | 2011-10-06 | Mitsubishi Electric Corp | Tracking device |
JP2012073997A (en) * | 2010-09-01 | 2012-04-12 | Ricoh Co Ltd | Object tracking device, object tracking method, and program thereof |
CN102663366A (en) * | 2012-04-13 | 2012-09-12 | 中国科学院深圳先进技术研究院 | Method and system for identifying pedestrian target |
CN102831617A (en) * | 2012-07-17 | 2012-12-19 | 聊城大学 | Method and system for detecting and tracking moving object |
CN103489199A (en) * | 2012-06-13 | 2014-01-01 | 通号通信信息集团有限公司 | Video image target tracking processing method and system |
CN104376576A (en) * | 2014-09-04 | 2015-02-25 | 华为技术有限公司 | Target tracking method and device |
CN104637038A (en) * | 2015-03-11 | 2015-05-20 | 天津工业大学 | Improved CamShift tracing method based on weighted histogram model |
CN105913453A (en) * | 2016-04-01 | 2016-08-31 | 海信集团有限公司 | Target tracking method and target tracking device |
CN108198201A (en) * | 2017-12-19 | 2018-06-22 | 深圳市深网视界科技有限公司 | A kind of multi-object tracking method, terminal device and storage medium |
CN108198205A (en) * | 2017-12-22 | 2018-06-22 | 湖南源信光电科技股份有限公司 | A kind of method for tracking target based on Vibe and Camshift algorithms |
CN108876818A (en) * | 2018-06-05 | 2018-11-23 | 国网辽宁省电力有限公司信息通信分公司 | A kind of method for tracking target based on like physical property and correlation filtering |
CN108876816A (en) * | 2018-05-31 | 2018-11-23 | 西安电子科技大学 | Method for tracking target based on adaptive targets response |
CN108898057A (en) * | 2018-05-25 | 2018-11-27 | 广州杰赛科技股份有限公司 | Track method, apparatus, computer equipment and the storage medium of target detection |
CN109074657A (en) * | 2018-07-18 | 2018-12-21 | 深圳前海达闼云端智能科技有限公司 | Target tracking method and device, electronic equipment and readable storage medium |
-
2019
- 2019-01-23 CN CN201910065114.7A patent/CN111476065A/en active Pending
Patent Citations (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030035051A1 (en) * | 2001-08-07 | 2003-02-20 | Samsung Electronics Co., Ltd. | Device for and method of automatically tracking a moving object |
CN1988653A (en) * | 2005-12-21 | 2007-06-27 | 中国科学院自动化研究所 | Night target detecting and tracing method based on visual property |
JP2011196940A (en) * | 2010-03-23 | 2011-10-06 | Mitsubishi Electric Corp | Tracking device |
JP2012073997A (en) * | 2010-09-01 | 2012-04-12 | Ricoh Co Ltd | Object tracking device, object tracking method, and program thereof |
CN102136147A (en) * | 2011-03-22 | 2011-07-27 | 深圳英飞拓科技股份有限公司 | Target detecting and tracking method, system and video monitoring device |
CN102663366A (en) * | 2012-04-13 | 2012-09-12 | 中国科学院深圳先进技术研究院 | Method and system for identifying pedestrian target |
CN103489199A (en) * | 2012-06-13 | 2014-01-01 | 通号通信信息集团有限公司 | Video image target tracking processing method and system |
CN102831617A (en) * | 2012-07-17 | 2012-12-19 | 聊城大学 | Method and system for detecting and tracking moving object |
CN104376576A (en) * | 2014-09-04 | 2015-02-25 | 华为技术有限公司 | Target tracking method and device |
CN104637038A (en) * | 2015-03-11 | 2015-05-20 | 天津工业大学 | Improved CamShift tracing method based on weighted histogram model |
CN105913453A (en) * | 2016-04-01 | 2016-08-31 | 海信集团有限公司 | Target tracking method and target tracking device |
CN108198201A (en) * | 2017-12-19 | 2018-06-22 | 深圳市深网视界科技有限公司 | A kind of multi-object tracking method, terminal device and storage medium |
CN108198205A (en) * | 2017-12-22 | 2018-06-22 | 湖南源信光电科技股份有限公司 | A kind of method for tracking target based on Vibe and Camshift algorithms |
CN108898057A (en) * | 2018-05-25 | 2018-11-27 | 广州杰赛科技股份有限公司 | Track method, apparatus, computer equipment and the storage medium of target detection |
CN108876816A (en) * | 2018-05-31 | 2018-11-23 | 西安电子科技大学 | Method for tracking target based on adaptive targets response |
CN108876818A (en) * | 2018-06-05 | 2018-11-23 | 国网辽宁省电力有限公司信息通信分公司 | A kind of method for tracking target based on like physical property and correlation filtering |
CN109074657A (en) * | 2018-07-18 | 2018-12-21 | 深圳前海达闼云端智能科技有限公司 | Target tracking method and device, electronic equipment and readable storage medium |
Non-Patent Citations (2)
Title |
---|
况扬 主编: "《影视特技与后期合成》", 31 January 2010, 中央广播电视大学出版社, pages: 257 * |
尹小港 编: "《新编After Effects CC 标准教程》", 30 April 2014, 海洋出版社, pages: 91 * |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112308871A (en) * | 2020-10-30 | 2021-02-02 | 地平线(上海)人工智能技术有限公司 | Method and device for determining motion speed of target point in video |
CN112308871B (en) * | 2020-10-30 | 2024-05-14 | 地平线(上海)人工智能技术有限公司 | Method and device for determining movement speed of target point in video |
CN113223057A (en) * | 2021-06-04 | 2021-08-06 | 北京奇艺世纪科技有限公司 | Face tracking method and device, electronic equipment and storage medium |
CN113781416A (en) * | 2021-08-30 | 2021-12-10 | 武汉理工大学 | A kind of conveyor belt tear detection method, device and electronic equipment |
CN114500873A (en) * | 2021-12-31 | 2022-05-13 | 浙江大华技术股份有限公司 | Tracking shooting system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110176027B (en) | Video target tracking method, device, equipment and storage medium | |
CN111192292B (en) | Target tracking method and related equipment based on attention mechanism and Siamese network | |
US11222211B2 (en) | Method and apparatus for segmenting video object, electronic device, and storage medium | |
CN111476065A (en) | Target tracking method and device, computer equipment and storage medium | |
WO2023035531A1 (en) | Super-resolution reconstruction method for text image and related device thereof | |
CN112614110B (en) | Method and device for evaluating image quality and terminal equipment | |
CN109977832B (en) | Image processing method, device and storage medium | |
CN110942071A (en) | License plate recognition method based on license plate classification and LSTM | |
CN116580305B (en) | A tea bud detection method based on deep learning and its model building method | |
CN113569740B (en) | Video recognition model training method and device, and video recognition method and device | |
CN112163120A (en) | Classification method, terminal and computer storage medium | |
CN106560840A (en) | Recognition processing method and device of image information | |
CN111507138A (en) | Image recognition method, device, computer equipment and storage medium | |
CN114096994A (en) | Image alignment method and device, electronic equipment and storage medium | |
CN111667504B (en) | Face tracking method, device and equipment | |
US10180782B2 (en) | Fast image object detector | |
CN110689014B (en) | Method and device for detecting region of interest, electronic equipment and readable storage medium | |
CN111476064A (en) | Small target detection method and device, computer equipment and storage medium | |
CN110399826B (en) | End-to-end face detection and identification method | |
CN112258527A (en) | Image processing method, apparatus, electronic device, and computer-readable storage medium | |
CN110648284A (en) | Image processing method and device for uneven illumination | |
CN111898693A (en) | Training method, visibility estimation method and device for visibility classification model | |
CN116862812A (en) | Infrared image processing method, device, computer equipment, storage medium and product | |
CN111476132A (en) | Video scene recognition method, device and electronic device, storage medium | |
CN114419086A (en) | Edge extraction method, device, electronic device and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |