Video playback method and device

文档序号:1601726 发布日期:2020-01-07 浏览:10次 中文

阅读说明:本技术 一种录像回放的方法及装置 (Video playback method and device ) 是由 陈天海 于 2019-09-18 设计创作,主要内容包括:本发明公开了一种录像回放的方法及装置,通过录像中待查找的目标区域,确定出目标区域在预设表格中的位置的第一结果,根据录像中待查找的目标对象的类型,在预先建立的索引数据与目标对象的类型之间的对应关系中,查找与待查找的目标对象的类型相同的索引数据,当查找到的索引数据中的第二结果和第一结果满足预设条件时,回放与该索引数据中的一帧画面信息对应的帧画面。如此,可以根据目标对象的类型和目标对象,可以在录像中快速地查找到需要查找的录像,然后将查找到的录像进行回放,不仅可以达到快速定位回放的目的,还可以提高录像回放的效率和准确率。(The invention discloses a method and a device for playing back a video, wherein a first result of the position of a target area in a preset table is determined through the target area to be searched in the video, index data with the same type as the target object to be searched is searched in a corresponding relation between pre-established index data and the type of the target object according to the type of the target object to be searched in the video, and a frame corresponding to frame information in the index data is played back when a second result and a first result in the searched index data meet preset conditions. Therefore, the video needing to be searched can be quickly searched in the video according to the type of the target object and the target object, and then the searched video is played back, so that the purpose of quick positioning and playback can be achieved, and the efficiency and accuracy of video playback can be improved.)

1. A method for video playback, comprising:

determining a first result for representing the position of a target area in a preset table according to the target area to be searched in a video;

according to the type of a target object to be searched in a video, searching index data with the same type as the target object to be searched in a corresponding relation between pre-established index data and the type of the target object; wherein the index data comprises: the video recording method comprises the following steps of recording a frame of picture information in a video and a second result corresponding to the frame of picture information, wherein the second result is used for representing the position of a target object in a preset table;

and when the second result and the first result in the searched index data are judged to meet the preset condition, playing back a frame image corresponding to frame image information in the index data.

2. The method of claim 1, wherein the first result and the second result are each represented in an array;

judging whether the second result and the obtained first result in the searched index data meet preset conditions, specifically including:

performing AND operation processing on the second result in the searched index data and the obtained first result;

and judging whether the second result in the searched index data and the obtained first result meet preset conditions or not according to the result of the operation processing.

3. The method according to claim 2, wherein determining whether the second result in the searched index data and the obtained first result satisfy a preset condition according to the result of the operation processing specifically includes:

judging whether the position of the target object represented in the second result in the preset table and the position of the target area represented in the first result in the preset table are overlapped or not according to the result of the AND operation processing;

if so, determining that the second result in the searched index data and the obtained first result meet the preset condition;

if not, determining that the second result in the searched index data and the obtained first result do not meet the preset condition.

4. The method according to claim 1, wherein when it is determined that the second result in the searched index data and the obtained first result satisfy a preset condition, playing back a frame corresponding to one frame of picture information in the index data specifically includes:

when a plurality of index data are found, determining the frame sequence in one frame of picture information in each index data;

and when the second result in each searched index data and the obtained first result meet the preset condition according to the frame sequence from small to large, playing back the frame corresponding to one frame of image information in the index data meeting the preset condition.

5. The method according to claim 4, wherein when it is determined that the second result and the obtained first result in each of the searched index data satisfy a preset condition according to a frame sequence from small to large, playing back a frame corresponding to one frame of picture information in the index data that satisfies the preset condition specifically includes:

sequentially judging whether the second result and the obtained first result in each corresponding index data meet a preset condition or not according to a frame sequence from small to large;

when the second result in one searched index data and the obtained first result meet the preset condition, playing back a frame image corresponding to one frame image information in the index data;

and when the second result in one searched index data and the obtained first result do not meet the preset condition, continuously judging whether the second result in the next searched index data and the obtained first result meet the preset condition or not until the judgment of all the searched index data is finished.

6. The method of claim 1, wherein determining a first result indicating a position of a target area in a preset table according to the target area to be searched in the video includes:

marking the target area in the preset table according to the target area to be searched in the video;

calculating each row of data in the preset table marked with the target area according to a first preset algorithm to obtain a first row value corresponding to each row of data;

and performing integration processing on the obtained first row values to obtain a first result for representing the position of the target area in a preset table.

7. The method of claim 1, wherein establishing the correspondence between the index data and the type of the target object is by:

acquiring an Nth frame of picture in a video and determining mark information of the Nth frame of picture;

determining a target object, the type of the target object and the position of the target object in the Nth frame of picture according to a second preset algorithm;

