WO2018090825A1 - 一种自动聚焦方法及ptz摄像机 - Google Patents
一种自动聚焦方法及ptz摄像机 Download PDFInfo
- Publication number
- WO2018090825A1 WO2018090825A1 PCT/CN2017/108890 CN2017108890W WO2018090825A1 WO 2018090825 A1 WO2018090825 A1 WO 2018090825A1 CN 2017108890 W CN2017108890 W CN 2017108890W WO 2018090825 A1 WO2018090825 A1 WO 2018090825A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- ptz camera
- spatial
- target
- lens
- coordinate system
- Prior art date
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
- H04N23/67—Focus control based on electronic image sensor signals
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
- H04N23/67—Focus control based on electronic image sensor signals
- H04N23/673—Focus control based on electronic image sensor signals based on contrast or high frequency components of image signals, e.g. hill climbing method
-
- G—PHYSICS
- G03—PHOTOGRAPHY; CINEMATOGRAPHY; ANALOGOUS TECHNIQUES USING WAVES OTHER THAN OPTICAL WAVES; ELECTROGRAPHY; HOLOGRAPHY
- G03B—APPARATUS OR ARRANGEMENTS FOR TAKING PHOTOGRAPHS OR FOR PROJECTING OR VIEWING THEM; APPARATUS OR ARRANGEMENTS EMPLOYING ANALOGOUS TECHNIQUES USING WAVES OTHER THAN OPTICAL WAVES; ACCESSORIES THEREFOR
- G03B3/00—Focusing arrangements of general interest for cameras, projectors or printers
- G03B3/10—Power-operated focusing
-
- G—PHYSICS
- G02—OPTICS
- G02B—OPTICAL ELEMENTS, SYSTEMS OR APPARATUS
- G02B7/00—Mountings, adjusting means, or light-tight connections, for optical elements
- G02B7/28—Systems for automatic generation of focusing signals
- G02B7/30—Systems for automatic generation of focusing signals using parallactic triangle with a base line
-
- G—PHYSICS
- G03—PHOTOGRAPHY; CINEMATOGRAPHY; ANALOGOUS TECHNIQUES USING WAVES OTHER THAN OPTICAL WAVES; ELECTROGRAPHY; HOLOGRAPHY
- G03B—APPARATUS OR ARRANGEMENTS FOR TAKING PHOTOGRAPHS OR FOR PROJECTING OR VIEWING THEM; APPARATUS OR ARRANGEMENTS EMPLOYING ANALOGOUS TECHNIQUES USING WAVES OTHER THAN OPTICAL WAVES; ACCESSORIES THEREFOR
- G03B13/00—Viewfinders; Focusing aids for cameras; Means for focusing for cameras; Autofocus systems for cameras
- G03B13/32—Means for focusing
- G03B13/34—Power focusing
- G03B13/36—Autofocus systems
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
- H04N23/67—Focus control based on electronic image sensor signals
- H04N23/675—Focus control based on electronic image sensor signals comprising setting of focusing regions
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
- H04N23/695—Control of camera direction for changing a field of view, e.g. pan, tilt or based on tracking of objects
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
- H04N23/69—Control of means for changing angle of the field of view, e.g. optical zoom objectives or electronic zooming
Definitions
- the present application relates to the field of optical imaging technology, and in particular, to an auto focus method and a PTZ camera.
- PTZ Pan/tilt/Zoom
- pan/tilt cameras In order to obtain clear images during the photographing process, PTZ (Pan/Tilt/Zoom) cameras, usually referred to as pan/tilt cameras, often need to automatically focus on the objects to be photographed so that The focus of the lens in the PTZ camera falls on an image sensor such as a CMOS (Complementary Metal Oxide Semiconductor) image sensor.
- CMOS Complementary Metal Oxide Semiconductor
- the PTZ camera in order to realize autofocus, the PTZ camera needs to adjust the position of the focus motor in the lens multiple times, and uses the sharpness evaluation function to perform the resolution evaluation analysis on the object to be photographed at each position, and obtain the corresponding positions of the respective positions.
- Sharpness value reuse the blind mountain climbing search algorithm, search back and forth at each position to obtain the position corresponding to the maximum sharpness value, and then move the focus motor to the position to complete the auto focus.
- this kind of autofocusing method has a slow focusing speed and cannot achieve fast focusing.
- an embodiment of the present application provides an autofocus method, which is applied to a pan-tilt omni-directional PTZ camera, and the method may include:
- the spatial object distance parameter includes a spatial plane equation of a reference monitoring plane
- the reference monitoring plane is an equivalent plane of the target monitoring plane
- the focus motor is driven to the position of the determined position information.
- the step of constructing the spatial object distance parameter may include:
- the step of determining the spatial coordinates of any one of the three target points may include:
- the step of obtaining a distance from any target point in the space rectangular coordinate system to the lens of the PTZ camera may include:
- the spatial Cartesian coordinate system includes an X axis, a Y axis, and a Z axis;
- the position information of the lens of the PTZ camera in the space rectangular coordinate system includes:
- the step of calculating a current target distance of the lens of the PTZ camera to the monitored target monitoring plane based on the pre-configured spatial object distance parameter may include:
- the origin is an intersection of a rotation axis of the PTZ camera;
- the rotation axis of the PTZ camera includes: a rotation axis of the PTZ camera rotating in a horizontal direction and a rotation axis of the PTZ camera rotating in a vertical direction.
- the step of calculating a current target distance of the lens of the PTZ camera to the monitored target monitoring plane based on the pre-configured spatial object distance parameter may include:
- the center point is an intersection of a line where the target unit vector is located and the reference monitoring plane; the target unit vector is: one of the origins determined based on the first angle and the second angle a unit vector; the origin is an intersection of a rotation axis of the PTZ camera; the rotation axis of the PTZ camera includes: a rotation axis of the PTZ camera rotating in a horizontal direction and a rotation axis of the PTZ camera rotating in a vertical direction.
- the embodiment of the present application further provides a PTZ camera, where the PTZ camera may include:
- a building module for constructing a spatial object distance parameter
- a calculation module configured to calculate a current target object distance of the lens of the PTZ camera to the monitored target monitoring plane based on a spatial object distance parameter pre-built by the building module; wherein the space object distance parameter includes one Referring to a spatial plane equation of the monitoring plane; the reference monitoring plane is an equivalent plane of the target monitoring plane;
- a locating module configured to determine, according to the current target distance, a current magnification of the PTZ camera, a preset relationship table, and determine location information corresponding to the focus motor of the PTZ camera, where the preset relationship table includes The relationship between the target object distance, the magnification, and the position information of the focus motor when the focus of the lens of the PTZ camera falls on the image sensor of the PTZ camera;
- a driving module configured to drive the focus motor to a position of the determined position information.
- the building module may include:
- a first determining submodule configured to determine a reference monitoring plane of the PTZ camera
- a second determining submodule configured to determine spatial coordinates of at least three target points on the reference monitoring plane
- a first calculation submodule configured to calculate a spatial plane equation of the reference monitoring plane based on spatial coordinates of each target point to construct the spatial object distance model parameter.
- the second determining submodule may include:
- a first obtaining unit configured to obtain a distance from any target point in the space rectangular coordinate system to a lens of the PTZ camera, wherein an origin of the spatial rectangular coordinate system is an intersection of a rotation axis of the PTZ camera;
- the rotating shaft of the PTZ camera includes a rotating shaft that rotates in the horizontal direction of the PTZ camera and a rotating shaft that rotates in the vertical direction of the PTZ camera;
- a second obtaining unit configured to obtain position information of a lens of the PTZ camera in the space rectangular coordinate system
- a calculating unit for arranging the right angle in the space according to the distance and the lens of the PTZ camera
- the position information in the coordinate system calculates the spatial coordinates of any target point.
- the first obtaining unit is specifically configured to:
- the spatial rectangular coordinate system constructed by the building module includes an X axis, a Y axis, and a Z axis;
- the position information of the lens of the PTZ camera in the space rectangular coordinate system includes:
- the calculating module may include:
- a first reading submodule for reading a spatial plane equation included in the pre-constructed spatial object distance parameter
- a third determining submodule configured to determine a spatial rectangular coordinate system in which the spatial plane equation is located
- a second calculation submodule configured to calculate a vertical distance of the origin to a reference monitoring plane by using a spatial coordinate of an origin of the spatial rectangular coordinate system and the spatial plane equation, and use the vertical distance as: the PTZ The current target distance of the camera's lens to the monitored target monitoring plane;
- the origin is an intersection of a rotation axis of the PTZ camera;
- the rotation axis of the PTZ camera includes: a rotation axis of the PTZ camera rotating in a horizontal direction and a rotation axis of the PTZ camera rotating in a vertical direction.
- the calculating module includes:
- a second reading submodule for reading a spatial plane equation included in the pre-constructed spatial object distance parameter
- a fourth determining submodule configured to determine a spatial rectangular coordinate system in which the spatial plane equation is located
- a fifth determining submodule configured to determine a first angle formed by a lens of the PTZ camera and a Z axis of the spatial rectangular coordinate system, and an X axis formed by the lens and the space rectangular coordinate system Second angle
- a third calculating submodule configured to calculate, by using the first angle, the second angle, and the spatial plane equation, a center point distance from an origin of the space rectangular coordinate system to a center point of a reference monitoring plane, and Taking the center point distance as: the current target distance of the lens of the PTZ camera to the monitored target monitoring plane;
- the center point is an intersection of a line where the target unit vector is located and the reference monitoring plane; the target unit vector is: one of the origins determined based on the first angle and the second angle a unit vector; the origin is an intersection of a rotation axis of the PTZ camera; the rotation axis of the PTZ camera includes: a rotation axis of the PTZ camera rotating in a horizontal direction and a rotation axis of the PTZ camera rotating in a vertical direction.
- the embodiment of the present application further provides a storage medium for storing executable program code, where the executable program code is executed to execute the auto focus method described in the embodiment of the present application.
- the embodiment of the present application further provides an application, where the application is used to execute the auto focus method described in the embodiment of the present application at runtime.
- the current target object distance of the target monitoring plane corresponding to the lens of the PTZ camera at any angle to the arbitrary angle can be calculated according to the pre-constructed spatial object distance parameter, so that the pre-stored pre-preparation can be
- the relationship table is set to obtain the current target object distance and the position information of the focus motor corresponding to the current magnification of the PTZ camera to achieve fast focus.
- FIG. 1 is a flowchart of an auto focus method according to an embodiment of the present application
- FIG. 2 is a schematic diagram showing a relationship between a target object distance, a magnification, and position information of a focus motor recorded in a preset relationship table in the implementation of the present application;
- FIG. 3 is a schematic diagram of a spatial rectangular coordinate system constructed in an embodiment of the present application.
- Figure 4 is a schematic view of the XOY plane of the spatial rectangular coordinate system shown in Figure 3;
- Figure 5 is a schematic view of the XOZ plane of the spatial rectangular coordinate system shown in Figure 3;
- FIG. 6 is a schematic diagram of a reference monitoring plane in the space rectangular coordinate system shown in FIG. 3;
- FIG. 7 is a schematic diagram of a target point N in the spatial rectangular coordinate system shown in FIG. 3;
- FIG. 8 is a schematic structural diagram of a PTZ camera according to an embodiment of the present application.
- PTZ Pan/tilt/Zoom
- an embodiment of the present application provides an auto focus method and a PTZ camera.
- the execution subject of the auto focus method provided by the embodiment of the present application is a PTZ camera.
- the function software for implementing the auto focus method provided by the embodiment of the present application may be a special auto focus software set in the PTZ camera, or a function plug-in in the existing auto focus software installed in the PTZ camera. It is reasonable.
- the PTZ camera package But not limited to dome cameras.
- an auto focus method provided by an embodiment of the present application may include the following steps:
- S101 Calculate a current target object distance of the lens of the PTZ camera to the monitored target monitoring plane based on the pre-constructed spatial object distance parameter; wherein the spatial object distance parameter includes a spatial plane equation of a reference monitoring plane;
- the reference monitoring plane is an equivalent plane of the target monitoring plane;
- the PTZ camera when the PTZ camera rotates (that is, when the lens of the PTZ camera rotates), the area monitored by the PTZ camera changes, but the PTZ The areas monitored by the camera rotating to any angle are often in the same plane.
- the PTZ camera in a preset first time period, the PTZ camera is used to monitor the cell entrance lane, and in the first time period, the PTZ camera fixedly monitors the area: the area where the cell entrance lane is located, and the cell entrance lane
- the plane formed by the photographic image of the area can be used as a target monitoring plane; in the preset second time period, the left lane of the cell entrance is monitored by the PTZ camera, then the PTZ camera is in the second preset time period.
- the fixed monitoring area is: the area where the left lane of the cell entrance is located, and the plane formed by the photographic image of the area where the left lane of the cell entrance is located can be used as another target monitoring plane. It can be seen that the plane formed by the photographic image of the area monitored by the camera can be used as the target monitoring plane. It can be understood that the cell entrance lane and its left lane are usually on the same plane, or there is a slight angle.
- the lens of the PTZ camera moves, and the lens of the PTZ camera arrives at the camera.
- the current target distance of the monitored target monitoring plane is likely to have changed as well.
- the plane formed by the photographic image of the area where the cell entrance lane is located may be preset as the reference monitoring plane, but is not limited thereto.
- the spatial plane equation of a reference monitoring plane included in the spatial object distance parameter is: a spatial plane equation corresponding to a plane formed by the photographic image of the area where the cell entrance lane is located.
- the angle of the slightly angle may be 3°, of course, not limited thereto.
- the vertical distance of the lens of the PTZ camera to the monitored target monitoring plane may be calculated according to the pre-constructed spatial object distance parameter as the current target object distance.
- the point-to-plane calculation method may be used to calculate the vertical distance of the lens to the reference monitoring plane, which is of course not limited thereto.
- the spatial object distance parameter can also be understood as a spatial object distance model.
- the center point distance of the lens of the PTZ camera to the center point of the monitored target monitoring plane may be calculated according to the pre-constructed spatial object distance parameter as the current target distance.
- the center point of the lens to the center point of the reference monitoring plane may be calculated by combining the target monitoring plane center point on the target monitoring plane and the reference monitoring plane as the equivalent plane of the target monitoring plane. Distance to get the current target distance.
- the target monitoring plane is parallel to the XOY plane shown in FIG. 7, and the center point of the target monitoring plane is N points, and the space coordinates of the N points are (x, y, z).
- the point O in Fig. 7 is the position of the lens of the PTZ camera, or the point O is closer to the lens of the PTZ camera, that is, the position of the O point is considered to be the position of the lens of the PTZ camera.
- the angle between the lens and the Z axis is the first angle a
- the angle between the lens and the X axis is the second angle b.
- x, y, and z can be represented by the center point distance L ON of the lens to the center point.
- x sina ⁇ cosb ⁇ L ON
- y sina ⁇ sinb ⁇ L ON
- z cosa ⁇ L ON .
- the current target distance of the lens of the PTZ camera to the monitored target monitoring plane may be: a vertical distance of the lens of the PTZ camera to the monitored target monitoring plane, or a PTZ camera.
- calculating the distance between the lens of the PTZ camera and the center point of the monitored target plane of the target can make the PTZ camera focus on the center point, so that the images of the other positions of the target monitoring plane are relatively clear.
- S102 Searching, according to the current target distance, the current magnification of the PTZ camera, a preset relationship table, and determining location information corresponding to the focus motor of the PTZ camera, where the preset relationship table includes a target object distance, The relationship between the magnification and the position information of the focus motor;
- the prior art can be used to calculate a clear image (ie, when the focus falls on the image sensor of the PTZ camera) before the official shooting is performed by using the PTZ camera, and the target object distance is obtained. And an association relationship between the magnification and the position information of the focus motor, and storing the association relationship in a preset relationship table of the PTZ camera.
- the magnification of the lens of the PTZ camera is preset, and the magnification (ie, the position of the zoom motor in the PTZ camera) is set to be unchanged, as described in the background art.
- the sharpness evaluation function and the blind climbing search algorithm calculate the position of the focus motor when obtaining a clear image under each target distance, wherein each target distance is preset; and at this magnification, each target The position information of the focus motor corresponding to the object distance is stored in the preset relationship table.
- the magnification of the lens of the PTZ camera is changed, and under the changed magnification, the sharpness evaluation function and the blind climbing search algorithm as described in the background art are used to calculate the focus when obtaining a clear image at each target distance.
- the position of the motor; and the position information of the focus motor corresponding to each target object is stored in the preset relationship table at this magnification, thereby constructing a preset relationship table.
- a graph of the relationship between the target object distance, the magnification, and the position information of the focus motor as shown in FIG. 2 may be arranged according to the preset relationship table.
- the abscissa of FIG. 2 is the magnification Z, wherein the current magnification of the lens of the PTZ camera is between the maximum magnification and the minimum magnification; the ordinate is the focus motor position F, that is, the position information F of the focus motor. .
- the target object distance L is L 3 , the magnification and the focus motor position are obtained.
- the relationship curve L L 3 , that is, the relationship between Z and F when the target object distance is L 3 .
- the position information of the focus motor can be quickly obtained as F 1 .
- the position information of the focus motor can be quickly obtained as F 2 , which greatly improves the speed at which the position information of the focus motor is obtained.
- the current magnification of the PTZ camera refers to the ratio of the focal length of the current lens to the minimum focal length of the lens, and the position indicated by the ratio is the position of the variable power motor in the PTZ camera.
- the current magnification is: the magnification of the PTZ camera when the focus operation was last completed; or the preset initial magnification of the PTZ camera before the first focus operation is performed.
- the focus motor after obtaining the position information of the focus motor, the focus motor can be driven to a position corresponding to the position information to achieve fast focusing. That is to say, at this time, the PTZ camera can acquire a clear monitoring image.
- the current target object distance of the lens of the PTZ camera to the target monitoring plane corresponding to the arbitrary angle at any angle may be calculated according to the pre-constructed spatial object distance parameter, so that the pre-stored preset relationship may be
- the table obtains the current target distance and the position information of the focus motor corresponding to the current magnification of the PTZ camera, so as to achieve fast focusing, so that a clear image of the corresponding target monitoring plane at the angle can be captured.
- the step of constructing the spatial object distance parameter may include:
- Step 1 determining a reference monitoring plane monitored by the PTZ camera
- the PTZ camera can monitor the monitored area (eg, the cell) when the installation is completed.
- the plane formed by the entrance lane is determined as the reference monitoring plane.
- intersection point of the rotating shaft of the PTZ camera rotating in the horizontal direction and the rotating shaft rotating in the vertical direction may be used as the origin of the space rectangular coordinate system to construct a spatial rectangular coordinate system, wherein the constructed rectangular rectangular coordinates
- the system can be as shown in Figure 3.
- the figure includes an X-axis, a Y-axis, and a Z-axis.
- the Z-axis is set to be perpendicular to the monitored reference monitoring plane, and the PTZ camera can be rotated in the horizontal direction about the Z-axis.
- the X axis is set to be parallel to the monitored reference monitoring plane, and the PTZ camera can be rotated in the vertical direction about the X axis.
- the Y axis is also set to be parallel to the monitored reference monitoring plane, and the positive direction of the Y axis is at an angle of 90 degrees to the positive direction of the X axis. Referring to FIG.
- the horizontal angle P 360 degrees.
- Step two determining spatial coordinates of at least three target points on the reference monitoring plane
- the spatial coordinate of at least three target points on the reference monitoring plane can be determined by using the established spatial Cartesian coordinate system.
- FIG. 6 those skilled in the art can refer to FIG.
- the three target points M, N, and P are calibrated in advance on the reference monitoring plane ABCD, and those skilled in the art can predetermine the spatial coordinates of the three target points in the established space rectangular coordinate system and input to This is reasonable for the PTZ camera.
- Step 3 Calculate a spatial plane equation of the reference monitoring plane based on spatial coordinates of each target point to construct the spatial object distance parameter.
- the spatial coordinates of the three target coordinate points on the reference monitoring plane can also be calculated.
- the step of calculating the spatial coordinates of any one of the three target points may include:
- the target relationship to the PTZ camera can be found in the preset relationship table.
- the distance of the lens can be calculated by using a contrast autofocus algorithm at a preset magnification, which is an existing calculation method, and the specific calculation process is not performed here. Carry out the details.
- the PTZ camera is often rotated according to a rotation rule set by a technician, for example, in a first period of time, the PTZ camera is rotated to a first target position according to a rotation rule; in a second time period, The PTZ camera is rotated to the second target position according to the rotation rule. Therefore, the position information of the lens of the PTZ camera in a pre-constructed spatial Cartesian coordinate system can be obtained according to a preset rotation rule.
- the position information of the lens of the obtained PTZ camera may be: the PTZ camera The coordinate information of the lens in the established space rectangular coordinate system; or the first angle formed by the lens of the PTZ camera and the Z axis of the spatial rectangular coordinate system, and the space rectangular coordinate This is reasonable for the second angle formed by the X-axis of the system.
- the distance from the lens to the target point can be utilized, which is equal to the principle of finding the distance of the target point to the lens of the PTZ camera in the preset relationship table, combined with calculation The calculation formula of the distance between the two points calculates the spatial coordinates of the target point.
- FIG. 7 When the first angle formed by the lens and the Z axis of the spatial rectangular coordinate system and the second angle formed by the X axis of the space rectangular coordinate system are obtained, reference may be made to FIG. 7 .
- the spatial coordinates of the current target point are calculated. As shown in FIG. 7, assuming that any of the target points is an N (x2, y2, z2) point, a line segment L ON at which the distance between the target point N and the origin O is obtained is formed by the Z-axis.
- the embodiment of the present application further provides a PTZ camera, where the PTZ camera may include:
- a building module 801 configured to construct a spatial object distance parameter
- a calculation module 802 configured to calculate a current target object distance of the lens of the PTZ camera to the monitored target monitoring plane based on a spatial object distance parameter pre-configured by the construction module 801; wherein the spatial object distance parameter is Include a spatial plane equation of a reference monitoring plane; the reference monitoring plane is an equivalent plane of the target monitoring plane;
- the searching module 803 is configured to search, according to the current target distance, the current magnification of the PTZ camera, a preset relationship table, and determine location information of a focus motor of the PTZ camera, where the preset relationship table is Corresponding relationship between the target object distance, the magnification, and the position information of the focus motor when the focus of the lens of the PTZ camera is recorded on the image sensor of the PTZ camera;
- the driving module 804 is configured to drive the focus motor to the position of the determined position information.
- the current target distance of the lens of the PTZ camera to the target monitoring plane at any angle can be calculated according to the pre-constructed spatial object distance parameter, thereby being pre-stored according to the pre-existing
- the stored preset relationship table obtains the current target object distance and the position information of the focus motor corresponding to the current magnification of the PTZ camera to achieve fast focus.
- the building module 801 can include:
- a first determining submodule configured to determine a reference monitoring plane of the PTZ camera
- a second determining submodule configured to determine spatial coordinates of at least three target points on the reference monitoring plane
- a first calculation submodule configured to calculate a spatial plane equation of the reference monitoring plane based on spatial coordinates of each target point to construct the spatial object distance parameter.
- the second determining submodule includes:
- a first obtaining unit configured to obtain a distance from any target point in the space rectangular coordinate system to a lens of the PTZ camera, wherein an origin of the spatial rectangular coordinate system is an intersection of a rotation axis of the PTZ camera;
- the rotating shaft of the PTZ camera includes a rotating shaft that rotates in the horizontal direction of the PTZ camera and a rotating shaft that rotates in the vertical direction of the PTZ camera;
- a second obtaining unit configured to obtain position information of a lens of the PTZ camera in the space rectangular coordinate system
- a calculating unit configured to calculate spatial coordinates of any target point according to the distance and position information of the lens of the PTZ camera in the spatial rectangular coordinate system.
- the first obtaining unit is specifically configured to:
- the spatial rectangular coordinate system constructed by the building block 801 includes an X axis, a Y axis, and a Z axis;
- the position information of the lens of the PTZ camera in the space rectangular coordinate system includes:
- the calculating module may include:
- a first reading submodule for reading a spatial plane equation included in the pre-constructed spatial object distance parameter
- a third determining submodule configured to determine a spatial rectangular coordinate system in which the spatial plane equation is located
- a second calculation submodule configured to calculate a vertical distance of the origin to a reference monitoring plane by using a spatial coordinate of an origin of the spatial rectangular coordinate system and the spatial plane equation, and use the vertical distance as: the PTZ The current target distance of the camera's lens to the monitored target monitoring plane;
- the origin is an intersection of a rotation axis of the PTZ camera;
- the rotation axis of the PTZ camera includes: a rotation axis of the PTZ camera rotating in a horizontal direction and a rotation axis of the PTZ camera rotating in a vertical direction.
- the calculating module may include:
- a second reading submodule for reading a spatial plane equation included in the pre-constructed spatial object distance parameter
- a fourth determining submodule configured to determine a spatial rectangular coordinate system in which the spatial plane equation is located
- a fifth determining submodule configured to determine a first angle formed by a lens of the PTZ camera and a Z axis of the spatial rectangular coordinate system, and an X axis formed by the lens and the space rectangular coordinate system Second angle
- a third calculating submodule configured to calculate, by using the first angle, the second angle, and the spatial plane equation, a center point distance from an origin of the space rectangular coordinate system to a center point of a reference monitoring plane, and Taking the center point distance as: the current target distance of the lens of the PTZ camera to the monitored target monitoring plane;
- the center point is an intersection of a line where the target unit vector is located and the reference monitoring plane; the target unit vector is: one of the origins determined based on the first angle and the second angle a unit vector; the origin is an intersection of a rotation axis of the PTZ camera; the rotation axis of the PTZ camera includes: a rotation axis of the PTZ camera rotating in a horizontal direction and a rotation axis of the PTZ camera rotating in a vertical direction.
- the embodiment of the present application further provides a storage medium for storing executable program code, where the executable program code is used to execute at runtime:
- the auto focus method provided by the embodiment of the present application
- the auto focus method may include the following steps:
- the spatial object distance parameter includes a spatial plane equation of a reference monitoring plane
- the reference monitoring plane is an equivalent plane of the target monitoring plane
- the focus motor is driven to the position of the determined position information.
- the step of constructing the spatial object distance parameter may include:
- the step of determining the spatial coordinates of any one of the three target points may include:
- the step of obtaining a distance from any target point in the space rectangular coordinate system to the lens of the PTZ camera may include:
- the spatial Cartesian coordinate system includes an X axis, a Y axis, and a Z axis;
- the position information of the lens of the PTZ camera in the space rectangular coordinate system includes:
- the step of calculating a current target distance of the lens of the PTZ camera to the monitored target monitoring plane based on the pre-configured spatial object distance parameter may include:
- the origin is an intersection of a rotation axis of the PTZ camera;
- the rotation axis of the PTZ camera includes: a rotation axis of the PTZ camera rotating in a horizontal direction and a rotation axis of the PTZ camera rotating in a vertical direction.
- the step of calculating a current target distance of the lens of the PTZ camera to the monitored target monitoring plane based on the pre-configured spatial object distance parameter may include:
- the center point is an intersection of a line where the target unit vector is located and the reference monitoring plane; the target unit vector is: one of the origins determined based on the first angle and the second angle a unit vector; the origin is an intersection of a rotation axis of the PTZ camera; the rotation axis of the PTZ camera includes: a rotation axis of the PTZ camera rotating in a horizontal direction and a rotation axis of the PTZ camera rotating in a vertical direction.
- the current target object distance of the lens of the PTZ camera at any angle to the target monitoring plane corresponding to the arbitrary angle may be calculated according to the pre-configured spatial object distance parameter, so that the pre-stored preset may be
- the relationship table obtains the current target distance and the position information of the focus motor corresponding to the current magnification of the PTZ camera to achieve fast focus, so that a clear image of the corresponding target monitoring plane at the angle can be captured.
- the embodiment of the present application further provides an application program for performing the autofocus method provided by the embodiment of the present application.
- the autofocus method may include the following steps. :
- the spatial object distance parameter includes a spatial plane equation of a reference monitoring plane
- the reference monitoring plane is an equivalent plane of the target monitoring plane
- the preset relationship table includes an association relationship between the target object distance, the magnification, and the position information of the focus motor.
- the step of constructing the spatial object distance parameter may include:
- the step of determining the spatial coordinates of any one of the three target points may include:
- the obtaining the distance from any target point in the space rectangular coordinate system to the lens of the PTZ camera may include:
- the spatial Cartesian coordinate system includes an X axis, a Y axis, and a Z axis;
- the position information of the lens of the PTZ camera in the space rectangular coordinate system includes:
- the step of calculating a current target distance of the lens of the PTZ camera to the monitored target monitoring plane based on the pre-configured spatial object distance parameter comprises:
- the origin is an intersection of a rotation axis of the PTZ camera;
- the rotation axis of the PTZ camera includes: a rotation axis of the PTZ camera rotating in a horizontal direction and a rotation axis of the PTZ camera rotating in a vertical direction.
- the step of calculating a current target distance of the lens of the PTZ camera to the monitored target monitoring plane based on the pre-configured spatial object distance parameter comprises:
- the center point is an intersection of a line where the target unit vector is located and the reference monitoring plane; the target unit vector is: one of the origins determined based on the first angle and the second angle a unit vector; the origin is an intersection of a rotation axis of the PTZ camera; the rotation axis of the PTZ camera includes: a rotation axis of the PTZ camera rotating in a horizontal direction and a rotation axis of the PTZ camera rotating in a vertical direction.
- the current target object distance of the lens of the PTZ camera to the target monitoring plane corresponding to the arbitrary angle at any angle may be calculated according to the pre-constructed spatial object distance parameter, so that the pre-stored preset relationship may be
- the table obtains the current target distance and the position information of the focus motor corresponding to the current magnification of the PTZ camera, so as to achieve fast focusing, so that a clear image of the corresponding target monitoring plane at the angle can be captured.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Optics & Photonics (AREA)
- Studio Devices (AREA)
- Lens Barrels (AREA)
Abstract
本申请实施例提供了一种自动聚焦方法及PTZ摄像机,该方法应用于PTZ摄像机,该方法包括:基于预先构建的空间物距参数,计算PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距;空间物距参数中包括一个参考监控平面的空间平面方程;参考监控平面为目标监控平面的等效平面;基于当前目标物距、PTZ摄像机的当前倍率,查找一个预设关系表,确定PTZ摄像机聚焦马达对应的位置信息,预设关系表中包括目标物距、倍率和聚焦马达位置的关联关系;将聚焦马达驱动到该确定得到的位置信息所对应的位置。应用本申请实施例,使得PTZ摄像机能够快速自动聚焦。
Description
本申请要求于2016年11月15日提交中国专利局、申请号为201611030013.9申请名称为“一种自动聚焦方法及PTZ摄像机”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及光学摄像技术领域,特别是涉及一种自动聚焦方法及PTZ摄像机。
目前,在拍照过程中,为了获取清晰的图像,PTZ(Pan/Tilt/Zoom,平移/倾斜/变焦)摄像机,通常简称为云台全方位摄像机,常常需要对待拍摄的物体进行自动聚焦,以使PTZ摄像机中镜头的焦点落在图像传感器,例如CMOS(Complementary Metal Oxide Semiconductor,互补金属氧化物半导体)图像传感器上。其中,焦点是指平行光线经镜头折射后的会聚点。
现有技术中,为了实现自动聚焦,PTZ摄像机需要多次调节镜头中聚焦马达的位置,并利用清晰度评价函数,对各个位置下的待拍摄的物体进行清晰度评估分析,获得各个位置对应的清晰度值;再利用盲人爬山搜索算法,在各个位置上来回搜索,以获得最大清晰度值所对应的位置,进而将聚焦马达移动到该位置,完成自动聚焦。
但是该种自动聚焦的方式,聚焦速度慢,无法实现快速聚焦。
发明内容
本申请实施例的目的在于提供一种自动聚焦方法及PTZ摄像机,以实现快速聚焦。
第一方面,本申请实施例提供了一种自动聚焦方法,应用于云台全方位PTZ摄像机,所述方法可以包括:
基于预先构建的空间物距参数,计算所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距;其中,所述空间物距参数中包括一个参考监控平面的空间平面方程;所述参考监控平面为所述目标监控平面的等效平面;
基于所述当前目标物距、所述PTZ摄像机的当前倍率,查找一个预设关系表,确定所述PTZ摄像机聚焦马达对应的位置信息,其中,所述预设关系表包括所述PTZ摄像机的镜头的焦点落在所述PTZ摄像机的图像传感器上时,目标物距、倍率和聚焦马达的位置信息的关联关系;
将所述聚焦马达驱动到该确定得到的位置信息的位置。
可选地,构建所述空间物距参数的步骤可以包括:
确定所述PTZ摄像机的参考监控平面;
确定所述参考监控平面上至少三个目标点的空间坐标;
基于各个目标点的空间坐标,计算所述参考监控平面的空间平面方程,以构建所述空间物距参数。
可选地,确定所述三个目标点中任一目标点的空间坐标的步骤可以包括:
获得在空间直角坐标系中任一目标点到所述PTZ摄像机的镜头的距离,其中,所述空间直角坐标系的原点为所述PTZ摄像机的旋转轴的交点;所述PTZ摄像机的旋转轴包括所述PTZ摄像机在水平方向转动的转轴和所述PTZ摄像机在垂直方向转动的转轴;
获得所述PTZ摄像机的镜头在所述空间直角坐标系中的位置信息;
根据所述距离和所述PTZ摄像机的镜头在所述空间直角坐标系中的位置信息,计算任一目标点的空间坐标。
可选地,所述获得在空间直角坐标系中任一目标点到所述PTZ摄像机的镜头的距离的步骤可以包括:
在预设倍率下,利用反差式自动聚焦算法计算聚焦任一目标点时的聚焦马达的位置信息;
基于所述预设倍率、利用反差式自动聚焦算法计算得到的目标位置信息和所述预设关系表,计算任一目标点到所述PTZ摄像机的镜头的距离。
可选地,所述空间直角坐标系包括X轴、Y轴和Z轴;
所述PTZ摄像机的镜头在所述空间直角坐标系中的位置信息包括:
所述PTZ摄像机的镜头与所述空间直角坐标系的Z轴所形成的第一夹角,以及与所述空间直角坐标系的X轴所形成的第二夹角。
可选地,所述基于预先构建的空间物距参数,计算所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距的步骤,可以包括:
读取预先构建的空间物距参数中包含的空间平面方程;
确定所述空间平面方程所在的空间直角坐标系;
利用所述空间直角坐标系的原点的空间坐标和所述空间平面方程,计算所述原点到参考监控平面的垂直距离,并将所述垂直距离作为:所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距;
其中,所述原点为所述PTZ摄像机的旋转轴的交点;所述PTZ摄像机的旋转轴包括:所述PTZ摄像机在水平方向转动的转轴和所述PTZ摄像机在垂直方向转动的转轴。
可选地,所述基于预先构建的空间物距参数,计算所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距的步骤,可以包括:
读取预先构建的空间物距参数中包含的空间平面方程;
确定所述空间平面方程所在的空间直角坐标系;
确定所述PTZ摄像机的镜头与所述空间直角坐标系的Z轴所形成的第一夹角,以及所述镜头与所述空间直角坐标系的X轴所形成的第二夹角;
利用所述第一夹角、所述第二夹角和所述空间平面方程,计算所述空间直角坐标系的原点到参考监控平面中心点的中心点距离,并将所述中心点距离作为:所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距;
其中,所述中心点为目标单位向量所在直线与所述参考监控平面的交点;所述目标单位向量为:基于所述第一夹角和所述第二夹角确定的、所述原点的一个单位向量;所述原点为所述PTZ摄像机的旋转轴的交点;所述PTZ摄像机的旋转轴包括:所述PTZ摄像机在水平方向转动的转轴和所述PTZ摄像机在垂直方向转动的转轴。
第二方面,本申请实施例还提供了一种PTZ摄像机,所述PTZ摄像机可以包括:
构建模块,用于构建空间物距参数;
计算模块,用于基于所述构建模块所预先构建的空间物距参数,计算所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距;其中,所述空间物距参数中包括一个参考监控平面的空间平面方程;所述参考监控平面为所述目标监控平面的等效平面;
查找模块,用于基于所述当前目标物距、所述PTZ摄像机的当前倍率,查找一个预设关系表,确定所述PTZ摄像机聚焦马达对应的位置信息,其中,所述预设关系表包括所述PTZ摄像机的镜头的焦点落在所述PTZ摄像机的图像传感器上时,目标物距、倍率和聚焦马达的位置信息的关联关系;
驱动模块,用于将所述聚焦马达驱动到该确定得到的位置信息的位置。
可选地,所述构建模块可以包括:
第一确定子模块,用于确定所述PTZ摄像机的参考监控平面;
第二确定子模块,用于确定所述参考监控平面上至少三个目标点的空间坐标;
第一计算子模块,用于基于各个目标点的空间坐标,计算所述参考监控平面的空间平面方程,以构建所述空间物距模型参数。
可选地,所述第二确定子模块可以包括:
第一获得单元,用于获得在空间直角坐标系中任一目标点到所述PTZ摄像机的镜头的距离,其中,所述空间直角坐标系的原点为所述PTZ摄像机的旋转轴的交点;所述PTZ摄像机的旋转轴包括所述PTZ摄像机在水平方向转动的转轴和所述PTZ摄像机在垂直方向转动的转轴;
第二获得单元,用于获得所述PTZ摄像机的镜头在所述空间直角坐标系中的位置信息;
计算单元,用于根据所述距离和所述PTZ摄像机的镜头在所述空间直角
坐标系中的位置信息,计算任一目标点的空间坐标。
可选地,所述第一获得单元具体用于:
在预设倍率下,利用反差式自动聚焦算法计算聚焦任一目标点时的聚焦马达的位置信息;
基于所述预设倍率、利用反差式自动聚焦算法计算得到的位置信息和所述预设关系表,计算任一目标点到所述PTZ摄像机的镜头的距离。
可选地,所述构建模块所构建的空间直角坐标系包括X轴、Y轴和Z轴;
所述PTZ摄像机的镜头在所述空间直角坐标系中的位置信息包括:
所述PTZ摄像机的镜头与所述构建模块所构建的空间直角坐标系的Z轴所形成的第一夹角,以及与所述构建模块所构建的空间直角坐标系的X轴所形成的第二夹角。
可选地,在一种实现方式中,所述计算模块可以包括:
第一读取子模块,用于读取预先构建的空间物距参数中包含的空间平面方程;
第三确定子模块,用于确定所述空间平面方程所在的空间直角坐标系;
第二计算子模块,用于利用所述空间直角坐标系的原点的空间坐标和所述空间平面方程,计算所述原点到参考监控平面的垂直距离,并将所述垂直距离作为:所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距;
其中,所述原点为所述PTZ摄像机的旋转轴的交点;所述PTZ摄像机的旋转轴包括:所述PTZ摄像机在水平方向转动的转轴和所述PTZ摄像机在垂直方向转动的转轴。
可选地,在另一种实现方式中,所述计算模块包括:
第二读取子模块,用于读取预先构建的空间物距参数中包含的空间平面方程;
第四确定子模块,用于确定所述空间平面方程所在的空间直角坐标系;
第五确定子模块,用于确定所述PTZ摄像机的镜头与所述空间直角坐标系的Z轴所形成的第一夹角,以及所述镜头与所述空间直角坐标系的X轴所形成的第二夹角;
第三计算子模块,用于利用所述第一夹角、所述第二夹角和所述空间平面方程,计算所述空间直角坐标系的原点到参考监控平面中心点的中心点距离,并将所述中心点距离作为:所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距;
其中,所述中心点为目标单位向量所在直线与所述参考监控平面的交点;所述目标单位向量为:基于所述第一夹角和所述第二夹角确定的、所述原点的一个单位向量;所述原点为所述PTZ摄像机的旋转轴的交点;所述PTZ摄像机的旋转轴包括:所述PTZ摄像机在水平方向转动的转轴和所述PTZ摄像机在垂直方向转动的转轴。
第三方面,本申请实施例还提供了一种存储介质,用于存储可执行程序代码,所述可执行程序代码被运行以执行本申请实施例所述的自动聚焦方法。
第四方面,本申请实施例还提供了一种应用程序,所述应用程序用于在运行时执行本申请实施例所述的自动聚焦方法。
在本申请实施例中,可以根据预先构建的空间物距参数,计算PTZ摄像机的镜头在任意角度下,到该任意角度下对应的目标监控平面的当前目标物距,从而可以根据预先存储的预设关系表,获得所述当前目标物距和所述PTZ摄像机的当前倍率下所对应的聚焦马达的位置信息,实现快速聚焦。
为了更清楚地说明本申请实施例和现有技术的技术方案,下面对实施例和现有技术中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例提供的一种自动聚焦方法的流程图;
图2为本申请实施中预设关系表所记录的目标物距、倍率和聚焦马达的位置信息三者之间的关系曲线示意图;
图3为本申请实施例中所构建的空间直角坐标系的示意图;
图4为图3所示的空间直角坐标系的XOY平面的示意图;
图5为图3所示的空间直角坐标系的XOZ平面的示意图;
图6为图3所示的空间直角坐标系中的参考监控平面的示意图;
图7为图3所示的空间直角坐标系中的目标点N的示意图;
图8为本申请实施例提供的一种PTZ摄像机的结构示意图。
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本领域技术人员可以理解的是,为了实现对较大范围的场景进行监控,PTZ(Pan/Tilt/Zoom,平移/倾斜/变焦)摄像机,通常简称为云台全方位摄像机常常需要在水平方向和垂直方向进行旋转。而当所述PTZ摄像机发生转动时,需要重新对待拍摄的物体进行自动聚焦,以获得清晰的图像。
现有技术中,为了重新对待拍摄的物体进行自动聚焦,在拍摄过程中常需要通过背景技术中所描述的一系列操作及算法来实现自动聚焦。但是由于多次调节聚焦马达位置、利用清晰度评价函数进行清晰度评估分析和利用盲人爬山搜索算法搜索最大清晰度值所对应的聚焦马达的位置等操作,会花费较多的时间,因此该种自动聚焦方式会导致聚焦的速度较慢。
为了解决上述技术问题,本申请实施例提供了一种自动聚焦方法及PTZ摄像机。
下面首先对本申请实施例提供的自动聚焦方法进行说明。
需要说明的是,执行本申请实施例提供的自动聚焦方法的执行主体为PTZ摄像机。另外,实现本申请实施例提供的自动聚焦方法的功能软件可以为设置于PTZ摄像机中的专门的自动聚焦软件,也可以为设置于PTZ摄像机中的现有自动聚焦软件中的功能插件,这都是合理的。其中,所述PTZ摄像机包
括但并不局限于球型摄像机。
参见图1,本申请实施例提供的自动聚焦方法可以包括如下步骤:
S101:基于预先构建的空间物距参数,计算所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距;其中,所述空间物距参数中包括一个参考监控平面的空间平面方程;所述参考监控平面为所述目标监控平面的等效平面;
需要说明的是,在PTZ摄像机的具体应用中,当所述PTZ摄像机发生转动时(即所述PTZ摄像机的镜头发生转动时),所述PTZ摄像机所监控的区域发生了改变,但是所述PTZ摄像机旋转到任意角度所监控的区域常常都是处于同一平面。举例而言,在预设的第一时间段,利用PTZ摄像机对小区入口车道进行监控,那么在该第一时间段,PTZ摄像机固定监控的区域为:小区入口车道所在区域,并且该小区入口车道所在区域的摄影图像形成的平面可以作为一个目标监控平面;在预设的第二时间段,利用所述PTZ摄像机对小区入口的左边车道进行监控,那么在该第二预设时间段,PTZ摄像机固定监控的区域为:小区入口左边车道所在区域,并且该小区入口左边车道所在区域的摄影图像形成的平面可以作为另一个目标监控平面。可见,摄像机所监控的区域的摄影图像形成的平面均可作为目标监控平面。可以理解的是,小区入口车道与其的左边车道通常是位于同一平面上,或者存在略微夹角。
另外,当所述PTZ摄像机从监控小区入口车道所对应的角度,转动到监控小区入口的左边车道所对应的角度时,所述PTZ摄像机的镜头发生了移动,则所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距很可能也发生了改变。
其中,可以预先设定小区入口车道所在区域的摄影图像形成的平面为参考监控平面,当然并不局限于此。在该种方式中,空间物距参数中包括的一个参考监控平面的空间平面方程为:小区入口车道所在区域的摄影图像形成的平面对应的空间平面方程。这样,由于小区入口车道与其的左边车道通常是位于同一平面上,或者存在略微夹角,也就是说,预先设定的参考监控平面为所述目标监控平面的等效平面。因而,可以利用空间物距参数中包括的该参考监控平面的空间平面方程,计算PTZ摄像机的镜头到所监控的目标监
控平面的当前目标物距。
可以理解的是,本领域技术人员可以根据经验值设置该略微夹角的角度。举例而言,该略微夹角的角度可以为3°,当然并不局限于此。
其中,在一种实现方式中,可以根据预先构建的空间物距参数,计算所述PTZ摄像机的镜头到所监控的目标监控平面的垂直距离,作为当前目标物距。该种实现方式中,可以利用点到平面的计算方法,计算所述镜头到所述参考监控平面的垂直距离,当然并不局限于此。其中,该空间物距参数也可以理解为一个空间物距模型。
在另一种实现方式中,可以根据预先构建的空间物距参数,计算所述PTZ摄像机的镜头到所监控的目标监控平面中心点的中心点距离,作为当前目标距离。在该种实现方式中,可以结合目标监控平面中心点在目标监控平面上,以及参考监控平面为目标监控平面的等效平面的特点,计算所述镜头到所述参考监控平面中心点的中心点距离,从而得到当前目标距离。
例如,假设目标监控平面与图7所示的XOY平面平行,且该目标监控平面的中心点为N点,N点的空间坐标为(x,y,z)。另外,假设图7中O点为PTZ摄像机的镜头所在位置,或者,O点距离PTZ摄像机的镜头的距离较近,也就是,可认为O点所在位置即为PTZ摄像机的镜头所在位置。还假设镜头与Z轴的夹角为第一夹角a,镜头与X轴的夹角为第二夹角b。这样,可以利用镜头到中心点的中心点距离LON来表示x、y和z。具体地,x=sina×cosb×LON、y=sina×sinb×LON和z=cosa×LON。然后,将x、y和z代入预先构建的空间物距参数中包括的空间平面方程中,即可计算得到中心点距离LON,此时,该中心点距离LON即为当前目标物距。
从上述两种实现方式中可知,所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距具体可以为:PTZ摄像机的镜头到所监控的目标监控平面的垂直距离,或者,PTZ摄像机的镜头到所监控的目标监控平面中心点的中心点距离。其中,计算PTZ摄像机的镜头到所监控的目标监控平面中心点的中心点距离,可以使PTZ摄像机对该中心点聚焦,从而使拍摄得到的目标监控平面的其他位置点的图像都较为清晰。
S102:基于所述当前目标物距、所述PTZ摄像机的当前倍率,查找一个预设关系表,确定所述PTZ摄像机聚焦马达对应的位置信息,其中,所述预设关系表包括目标物距、倍率和聚焦马达的位置信息的关联关系;
本领域技术人员可以理解的是,可以利用现有技术,在利用所述PTZ摄像进行正式拍摄前,计算获得清晰图像时(即焦点落在所述PTZ摄像机的图像传感器上时),目标物距、倍率和聚焦马达的位置信息的关联关系,并将所述关联关系存储到所述PTZ摄像机的预设关系表中。
例如,在构建预设关系表的阶段,预先设定所述PTZ摄像机的镜头的倍率,并设定该倍率(即所述PTZ摄像机中变倍马达的位置)不变,利用如背景技术所述的清晰度评价函数和盲人爬山搜索算法,计算在各个目标物距下获得清晰图像时的聚焦马达的位置,其中,该各个目标物距均为预设的;并将此时倍率下,各个目标物距所对应的聚焦马达的位置信息存储至预设关系表中。然后,改变所述PTZ摄像机的镜头的倍率,并在改变得到的倍率下,利用如背景技术所述的清晰度评价函数和盲人爬山搜索算法,计算在各个目标物距下获得清晰图像时的聚焦马达的位置;并将此时倍率下,各个目标物距所对应的聚焦马达的位置信息存储至预设关系表中,从而构建得到预设关系表。
为了方便对所构建得到的预设关系表进行说明,可以根据所述预设关系表,整理出如图2所示的目标物距、倍率和聚焦马达的位置信息三者关系的曲线图。
如图2所示,图2的横坐标为倍率Z,其中,所述PTZ摄像机的镜头的当前倍率位于最大倍率和最小倍率之间;纵坐标为聚焦马达位置F,即聚焦马达的位置信息F。当目标物距L为L1时,得到倍率和聚焦马达位置之间的关系曲线L=L1,即目标物距为L1时Z和F的关系曲线;当目标物距L为L2时,得到倍率和聚焦马达位置之间的关系曲线L=L2,即目标物距为L2时Z和F的关系曲线;当目标物距L为L3时,得到倍率和聚焦马达位置之间的关系曲线L=L3,即目标物距为L3时Z和F的关系曲线。
因此,结合图2可知,在利用所述PTZ摄像机进行正式拍摄时,在聚焦过程中获得当前目标物距=L1和当前倍率=Z1后,可快速的获得聚焦马达的位
置信息为F1;在聚焦过程中获得当前目标物距=L1和当前倍率=Z2后,可快速的获得聚焦马达的位置信息为F2,极大地提高了获得聚焦马达的位置信息的速度。
需要说明的是,所述PTZ摄像机的当前倍率是指当前镜头的焦距与该镜头的最小焦距的比值,且该比值所指示的位置为所述PTZ摄像机中变倍马达的位置,此为现有技术,在此不做详述。
其中,当前倍率为:PTZ摄像机在上一次完成聚焦操作时的倍率;或者,PTZ摄像机在第一次执行聚焦操作之前的预设的初始倍率。
S103:将所述聚焦马达驱动到该确定得到的位置信息的位置。
其中,在获得所述聚焦马达的位置信息后,即可将所述聚焦马达驱动到该位置信息所对应的位置,实现快速聚焦。也就是说,此时所述PTZ摄像机可以采集到清晰的监控图像。
在本申请实施例中,可以根据预先构建的空间物距参数,计算PTZ摄像机的镜头在任意角度下到该任意角度对应的目标监控平面的当前目标物距,从而可以根据预先存储的预设关系表,获得所述当前目标物距和所述PTZ摄像机的当前倍率下所对应的聚焦马达的位置信息,实现快速聚焦,从而可以拍摄到该角度下对应的目标监控平面的清晰图像。
下面结合图3至图6,对本申请实施例中构建所述空间物距参数的方式进行说明。
在本申请的一个具体实施例中,构建所述空间物距参数的步骤可以包括:
步骤一:确定所述PTZ摄像机所监控的参考监控平面;
可以理解的是,由于PTZ摄像机常用于对监控区域进行监控,因此当所述PTZ摄像机安装完毕后,在一个实施例中,所述PTZ摄像机可以将安装完毕时所监控到的监控区域(例如小区入口车道)所形成的平面确定为参考监控平面。
另外,由于所述PTZ摄像机常会在水平方向和垂直方向进行转动,因此
可以将所述PTZ摄像机在水平方向转动的转轴和在垂直方向转动的转轴的交点,即旋转轴的交点,作为空间直角坐标系的原点来构建空间直角坐标系,其中,所构建的空间直角坐标系可如图3所示。
参见图3,图中包括X轴、Y轴和Z轴,设定Z轴与所监控的参考监控平面垂直,且所述PTZ摄像机可以绕所述Z轴在水平方向进行转动。设定X轴与所监控的参考监控平面平行,且所述PTZ摄像机可以绕所述X轴在垂直方向进行转动。设定所述Y轴也与所监控的参考监控平面平行,且所述Y轴的正方向与所述X轴的正方向成90度夹角。参见图4,设定所述X轴的正方向为水平角度P=0度,则所述Y轴的正方向为水平角度P=90度,所述述X轴的负方向为水平角度P=180度,所述Y轴的负方向为水平角度P=270度,则所述X轴的正方向为水平角度P=0度的同时,也为水平角度P=360度。参见图5,设定所述Z轴的正方向为垂直角度T=90度;设定所述Z轴的负方向为垂直角度T=-90度;并设定垂直角度T=0度为垂直于Z轴,且经过原点O的任意方向角,例如X轴的正方向也为垂直角度T=0度,Y轴的正方向也为垂直角度T=0度。
步骤二:确定所述参考监控平面上至少三个目标点的空间坐标;
可以理解的是,在确定空间直角坐标系后,从而可以利用所建立空间直角坐标系,确定所确定的所述参考监控平面上至少三个目标点的空间坐标,参见图6,本领域技术人员预先在参考监控平面ABCD上标定的三个目标点M、N和P,且本领域技术人员可以预先确定好所标定的三个目标点在所建立的空间直角坐标系的空间坐标,并输入至所述PTZ摄像机,这是合理的。
步骤三:基于各个目标点的空间坐标,计算所述参考监控平面的空间平面方程,以构建所述空间物距参数。
举例而言,在确定所述PTZ摄像机所监控的参考监控平面后,例如确定小区入口车道所在平面为参考监控平面ABCD后,确定所述参考监控平面ABCD上至少三个目标点的空间坐标分别为M(x1,y1,z1)、N(x2,y2,z2)和P(x3,y3,z3)。再利用所述至少三个目标点的空间坐标,代入点法式方程进行计算,从而可以转换得到一般空间平面方程:A(x)+B(y)+C(z)+D=0。也就是,可计算出A、B、C和D的值,然后可以将该一般空间平面方程作为
参考监控平面的空间平面方程,此为常用数学计算方法,在此不对具体计算过程进行具体描述。
另外,由数学知识可知,当需要通过三个目标点的空间坐标计算空间平面方程时,所述三个目标点不在同一直线上,即本领域技术人员所标定的三个目标点不在同一直线上。
当然,所述参考监控平面上的所标定的三个目标坐标点的空间坐标也可以是计算得到的。其中,计算所述三个目标点中任一目标点的空间坐标的步骤可以包括:
获得在空间直角坐标系中任一目标点到所述PTZ摄像机的镜头的距离,其中,所述空间直角坐标系的原点为所述PTZ摄像机的旋转轴的交点;所述PTZ摄像机的旋转轴包括所述PTZ摄像机在水平方向转动的转轴和所述PTZ摄像机在垂直方向转动的转轴;
获得所述PTZ摄像机的镜头在所述空间直角坐标系中的位置信息;
根据所述距离和所述PTZ摄像机的镜头在所述空间直角坐标系中的位置信息,计算任一目标点的空间坐标。
可以理解的是,当需要计算所述三个目标点中任一目标点的空间坐标时,需要首先获得该任一目标点到PTZ摄像机的镜头的距离。其中,可以根据此时所述PTZ摄像机的当前倍率,以及能够清晰拍到该任一目标点时所述聚焦马达的位置信息,在预设关系表中查找得到该任一目标点到PTZ摄像机的镜头的距离。其中,在一种实现方式中,可以在预设倍率下,利用反差式自动聚焦算法计算实现聚焦当前目标点时的聚焦马达的位置信息,此为现有计算方式,在此不对具体的计算过程进行详述。
另外,由于所述PTZ摄像机常常是根据技术人员所设定的转动规则进行转动的,例如在第一时间段,所述PTZ摄像机根据转动规则转动到第一目标位置;在第二时间段,所述PTZ摄像机根据转动规则转动到第二目标位置。因此,可以根据预先设定的转动规则,获得所述PTZ摄像机的镜头在预先构建的空间直角坐标系中的位置信息。
其中,该获得的PTZ摄像机的镜头的位置信息可以是:所述PTZ摄像机
的镜头在所建立的空间直角坐标系中的坐标信息;也可以是:所述PTZ摄像机的镜头与所述空间直角坐标系的Z轴所形成的第一夹角,以及与所述空间直角坐标系的X轴所形成的第二夹角,这都是合理的。
当所获得的是镜头的坐标信息时,可以利用所述镜头到该任一目标点的距离,等于在预设关系表中查找得到该任一目标点到PTZ摄像机的镜头的距离的原理,结合计算两点之间的距离的计算公式,计算得到该目标点的空间坐标。
当所获得的是镜头与所述空间直角坐标系的Z轴所形成的第一夹角,以及与所述空间直角坐标系的X轴所形成的第二夹角时,可以参见图7对所述当前目标点的空间坐标进行计算。如图7所示,假设该任一目标点为N(x2,y2,z2)点,获得该任一目标点N和原点O之间两者距离的线段LON与所述Z轴所形成的第一夹角a,与所述X轴所形成的第二夹角b,因此可以计算得到z2=cosa×LON,x2=sina×cosb×LON,y2=sina×sinb×LON,从而获得该任一目标点N的空间坐标为N(x2,y2,z2)。
相应于上述方法实施例,本申请实施例还提供了一种PTZ摄像机,所述PTZ摄像机可以包括:
构建模块801,用于构建空间物距参数;
计算模块802,用于基于所述构建模块801所预先构建的空间物距参数,计算所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距;其中,所述空间物距参数中包括一个参考监控平面的空间平面方程;所述参考监控平面为所述目标监控平面的等效平面;
查找模块803,用于基于所述当前目标物距、所述PTZ摄像机的当前倍率,查找一个预设关系表,确定所述PTZ摄像机的聚焦马达的位置信息,其中,所述预设关系表中记录有所述PTZ摄像机的镜头的焦点落在所述PTZ摄像机的图像传感器上时,目标物距、倍率和聚焦马达的位置信息的对应关系;
驱动模块804,用于将所述聚焦马达驱动到该确定得到的位置信息的位置。
在本申请实施例中,可以根据预先构建的空间物距参数,计算PTZ摄像机的镜头在任意角度下到目标监控平面的当前目标物距,从而可以根据预先存
储的预设关系表,获得所述当前目标物距和所述PTZ摄像机的当前倍率下所对应的聚焦马达的位置信息,实现快速聚焦。
可选地,所述构建模块801可以包括:
第一确定子模块,用于确定所述PTZ摄像机的参考监控平面;
第二确定子模块,用于确定所述参考监控平面上至少三个目标点的空间坐标;
第一计算子模块,用于基于各个目标点的空间坐标,计算所述参考监控平面的空间平面方程,以构建所述空间物距参数。
可选地,所述第二确定子模块包括:
第一获得单元,用于获得在空间直角坐标系中任一目标点到所述PTZ摄像机的镜头的距离,其中,所述空间直角坐标系的原点为所述PTZ摄像机的旋转轴的交点;所述PTZ摄像机的旋转轴包括所述PTZ摄像机在水平方向转动的转轴和所述PTZ摄像机在垂直方向转动的转轴;
第二获得单元,用于获得所述PTZ摄像机的镜头在所述空间直角坐标系中的位置信息;
计算单元,用于根据所述距离和所述PTZ摄像机的镜头在所述空间直角坐标系中的位置信息,计算任一目标点的空间坐标。
可选地,所述第一获得单元具体用于:
在预设倍率下,利用反差式自动聚焦算法计算聚焦任一目标点时的聚焦马达的位置信息;
基于所述预设倍率、利用反差式自动聚焦算法计算得到的位置信息和所述预设关系表,计算任一目标点到所述PTZ摄像机的镜头的距离。
可选地,所述构建模块801所构建的空间直角坐标系包括X轴、Y轴和Z轴;
所述PTZ摄像机的镜头在所述空间直角坐标系中的位置信息包括:
所述PTZ摄像机的镜头与所述构建模块801所构建的空间直角坐标系的Z轴所形成的第一夹角,以及与所述构建模块801所构建的空间直角坐标系的X
轴所形成的第二夹角。
可选地,在一种实现方式中,所述计算模块可以包括:
第一读取子模块,用于读取预先构建的空间物距参数中包含的空间平面方程;
第三确定子模块,用于确定所述空间平面方程所在的空间直角坐标系;
第二计算子模块,用于利用所述空间直角坐标系的原点的空间坐标和所述空间平面方程,计算所述原点到参考监控平面的垂直距离,并将所述垂直距离作为:所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距;
其中,所述原点为所述PTZ摄像机的旋转轴的交点;所述PTZ摄像机的旋转轴包括:所述PTZ摄像机在水平方向转动的转轴和所述PTZ摄像机在垂直方向转动的转轴。
可选地,在另一种实现方式中,所述计算模块可以包括:
第二读取子模块,用于读取预先构建的空间物距参数中包含的空间平面方程;
第四确定子模块,用于确定所述空间平面方程所在的空间直角坐标系;
第五确定子模块,用于确定所述PTZ摄像机的镜头与所述空间直角坐标系的Z轴所形成的第一夹角,以及所述镜头与所述空间直角坐标系的X轴所形成的第二夹角;
第三计算子模块,用于利用所述第一夹角、所述第二夹角和所述空间平面方程,计算所述空间直角坐标系的原点到参考监控平面中心点的中心点距离,并将所述中心点距离作为:所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距;
其中,所述中心点为目标单位向量所在直线与所述参考监控平面的交点;所述目标单位向量为:基于所述第一夹角和所述第二夹角确定的、所述原点的一个单位向量;所述原点为所述PTZ摄像机的旋转轴的交点;所述PTZ摄像机的旋转轴包括:所述PTZ摄像机在水平方向转动的转轴和所述PTZ摄像机在垂直方向转动的转轴。
相应于上述方法实施例,本申请实施例还提供了一种存储介质,用于存储可执行程序代码,所述可执行程序代码用于在运行时执行:本申请实施例所提供的自动聚焦方法;具体的,所述自动聚焦方法,可以包括如下步骤:
基于预先构建的空间物距参数,计算所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距;其中,所述空间物距参数中包括一个参考监控平面的空间平面方程;所述参考监控平面为所述目标监控平面的等效平面;
基于所述当前目标物距、所述PTZ摄像机的当前倍率查找一个预设关系表,确定所述PTZ摄像机聚焦马达对应的位置信息,其中,所述预设关系表包括所述PTZ摄像机的镜头的焦点落在所述PTZ摄像机的图像传感器上时,目标物距、倍率和聚焦马达的位置位置信息的关联关系;
将所述聚焦马达驱动到该确定得到的位置信息的位置。
可选地,构建所述空间物距参数的步骤可以包括:
确定所述PTZ摄像机的参考监控平面;
确定所述参考监控平面上至少三个目标点的空间坐标;
基于各个目标点的空间坐标,计算所述参考监控平面的空间平面方程,以构建所述空间物距参数。
可选地,确定所述三个目标点中任一目标点的空间坐标的步骤可以包括:
获得在空间直角坐标系中任一目标点到所述PTZ摄像机的镜头的距离,其中,所述空间直角坐标系的原点为所述PTZ摄像机的旋转轴的交点;所述PTZ摄像机的旋转轴包括所述PTZ摄像机在水平方向转动的转轴和所述PTZ摄像机在垂直方向转动的转轴;
获得所述PTZ摄像机的镜头在所述空间直角坐标系中的位置信息;
根据所述距离和所述PTZ摄像机的镜头在所述空间直角坐标系中的PTZ摄像机的镜头在所述空间直角坐标系中的位置信息,计算任一目标点的空间坐标。
可选地,所述获得在空间直角坐标系中任一目标点到所述PTZ摄像机的镜头的距离的步骤可以包括:
在预设倍率下,利用反差式自动聚焦算法计算聚焦当前目标点时的聚焦马达的位置信息;
基于所述预设倍率、利用反差式自动聚焦算法计算得到的位置信息和所述预设关系表,计算任一目标点到所述PTZ摄像机的镜头的距离。
可选地,所述空间直角坐标系包括X轴、Y轴和Z轴;
所述PTZ摄像机的镜头在所述空间直角坐标系中的位置信息包括:
所述PTZ摄像机的镜头与所述空间直角坐标系的Z轴所形成的第一夹角,以及与所述空间直角坐标系的X轴所形成的第二夹角。
可选地,所述基于预先构建的空间物距参数,计算所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距的步骤,可以包括:
读取预先构建的空间物距参数中包含的空间平面方程;
确定所述空间平面方程所在的空间直角坐标系;
利用所述空间直角坐标系的原点的空间坐标和所述空间平面方程,计算所述原点到参考监控平面的垂直距离,并将所述垂直距离作为:所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距;
其中,所述原点为所述PTZ摄像机的旋转轴的交点;所述PTZ摄像机的旋转轴包括:所述PTZ摄像机在水平方向转动的转轴和所述PTZ摄像机在垂直方向转动的转轴。
可选地,所述基于预先构建的空间物距参数,计算所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距的步骤,可以包括:
读取预先构建的空间物距参数中包含的空间平面方程;
确定所述空间平面方程所在的空间直角坐标系;
确定所述PTZ摄像机的镜头与所述空间直角坐标系的Z轴所形成的第一夹角,以及所述镜头与所述空间直角坐标系的X轴所形成的第二夹角;
利用所述第一夹角、所述第二夹角和所述空间平面方程,计算所述空间直角坐标系的原点到参考监控平面中心点的中心点距离,并将所述中心点距离作为:所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距;
其中,所述中心点为目标单位向量所在直线与所述参考监控平面的交点;所述目标单位向量为:基于所述第一夹角和所述第二夹角确定的、所述原点的一个单位向量;所述原点为所述PTZ摄像机的旋转轴的交点;所述PTZ摄像机的旋转轴包括:所述PTZ摄像机在水平方向转动的转轴和所述PTZ摄像机在垂直方向转动的转轴。
在本申请实施例中,可以根据预先构建的空间物距参数,计算PTZ摄像机的镜头在任意角度下,到该任意角度对应的目标监控平面的当前目标物距,从而可以根据预先存储的预设关系表,获得所述当前目标物距和所述PTZ摄像机的当前倍率下所对应的聚焦马达的位置信息,实现快速聚焦,从而可以拍摄到该角度下对应的目标监控平面的清晰图像。
相应于上述方法实施例,本申请实施例还提供了一种应用程序,用于在运行时执行:本申请实施例所提供的自动聚焦方法;具体的,所述自动聚焦方法,可以包括如下步骤:
基于预先构建的空间物距参数,计算所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距;其中,所述空间物距参数中包括一个参考监控平面的空间平面方程;所述参考监控平面为所述目标监控平面的等效平面;
基于所述当前目标物距、所述PTZ摄像机的当前倍率,查找一个预设关系表,确定所述PTZ摄像机聚焦马达对应的位置信息,并将所述聚焦马达驱动到该位置信息的位置;
其中,所述预设关系表包括目标物距、倍率和聚焦马达的位置信息的关联关系。
可选地,构建所述空间物距参数的步骤可以包括:
确定所述PTZ摄像机的参考监控平面;
确定所述参考监控平面上至少三个目标点的空间坐标;
基于各个目标点的空间坐标,计算所述参考监控平面的空间平面方程,以构建所述空间物距参数。
可选地,确定所述三个目标点中任一目标点的空间坐标的步骤可以包括:
获得在空间直角坐标系中任一目标点到所述PTZ摄像机的镜头的距离,其中,所述空间直角坐标系的原点为所述PTZ摄像机的旋转轴的交点;所述PTZ摄像机的旋转轴包括所述PTZ摄像机在水平方向转动的转轴和所述PTZ摄像机在垂直方向转动的转轴;
获得所述PTZ摄像机的镜头在所述空间直角坐标系中的位置信息;
根据所述距离和所述PTZ摄像机的镜头在所述空间直角坐标系中的位置信息,计算任一目标点的空间坐标。
可选地,所述获得在空间直角坐标系中任一目标点到所述PTZ摄像机的镜头的距离,可以包括:
在预设倍率下,利用反差式自动聚焦算法计算聚焦任一目标点时的聚焦马达的位置信息;
基于所述预设倍率、利用反差式自动聚焦算法计算得到的位置信息和所述预设关系表,计算任一目标点到所述PTZ摄像机的镜头的距离。
可选地,所述空间直角坐标系包括X轴、Y轴和Z轴;
所述PTZ摄像机的镜头在所述空间直角坐标系中的位置信息包括:
所述PTZ摄像机的镜头与所述空间直角坐标系的Z轴所形成的第一夹角,以及与所述空间直角坐标系的X轴所形成的第二夹角。
可选地,所述基于预先构建的空间物距参数,计算所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距的步骤,包括:
读取预先构建的空间物距参数中包含的空间平面方程;
确定所述空间平面方程所在的空间直角坐标系;
利用所述空间直角坐标系的原点的空间坐标和所述空间平面方程,计算所述原点到参考监控平面的垂直距离,并将所述垂直距离作为:所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距;
其中,所述原点为所述PTZ摄像机的旋转轴的交点;所述PTZ摄像机的旋转轴包括:所述PTZ摄像机在水平方向转动的转轴和所述PTZ摄像机在垂直方向转动的转轴。
可选地,所述基于预先构建的空间物距参数,计算所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距的步骤,包括:
读取预先构建的空间物距参数中包含的空间平面方程;
确定所述空间平面方程所在的空间直角坐标系;
确定所述PTZ摄像机的镜头与所述空间直角坐标系的Z轴所形成的第一夹角,以及所述镜头与所述空间直角坐标系的X轴所形成的第二夹角;
利用所述第一夹角、所述第二夹角和所述空间平面方程,计算所述空间直角坐标系的原点到参考监控平面中心点的中心点距离,并将所述中心点距离作为:所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距;
其中,所述中心点为目标单位向量所在直线与所述参考监控平面的交点;所述目标单位向量为:基于所述第一夹角和所述第二夹角确定的、所述原点的一个单位向量;所述原点为所述PTZ摄像机的旋转轴的交点;所述PTZ摄像机的旋转轴包括:所述PTZ摄像机在水平方向转动的转轴和所述PTZ摄像机在垂直方向转动的转轴。
在本申请实施例中,可以根据预先构建的空间物距参数,计算PTZ摄像机的镜头在任意角度下到该任意角度对应的目标监控平面的当前目标物距,从而可以根据预先存储的预设关系表,获得所述当前目标物距和所述PTZ摄像机的当前倍率下所对应的聚焦马达的位置信息,实现快速聚焦,从而可以拍摄到该角度下对应的目标监控平面的清晰图像。
需要强调的是,对于PTZ摄像机、应用程序以及存储介质实施例而言,由
于其所涉及的方法内容基本相似于前述的方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
以上所述仅为本申请的较佳实施例而已,并非用于限定本申请的保护范围。凡在本申请的精神和原则之内所作的任何修改、等同替换、改进等,均包含在本申请的保护范围内。
Claims (16)
- 一种自动聚焦方法,其特征在于,应用于PTZ摄像机,包括:基于预先构建的空间物距参数,计算所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距;其中,所述空间物距参数中包括一个参考监控平面的空间平面方程;所述参考监控平面为所述目标监控平面的等效平面;基于所述当前目标物距、所述PTZ摄像机的当前倍率,查找一个预设关系表,确定所述PTZ摄像机聚焦马达对应的位置信息,并将所述聚焦马达驱动到该位置信息的位置;其中,所述预设关系表包括目标物距、倍率和聚焦马达的位置信息的关联关系。
- 根据权利要求1所述的方法,其特征在于,构建所述空间物距参数的步骤包括:确定所述PTZ摄像机的参考监控平面;确定所述参考监控平面上至少三个目标点的空间坐标;基于各个目标点的空间坐标,计算所述参考监控平面的空间平面方程,以构建所述空间物距参数。
- 根据权利要求2所述的方法,其特征在于,确定所述三个目标点中任一目标点的空间坐标的步骤包括:获得在空间直角坐标系中任一目标点到所述PTZ摄像机的镜头的距离,其中,所述空间直角坐标系的原点为所述PTZ摄像机的旋转轴的交点;所述PTZ摄像机的旋转轴包括所述PTZ摄像机在水平方向转动的转轴和所述PTZ摄像机在垂直方向转动的转轴;获得所述PTZ摄像机的镜头在所述空间直角坐标系中的位置信息;根据所述距离和所述PTZ摄像机的镜头在所述空间直角坐标系中的位置信息,计算任一目标点的空间坐标。
- 根据权利要求3所述的方法,其特征在于,所述获得在空间直角坐标 系中任一目标点到所述PTZ摄像机的镜头的距离,包括:在预设倍率下,利用反差式自动聚焦算法计算聚焦任一目标点时的聚焦马达的位置信息;基于所述预设倍率、利用反差式自动聚焦算法计算得到的位置信息和所述预设关系表,计算任一目标点到所述PTZ摄像机的镜头的距离。
- 根据权利要求3所述的方法,其特征在于,所述空间直角坐标系包括X轴、Y轴和Z轴;所述PTZ摄像机的镜头在所述空间直角坐标系中的位置信息包括:所述PTZ摄像机的镜头与所述空间直角坐标系的Z轴所形成的第一夹角,以及与所述空间直角坐标系的X轴所形成的第二夹角。
- 根据权利要求1所述的方法,其特征在于,所述基于预先构建的空间物距参数,计算所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距的步骤,包括:读取预先构建的空间物距参数中包含的空间平面方程;确定所述空间平面方程所在的空间直角坐标系;利用所述空间直角坐标系的原点的空间坐标和所述空间平面方程,计算所述原点到参考监控平面的垂直距离,并将所述垂直距离作为:所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距;其中,所述原点为所述PTZ摄像机的旋转轴的交点;所述PTZ摄像机的旋转轴包括:所述PTZ摄像机在水平方向转动的转轴和所述PTZ摄像机在垂直方向转动的转轴。
- 根据权利要求1所述的方法,其特征在于,所述基于预先构建的空间物距参数,计算所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距的步骤,包括:读取预先构建的空间物距参数中包含的空间平面方程;确定所述空间平面方程所在的空间直角坐标系;确定所述PTZ摄像机的镜头与所述空间直角坐标系的Z轴所形成的第一夹角,以及所述镜头与所述空间直角坐标系的X轴所形成的第二夹角;利用所述第一夹角、所述第二夹角和所述空间平面方程,计算所述空间直角坐标系的原点到参考监控平面中心点的中心点距离,并将所述中心点距离作为:所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距;其中,所述中心点为目标单位向量所在直线与所述参考监控平面的交点;所述目标单位向量为:基于所述第一夹角和所述第二夹角确定的、所述原点的一个单位向量;所述原点为所述PTZ摄像机的旋转轴的交点;所述PTZ摄像机的旋转轴包括:所述PTZ摄像机在水平方向转动的转轴和所述PTZ摄像机在垂直方向转动的转轴。
- 一种PTZ摄像机,其特征在于,包括:构建模块,用于构建空间物距参数;计算模块,用于基于所述构建模块所预先构建的空间物距参数,计算所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距;其中,所述空间物距参数中包括一个参考监控平面的空间平面方程;所述参考监控平面为所述目标监控平面的等效平面;查找模块,用于基于所述当前目标物距、所述PTZ摄像机的当前倍率,查找一个预设关系表,确定所述PTZ摄像机聚焦马达对应的位置信息;驱动模块,用于将所述聚焦马达驱动到该位置信息的位置;其中,所述预设关系表包括目标物距、倍率和聚焦马达的位置信息的关联关系。
- 根据权利要求8所述的PTZ摄像机,其特征在于,所述构建模块包括:第一确定子模块,用于确定所述PTZ摄像机的参考监控平面;第二确定子模块,用于确定所述参考监控平面上至少三个目标点的空间坐标;第一计算子模块,用于基于各个目标点的空间坐标,计算所述参考监控 平面的空间平面方程,以构建所述空间物距参数。
- 根据权利要求9所述的PTZ摄像机,其特征在于,所述第二确定子模块包括:第一获得单元,用于获得在空间直角坐标系中任一目标点到所述PTZ摄像机的镜头的距离,其中,所述空间直角坐标系的原点为所述PTZ摄像机的旋转轴的交点;所述PTZ摄像机的旋转轴包括所述PTZ摄像机在水平方向转动的转轴和所述PTZ摄像机在垂直方向转动的转轴;第二获得单元,用于获得所述PTZ摄像机的镜头在所述空间直角坐标系中的位置信息;计算单元,用于根据所述距离和所述PTZ摄像机的镜头在所述空间直角坐标系中的位置信息,计算任一目标点的空间坐标。
- 根据权利要求10所述的PTZ摄像机,其特征在于,所述第一获得单元具体用于:在预设倍率下,利用反差式自动聚焦算法计算聚焦任一目标点时的聚焦马达的位置信息;基于所述预设倍率、利用反差式自动聚焦算法计算得到的位置信息和所述预设关系表,计算任一目标点到所述PTZ摄像机的镜头的距离。
- 根据权利要求10所述的PTZ摄像机,其特征在于,所述构建模块所构建的空间直角坐标系包括X轴、Y轴和Z轴;所述PTZ摄像机的镜头在所述空间直角坐标系中的位置信息包括:所述PTZ摄像机的镜头与所述构建模块所构建的空间直角坐标系的Z轴所形成的第一夹角,以及与所述构建模块所构建的空间直角坐标系的X轴所形成的第二夹角。
- 根据权利要求8所述的PTZ摄像机,其特征在于,所述计算模块包括:第一读取子模块,用于读取预先构建的空间物距参数中包含的空间平面方程;第三确定子模块,用于确定所述空间平面方程所在的空间直角坐标系;第二计算子模块,用于利用所述空间直角坐标系的原点的空间坐标和所述空间平面方程,计算所述原点到参考监控平面的垂直距离,并将所述垂直距离作为:所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距;其中,所述原点为所述PTZ摄像机的旋转轴的交点;所述PTZ摄像机的旋转轴包括:所述PTZ摄像机在水平方向转动的转轴和所述PTZ摄像机在垂直方向转动的转轴。
- 根据权利要求8所述的PTZ摄像机,其特征在于,所述计算模块包括:第二读取子模块,用于读取预先构建的空间物距参数中包含的空间平面方程;第四确定子模块,用于确定所述空间平面方程所在的空间直角坐标系;第五确定子模块,用于确定所述PTZ摄像机的镜头与所述空间直角坐标系的Z轴所形成的第一夹角,以及所述镜头与所述空间直角坐标系的X轴所形成的第二夹角;第三计算子模块,用于利用所述第一夹角、所述第二夹角和所述空间平面方程,计算所述空间直角坐标系的原点到参考监控平面中心点的中心点距离,并将所述中心点距离作为:所述PTZ摄像机的镜头到所监控的目标监控平面的当前目标物距;其中,所述中心点为目标单位向量所在直线与所述参考监控平面的交点;所述目标单位向量为:基于所述第一夹角和所述第二夹角确定的、所述原点的一个单位向量;所述原点为所述PTZ摄像机的旋转轴的交点;所述PTZ摄像机的旋转轴包括:所述PTZ摄像机在水平方向转动的转轴和所述PTZ摄像机在垂直方向转动的转轴。
- 一种存储介质,其特征在于,用于存储可执行程序代码,所述可执行程序代码被运行以执行权利要求1-7任一项所述的自动聚焦方法。
- 一种应用程序,其特征在于,所述应用程序用于在运行时执行权利要求1-7任一项所述的自动聚焦方法。
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
EP17871326.9A EP3393120B1 (en) | 2016-11-15 | 2017-11-01 | Method for automatic focus and ptz camera |
US16/066,105 US10652452B2 (en) | 2016-11-15 | 2017-11-01 | Method for automatic focus and PTZ camera |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611030013.9A CN108076281B (zh) | 2016-11-15 | 2016-11-15 | 一种自动聚焦方法及ptz摄像机 |
CN201611030013.9 | 2016-11-15 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2018090825A1 true WO2018090825A1 (zh) | 2018-05-24 |
Family
ID=62145213
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2017/108890 WO2018090825A1 (zh) | 2016-11-15 | 2017-11-01 | 一种自动聚焦方法及ptz摄像机 |
Country Status (4)
Country | Link |
---|---|
US (1) | US10652452B2 (zh) |
EP (1) | EP3393120B1 (zh) |
CN (1) | CN108076281B (zh) |
WO (1) | WO2018090825A1 (zh) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110933372A (zh) * | 2019-12-03 | 2020-03-27 | 西安电子科技大学青岛计算技术研究院 | 一种基于ptz目标跟踪型监控方法 |
CN114706187A (zh) * | 2022-04-13 | 2022-07-05 | 大连理工大学 | 一种基于定位系统的自动追踪对焦方法 |
CN116193262A (zh) * | 2023-04-25 | 2023-05-30 | 上海安维尔信息科技股份有限公司 | 一种堆场中集装箱ptz相机选择瞄准方法及系统 |
Families Citing this family (18)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US12063380B2 (en) | 2015-09-09 | 2024-08-13 | Vantrix Corporation | Method and system for panoramic multimedia streaming enabling view-region selection |
US11108670B2 (en) | 2015-09-09 | 2021-08-31 | Vantrix Corporation | Streaming network adapted to content selection |
US10419770B2 (en) | 2015-09-09 | 2019-09-17 | Vantrix Corporation | Method and system for panoramic multimedia streaming |
US11287653B2 (en) | 2015-09-09 | 2022-03-29 | Vantrix Corporation | Method and system for selective content processing based on a panoramic camera and a virtual-reality headset |
CN110557550B (zh) * | 2018-05-31 | 2020-10-30 | 杭州海康威视数字技术股份有限公司 | 聚焦方法、装置及计算机可读存储介质 |
CN110602376B (zh) * | 2018-06-12 | 2021-03-26 | 杭州海康威视数字技术股份有限公司 | 抓拍方法及装置、摄像机 |
CN110740249B (zh) * | 2018-07-19 | 2021-07-02 | 杭州海康威视数字技术股份有限公司 | 图像采集方法及图像采集设备 |
CN110740250B (zh) * | 2018-07-19 | 2021-08-13 | 杭州海康威视数字技术股份有限公司 | 图像采集方法及图像采集设备 |
US11425307B2 (en) | 2018-07-19 | 2022-08-23 | Hangzhou Hikvision Digital Technology Co., Ltd. | Image capture device in which the focal length of the image capture device can be expanded without increasing the size of lenses |
CN109034104A (zh) * | 2018-08-15 | 2018-12-18 | 罗普特(厦门)科技集团有限公司 | 一种场景标签定位方法以及装置 |
CN109151326A (zh) * | 2018-10-26 | 2019-01-04 | 深圳鳍源科技有限公司 | 一种运动相机对焦方法、装置、运动相机及存储介质 |
CN111741210A (zh) * | 2019-03-25 | 2020-10-02 | 高新兴科技集团股份有限公司 | 一种基于固定场景的快速自动聚焦的方法及装置 |
CN112419405B (zh) * | 2019-08-23 | 2024-03-08 | 杭州海康威视数字技术股份有限公司 | 一种目标跟踪联合显示方法、安防系统及电子设备 |
CN112911128A (zh) * | 2019-11-19 | 2021-06-04 | 杭州海康微影传感科技有限公司 | 聚焦控制方法、系统、装置及设备、存储介质 |
CN111541844B (zh) * | 2020-04-22 | 2021-12-17 | 浙江大华技术股份有限公司 | 云台控制摄像机的物距预测方法、装置及存储设备 |
CN112230257A (zh) * | 2020-09-04 | 2021-01-15 | 勤上光电股份有限公司 | 一种基于ptz摄像机的定位监控方法 |
CN112383705B (zh) * | 2020-10-30 | 2023-09-12 | 浙江大华技术股份有限公司 | 相机物距确定方法和装置、存储介质及电子装置 |
CN112835172A (zh) * | 2020-12-31 | 2021-05-25 | 华兴源创(成都)科技有限公司 | 一种定倍率成像的自动对焦方法及系统 |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101446739A (zh) * | 2008-12-26 | 2009-06-03 | 天津市亚安科技电子有限公司 | 摄像监控系统中的测距方法 |
CN101494737A (zh) * | 2009-03-09 | 2009-07-29 | 杭州海康威视数字技术股份有限公司 | 一种一体化摄像机装置及自适应自动聚焦方法 |
CN101611625A (zh) * | 2007-03-05 | 2009-12-23 | 松下电器产业株式会社 | 自动跟踪装置和自动跟踪方法 |
US20110075125A1 (en) * | 2009-09-30 | 2011-03-31 | Canon Kabushiki Kaisha | Image taking system and lens apparatus |
CN103197491A (zh) * | 2013-03-28 | 2013-07-10 | 华为技术有限公司 | 快速自动聚焦的方法和图像采集装置 |
CN103747179A (zh) * | 2014-01-02 | 2014-04-23 | 深圳英飞拓科技股份有限公司 | 一种基于聚焦评价值反馈调节的变倍跟踪方法及系统 |
CN104469168A (zh) * | 2014-12-29 | 2015-03-25 | 信利光电股份有限公司 | 摄像模组及其自动对焦方法 |
CN105227835A (zh) * | 2015-09-11 | 2016-01-06 | 浙江宇视科技有限公司 | 一种辅助聚焦方法和装置 |
CN105765964A (zh) * | 2013-11-27 | 2016-07-13 | 思科技术公司 | 基于发言人位置移动摄像机聚焦 |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4794417A (en) * | 1985-10-04 | 1988-12-27 | Canon Kabushiki Kaisha | Photographing apparatus |
JPH067212B2 (ja) * | 1988-09-19 | 1994-01-26 | 日本ビクター株式会社 | ズームレンズシステム |
KR0147572B1 (ko) * | 1992-10-09 | 1998-09-15 | 김광호 | 자동 줌잉을 위한 피사체 추적방법 및 그 장치 |
WO2013055737A1 (en) * | 2011-10-14 | 2013-04-18 | Pelco, Inc. | Focus control for ptz cameras |
CN104135614B (zh) * | 2014-07-24 | 2017-10-03 | 浙江宇视科技有限公司 | 一种摄像机位移补偿方法和装置 |
-
2016
- 2016-11-15 CN CN201611030013.9A patent/CN108076281B/zh active Active
-
2017
- 2017-11-01 US US16/066,105 patent/US10652452B2/en active Active
- 2017-11-01 WO PCT/CN2017/108890 patent/WO2018090825A1/zh active Application Filing
- 2017-11-01 EP EP17871326.9A patent/EP3393120B1/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101611625A (zh) * | 2007-03-05 | 2009-12-23 | 松下电器产业株式会社 | 自动跟踪装置和自动跟踪方法 |
CN101446739A (zh) * | 2008-12-26 | 2009-06-03 | 天津市亚安科技电子有限公司 | 摄像监控系统中的测距方法 |
CN101494737A (zh) * | 2009-03-09 | 2009-07-29 | 杭州海康威视数字技术股份有限公司 | 一种一体化摄像机装置及自适应自动聚焦方法 |
US20110075125A1 (en) * | 2009-09-30 | 2011-03-31 | Canon Kabushiki Kaisha | Image taking system and lens apparatus |
CN103197491A (zh) * | 2013-03-28 | 2013-07-10 | 华为技术有限公司 | 快速自动聚焦的方法和图像采集装置 |
CN105765964A (zh) * | 2013-11-27 | 2016-07-13 | 思科技术公司 | 基于发言人位置移动摄像机聚焦 |
CN103747179A (zh) * | 2014-01-02 | 2014-04-23 | 深圳英飞拓科技股份有限公司 | 一种基于聚焦评价值反馈调节的变倍跟踪方法及系统 |
CN104469168A (zh) * | 2014-12-29 | 2015-03-25 | 信利光电股份有限公司 | 摄像模组及其自动对焦方法 |
CN105227835A (zh) * | 2015-09-11 | 2016-01-06 | 浙江宇视科技有限公司 | 一种辅助聚焦方法和装置 |
Non-Patent Citations (1)
Title |
---|
See also references of EP3393120A4 * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110933372A (zh) * | 2019-12-03 | 2020-03-27 | 西安电子科技大学青岛计算技术研究院 | 一种基于ptz目标跟踪型监控方法 |
CN110933372B (zh) * | 2019-12-03 | 2024-03-19 | 西安电子科技大学青岛计算技术研究院 | 一种基于ptz目标跟踪型监控方法 |
CN114706187A (zh) * | 2022-04-13 | 2022-07-05 | 大连理工大学 | 一种基于定位系统的自动追踪对焦方法 |
CN114706187B (zh) * | 2022-04-13 | 2023-06-16 | 大连理工大学 | 一种基于定位系统的自动追踪对焦方法 |
CN116193262A (zh) * | 2023-04-25 | 2023-05-30 | 上海安维尔信息科技股份有限公司 | 一种堆场中集装箱ptz相机选择瞄准方法及系统 |
CN116193262B (zh) * | 2023-04-25 | 2023-09-01 | 上海安维尔信息科技股份有限公司 | 一种堆场中集装箱ptz相机选择瞄准方法及系统 |
Also Published As
Publication number | Publication date |
---|---|
CN108076281B (zh) | 2020-04-03 |
US10652452B2 (en) | 2020-05-12 |
US20190342503A1 (en) | 2019-11-07 |
EP3393120A4 (en) | 2019-07-24 |
EP3393120B1 (en) | 2020-08-26 |
CN108076281A (zh) | 2018-05-25 |
EP3393120A1 (en) | 2018-10-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2018090825A1 (zh) | 一种自动聚焦方法及ptz摄像机 | |
CN109922251B (zh) | 快速抓拍的方法、装置及系统 | |
KR102143456B1 (ko) | 심도 정보 취득 방법 및 장치, 그리고 이미지 수집 디바이스 | |
KR102032882B1 (ko) | 자동 포커싱 방법, 장치 및 전자 장치 | |
US8861948B2 (en) | Image pickup apparatus | |
US20100166406A1 (en) | Sound-based focus system and focus method thereof | |
JP4858263B2 (ja) | 3次元計測装置 | |
TWI529661B (zh) | 快速建立景深圖的方法及影像處理裝置 | |
JP2018525658A (ja) | 自動焦点トリガのためのシステムおよび方法 | |
WO2014153950A1 (zh) | 快速自动聚焦的方法和图像采集装置 | |
CN107850753B (zh) | 检测设备、检测方法、检测程序和成像设备 | |
TW201312249A (zh) | 影像處理系統及自動對焦方法 | |
CN106031148B (zh) | 成像设备,成像设备中自动对焦的方法以及对应计算机程序 | |
US20190356842A1 (en) | Camera depth prediction using generative adversarial network | |
CN105704393B (zh) | 摄影装置、摄影方向的控制方法以及记录介质 | |
US20170064210A1 (en) | Control apparatus, control method, and storage medium | |
CN110602376A (zh) | 抓拍方法及装置、摄像机 | |
US10880536B2 (en) | Three-dimensional image capturing device and method | |
JP2016024315A5 (zh) | ||
Li | Autofocus searching algorithm considering human visual system limitations | |
JP2005175852A (ja) | 撮影装置及び撮影装置の制御方法 | |
JP2014206640A (ja) | 撮像装置およびその制御方法 | |
JP2011247988A (ja) | 撮像装置 | |
CN116418971A (zh) | 传感器的平整度检测方法、装置、计算机设备及存储介质 | |
KR102107126B1 (ko) | 카메라 초점조절방법 및 초점조절시스템 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
WWE | Wipo information: entry into national phase |
Ref document number: 2017871326 Country of ref document: EP |
|
ENP | Entry into the national phase |
Ref document number: 2017871326 Country of ref document: EP Effective date: 20180718 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |