Summary of the invention
The invention provides video retrieval method and device, to improve retrieval rate.
Technical scheme of the present invention is achieved in that
A kind of video retrieval method, this method comprises:
Gather and preserve video sequence;
Video sequence is carried out motion detection, whenever detect a motion segment, calculate and preserve the motion description value of this motion segment;
In the time will in video sequence, retrieving the motion segment, calculate the motion description value of this motion segment that will retrieve, the motion description value of each motion segment of this motion description value that calculates and described preservation is mated one by one, if on the coupling, output this motion segment of preserving then.
Described motion description value is motor area thresholding or movement locus value.
When described motion description value is the motor area thresholding,
The motion description value of described calculating campaign segment comprises: image is described in the moving region of determining this motion segment, and it is n piece that image division is described in this moving region, and wherein, n is a positive integer,
For each piece,, be " 1 " then with this piece value if this piece is arranged in the moving region; Otherwise, be " 0 " with this piece value, the value of n piece is arranged according to pre-defined rule, obtain the motor area thresholding of this motion segment; Perhaps,
For each piece,, be " 0 " then with this piece value if this piece is arranged in the moving region; Otherwise, be " 1 " with this piece value, the value of n piece is arranged according to pre-defined rule, obtain the motor area thresholding of this motion segment.
It is described that image division is described in the moving region is that n piece further comprises: this n piece is numbered from 1 to n,
Described value with n piece is arranged as according to pre-defined rule: with the value of n piece according to its numbering from small to large, arrange from the low level to a high position successively; Perhaps,
With the value of n piece from small to large, from a high position to the low level, arrange successively according to its numbering.
Described to n piece from 1 to n be numbered for: the probability that prospect occurs according to each piece is numbered from 1 to n n piece from high to low successively; Perhaps, the probability that prospect occurs according to each piece is numbered from 1 to n n piece from low to high successively.
Described image division is described in the moving region is that n piece is: it is n the piece that size is identical that image division is described in the moving region, perhaps,
According to the area of each piece on the high zone of the prospect probability of occurrence principle less than the area of each piece on the low zone of prospect probability of occurrence, it is n piece that image division is described in the moving region.
When described motion description value is the movement locus value,
The movement locus value of described calculating campaign segment comprises: image is described in the moving region of determining this motion segment, it is n piece that image division is described in this moving region, calculate the center of gravity that each prospect in the image is described in the moving region, the center of gravity of every adjacent two prospects is linked to each other, obtain movement locus, wherein, n is a positive integer;
For each piece,, be " 1 " then with this piece value if this piece is positioned on the movement locus; Otherwise, be " 0 " with this piece value, the value of n piece is arranged according to pre-defined rule, obtain the movement locus value of this motion segment; Perhaps,
For each piece,, be " 0 " then with this piece value if this piece is positioned on the movement locus; Otherwise, be " 1 " with this piece value, the value of n piece is arranged according to pre-defined rule, obtain the movement locus value of this motion segment.
Described motion description value is with binary representation,
The motion description value of each motion segment of described motion description value that will calculate and preservation is mated one by one and comprised: the motion description value step-by-step of the motion description value that will calculate and each motion segment of preservation is carried out and computing, if the result who obtains greater than preset value, then determines on the coupling.
A kind of video frequency searching device, this device comprises:
Acquisition module is gathered video sequence, and video sequence is saved in the buffer memory;
Motion description value computing module, the video sequence that collects is carried out motion detection, whenever detect a motion segment, calculate the motion description value of this motion segment, the motion description value of motion segment and the corresponding relation of motion segment index are saved in the database; Image is described in the motion that receives the motion segment that will retrieve of user's input, calculates the motion description value that the image correspondence is described in this motion, and this motion description value is sent to retrieval module;
Retrieval module receives motion description value, and the motion description value of each motion segment that this motion description value and database are preserved is mated one by one, if on the coupling, reads the motion segment and offers the user from buffer memory according to the motion segment index on mating.
Described motion description value computing module comprises:
The moving region determination module carries out motion detection to the video sequence that collects, and whenever detects a motion segment, determines that image is described in the moving region of this video sequence, image is described in the moving region send to piece division module;
Piece is divided module, and it is n piece that image division is described in the moving region that receives, and the moving region after piece is divided is described image and sent to motor area thresholding computing module, and wherein, n is a positive integer;
Motor area thresholding computing module is described each piece in the image for the moving region that receives, if this piece is arranged in the moving region, is " 1 " with this piece value then; Otherwise, be " 0 " with this piece value; Perhaps, for each piece,, be " 0 " then with this piece value if this piece is arranged in the moving region; Otherwise, with this piece value is " 1 ", and the value of n piece is arranged according to pre-defined rule, obtains the motor area thresholding of motion segment, the corresponding relation of this motor area thresholding and motion segment index is saved in the database, perhaps the motor area thresholding is sent to retrieval module.
Described motion description value computing module comprises:
The moving region determination module carries out motion detection to the video sequence that collects, and whenever detects a motion segment, determines that image is described in the moving region of this motion segment, image is described in the moving region send to piece division module;
Piece is divided module, and it is n piece that image division is described in the moving region that receives, and the moving region after piece is divided is described image and sent to the movement locus determination module; It is n piece that the movement locus that receives is described image division, and the movement locus after piece is divided is described image and sent to movement locus value computing module;
The movement locus determination module calculates the center of gravity that each prospect in the image is described in the moving region that receives, and the center of gravity of every adjacent two prospects is continuous, obtains the movement locus mask image, and the movement locus mask image is sent to movement locus value computing module;
Movement locus value computing module is described each piece in the image for the movement locus mask image that receives or movement locus, if this piece is positioned on the movement locus, is " 1 " with this piece value then; Otherwise, be " 0 " with this piece value; Perhaps, for each piece,, be " 0 " then with this piece value if this piece is positioned on the movement locus; Otherwise, be " 1 " with this piece value, the value of n piece is arranged according to pre-defined rule, obtain the movement locus value, the corresponding relation of movement locus value and motion segment index is saved in the database, perhaps the movement locus value is sent to retrieval module.
Described retrieval module comprises:
The match retrieval module, the motion description value that receives that motion description value computing module sends with the motion segment that will retrieve of binary representation, with this motion description value respectively with database in the motion description value step-by-step with each motion segment of binary representation of preserving carry out and computing, to output to judge module with operation result, if receive the coupling indication of judge module output, then read the motion segment and offer the user from buffer memory according to the motion segment index on the coupling;
Judge module receives that the match retrieval module is sent and operation result, if this result greater than preset value, then returns the coupling indication to the match retrieval module.
Compared with prior art, the present invention whenever detects a motion segment by the video sequence that collects is carried out motion detection, calculates and preserve the motion description value of this motion segment; In the time will from video sequence, retrieving the motion segment, calculate the motion description value of this motion segment that will retrieve, the motion description value of each motion segment of this motion description value that calculates and described preservation is mated one by one, if on the coupling, this motion segment in the output database then.The present invention quantizes the motion detection result of video sequence, needn't use complicated multimedia database and only need use the relevant database of existing technology maturation can realize the retrieval of video data, realizes simply, has improved retrieval rate.
Embodiment
The present invention is further described in more detail below in conjunction with drawings and the specific embodiments.
The process flow diagram of the video frequency searching that Fig. 2 provides for the embodiment of the invention one, as shown in Figure 2, its concrete steps are as follows:
Step 201: gather and preserve a video sequence under the scene; Simultaneously, this video sequence is carried out motion detection, whenever detect a motion segment, determine that image is described in the moving region of this motion segment.
The starting point of a motion segment is the frame that detects the motion beginning, the frame that terminating point finishes for this motion.May there be a plurality of motion segments in the video sequence, for example: if video sequence totally 1000 frames, wherein, do not detect motion in 1~500 frame, detect motion in 501~700 frames, do not detect motion in 701~800 frames, detect motion in 801~1000 frames, then have two motion segments in this video sequence: 501~700 frames, 801~1000 frames, image is described in the corresponding moving region of each motion segment, is used for the moving region of description prospect in this motion segment.
Usually, the every two field picture in the moving region size of describing image and the video sequence is big or small identical.
If do not have prospect in this video sequence, perhaps prospect does not move, and does not then just exist the moving region to describe image.
Step 202: according to predefined division methods, it is n piece that image division is described in each moving region, with n piece be numbered 1,2 respectively ..., n.
For different scenes, the piece division methods possibility that image is described in motion is different.
N is a positive integer, and the value of n can rule of thumb determine, usually n<<image resolution ratio.When n is big, desirable n=2
m, wherein, m is a positive integer.The size of n piece can be identical, shown in Fig. 3-1; Also can be different, shown in Fig. 3-2, for prospect probability of occurrence lower, the area of piece can be bigger, and for prospect probability of occurrence higher position, the area of piece can be less, in Fig. 3-2, piece 1~16 is a prospect probability of occurrence higher position.Adjacent block can be overlapping, and shown in Fig. 3-3, piece 2,4,5 is overlapping.
To block number the time, can position on the image be described in the moving region according to piece, number consecutively from top to bottom from left to right, also can be numbered according to the importance of piece, for example: can adjacently number for the piece on the higher zone of prospect probability of occurrence, shown in Fig. 3-2, piece 1~16 adjacent numbering that the prospect probability of occurrence is higher.
For the moving region n piece on the image described, according to its numbering from low to high, execution in step 203~206 respectively:
Step 203: judge whether this piece is the moving region, if, execution in step 204; Otherwise, execution in step 205.
Step 204: the value of this piece is changed to " 1 ", goes to step 206.
Step 205: the value of this piece is changed to " 0 ".
In actual applications, when piece is the moving region, also the value of piece can be changed to " 0 ", simultaneously, when piece is not the moving region, the value of piece be changed to " 1 ".
Step 206: whether the numbering of judging current block is n, if, execution in step 208; Otherwise, execution in step 207.
Step 207: the numbering of piece is added 1, return step 203.
Step 208: from low to high according to the numbering of n piece, the value of n piece is arranged from a high position to the low level successively, obtain the binary number of a n position, the binary number of this n position as the motor area thresholding, is saved in the index of motion segment and the corresponding relation of motor area thresholding in the monitor database.
The index of motion segment can be the motion segment initial moment+termination constantly, also can be initial moment+continue duration.
In actual applications, also can according to the numbering of n piece from low to high the value of n piece be arranged from the low level to a high position successively.
Step 209: in the time will in the video sequence under certain scene, retrieving the motion segment that satisfies the moving region of setting, according to the scene identity of record and the corresponding relation of piece division methods, determine the piece division methods under this scene, image is described in the moving region of this setting carry out the piece division, obtain the motor area thresholding of this motion segment.
Step 210: if the motor area thresholding coupling of each motion segment that motor area thresholding and the monitor database determined in the step 209 are preserved on the coupling, then according to the index of this motion segment, finds this motion segment in the video sequence of preservation.
Here, with the motor area thresholding determined in the step 209 respectively with monitor database in the motor area thresholding step-by-step work and the computing of each motion segment of preserving, as long as one of them is arranged with operation result be 1, then think on the coupling; Perhaps, with the motor area thresholding determined in the step 209 respectively with monitor database in the motor area thresholding step-by-step work and the computing of each motion segment of preserving, with all result bits additions that obtain, if the value that obtains greater than preset value, is then thought on the coupling.
In actual applications, longer for fear of the motion segment, can preestablish a motion segment maximum length Lmax, if detected motion fragment length L>Lmax, then be at interval, L is divided into a plurality of intervals, the motion segment on each interval is calculated the motor area thresholding with Lmax.
Fig. 4-1 has provided the moving region that a video sequence is carried out the motion segment that motion detection obtains and has described image, shown in Fig. 4-1, comprises 6 human bodies among the figure, represents respectively that from left to right a people is in difference position constantly.Fig. 4-2 has provided image division is described in the moving region is n piece, and moving region mask image to obtaining after each piece value, shown in Fig. 4-2, dash area among the figure is the moving region, if n piece is numbered 1,2 from top to bottom from left to right respectively ..., n, then the motor area thresholding is 0x0063e6fe3c380000, and wherein, 0x represents 16 systems.
Fig. 2 has provided by each the motion segment in the video sequence is identified with a motor area thresholding, thereby scheme according to the motor area thresholding retrieve video sequence of motion segment, in actual applications, also each the motion segment in the video sequence can be identified with a movement locus value, thereby according to movement locus value retrieve video sequence.
The process flow diagram of the video frequency searching that Fig. 5 provides for the embodiment of the invention two, as shown in Figure 5, its concrete steps are as follows:
Step 501~502 are identical with step 201~202.
Step 503: each prospect that each moving region is described in the image is carried out center of gravity calculation, obtain the center of gravity of each prospect.
Shown in Fig. 4-1, each human body, i.e. corresponding irregular figure of prospect, the center of gravity of this irregular figure is the center of gravity of this human body, can obtain 6 gravity center of human body altogether.
Step 504: the center of gravity straight line of adjacent prospect is linked to each other, obtain the movement locus mask image.
For example: for 6 gravity center of human body that obtain according to Fig. 4-1, every adjacent two gravity center of human body's straight lines are linked to each other, just can obtain this people's movement locus, Fig. 4-3 is the movement locus mask image.
For the piece of the n on the movement locus mask image, according to its numbering from low to high, difference execution in step 505~508:
Step 505: judge whether this piece is the movement locus zone, if, execution in step 506; Otherwise, execution in step 507.
Step 506: the value of this piece is changed to " 1 ", goes to step 508.
Step 507: the value of this piece is changed to " 0 ".
In actual applications,, also the value of piece can be changed to " 0 ", simultaneously, when piece be movement locus when regional, the value of piece be changed to " 1 " when piece is movement locus when zone.
Step 508: whether the numbering of judging current block is n, if, execution in step 510; Otherwise, execution in step 509.
Step 509: the numbering of piece is added 1, return step 505.
Step 510: from low to high according to the numbering of n piece, the value of n piece is arranged from a high position to the low level successively, obtain the binary number of a n position, the binary number of this n position as the movement locus value, is saved in the index of motion segment and the corresponding relation of motor area thresholding in the monitor database.
The index of motion segment can be the motion segment initial moment+termination constantly, also can be initial moment+continue duration.
Movement locus value as Fig. 4-3 expression is 0xc3663c000000, and wherein, 0x represents 16 systems.
In actual applications, also can according to the numbering of n piece from low to high the value of n piece be arranged from the low level to a high position successively.
Step 511: in the time will in the video sequence under certain scene, retrieving the motion segment that satisfies the movement locus of setting, according to the scene identity of record and the corresponding relation of piece division methods, determine the piece division methods under this scene, the movement locus of this setting is described image carry out the piece division, obtain the movement locus value of this motion segment.
Fig. 6-1 is that a movement locus to the motion segment that will retrieve is described image and carried out the synoptic diagram that piece is divided, and Fig. 6-2 be the movement locus mask image of constructing according to Fig. 6-1, can obtain the movement locus value of this motion segment according to Fig. 6-2.
Step 512: if the movement locus value coupling of each motion segment that movement locus value and the monitor database determined in the step 511 are preserved on the coupling, then according to the index of this motion segment, finds this motion segment in the video sequence of preservation.
Here, with the movement locus value determined in the step 511 respectively with monitor database in the movement locus value step-by-step work and the computing of each motion segment of preserving, as long as one of them is arranged with operation result be 1, then think on the coupling; Perhaps, with the movement locus value determined in the step 511 respectively with monitor database in the movement locus value step-by-step work and the computing of each motion segment of preserving, with all result bits additions that obtain, if the value that obtains greater than preset value, is then thought on the coupling.
The composition diagram of the video frequency searching device that Fig. 7 provides for the embodiment of the invention, as shown in Figure 7, it mainly comprises: video acquisition module 71, motion description value computing module 72 and retrieval module 73, wherein:
Video acquisition module 71: gather the video sequence under the scene, video sequence is saved in the buffer memory.
Motion description value computing module 72: from buffer memory, take out video sequence successively, this video sequence is carried out motion detection, whenever detect a motion segment, calculate the motion description value of this motion segment, the motion description value of motion segment and the corresponding relation of motion segment index are saved in the monitor database; Image is described in the motion that receives the motion segment that will retrieve of user's input, calculates the motion description value that image is described in this motion, and this motion description value is sent to retrieval module 73.
Retrieval module 73: the motion description value of the motion segment that will retrieve that reception motion description value computing module 72 is sent, the motion description value of each motion segment of preserving in this motion description value and the monitor database is mated one by one, if on the coupling, then from buffer memory, read the motion segment and offer the user according to the motion segment index on the coupling.
The composition diagram of the motion description value computing module 72 that Fig. 8 provides for the embodiment of the invention one, as shown in Figure 8, motion description value computing module 72 can comprise: moving region determination module 721, piece are divided module 722 and motor area thresholding computing module 723, wherein:
Moving region determination module 721: from buffer memory, take out video sequence, this video sequence is carried out motion detection, whenever detect a motion segment, determine that image is described in the moving region of this motion segment, image and motion segment index are described in this moving region output to piece and divide module 722.
Piece is divided module 722: image and motion segment index are described in the moving region that reception moving region determination module 721 is sent, it is n piece that image division is described in the moving region, image is described in the moving region after dividing and the motion segment index outputs to motor area thresholding computing module 723; Image and scene identity are described in the motion that receives the motion segment that will retrieve of user's input, according to the scene identity of preserving and the corresponding relation of piece division methods, determine the piece division methods of the scene identity correspondence of input, according to this piece division methods, it is n piece that image division is described in the moving region of input, image is described in moving region after dividing and the retrieval sign sends to motor area thresholding computing module 723, wherein, n is a positive integer.
Motor area thresholding computing module 723: receiving piece and divide the moving region that module 722 sends and describe image, describe each piece in the image for the moving region, if this piece is arranged in the moving region, is " 1 " with this piece value then; Otherwise, be " 0 " with this piece value; Perhaps, for each piece,, be " 0 " then with this piece value if this piece is arranged in the moving region; Otherwise, with this piece value is " 1 ", the value of n piece is arranged according to pre-defined rule, obtain the motor area thresholding, divide the motion segment index that module 722 is sent if receive piece, then the corresponding relation with motor area thresholding and motion segment index is saved in the monitor database, divides the retrieval sign that module 722 is sent if receive piece, then the motor area thresholding is sent to retrieval module 73.
The composition diagram of the motion description value computing module 72 that Fig. 9 provides for the embodiment of the invention two, as shown in Figure 9, motion description value computing module 72 can comprise: moving region determination module 821, piece are divided module 822, movement locus determination module 823 and movement locus value computing module 824, wherein:
Moving region determination module 821: from buffer memory, take out video sequence, this video sequence is carried out motion detection, whenever detect a motion segment, determine that image is described in the moving region of this motion segment, image and motion segment index are described in the moving region output to piece and divide module 822.
Piece is divided module 822: image and motion segment index are described in the moving region that reception moving region determination module 821 is sent, it is n piece that image division is described in the moving region, image is described in moving region after dividing and the motion segment index sends to movement locus determination module 823; Image and scene identity are described in the motion that receives the motion segment that will retrieve of user's input, according to the scene identity of preserving and the corresponding relation of piece division methods, determine the piece division methods of the scene identity correspondence of input, according to this piece division methods, it is n piece that the movement locus of input is described image division, movement locus after the piece division is described image send to movement locus value computing module 824, perhaps, movement locus after further dividing according to piece is described image configuration movement locus mask image, movement locus mask image after the piece division is sent to movement locus value computing module 824, wherein, n is a positive integer.
Movement locus determination module 823: image and motion segment index are described in the moving region that reception piece division module 822 is sent, calculate the center of gravity that each prospect in the image is described in the moving region, the center of gravity straight line of every adjacent two prospects is linked to each other, obtain the movement locus mask image, movement locus mask image and motion segment index are sent to movement locus value computing module 824; Image and retrieval sign are described in the moving region that reception piece division module 822 is sent, calculate the center of gravity that each prospect in the image is described in the moving region, the center of gravity straight line of every adjacent two prospects is linked to each other, obtain the movement locus mask image, movement locus mask image and motion segment index are sent to movement locus value computing module 824.
Movement locus value computing module 824: receiving movement locus determination module 823 or piece and divide the movement locus mask image that module 822 is sent, for each piece in the movement locus mask image, if this piece is positioned on the movement locus, is " 1 " with this piece value then; Otherwise, be " 0 " with this piece value; Perhaps, for each piece,, be " 0 " then with this piece value if this piece is positioned on the movement locus; Otherwise, with this piece value is " 1 ", the value of n piece is arranged according to pre-defined rule, obtain the movement locus value, if the movement locus mask image is from movement locus determination module 823, then movement locus value and the corresponding relation that reaches the motion segment index are saved in the monitor database,, then the movement locus value are sent to retrieval module 73 if the movement locus mask image is divided module 822 from piece.
The composition diagram of the retrieval module 73 that Figure 10 provides for the embodiment of the invention, as shown in figure 10, retrieval module 73 can comprise: match retrieval module 731 and judge module 732, wherein:
Match retrieval module 731: the motion description value that receives that motion description value computing module 72 sends with the motion segment that will retrieve of binary representation, this motion description value is carried out and computing with the motion description value step-by-step with each motion segment of binary representation that motion description value computing module 72 is preserved respectively, to output to judge module 732 with operation result, if receive the coupling indication of judge module 732 outputs, then from buffer memory, read the motion segment and offer the user according to the motion segment index on the coupling.
Judge module 732: receive match retrieval module 731 send and operation results, if this result greater than preset value, then returns the coupling indication to match retrieval module 731.
The above only is process of the present invention and method embodiment, in order to restriction the present invention, all any modifications of being made within the spirit and principles in the present invention, is not equal to replacement, improvement etc., all should be included within protection scope of the present invention.