after the N frame of picture is converted into the preset table, marking the target object in the preset table according to the determined position of the target object; wherein different types of target objects adopt different marks;

for each type of the target object:

calculating a second row value corresponding to each row of data when only the target objects of the same type exist in the preset table according to a first preset algorithm;

integrating the calculated second row values to obtain a second result for representing the positions of the target objects of the same type in the preset table;

associating the obtained second result with the mark information of the Nth frame of picture to obtain index data;

and establishing a corresponding relation between the obtained index data and the type of the target object.

8. The method of claim 7, wherein the correspondence is pre-stored in header information of a video file in a memory.

9. An apparatus for video playback, comprising:

the device comprises a determining module, a searching module and a searching module, wherein the determining module is used for determining a first result for representing the position of a target area in a preset table according to the target area to be searched in a video;

the searching module is used for searching index data with the same type as the target object to be searched in the corresponding relation between the pre-established index data and the type of the target object according to the type of the target object to be searched in the video; wherein the index data comprises: the video recording method comprises the following steps of recording a frame of picture information in a video and a second result corresponding to the frame of picture information, wherein the second result is used for representing the position of a target object in a preset table;

and the processing module is used for playing back a frame picture corresponding to frame picture information in the index data when the second result and the first result in the searched index data are judged to meet a preset condition.

10. The apparatus of claim 9, wherein the first result and the second result are each represented in an array;

the processing module is specifically configured to:

performing AND operation processing on the second result in the searched index data and the obtained first result;

and judging whether the second result in the searched index data and the obtained first result meet preset conditions or not according to the result of the operation processing.

11. The apparatus of claim 10, wherein the processing module is specifically configured to:

judging whether the position of the target object represented in the second result in the preset table and the position of the target area represented in the first result in the preset table are overlapped or not according to the result of the AND operation processing;

if so, determining that the second result in the searched index data and the obtained first result meet the preset condition;

if not, determining that the second result in the searched index data and the obtained first result do not meet the preset condition.

12. The apparatus of claim 9, wherein the processing module is specifically configured to:

when a plurality of index data are found, determining the frame sequence in one frame of picture information in each index data;

and when the second result in each searched index data and the obtained first result meet the preset condition according to the frame sequence from small to large, playing back the frame corresponding to one frame of image information in the index data meeting the preset condition.

13. The apparatus of claim 12, wherein the processing module is specifically configured to:

sequentially judging whether the second result and the obtained first result in each corresponding index data meet a preset condition or not according to a frame sequence from small to large;

when the second result in one searched index data and the obtained first result meet the preset condition, playing back a frame image corresponding to one frame image information in the index data;

and when the second result in one searched index data and the obtained first result do not meet the preset condition, continuously judging whether the second result in the next searched index data and the obtained first result meet the preset condition or not until the judgment of all the searched index data is finished.

14. The apparatus of claim 9, wherein the determination module is specifically configured to:

marking the target area in the preset table according to the target area to be searched in the video;

calculating each row of data in the preset table marked with the target area according to a first preset algorithm to obtain a first row value corresponding to each row of data;

and performing integration processing on the obtained first row values to obtain a first result for representing the position of the target area in a preset table.

15. The apparatus of claim 9, further comprising a correspondence module to: and the corresponding relation between the pre-established index data and the type of the target object.

16. The apparatus of claim 15, wherein the correspondence module is specifically configured to:

acquiring an Nth frame of picture in a video and determining mark information of the Nth frame of picture;

determining a target object, the type of the target object and the position of the target object in the Nth frame of picture according to a second preset algorithm;

after the N frame of picture is converted into the preset table, marking the target object in the preset table according to the determined position of the target object; wherein different types of target objects adopt different marks;

for each type of the target object:

calculating a second row value corresponding to each row of data when only the target objects of the same type exist in the preset table according to a first preset algorithm;

integrating the calculated second row values to obtain a second result for representing the positions of the target objects of the same type in the preset table;

associating the obtained second result with the mark information of the Nth frame of picture to obtain index data;

and establishing a corresponding relation between the obtained index data and the type of the target object.

Technical Field

The present invention relates to the field of monitoring technologies, and in particular, to a method and an apparatus for video playback.

Background

In the prior art, when video recording and playback are performed, generally, an image of a moving object is acquired according to position information of the moving object, and then the acquired image of the moving object is displayed in a superimposed manner on a screen corresponding to a monitoring field of view. Such a video playback process has the following problems:

firstly, playing back a video according to a target area, so that a user cannot check a target object in the target area when playing back the video;

secondly, playing back the video without distinguishing the type of the target object, so that some pictures may not have the target object to be checked but still be played back when playing back the video, thereby reducing the accuracy of video playback;

