Presetting bit method and control system
Technical Field
The invention relates to the field of cameras and video monitoring, in particular to a presetting bit method and a control system.
Background
In the field of security monitoring, monitored key areas need to be linked with the operation condition of a dome camera, a plurality of specific monitoring area positions need to be set and stored in a rear-end controller, and when the areas need to be monitored, the controller calls the set preset positions by sending commands. The preset bit setting and calling mode usually needs to store direction information, Zoom (magnification) and Focus (aggregation) of the dome camera at the same time when the preset bit is set, and only under the specific Zoom, the preset bit can be called quickly and accurately when the preset bit is called, so that the stored data volume is large when the preset bit is set, but the information is less, and when the preset bit is called, the specific Zoom is needed to be accurately positioned.
Disclosure of Invention
The invention aims to provide a presetting bit method and a control system, which solve the problem that a dome camera can accurately preset bits under different zooms in any direction.
The purpose of the invention is realized by the following technical method:
a method of presetting bits, comprising the steps of: a preset bit setting step and a preset bit calling step,
the preset bit setting step comprises the following steps:
(A1) after the system is initialized, the center of the camera image is aligned with a specified target,
(A2) sending the direction information of the dome camera and the Zoom value in a given range to the all-in-one machine, wherein the direction information comprises the horizontal angle of the dome camera and the vertical angle of the dome camera,
(A3) the all-in-one machine utilizes automatic focusing to make the image target clear and obtain the current Focus value under the Zoom value,
(A4) calculating the line number of the current preset point by using the current Zoom value and the Focus value according to a linear interpolation method in a line number database, wherein the line number comprises the Zoom value and the Focus value corresponding to the current direction information,
(A5) the current direction information and the line number are stored,
(A6) repeating the steps from (A1) to (A5) according to the number of preset positions, and storing the direction information corresponding to all preset position setting points and the line numbers obtained by calculation to form a preset position information table;
the preset bit calling step comprises the following steps:
(B1) after the system is initialized, the center of the camera image is aligned with a specified target,
(B2) sending the direction information of the dome camera and any Zoom value to the all-in-one machine,
(B3) inquiring the stored direction information and line number when the preset bit is set, and judging whether the current corresponding direction information exists,
(B4) if (B3) the corresponding direction information can be searched, the current line number is directly searched,
(B5) if the corresponding direction information can not be inquired (B3), searching and calculating the line number by an interpolation calculation method,
(B6) after the line number obtained through (B4) or (B5), calculating a corresponding Focus value according to the line number and the Zoom value in (B1), thereby rapidly obtaining a clear image,
(B7) repeating the steps (B1) to (B6) according to the specified preset bit calling number.
Presetting a bit setting: and setting the current line number according to the direction information of the dome camera and the magnification Zoom in a given range.
Calling a preset bit: and searching the current corresponding line number according to the direction information of the dome camera received by the all-in-one machine and any current magnification factor and a correlation method.
Specifically speaking: when the center of the camera image is aligned with a specified target, direction information including a horizontal angle and a vertical angle of the dome camera and a Zoom value in a given range are acquired from the dome camera according to the dome camera control equipment. And under the Zoom value, the all-in-one machine core makes an image target clear by utilizing automatic focusing and acquires a current Focus value, and then calculates the line number of the current preset point according to the database by utilizing the current Zoom value and the Focus value. The line number at this time is the Zoom value and the Focus value at the current horizontal angle and the vertical angle, and the Focus value corresponding to the Zoom value is different, so the line number information corresponds to a plurality of Zoom values and Focus values corresponding to one-to-one mapping.
The preset position setting needs to store the horizontal angle and the vertical angle of the ball machine corresponding to all the preset position setting points and the line number obtained through calculation.
The preset position calling comprises the steps of setting the horizontal angle, the vertical angle and the Zoom value of the dome camera, solving the current line number according to the relation between the stored dome camera angle information and the line number when the preset position is set, and calculating the corresponding Focus value according to the Zoom value and the searched line number, so that the all-in-one machine can clearly align to the preset position calling point. Therefore, the present invention does not need to store Focus values, and the Zoom value at the time of call can be any Zoom value.
It can be seen from the above that, the line number is obtained by using the curve relationship between the Zoom value and the Focus value, and the traditional way of storing the Zoom value and the Focus value is changed by using the way of storing the line number, so that the clear calling of the image can be realized only by calling the line number and any Zoom value, therefore, the amplification factor when the preset bit is called has no relationship with the amplification factor when the preset bit is set, is not restricted by the amplification factor when the preset bit is set, and can be any amplification factor.
When the preset position is called, all the angle information of the dome camera cannot be found in the storage table, therefore, an interpolation calculation method is needed to search and calculate the line number, the interpolation method is to adopt the line number with the closest horizontal angle and the closest vertical angle of the dome camera in the direction, and the more accurate line number at the moment is calculated by a linear interpolation method.
The Zoom value range in (A2) is。
The preset information table comprises line number data, dome camera horizontal angle data and dome camera vertical angle data.
(B5) The formula adopted in the method for searching and calculating the line number by an interpolation calculation is as follows:
;
wherein,andrespectively horizontal and vertical interpolation coefficients,is based onToAndthe distance between the two or more of the three or more of,is based onToAndthe following are specific examples:
;(ii) a (B2) The direction information of the ball machine is as follows: horizontal anglePerpendicular angle,、At an angle to the horizontalThe adjacent horizontal angles are arranged in a way that,、at an angle to the verticalThe adjacent vertical angles are such that, x,yindicating finding and calculating lines by interpolationThe number of the mobile station is, i,jindicating horizontal anglePerpendicular angleThe number of the lines of the composition, i+1,jindicating horizontal anglePerpendicular angleThe number of the lines of the composition, i,j+1indicating horizontal anglePerpendicular angleThe number of the lines of the composition, i+1,j+1indicating horizontal anglePerpendicular angleThe number of the lines of the composition,
the calculation formula is realized by fixed-point processing in a processor,andare normalized to 128 or 256,、、all represent horizontal angles,、、All represent vertical angles。
One direction information composed of one dome machine horizontal angle data and one dome machine vertical angle data corresponds to one line number, and one line number corresponds to a plurality of magnification Zoom values and Focus values under the corresponding magnification Zoom values.
The current Focus value is obtained by calculating the current Focus value according to the direction information and the Zoom value, wherein the calculation method is to make the target image clear under the Zoom value in a given range and record the Focus value at the moment.
A control system generated according to the preset bit method,
comprises ball machine control equipment capable of sending commands to a ball machine,
comprises a command analysis module which can analyze a command header,
comprises a Focus calculation module capable of calculating a Focus value,
comprises a preset position setting line number calculating module capable of calculating the line number,
comprises a preset information storage module capable of storing horizontal angles, vertical angles and line numbers,
comprises a preset bit calling line number module capable of calling line numbers,
comprises a preset bit calling Focus calculating module which can calculate the Focus value according to the line number and the Zoom value,
comprises a positioning module which can carry out positioning according to the Focus value and the Zoom value,
also comprises a motor control module which acts according to the Focus value and the Zoom value,
the format of the commands issued by the ball machine control device is defined as follows:
the method comprises a 2-byte command head, a 2-byte magnification Zoom value, a 2-byte ball machine horizontal angle and a 1-byte vertical angle, wherein the command head determines whether to set a preset bit or call the preset bit.
The command parsing module analyzes whether the preset bit is set or called according to the command header of the preset bit command.
When the command analysis module analyzes that the preset position is set according to a command header, the command is transmitted into a Focus calculation module, the Focus calculation module calculates the current Focus value according to the horizontal angle and the vertical angle in the command and the Zoom value, after the Focus value is obtained, the Focus calculation module sends data [ Zoom, Focus ] to a preset position setting line number calculation module, the preset position setting line number calculation module calculates the current line number in a line number database according to the current data [ Zoom, Focus ] by a linear interpolation method, and finally, the current horizontal angle, the vertical angle and the line number are stored in a preset information storage module;
when the command analysis module analyzes that the command is a preset bit call according to the command header, the command is transmitted to the preset bit call line number module, the preset bit call line number module inquires the line number corresponding to the current horizontal angle and the vertical angle according to the horizontal angle and the vertical angle in the command, the preset bit call Focus calculation module calculates the current Focus value according to the line number and the Zoom value, the motor control module is controlled by the camera positioning module by utilizing the Zoom value and the Focus value,
when the command analysis module analyzes that the command is a preset bit call according to the command header, the command is transmitted to the preset bit call line number module, the preset bit call line number module inquires that the line number corresponding to the current horizontal angle and the vertical angle cannot be obtained according to the horizontal angle and the vertical angle in the command, then the current line number is searched and calculated through an interpolation calculation method, the Focus calculation module is called through the preset bit to calculate the current Focus value according to the line number and the Zoom value, the motor control module is controlled through the camera positioning module by utilizing the Zoom value and the Focus value,
the Zoom value at the time of setting the preset bit must satisfy within a given range, and the Zoom value at the time of calling the preset bit may be any Zoom factor.
The invention adopts the presetting bit method, thereby greatly improving the presetting bit precision and efficiency. Therefore, compared with the method in the background art, the method has the following advantages:
1. larger information quantity can be preset, and preset positions under any multiple of the angle of the ball machine can be adjusted;
2. the Zoom value when the preset bit is called is irrelevant to the Zoom value when the preset bit is set, and can be any Zoom value;
3. the method is convenient for automatic tracking, and automatic tracking can be realized when the Zoom value is given;
4. according to a specific scene, angle preset position setting and tracking are carried out, when the angle changes, the change information of the dome camera is sent to the all-in-one machine by the controller, angle and Zoom value predicted values are given, and the speed and smoothness of preset position tracking can be greatly improved.
Drawings
Fig. 1 is a block diagram of a presetting bit method according to an embodiment of the present invention;
fig. 2 is a specific flowchart of a method for presetting bits according to an embodiment of the present invention;
fig. 3 is a schematic diagram of interpolation search line numbers in a preset bit method according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a preset bit system according to an embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to examples, but the embodiments of the present invention are not limited thereto.
Example 1:
as shown in figure 1 of the drawings, in which,
fig. 1 shows a structural block diagram of an embodiment of the preset bit method of the present invention, which specifically includes preset bit setting and preset bit calling, where the preset bit setting is to determine a current line number according to current direction information and amplification factor of a dome camera and store the direction information and the line number, and the preset bit calling is to search the line number according to the current direction information of the dome camera and determine a current focal length according to the amplification factor sent by the dome camera, so as to perform accurate and rapid preset bit calling.
As shown in figure 2 of the drawings, in which,
a method of presetting bits, comprising the steps of: a preset bit setting step and a preset bit calling step,
as shown in the flow of the area a in fig. 2, the preset bit setting step includes the following steps:
(A1) after the system is initialized, the center of the camera image is aligned with a specified target,
(A2) sending the direction information of the dome camera and the Zoom value in a given range to the all-in-one machine, wherein the direction information comprises the horizontal angle of the dome camera and the vertical angle of the dome camera,
(A3) the all-in-one machine utilizes automatic focusing to make the image target clear and obtain the current Focus value under the Zoom value,
(A4) calculating the line number of the current preset point by using the current Zoom value and the Focus value according to a linear interpolation method in a line number database, wherein the line number comprises the Zoom value and the Focus value corresponding to the current direction information,
(A5) the current direction information and the line number are stored,
(A6) repeating the steps from (A1) to (A5) according to the number of preset positions, and storing the direction information corresponding to all preset position setting points and the line numbers obtained by calculation to form a preset position information table; thus, if N preset points are provided, an information table of the preset points of the element data, which has the length of N and comprises a horizontal angle of the ball machine, a vertical angle of the ball machine and a line number, is stored.
As shown in the flow of the area B in fig. 2, the preset bit calling step includes the following steps:
(B1) after the system is initialized, the center of the camera image is aligned with a specified target,
(B2) sending the direction information of the dome camera and any Zoom value to the all-in-one machine,
(B3) inquiring the stored direction information and line number when the preset bit is set, and judging whether the current corresponding direction information exists,
(B4) if (B3) the corresponding direction information can be searched, the current line number is directly searched,
(B5) if the corresponding direction information can not be inquired (B3), searching and calculating the line number by an interpolation calculation method,
(B6) after the line number obtained through (B4) or (B5), calculating a corresponding Focus value according to the line number and the Zoom value in (B1), thereby rapidly obtaining a clear image,
(B7) repeating the steps (B1) to (B6) according to the specified preset bit calling number.
Presetting a bit setting: and setting the current line number according to the direction information of the dome camera and the magnification Zoom in a given range.
Calling a preset bit: and searching the current corresponding line number according to the direction information of the dome camera received by the all-in-one machine and any current magnification factor and a correlation method.
Specifically speaking: when the center of the camera image is aligned with a specified target, direction information including a horizontal angle and a vertical angle of the dome camera and a Zoom value in a given range are acquired from the dome camera according to the dome camera control equipment. And under the Zoom value, the all-in-one machine core makes an image target clear by utilizing automatic focusing and acquires a current Focus value, and then calculates the line number of the current preset point according to the database by utilizing the current Zoom value and the Focus value. The line number at this time is the Zoom value and the Focus value at the current horizontal angle and the vertical angle, and the Focus value corresponding to the Zoom value is different, so the line number information corresponds to a plurality of Zoom values and Focus values corresponding to one-to-one mapping.
The preset position setting needs to store the horizontal angle and the vertical angle of the ball machine corresponding to all the preset position setting points and the line number obtained through calculation.
The preset position calling comprises the steps of setting the horizontal angle, the vertical angle and the Zoom value of the dome camera, solving the current line number according to the relation between the stored dome camera angle information and the line number when the preset position is set, and calculating the corresponding Focus value according to the Zoom value and the searched line number, so that the all-in-one machine can clearly align to the preset position calling point. Therefore, the present invention does not need to store Focus values, and the Zoom value at the time of call can be any Zoom value.
It can be seen from the above that, the line number is obtained by using the curve relationship between the Zoom value and the Focus value, and the traditional way of storing the Zoom value and the Focus value is changed by using the way of storing the line number, so that the clear calling of the image can be realized only by calling the line number and any Zoom value, therefore, the amplification factor when the preset bit is called has no relationship with the amplification factor when the preset bit is set, is not restricted by the amplification factor when the preset bit is set, and can be any amplification factor.
When the preset position is called, all the angle information of the dome camera cannot be found in the storage table, therefore, an interpolation calculation method is needed to search and calculate the line number, the interpolation method is to adopt the line number with the closest horizontal angle and the closest vertical angle of the dome camera in the direction, and the more accurate line number at the moment is calculated by a linear interpolation method.
The Zoom value range in (A2) is。
The preset information table comprises line number data, dome camera horizontal angle data and dome camera vertical angle data.
As shown in fig. 3, (B5) the formula for finding and calculating the line number by interpolation is as follows:
;
wherein,andrespectively horizontal and vertical interpolation coefficients,is based onToAndthe distance between the two or more of the three or more of,is based onToAndthe following are specific examples:
;(ii) a (B2) The direction information of the ball machine is as follows: horizontal anglePerpendicular angle,、At an angle to the horizontalThe adjacent horizontal angles are arranged in a way that,、at an angle to the verticalThe adjacent vertical angles are such that, x,yindicating that the line number is searched and calculated by interpolation, i,jindicating horizontal anglePerpendicular angleThe number of the lines of the composition, i+1,jindicating horizontal anglePerpendicular angleThe number of the lines of the composition, i,j+1indicating horizontal anglePerpendicular angleThe number of the lines of the composition, i+1,j+1indicating horizontal anglePerpendicular angleThe number of the lines of the composition,
the calculation formula is realized by fixed-point processing in a processor,andare normalized to 128 or 256,、、all represent horizontal angles,、、All represent vertical angles。
One direction information composed of one dome machine horizontal angle data and one dome machine vertical angle data corresponds to one line number, and one line number corresponds to a plurality of magnification Zoom values and Focus values under the corresponding magnification Zoom values.
The current Focus value is obtained by calculating the current Focus value according to the direction information and the Zoom value, wherein the calculation method is to make the target image clear under the Zoom value in a given range and record the Focus value at the moment.
Example 2
As shown in fig. 4, the control system generated according to the preset bit method,
comprises ball machine control equipment capable of sending commands to a ball machine,
comprises a command analysis module which can analyze a command header,
comprises a Focus calculation module capable of calculating a Focus value,
comprises a preset position setting line number calculating module capable of calculating the line number,
comprises a preset information storage module capable of storing horizontal angles, vertical angles and line numbers,
comprises a preset bit calling line number module capable of calling line numbers,
comprises a preset bit calling Focus calculating module which can calculate the Focus value according to the line number and the Zoom value,
comprises a positioning module which can carry out positioning according to the Focus value and the Zoom value,
also comprises a motor control module which acts according to the Focus value and the Zoom value,
the format of the commands issued by the ball machine control device is defined as follows:
the method comprises a 2-byte command head, a 2-byte magnification Zoom value, a 2-byte ball machine horizontal angle and a 1-byte vertical angle, wherein the command head determines whether to set a preset bit or call the preset bit. For example: presetting a bit command:。
the command parsing module analyzes whether the preset bit is set or called according to the command header of the preset bit command.
When the command analysis module analyzes that the preset position is set according to a command header, the command is transmitted into a Focus calculation module, the Focus calculation module calculates the current Focus value according to the horizontal angle and the vertical angle in the command and the Zoom value, after the Focus value is obtained, the Focus calculation module sends data [ Zoom, Focus ] to a preset position setting line number calculation module, the preset position setting line number calculation module calculates the current line number in a line number database according to the current data [ Zoom, Focus ] by a linear interpolation method, and finally, the current horizontal angle, the vertical angle and the line number are stored in a preset information storage module;
when the command analysis module analyzes that the command is a preset bit call according to the command header, the command is transmitted to the preset bit call line number module, the preset bit call line number module inquires the line number corresponding to the current horizontal angle and the vertical angle according to the horizontal angle and the vertical angle in the command, the preset bit call Focus calculation module calculates the current Focus value according to the line number and the Zoom value, the motor control module is controlled by the camera positioning module by utilizing the Zoom value and the Focus value,
when the command analysis module analyzes that the command is a preset bit call according to the command header, the command is transmitted to the preset bit call line number module, the preset bit call line number module inquires that the line number corresponding to the current horizontal angle and the vertical angle cannot be obtained according to the horizontal angle and the vertical angle in the command, then the current line number is searched and calculated through an interpolation calculation method, the Focus calculation module is called through the preset bit to calculate the current Focus value according to the line number and the Zoom value, the motor control module is controlled through the camera positioning module by utilizing the Zoom value and the Focus value,
the Zoom value at the time of setting the preset bit must satisfy within a given range, and the Zoom value at the time of calling the preset bit may be any Zoom factor.
The invention adopts the presetting bit method, thereby greatly improving the presetting bit precision and efficiency. Therefore, compared with the method in the background art, the method has the following advantages:
1. larger information quantity can be preset, and preset positions under any multiple of the angle of the ball machine can be adjusted;
2. the Zoom value when the preset bit is called is irrelevant to the Zoom value when the preset bit is set, and the Zoom value when the preset bit is called can be any Zoom value;
3. the method is convenient for automatic tracking, and automatic tracking can be realized when the Zoom value is given;
4. according to a specific scene, angle preset position setting and tracking are carried out, when the angle changes, the change information of the dome camera is sent to the all-in-one machine by the controller, angle and Zoom value predicted values are given, and the speed and smoothness of preset position tracking can be greatly improved.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the present invention in any way, and all simple modifications and equivalent variations of the above embodiment according to the present invention are within the scope of the present invention.