Summary of the invention
The invention provides a kind of video frequency monitoring method and video monitoring system, improved the integrality and the definition of the video data of a plurality of camera outputs.
Technical scheme of the present invention is: a kind of video frequency monitoring method, and it comprises step:
Step 1, by first camera collection, first video data, by second camera collection, second video data;
Step 2, when described first video data and second video data are overlapping, then extract described first video data in first overlapped data of overlapping region and described second video data second overlapped data in the overlapping region;
Step 3, described first overlapped data is converted to first gray-scale map, described second overlapped data is converted to second gray-scale map;
Step 4, to described first gray-scale map in the pixel of first presumptive area and second gray-scale map pixel in second presumptive area, adopt by pixel method relatively the positional information that the pixel of utilizing the piece adaptation function to calculate the pixel of described first presumptive area and described second presumptive area is complementary;
Step 5, go out the vertical and horizontal offset of relative second gray-scale map of described first gray-scale map, described first video data and second video data are spliced according to described vertical and horizontal offset according to described positional information calculation.
The present invention has also disclosed a kind of video monitoring system, and it comprises:
First camera is used to gather first video data;
Second camera is used to gather second video data;
Extraction module when described first video data and second video data are overlapping, is used to extract described first video data in first overlapped data of overlapping region and described second video data second overlapped data in the overlapping region;
Modular converter is used for described first overlapped data is converted to first gray-scale map, and described second overlapped data is converted to second gray-scale map;
Computing module, be used for described first gray-scale map in the pixel of first presumptive area and second gray-scale map pixel in second presumptive area, adopt by pixel method relatively the positional information that the pixel of utilizing the piece adaptation function to calculate the pixel of described first presumptive area and described second presumptive area is complementary;
Concatenation module goes out the vertical and horizontal offset of relative second gray-scale map of described first gray-scale map according to described positional information calculation, according to described vertical and horizontal offset described first video data and second video data is spliced.
Video frequency monitoring method of the present invention and video monitoring system, described video frequency monitoring method can be when described first video data and second video data be overlapping, calculate the vertical and horizontal offset of relative second video data of first video data, according to described vertical and horizontal offset described first video data and second video data are spliced processing, make the video data comparison complete sum of win camera and the output of second camera clear, the overlapping video data can not occur, make things convenient for the user to check; Owing to the wide coverage of a plurality of cameras, then can realize in addition large-scale video monitoring.
Embodiment
Video frequency monitoring method of the present invention and video monitoring system, described video frequency monitoring method can be when described first video data and second video data be overlapping, calculate the vertical and horizontal offset of relative second video data of first video data, according to described vertical and horizontal offset described first video data and second video data are spliced processing, make the video data comparison complete sum of win camera and the output of second camera clear, the overlapping video data can not occur, make things convenient for the user to check; Owing to the wide coverage of a plurality of cameras, then can realize in addition large-scale video monitoring.
Below in conjunction with accompanying drawing specific embodiments of the invention are done a detailed elaboration.
Video frequency monitoring method of the present invention as Fig. 1, comprises step:
S101, by first camera collection, first video data, by second camera collection, second video data; The angle that first camera and second camera are installed can be installed as required, enlarges the scope of video monitoring by two cameras are installed.
S102, when described first video data and second video data are overlapping, then extract described first video data in first overlapped data of overlapping region and described second video data second overlapped data in the overlapping region; In a preferred embodiment, before when described first video data and second video data are overlapping, can also comprise step: it is overlapping whether the video data that the setting angle by described first camera and second camera detects described first camera and the output of second camera has, and also can judge whether the video data of described first camera and the output of second camera has overlapping by other method.After having judged the overlapping angle of first video data and second video data, can extract described first video data in first overlapped data of overlapping region and described second video data second overlapped data according to described overlapping angle in the overlapping region.
S103, described first overlapped data is converted to first gray-scale map, described second overlapped data is converted to second gray-scale map.
S104, to described first gray-scale map in the pixel of first presumptive area and second gray-scale map pixel in second presumptive area, adopt by pixel method relatively the positional information that the pixel of utilizing the piece adaptation function to calculate the pixel of described first presumptive area and described second presumptive area is complementary.
First presumptive area can be a part of data of first gray-scale map, it also can be the total data of first gray-scale map, second presumptive area can be a part of data of second gray-scale map, it also can be the total data of second gray-scale map, when first presumptive area be the total data of first gray-scale map, when second presumptive area is the total data of second gray-scale map, the positional information that the pixel of utilizing the piece adaptation function to calculate the pixel of described first presumptive area and described second presumptive area is complementary is the most accurate.This piece adaptation function can be the average of calculating pixel difference absolute value in a preferred embodiment, can certainly adopt other piece adaptation function to calculate.Adopt by pixel method relatively, the positional information that the pixel of utilizing the piece adaptation function to calculate the pixel of described first presumptive area and described second presumptive area is complementary, specifically can be: get each pixel of first presumptive area and each pixel of second presumptive area respectively, calculate the average of pixel difference absolute value of each pixel of each pixel of first presumptive area and second presumptive area, the minimum value of the average of the plain difference of capture absolute value, certain locations of pixels information of certain the locations of pixels information of first presumptive area and second presumptive area when average of recording pixel difference absolute value is got minimum value.
S105, go out the vertical and horizontal offset of relative second gray-scale map of described first gray-scale map, described first video data and second video data are spliced according to described vertical and horizontal offset according to described positional information calculation.Can know the vertical and horizontal offset of relative second gray-scale map of described first gray-scale map according to described positional information, thereby can splice first video data and second video data according to vertical and horizontal offset.
Need to prove, in actual applications, can also gather video data, design according to actual needs by more than two cameras, the video monitoring range of camera is wider like this, only shows first camera and second camera in the above-described embodiments.
In order to prevent that first video data or second video data from shake occurring or deformity occurring, in a preferred embodiment, described first video data or second video data are through the data behind the video correction, as Fig. 2, can also comprise described video correction process S1011 between step S101 and step S102, described first video data or second video data are carried out video correction, detailed process comprises as follows:
Step 1, described first video data of preliminary election or second video data as benchmark image, obtain the angle point of described benchmark image in the data of predetermined instant; This angle point promptly is the characteristic point of described benchmark image;
Step 2, obtain the match point of described first video data or the described relatively angle point of the data of second video data behind described predetermined instant by zone coupling;
Step 3, calculate the motion excursion amount of described match point with respect to described angle point according to affine model; According to described motion excursion amount described first video data or second video data are carried out motion compensation.
In a preferred embodiment, described affine model is four parameter affine models.
In a preferred embodiment, in described step S1011, can also comprise step: the distinguishing characteristics that detects described first video data or the described relatively benchmark image of the data of second video data behind described predetermined instant, when described distinguishing characteristics satisfies predetermined condition, be benchmark image with the Data Update behind the described predetermined instant.This distinguishing characteristics can be features such as light or side-play amount, and predetermined condition is predefined, is predefined light or side-play amount equivalence, when light or side-play amount etc. satisfies predefined value, just needs to upgrade benchmark image.By bringing in constant renewal in benchmark image, can improve the effect of video correction, prevent that small shake from appearring in video data.
Below in conjunction with specific embodiment the method for above-mentioned first video data and the splicing of second video data is done a detailed elaboration:
Consider that first video data and second video data need do the splicing on level and the vertical direction, taked by pixel way relatively.If first video data is I, second video data is J, and its size is respectively Wi, hi and Wj, hj, and hi=hj is then arranged, and Wi and Wj represent the width of first video data and second video data, and hi and hj represent the height of first video data and second video data.
1. getting I the right and J left side size is
The zone be the overlapping region, change respectively
Changing first video data and second video data data in the overlapping region is gray-scale map I
rAnd J
l
2. establish w for comparing width, h is than height,
For?h=(-Δh,+Δh)
For
If?h<0
Calculate D[I
r(1~w ,-h~h
i), J
l(1~w, 1~h+h
j)];
Else
Calculate D[I
r(1~w, 1~h
i-h), J
l(1~w, h~h
j)];
Get the coordinate information of the corresponding pixel of minimum D value, calculate the vertical and horizontal offset of relative second video data of first video data according to the coordinate information of the pixel of correspondence, first video data and second video data are spliced according to described vertical and horizontal offset.
Wherein (I J) is the piece adaptation function to D, is defined as the average of pixel difference absolute value here.I (x
1~x
2, y
1~y
2) represent to get the subimage of image I, its coordinate range is x ∈ [x
1, x
2], y ∈ [y
1, y
2].The video data coordinate is since 1.Δ h is the hunting zone on the vertical direction of being scheduled to, and can get h/20 in realization.
The present invention has also disclosed a kind of video monitoring system, as Fig. 3, comprising: first camera, second camera, extraction module, modular converter, computing module and concatenation module; The output of described first camera and second camera is connected with the input of extraction module respectively, and the output of extraction module is connected with concatenation module by modular converter, computing module successively;
First camera is used to gather first video data;
Second camera is used to gather second video data; The angle that first camera and second camera are installed can be installed as required, can enlarge the scope of video monitoring by two cameras are installed;
Extraction module when described first video data and second video data are overlapping, is used to extract described first video data in first overlapped data of overlapping region and described second video data second overlapped data in the overlapping region; In a preferred embodiment, described extraction module also be used for according to the angle that described first camera and second camera are installed detect described first video data and second video data whether overlapping, also can detect described first video data by other method and second video data whether overlapping; After having detected overlapping angle, can extract described first video data in first overlapped data of overlapping region and described second video data second overlapped data according to described overlapping angle in the overlapping region;
Modular converter is used for described first overlapped data is converted to first gray-scale map, and described second overlapped data is converted to second gray-scale map;
Computing module, be used for described first gray-scale map in the pixel of first presumptive area and second gray-scale map pixel in second presumptive area, adopt by pixel method relatively the positional information that the pixel of utilizing the piece adaptation function to calculate the pixel of described first presumptive area and described second presumptive area is complementary; In a preferred embodiment, described adaptation function is the average that is used for calculating pixel difference absolute value, also can adopt other piece adaptation function to calculate; The positional information that the pixel of utilizing the piece adaptation function to calculate the pixel of described first presumptive area and described second presumptive area is complementary, be specifically as follows: calculate the average of absolute value of difference of the pixel of the pixel of described first presumptive area and second presumptive area, the locations of pixels information of getting the locations of pixels information of pairing described first presumptive area of minimum mean and described second presumptive area is as the positional information that is complementary.
Concatenation module goes out the vertical and horizontal offset of relative second gray-scale map of described first gray-scale map according to described positional information calculation, according to described vertical and horizontal offset described first video data and second video data is spliced.
In a preferred embodiment, as Fig. 4, video monitoring system of the present invention also comprises the video correction module, is connected between the input of the output of described first camera and second camera and described extraction module, is used for:
Described first video data of preliminary election or second video data as benchmark image, obtain the angle point of described benchmark image in the data of predetermined instant;
Obtain the match point of described first video data or the described relatively angle point of the data of second video data behind described predetermined instant by the zone coupling;
Calculate the motion excursion amount of described match point according to affine model with respect to described angle point; According to described motion excursion amount described first video data or second video data are carried out motion compensation.
So just can carry out video correction, prevent that the phenomenon of shake or deformity from appearring in first video data or second video data first video data or second video data.
In a preferred embodiment, described affine model is four parameter affine models.
In a preferred embodiment, video monitoring system of the present invention also comprises the detection module that is connected with described video correction module, it is used to detect the distinguishing characteristics of described first video data or the described relatively benchmark image of the data of second video data behind described predetermined instant, when described distinguishing characteristics satisfies predetermined condition, be benchmark image with the Data Update behind the described predetermined instant.This distinguishing characteristics can be features such as light or side-play amount, and predetermined condition is predefined, is the sizes values of predefined light or side-play amount etc., when light or side-play amount etc. satisfies predefined sizes values, just needs to upgrade benchmark image.By bringing in constant renewal in benchmark image, can improve the effect of video correction, prevent that small shake from appearring in video data.
Above-described embodiment of the present invention does not constitute the qualification to protection range of the present invention.Any modification of being done within the spirit and principles in the present invention, be equal to and replace and improvement etc., all should be included within the claim protection range of the present invention.