thirdly, the time point of the video recording of interest cannot be located quickly, resulting in a reduction in the user experience.

Therefore, when the video is played back, how to improve the accuracy of playing back the video, quickly locate the video to be searched by the user, and improve the use experience of the user is a technical problem to be solved urgently by technical personnel in the field.

Disclosure of Invention

The embodiment of the invention provides a method and a device for playing back a video, which are used for improving the accuracy of video playback, quickly positioning the video to be searched by a user and improving the use experience of the user.

The embodiment of the invention provides a video playback method, which comprises the following steps:

determining a first result for representing the position of a target area in a preset table according to the target area to be searched in a video;

according to the type of a target object to be searched in a video, searching index data with the same type as the target object to be searched in a corresponding relation between pre-established index data and the type of the target object; wherein the index data comprises: the video recording method comprises the following steps of recording a frame of picture information in a video and a second result corresponding to the frame of picture information, wherein the second result is used for representing the position of a target object in a preset table;

and when the second result and the first result in the searched index data are judged to meet the preset condition, playing back a frame image corresponding to frame image information in the index data.

In a possible implementation manner, in the foregoing method provided in this embodiment of the present invention, the first result and the second result are both expressed in the form of an array;

judging whether the second result and the obtained first result in the searched index data meet preset conditions, specifically including:

performing AND operation processing on the second result in the searched index data and the obtained first result;

and judging whether the second result in the searched index data and the obtained first result meet preset conditions or not according to the result of the operation processing.

In a possible implementation manner, in the method provided in the embodiment of the present invention, determining whether the second result in the searched index data and the obtained first result meet a preset condition according to a result of the operation processing specifically includes:

judging whether the position of the target object represented in the second result in the preset table and the position of the target area represented in the first result in the preset table are overlapped or not according to the result of the AND operation processing;

if so, determining that the second result in the searched index data and the obtained first result meet the preset condition;

if not, determining that the second result in the searched index data and the obtained first result do not meet the preset condition.

In a possible implementation manner, in the method provided in an embodiment of the present invention, when it is determined that the second result in the searched index data and the obtained first result satisfy a preset condition, playing back a frame corresponding to frame information in the index data, specifically, the method includes:

when a plurality of index data are found, determining the frame sequence in one frame of picture information in each index data;

and when the second result in each searched index data and the obtained first result meet the preset condition according to the frame sequence from small to large, playing back the frame corresponding to one frame of image information in the index data meeting the preset condition.

In a possible implementation manner, in the method provided in an embodiment of the present invention, when it is determined that the second result and the obtained first result in each piece of index data that are found satisfy a preset condition according to a frame sequence from small to large, playing back a frame corresponding to one frame of picture information in the piece of index data that satisfies the preset condition, specifically includes:

sequentially judging whether the second result and the obtained first result in each corresponding index data meet a preset condition or not according to a frame sequence from small to large;

when the second result in one searched index data and the obtained first result meet the preset condition, playing back a frame image corresponding to one frame image information in the index data;

and when the second result in one searched index data and the obtained first result do not meet the preset condition, continuously judging whether the second result in the next searched index data and the obtained first result meet the preset condition or not until the judgment of all the searched index data is finished.

In a possible implementation manner, in the method provided in an embodiment of the present invention, determining, according to a target area to be searched in a video, a first result used for indicating a position of the target area in a preset table, specifically includes:

marking the target area in the preset table according to the target area to be searched in the video;

calculating each row of data in the preset table marked with the target area according to a first preset algorithm to obtain a first row value corresponding to each row of data;

and performing integration processing on the obtained first row values to obtain a first result for representing the position of the target area in a preset table.

In a possible implementation manner, in the foregoing method provided in an embodiment of the present invention, the method for establishing the correspondence between the index data and the type of the target object includes:

acquiring an Nth frame of picture in a video and determining mark information of the Nth frame of picture;

determining a target object, the type of the target object and the position of the target object in the Nth frame of picture according to a second preset algorithm;

after the N frame of picture is converted into the preset table, marking the target object in the preset table according to the determined position of the target object; wherein different types of target objects adopt different marks;

for each type of the target object:

calculating a second row value corresponding to each row of data when only the target objects of the same type exist in the preset table according to a first preset algorithm;

integrating the calculated second row values to obtain a second result for representing the positions of the target objects of the same type in the preset table;

associating the obtained second result with the mark information of the Nth frame of picture to obtain index data;

and establishing a corresponding relation between the obtained index data and the type of the target object.

In a possible implementation manner, in the foregoing method provided in an embodiment of the present invention, the correspondence is stored in the header information of the video file in the memory in advance.

On the other hand, an embodiment of the present invention further provides a device for video playback, including:

the device comprises a determining module, a searching module and a searching module, wherein the determining module is used for determining a first result for representing the position of a target area in a preset table according to the target area to be searched in a video;

the searching module is used for searching index data with the same type as the target object to be searched in the corresponding relation between the pre-established index data and the type of the target object according to the type of the target object to be searched in the video; wherein the index data comprises: the video recording method comprises the following steps of recording a frame of picture information in a video and a second result corresponding to the frame of picture information, wherein the second result is used for representing the position of a target object in a preset table;

and the processing module is used for playing back a frame picture corresponding to frame picture information in the index data when the second result and the first result in the searched index data are judged to meet a preset condition.

In a possible implementation manner, in the above apparatus provided in this embodiment of the present invention, the first result and the second result are both expressed in the form of an array;

the processing module is specifically configured to:

performing AND operation processing on the second result in the searched index data and the obtained first result;

and judging whether the second result in the searched index data and the obtained first result meet preset conditions or not according to the result of the operation processing.

In a possible implementation manner, in the apparatus provided in an embodiment of the present invention, the processing module is specifically configured to:

judging whether the position of the target object represented in the second result in the preset table and the position of the target area represented in the first result in the preset table are overlapped or not according to the result of the AND operation processing;

if so, determining that the second result in the searched index data and the obtained first result meet the preset condition;

if not, determining that the second result in the searched index data and the obtained first result do not meet the preset condition.

In a possible implementation manner, in the apparatus provided in an embodiment of the present invention, the processing module is specifically configured to:

when a plurality of index data are found, determining the frame sequence in one frame of picture information in each index data;

and when the second result in each searched index data and the obtained first result meet the preset condition according to the frame sequence from small to large, playing back the frame corresponding to one frame of image information in the index data meeting the preset condition.

In a possible implementation manner, in the apparatus provided in an embodiment of the present invention, the processing module is specifically configured to:

sequentially judging whether the second result and the obtained first result in each corresponding index data meet a preset condition or not according to a frame sequence from small to large;

when the second result in one searched index data and the obtained first result meet the preset condition, playing back a frame image corresponding to one frame image information in the index data;

and when the second result in one searched index data and the obtained first result do not meet the preset condition, continuously judging whether the second result in the next searched index data and the obtained first result meet the preset condition or not until the judgment of all the searched index data is finished.

In a possible implementation manner, in the apparatus provided in an embodiment of the present invention, the determining module is specifically configured to:

marking the target area in the preset table according to the target area to be searched in the video;

calculating each row of data in the preset table marked with the target area according to a first preset algorithm to obtain a first row value corresponding to each row of data;

and performing integration processing on the obtained first row values to obtain a first result for representing the position of the target area in a preset table.

In a possible implementation manner, in the apparatus provided in an embodiment of the present invention, the apparatus further includes a correspondence module, configured to: and the corresponding relation between the pre-established index data and the type of the target object.

In a possible implementation manner, in the apparatus provided in an embodiment of the present invention, the correspondence module is specifically configured to:

acquiring an Nth frame of picture in a video and determining mark information of the Nth frame of picture;

determining a target object, the type of the target object and the position of the target object in the Nth frame of picture according to a second preset algorithm;

after the N frame of picture is converted into the preset table, marking the target object in the preset table according to the determined position of the target object; wherein different types of target objects adopt different marks;

for each type of the target object:

calculating a second row value corresponding to each row of data when only the target objects of the same type exist in the preset table according to a first preset algorithm;

integrating the calculated second row values to obtain a second result for representing the positions of the target objects of the same type in the preset table;

associating the obtained second result with the mark information of the Nth frame of picture to obtain index data;

and establishing a corresponding relation between the obtained index data and the type of the target object.

The invention has the following beneficial effects:

according to the method and the device for playing back the video, the first result of the position of the target area in the preset table is determined through the target area to be searched in the video, the index data with the same type as the target object to be searched is searched in the corresponding relation between the pre-established index data and the type of the target object according to the type of the target object to be searched in the video, and when the second result and the first result in the searched index data meet the preset condition, the frame corresponding to one frame of image information in the index data is played back. Therefore, the video needing to be searched can be quickly searched in the video according to the type of the target object and the target object, and then the searched video is played back, so that the purpose of quick positioning and playback can be achieved, and the efficiency and accuracy of video playback can be improved.

Drawings

Fig. 1 is a flowchart of a method for playing back a video according to an embodiment of the present invention;

fig. 2 is a schematic diagram of a4 × 4 preset table provided in the embodiment of the present invention;

fig. 3 is a schematic diagram of an 8 × 6 preset table according to an embodiment of the present invention;

fig. 4 is a schematic structural diagram of a video file provided in an embodiment of the present invention;

FIG. 5 is a flow chart of a method according to a first embodiment of the present invention;

FIG. 6 is a flow chart of a method of a second embodiment provided in an embodiment of the present invention;

FIG. 7 is a schematic structural diagram of an apparatus for video playback according to an embodiment of the present invention;

fig. 8 is a schematic structural diagram of another video playback apparatus according to an embodiment of the present invention.

Detailed Description

The following describes in detail a specific implementation of a method and an apparatus for video playback according to an embodiment of the present invention with reference to the accompanying drawings. It should be noted that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

An embodiment of the present invention provides a method for playing back a video, as shown in fig. 1, the method may include:

s101, determining a first result for representing the position of a target area in a preset table according to the target area to be searched in a video;

the target area to be searched is set by the user according to the requirement. In order to enable the user to select the target area, the user may be provided with operation buttons and operation options for implementing the function on the operation interface. The operation buttons and operation options on the operation interface may be provided by the processing module (described below), or may be provided by other structures, as long as the user can select the target area, which is not limited herein.

S102, searching index data with the same type as a target object to be searched in a corresponding relation between pre-established index data and the type of the target object according to the type of the target object to be searched in the video;

wherein the index data may include: the video recording method comprises the steps that a frame of picture information in the video and a second result corresponding to the frame of picture information are obtained, and the second result is used for representing the position of a target object in a preset table;

the type of the target object to be searched is set by the user according to the requirement. In order to enable the user to select the type of the target object, the user may be provided with operation buttons and operation options for implementing the function on the operation interface. The operation buttons and operation options on the operation interface may be provided by a processing module (described in the following), or may be provided by other structures, as long as the user can select the type of the target object, which is not limited herein.

To illustrate, when searching for index data, a video within a specific time period may be selected according to the time of a video to be searched, so as to improve the searching efficiency, in this case, in the embodiment of the present invention, step S102 may specifically include:

according to the type of the target object to be searched in the video and the time of the video to be searched, searching index data which is the same as the type of the target object to be searched and corresponds to the time of the video to be searched in the corresponding relation between the pre-established index data and the type of the target object.

Therefore, the index data corresponding to the specific time period can be quickly searched, the searching time and the searching efficiency of the index data are reduced, and the accuracy of video playback is improved.

S103, when the second result in the searched index data and the obtained first result meet the preset condition, playing back a frame image corresponding to one frame image information in the index data.

In the embodiment of the invention, the video needing to be searched can be quickly searched in the video according to the type of the target object and the target object, and then the searched video is played back, so that the aim of quick positioning and playback can be fulfilled, the video playback efficiency and accuracy can be improved, the workload of searching a certain frame of picture in a huge video file is reduced, the searching time is greatly saved, and the use experience of a user is improved.

In a specific implementation, the first result and the second result may both be represented in an array form, and at this time, in order to determine whether the second result and the obtained first result in the searched index data satisfy the preset condition, in an embodiment of the present invention, determining whether the second result and the obtained first result in the searched index data satisfy the preset condition specifically includes:

performing AND operation processing on the second result and the obtained first result in the searched index data;

and judging whether the second result in the searched index data and the obtained first result meet preset conditions or not according to the result of the operation processing.

In order to determine whether the second result and the obtained first result in the searched index data meet the preset condition, performing and operation processing on the second result and the obtained first result in the searched index data; of course, other manners of processing the second result and the obtained first result in the searched index data may also be performed, as long as it can be determined that the second result and the obtained first result in the searched index data meet the preset condition, and which operation processing manner is adopted is not specifically limited herein.

Specifically, in order to determine whether the second result and the obtained first result in the searched index data satisfy the preset condition according to the result of the operation processing, in the embodiment of the present invention, determining whether the second result and the obtained first result in the searched index data satisfy the preset condition according to the result of the operation processing specifically includes:

judging whether the position of the target object represented in the second result in the preset table and the position of the target area represented in the first result in the preset table are overlapped or not according to the result of the operation processing;

if so, determining that the second result and the obtained first result in the searched index data meet a preset condition;

if not, determining that the second result in the searched index data and the obtained first result do not meet the preset condition.

And judging whether the position of the target object represented in the second result in the preset table and the position of the target area represented in the first result in the preset table are overlapped or not according to the result of the operation processing, and if so, meeting the preset condition.

In the embodiment of the present invention, since the array is an ordered sequence of elements, several elements having the same type may be organized in a certain order. Therefore, when the first result and the second result are expressed in the form of an array and the first result and the second result are subjected to and operation processing, whether the position of the target object expressed in the second result in the preset table and the position of the target area expressed in the first result in the preset table are overlapped or not can be judged through simple and operation processing, and whether the first result and the second result meet the preset condition or not can be further judged.

Therefore, whether the first result and the second result meet the preset condition or not can be judged through simple operation, the difficulty of operation processing is reduced, the processing speed can be increased, the processing speed of video playback is increased, and the purpose of quick playback is achieved.

To illustrate, when the first result and the second result are expressed in an array form, reference may be made to the prior art for a specific process of and operation processing performed between the first result and the second result, and details are not described here.

In specific implementation, when it is determined that the second result and the obtained first result in the searched index data satisfy the preset condition, playing back a frame corresponding to one frame of image information in the index data, specifically including:

when a plurality of index data are found, determining the frame sequence in one frame of picture information in each index data;

and when the second result in each searched index data and the obtained first result meet the preset condition according to the frame sequence from small to large, playing back the frame corresponding to one frame of image information in the index data meeting the preset condition.

Optionally, a frame of picture information in the index data includes not only frame number information but also timestamp information, and timestamp time corresponds to the frame number information, i.e. timestamp information may reflect a sequence between frame pictures in each index data.

Therefore, when a plurality of index data are searched, the searched index data can be sorted first according to the frame sequence or the timestamp information from small to large. Then, when the second result and the obtained first result in each searched index data are judged to meet the preset condition according to the sorting result, each frame meeting the preset condition can be played back in sequence according to the frame sequence from small to large so as to restore the played back video better and provide the required video for the user.

Of course, in the embodiment of the present invention, when the index data are sorted, the index data may be sorted according to a descending order or other orders, and may be arranged according to actual needs to meet the needs of users, so as to improve the flexibility of setting.

For example, the description will be given by taking three pieces of index data found as an example.

The first index data is number 1, the second index data is number 2, and the third index data is number 3, that is, index data 1, index data 2, and index data 3 are obtained.

The frame number in the frame picture information included in the index data 1 is a first frame, the frame number in the frame picture information included in the index data 2 is a third frame, and the frame number in the frame picture information included in the index data 3 is a second frame, so that after the index data are sorted according to the frame sequence in one frame picture information in the index data and according to the frame sequence from small to large, the sorting result of the index data is obtained as follows: index data 1, index data 3, index data 2.

Sequentially judging whether the sorted index data 1, index data 3 and index data 2 meet preset conditions;

and if the index data 1 and the index data 3 meet the preset condition, playing back a frame picture corresponding to one frame picture information in the index data 1 and the index data 3 meeting the preset condition.

Therefore, when a plurality of index data are searched, the video can be played back according to the frame sequence from small to large when the video is played back, so that the requirements of users are met, and the flexibility of video playback is improved while the video is played back quickly.

Specifically, when it is determined that the second result and the obtained first result in each searched index data satisfy the preset condition according to the frame sequence from small to large, playing back a frame corresponding to one frame of image information in the index data satisfying the preset condition, specifically includes:

sequentially judging whether the second result and the obtained first result in each corresponding index data meet a preset condition or not according to a frame sequence from small to large;

when the second result in one searched index data and the obtained first result meet the preset condition, playing back a frame picture corresponding to one frame picture information in the index data;

and when the second result in one searched index data and the obtained first result do not meet the preset condition, continuously judging whether the second result in the next searched index data and the obtained first result meet the preset condition or not until the judgment of all searched index data is finished.

And if the second result and the obtained first result in each index data meet the preset condition, playing back a frame corresponding to one frame of image information in the index data, and if the first result and the obtained first result do not meet the preset condition, not playing back any frame.

That is, the frame corresponding to the frame information in all the searched index data is not played back, but the frame corresponding to one frame information in the index data satisfying the preset condition is played back until the judgment of all the searched index data is completed.

For example, similarly, the found index data has three, and after sorting is performed according to the frame number of the frame picture information included in the index data from the smaller frame to the larger frame, the sorting results of the three index data are index data 1, index data 3, and index data 2.

Judging whether the second result in the index data 1 and the obtained first result meet a preset condition or not;

if yes, playing back a frame picture corresponding to one frame picture information in the index data 1;

if not, judging whether the second result in the index data 3 and the obtained first result meet a preset condition or not;

if yes, playing back a frame picture corresponding to one frame picture information in the index data 3;

if not, judging whether the second result in the index data 2 and the obtained first result meet a preset condition or not;

if yes, playing back a frame picture corresponding to one frame picture information in the index data 2;

if not, the frame corresponding to the frame information in the index data 2 is not played back.

Therefore, when the video is played back, the video can be played back according to the frame sequence from small to large so as to meet the requirements of users, and meanwhile, a large amount of searching time is reduced. And the interested time point can be effectively and quickly positioned, and the quick positioning of video playback is realized.

To illustrate, in this embodiment of the present invention, when it is determined that the second result and the obtained first result in each searched index data satisfy the preset condition according to the frame sequence from small to large, and when playing back a frame picture corresponding to one frame of picture information in the index data that satisfies the preset condition, the method may further include:

according to the frame sequence from small to large, judging that the second result and the obtained first result in each corresponding index data meet a preset condition;

and after the corresponding index data is judged, according to the judgment result and the frame sequence from small to large, playing back the frame corresponding to one frame of frame information in the index data meeting the preset condition in each index data.

In an actual situation, the corresponding index data may be sorted according to a frame sequence from small to large, and then determined according to a sorting result. Of course, the searched index data may not be sorted, but the corresponding index data may be sequentially determined according to the frame sequence from small to large.

For example, still taking the found index data with three as an example, and sorting the index data according to the frame number of the frame picture information included in the index data from the smaller frame to the larger frame, the sorting results of the three index data are index data 1, index data 3, and index data 2.

Sequentially judging whether a second result and an obtained first result in the index data 1, the index data 3 and the index data 2 meet a preset condition;

if the second result and the obtained first result in the index data 2 and the index data 3 meet the preset condition; the frame pictures corresponding to one frame picture information in the index data 2 and the index data 3 are played back.

Therefore, the picture meeting the preset conditions can be played back according to the actual needs and the requirements of the user, the purpose of quickly playing back the video can be achieved, and the flexibility of design can be improved so as to meet the needs of different users and different application scenes.

In a specific implementation, determining, according to a target area to be searched in a video, a first result used for indicating a position of the target area in a preset table, specifically includes:

marking a target area in a preset table according to the target area to be searched in the video;

calculating each row of data in a preset table marked with a target area according to a first preset algorithm to obtain a first row value corresponding to each row of data;

and performing integration processing on the obtained first row values to obtain a first result for indicating the position of the target area in the preset table.

For example, a preset table of 4 × 4 will be described as an example.

According to a target area to be searched in a video, marking the target area in a preset table, marking occupied squares as 1, marking unoccupied squares as 0 or not, as shown in fig. 2, wherein a dotted line frame represents the target area, and the unoccupied squares are not marked.

At this time, calculating each row of data in the marked preset table, wherein the calculating process is as follows:

in order from top to bottom, and from right to left, adopt 2(M-1)The calculation formula (2) calculates the value of each square in the preset table, wherein M represents the M-th square from the rightmost side in each row, and when calculating the value of each first row, only the square marked with 1 is calculated, and the calculation is ignored when the square not marked.

First row corresponding first row value (denoted a 1):

since only the 2 nd and 3 rd squares from the rightmost side are marked as 1 in the 4 squares in the first row, and the 1 st and 4 th squares from the rightmost side are not marked, only the squares marked with 1 are calculated, and the calculation is omitted for the squares without marks. Therefore, the numerical value of M corresponding to the 2 nd and 3 rd squares from the rightmost side is M2. 3, then: the number corresponding to the 2 nd square is 2(2-1)2, the 3 rd square corresponds to a value of 2(3-1)=4;

In this case, a1 is 2+4 — 6.

Second row corresponding first row value (denoted a 2):

since only the squares 2 and 3 from the rightmost side of the 4 squares in the second row are marked with 1 and the squares 1 and 2 from the rightmost side are not marked, only the squares marked with 1 are calculated, and the calculation is omitted for the squares not marked. Therefore, the numerical values of M corresponding to the 2 nd and 3 rd squares are 2 and 3 respectively, and the numerical value corresponding to the 2 nd square is 2(2-1)2, so the 3 rd square corresponds to a value of 2(3-1)=4;

In this case, a2 is 2+4 — 6.

Third row corresponding first row value (denoted a 3):

since there are no marks in the 4 squares in the third row, no calculation is performed, and a3 is 0.

Fourth row corresponds to the first row value (denoted a 4):

since there is no mark in the 4 squares in the fourth row, no calculation is performed, and a4 is 0.

And finally, integrating the obtained first row values to obtain a first result, wherein the first result can be represented in an array form.

It should be noted that the preset table is not limited to the form of 4 × 4, and may be in other forms, such as the form of 18 × 22, and is not limited herein.

Therefore, according to the target area to be searched, after the preset table is marked, the first row value corresponding to each row can be calculated conveniently, the first result can be determined conveniently, the position of the target area in the preset table is shown through the first result, and therefore the required video can be searched quickly according to the first result, and the purpose of quickly playing back the video is achieved.

In specific implementation, the method for establishing the corresponding relationship between the index data and the type of the target object comprises the following steps:

acquiring an Nth frame of picture in a video and determining the marking information of the Nth frame of picture;

determining a target object, the type of the target object and the position of the target object in the Nth frame of picture according to a second preset algorithm;

the second preset algorithm may be a video structuring algorithm, or may be other algorithms, which is not limited herein as long as the target object in the picture, the type of the target object, and the position of the target object can be determined.

After the N frame of picture is converted into a preset table, marking a target object in the preset table according to the determined position of the target object; wherein different types of target objects adopt different marks;

for each type of target object:

calculating a second row value corresponding to each row of data when only the target objects of the same type exist in the preset table according to a first preset algorithm;

integrating the calculated second row values to obtain a second result for representing the positions of the target objects of the same type in the preset table;

associating the obtained second result with the mark information of the Nth frame of picture to obtain index data;

and establishing a corresponding relation between the obtained index data and the type of the target object.

To explain this, the mark information of the frame picture may further include a time stamp, a frame length, a position offset, and the like. Of course, other information for identifying the frame picture may be included, and is not particularly limited herein.

For example, as shown in fig. 3, the preset table 8 × 6 is taken as an example to explain, the upper left dotted box represents a region where the target object is a person, the upper left dotted box is defined as a dotted box 1, the lower dotted box represents a region where the target object is a car, and the lower dotted box is defined as a dotted box 2.

When the corresponding relation between the people and the index data is established, the process is as follows:

when only the dashed box 1 exists in the preset table, that is, the type of the target object is a person, the preset table is calculated, and a second result is obtained.

The calculation process of the second result may refer to the calculation process of the first result, and repeated details are not repeated.

Further, assuming that the current frame is the 100 th frame, the second result is associated with the mark information of the current 100 th frame to obtain an index data (which may be represented by S1);

and establishing a corresponding relation between the type of the target object and the obtained index data, namely establishing the corresponding relation between the type of the target object and the index data S1.

When the corresponding relation between the vehicle and the index data is established, the process is as follows:

when only the dashed frame 2 exists in the preset table, that is, the type of the target object is vehicle-mounted, the preset table is calculated, and a second result is obtained.

The calculation process of the second result may refer to the calculation process of the first result, and repeated details are not repeated.

Further, assuming that the current frame is the 100 th frame, the second result is associated with the mark information of the current 100 th frame to obtain an index data (which may be represented by S2);

and establishing a corresponding relation between the type of the target object and the obtained index data, namely establishing the corresponding relation between the type of the target object and the index data S2.

Therefore, when a plurality of target objects of the same type exist in the preset table, only one second result needs to be obtained, and the second result is index data after the association is carried out; moreover, the obtained corresponding relation between the index data and the type of the target object can greatly reduce the size of the corresponding relation, so that the occupied memory space when the corresponding relation is stored is smaller, the storage space can be greatly saved, the searching speed can be improved, and the video playback efficiency is improved.

It should be noted that, in the embodiment of the present invention, the size of the preset table mentioned in establishing the corresponding relationship and the preset table mentioned in determining the first result according to the target area to be searched should be the same, so that when performing the operation processing, it can be accurately determined whether the position of the target area overlaps with the position of the target object according to the operation processing result, so as to search the required index data, thereby achieving the purposes of fast positioning and fast playing back the video.

Alternatively, the method in the embodiment of the present invention may be applied to an application scenario including a person and a vehicle, for example, detecting a video recording of an intersection. Of course, the method can also be applied to other application scenes, such as video recording of zoos, wherein the target objects are people, animals and the like; for example, a video recording of the detected weather, and the target object at this time is wind, rain, thunder, or the like. The type of the target object can be set according to actual needs to meet the needs of different application scenes, and the flexibility of design is improved.

In the specific implementation, the correspondence is stored in advance in the header information of the video file in the memory.

As shown in fig. 4, the video file includes header information and video data, where a denotes the header information and B denotes the video data. The header information a includes an index area, and other areas (e.g., black filled areas in a dotted line frame a) storing mark information of the frame picture. The video data B includes frames (e.g., gray filled areas in a dotted line box B). Wherein, the index area stores the corresponding relation.

The type of the frame picture may include an I frame type and a P frame type, and the identification information of the frame picture includes information of the type. Since the I frame represents the key frame, the P frame represents the forward predictive coding frame, the P frame is the frame which takes the I frame as the reference, the P frame is the predicted value and the motion vector which find out the 'certain point' of the P frame in the I frame, and the predicted difference value and the motion vector are taken to be transmitted together. Therefore, when the second result is associated with the flag information of the nth frame picture, only the I frame type is associated, and the P frame type is not associated.

The following describes the above-mentioned video playback method provided by the embodiment of the present invention in detail with reference to specific embodiments.

24页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:基于嵌入式监控设备点对点通信的录像回放方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类