Camera focusing method, device, camera and storage medium
By obtaining preset point information and determining the direction of movement, the movement of the camera's focus motor is directly controlled, which solves the problems of short life and slow speed of the focus motor and achieves fast focusing and extended life.
Patent Information
- Application Number
- CN202310129587.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-03
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2043-02-03
AI Technical Summary
The existing camera focusing method results in a long life loss of the focusing motor and a slow focusing speed. The automatic focusing algorithm needs to switch back and forth in different driving directions, which affects the performance of the equipment.
By obtaining the preset point information, including the target focus motor position and the final focus movement direction, the direction to be moved is determined and the focus motor movement is controlled, avoiding the back and forth conversion of the automatic focus algorithm, moving directly to the target position, and increasing the focus speed.
The life of the focusing motor is extended, rapid focusing is achieved, and equipment loss and performance impact caused by back and forth conversion are avoided.
Smart Images

Figure CN116170685B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of cameras, and in particular to a camera focusing method, a camera focusing device, a camera and a storage medium. Background Art
[0002] The setting and calling of camera preset points is a basic function used in current security monitoring applications. It can make the camera pan / tilt position move to the pan / tilt position preset by the user, the camera's zoom motor move to the preset zoom motor position, and the camera's focus motor move to the preset focus motor position. In this way, the camera can capture the scene corresponding to the preset point set by the user for the user to watch.
[0003] In the current focusing method, the camera pan, zoom motor and focus motor are first controlled to move to the pan position, zoom motor position and focus motor position corresponding to the preset point selected by the user. Once in place, automatic focusing is triggered to further adjust the focus motor position to obtain a clear scene image.
[0004] In the above focusing method, the automatic focusing algorithm requires the focus motor to switch back and forth in different driving directions, so as to control the focus lens group to move back and forth in different directions to achieve clear imaging. This greatly reduces the life of the focus motor, and automatic focusing can only be performed after the pan / tilt, zoom motor and focus motor are in place. The focus motor also needs to move back and forth, and the focusing speed is slow. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a focusing method, device, camera and storage medium for a camera, so as to increase the life of a focusing motor and achieve fast focusing. The specific technical solution is as follows:
[0006] In a first aspect, an embodiment of the present application provides a focusing method for a camera, the method comprising:
[0007] When a focus instruction for a camera is obtained, the preset point information of the camera indicated by the focus instruction is obtained, wherein the preset point information at least includes: a target focus motor position and a final focus movement direction of the focus motor when setting the preset point;
[0008] Acquire the current position of the focus motor of the camera, and determine the direction of the focus motor of the camera to be moved according to the current position of the focus motor of the camera and the target focus motor position as the first target movement direction;
[0009] The focus motor movement is controlled based on the first target movement direction and the final focus movement direction, and the magnitude relationship between the difference between the current position and the target focus motor position and a preset focus threshold.
[0010] Optionally, controlling the movement of the focus motor based on the first target movement direction and the last focus movement direction, and the magnitude relationship between the difference between the current position and the target focus motor position and a preset focus threshold, includes:
[0011] When the first target motion direction is the same as the last focus motion direction and the difference between the current position and the target focus motor position is not greater than a preset focus threshold, maintaining the focus motor at the current position;
[0012] When the first target movement direction is different from the last focus movement direction, or when the difference between the current position and the target focus motor position is greater than a preset focus threshold, the focus motor is controlled to move to the target focus motor position.
[0013] Optionally, when the difference between the current position and the target focus motor position is greater than a preset focus threshold, controlling the focus motor to move to the target focus motor position includes:
[0014] In a case where the first target motion direction is the same as the final focus motion direction, the focus motor is controlled to move to the target focus motor position according to the final focus motion direction.
[0015] Optionally, when the first target motion direction is different from the final focus motion direction, controlling the focus motor to move to the focus motor position includes:
[0016] Controlling the focus motor to move to a target focus position, wherein the target focus position is the sum of the target focus motor position and the return difference of the focus motor;
[0017] The focus motor is controlled to move from the target focus position to the target focus motor position according to the final focus movement direction.
[0018] Optionally, the preset point information further includes: a target zoom motor position and a final zoom movement direction of the zoom motor when setting the preset point; the method further includes:
[0019] Acquire the current position of the zoom motor of the camera, and determine the direction of movement of the zoom motor of the camera according to the current position of the zoom motor of the camera and the target zoom motor position as the second target movement direction;
[0020] When the second target movement direction is the same as the final zoom movement direction, controlling the zoom motor to move to the target zoom motor position according to the final zoom movement direction;
[0021] When the second target movement direction is different from the final magnification movement direction, the magnification motor is controlled to move to the target magnification position, and the magnification motor is controlled to move from the target magnification position to the target magnification motor position according to the final magnification movement direction, wherein the target magnification position is the sum of the target magnification motor position and the return difference of the magnification motor.
[0022] Optionally, the preset point information further includes: the temperature when the preset point is set;
[0023] Before acquiring the current position of the focus motor of the camera and determining the direction of the focus motor of the camera to be moved according to the current position of the focus motor of the camera and the target focus motor position, the method further includes:
[0024] The current temperature is obtained, and based on the target focus motor position, the current temperature, and the temperature when the preset point is set, the compensated focus motor position is calculated according to a preset temperature compensation formula as the updated target focus motor position.
[0025] Optionally, the preset point information further includes: a target PTZ position; and the method further includes:
[0026] Control the pan / tilt motor of the camera to move to the target pan / tilt position.
[0027] In a second aspect, an embodiment of the present application provides a focusing device for a camera, the device comprising:
[0028] An information acquisition module, configured to acquire, when a focus instruction for a camera is acquired, preset point information of the camera indicated by the focus instruction, wherein the preset point information at least includes: a target focus motor position and a final focus movement direction of the focus motor when setting the preset point;
[0029] A first movement direction determination module, used for acquiring the current position of the focus motor of the camera, and determining the direction of the focus motor of the camera to be moved as the first target movement direction according to the current position of the focus motor of the camera and the target focus motor position;
[0030] A focus motor control module is used to control the focus motor movement based on the first target movement direction and the last focus movement direction, and the size relationship between the difference between the current position and the target focus motor position and a preset focus threshold.
[0031] Optionally, the focusing motor control module includes:
[0032] a first control unit, configured to maintain the focus motor at the current position when the first target motion direction is the same as the last focus motion direction and the difference between the current position and the target focus motor position is not greater than a preset focus threshold;
[0033] The second control unit is used to control the focus motor to move to the target focus motor position when the first target movement direction is different from the final focus movement direction, or when the difference between the current position and the target focus motor position is greater than a preset focus threshold.
[0034] Optionally, the second control unit is specifically used to control the focusing motor to move to the target focusing motor position according to the final focusing movement direction when the first target movement direction is the same as the final focusing movement direction; to control the focusing motor to move to the target focusing position when the first target movement direction is different from the final focusing movement direction; and to control the focusing motor to move from the target focusing position to the target focusing motor position according to the final focusing movement direction, wherein the target focusing position is the sum of the target focusing motor position and the return difference of the focusing motor.
[0035] Optionally, the preset point information further includes: the target zoom motor position and the final zoom movement direction of the zoom motor when setting the preset point; the device further includes:
[0036] A second movement direction determination module is used to obtain the current position of the zoom motor of the camera, and determine the direction of movement of the zoom motor of the camera according to the current position of the zoom motor of the camera and the target zoom motor position as the second target movement direction;
[0037] A magnification motor control module, used to control the magnification motor to move to the target magnification motor position in the final magnification motion direction when the second target motion direction is the same as the final magnification motion direction; and to control the magnification motor to move to the target magnification position when the second target motion direction is different from the final magnification motion direction, and to control the magnification motor to move from the target magnification position to the target magnification motor position in the final magnification motion direction, wherein the target magnification position is the sum of the target magnification motor position and the return difference of the magnification motor.
[0038] Optionally, the preset point information further includes: a temperature when the preset point is set; and the device further includes:
[0039] The temperature compensation module is used to obtain the current temperature and calculate the compensated focus motor position as the updated target focus motor position based on the target focus motor position, the current temperature and the temperature when the preset point is set according to a preset temperature compensation formula.
[0040] Optionally, the preset point information also includes: a target PTZ position; the device also includes:
[0041] The pan / tilt control module is used to control the pan / tilt motor of the camera to move to the target pan / tilt position.
[0042] In a third aspect, an embodiment of the present application provides a camera, the camera comprising a pan / tilt motor, a zoom motor, a focus motor, a processor, and a memory, wherein:
[0043] Memory, used to store computer programs;
[0044] The processor is used to implement any method described in the first aspect when executing the program stored in the memory.
[0045] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any method described in the first aspect is implemented.
[0046] Beneficial effects of the embodiments of the present application:
[0047] In the solution provided by the embodiment of the present application, the camera can obtain the preset point information of the camera indicated by the focus instruction when obtaining the focus instruction for the camera, wherein the preset point information at least includes: the target focus motor position and the final focus movement direction of the focus motor when setting the preset point; obtain the current position of the focus motor of the camera, and determine the direction of the focus motor to be moved of the camera according to the current position of the focus motor of the camera and the target focus motor position, as the first target movement direction; based on the first target movement direction and the final focus movement direction, and the size relationship between the difference between the current position and the target focus motor position and the preset focus threshold, control the movement of the focus motor. Since the camera controls the movement of the focus motor to complete the focusing directly based on the first target movement direction and the final focus movement direction, and the size relationship between the difference between the current position and the target focus motor position and the preset focus threshold, and does not use the automatic focus algorithm for focusing, it avoids the problem that the focus motor needs to switch back and forth between different driving directions when using the automatic focus algorithm for focusing, thereby improving the life of the focus motor. At the same time, because when focusing, it is only necessary to obtain the target focus motor position, the last focus movement direction of the focus motor when setting the preset point, and the current position of the focus motor, there is no need to wait until the camera pan and zoom motor move to the pan position and zoom motor position corresponding to the preset point selected by the user before focusing. Therefore, the focusing speed is improved and fast focusing is achieved.
[0048] Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0050] Figure 1 A flowchart of a camera focusing method provided in an embodiment of the present application;
[0051] Figure 2 Based on Figure 1 A specific flow chart of the control mode of the focus motor movement of the embodiment shown;
[0052] Figure 3 Based on Figure 1 A flow chart of a method of controlling the movement of a variable power motor in the illustrated embodiment;
[0053] Figure 4 Based on Figure 1 A specific flow chart of a focusing method of a camera in the illustrated embodiment;
[0054] Figure 5 A schematic diagram of the structure of a focusing device of a camera provided in an embodiment of the present application;
[0055] Figure 6 A schematic diagram of the structure of a camera provided in an embodiment of the present application. DETAILED DESCRIPTION
[0056] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.
[0057] In order to improve the life of the focusing motor and achieve fast focusing, the embodiments of the present application provide a focusing method, device, camera, computer-readable storage medium and computer program product for a camera. The following first introduces a focusing method for a camera provided by the embodiments of the present application.
[0058] The focusing method of a camera provided in the embodiment of the present application can be applied to any camera with a focusing motor, and is not specifically limited here. For the sake of clarity, it is referred to as a camera below.
[0059] like Figure 1 As shown, a focusing method of a camera, the method comprising:
[0060] S101, when a focus instruction for a camera is obtained, obtaining preset point information of the camera indicated by the focus instruction;
[0061] Wherein, the preset point information at least includes: the target focus motor position and the final focus movement direction of the focus motor when setting the preset point;
[0062] S102, acquiring the current position of the focus motor of the camera, and determining the direction of the focus motor of the camera to be moved according to the current position of the focus motor of the camera and the target focus motor position as a first target movement direction;
[0063] S103, controlling the movement of the focus motor based on the first target movement direction and the final focus movement direction, and the magnitude relationship between the difference between the current position and the target focus motor position and a preset focus threshold.
[0064] In the solution provided by the embodiment of the present application, the camera can obtain the preset point information of the camera indicated by the focus instruction when obtaining the focus instruction for the camera, wherein the preset point information at least includes: the target focus motor position and the final focus movement direction of the focus motor when setting the preset point; obtain the current position of the focus motor of the camera, and determine the direction of the focus motor to be moved of the camera according to the current position of the focus motor of the camera and the target focus motor position, as the first target movement direction; based on the first target movement direction and the final focus movement direction, and the size relationship between the difference between the current position and the target focus motor position and the preset focus threshold, control the movement of the focus motor. Since the camera controls the movement of the focus motor to complete the focusing directly based on the first target movement direction and the final focus movement direction, and the size relationship between the difference between the current position and the target focus motor position and the preset focus threshold, and does not use the automatic focus algorithm for focusing, it avoids the problem that the focus motor needs to switch back and forth between different driving directions when using the automatic focus algorithm for focusing, thereby improving the life of the focus motor. At the same time, because when focusing, it is only necessary to obtain the target focus motor position, the last focus movement direction of the focus motor when setting the preset point, and the current position of the focus motor, there is no need to wait until the camera pan and zoom motor move to the pan position and zoom motor position corresponding to the preset point selected by the user before focusing. Therefore, the focusing speed is improved and fast focusing is achieved.
[0065] In order to move the focus motor of the camera to the designated focus motor position and clearly capture the preset scene, the user may send a focus instruction to the camera to trigger the camera to perform a focus operation, wherein the focus instruction may carry identification information of the preset point.
[0066] In this way, when the camera obtains a focus instruction for the camera, it can obtain the preset point information indicated by the identification information of the preset point carried in the focus instruction from the preset point information stored in itself, that is, obtain the preset point information of the camera indicated by the focus instruction.
[0067] In one implementation, the preset point information may be stored in the camera in the form of a preset point information table. The camera may query the target focus motor position corresponding to the identification information and the final focus movement direction of the focus motor when setting the preset point from the preset point information table according to the identification information of the preset point carried in the focus instruction, thereby obtaining the preset point information of the camera indicated by the focus instruction. The preset point information table may be in the form of the following table:
[0068] Identification Information Target focus motor position Finally focus on the direction of movement Preset point 1 F1 First Direction Preset 2 F2 Second direction
[0069] The above preset point information can be that the user focuses the image corresponding to the specific target to be photographed through automatic focusing and / or manual focusing, and then records the focus motor position at this time and the final focus movement direction of the focus motor during focusing, thereby obtaining a preset point information.
[0070] Similarly, the user can determine the corresponding preset point information for other objects to be photographed, thereby obtaining the above preset point information table. Each preset point information in the preset point information table reflects the parameters corresponding to the focus motor when the camera photographs the object to be photographed corresponding to the preset point in order to make the captured image clear.
[0071] Due to the existence of depth of field, there are targets at different distances in a scene to be shot, and the automatic focus algorithm cannot ensure that both near-field and far-field targets are in clear focus at the same time. Therefore, when the automatic focus algorithm is used for focusing, it may focus on the near-field target or the far-field target. As a result, the target that the user actually wants to control the camera to focus on may be a near-field target, but the camera focuses on the far-field target when using the automatic focus algorithm. Alternatively, the target that the user actually wants to control the camera to focus on may be a far-field target, but the camera focuses on the near-field target when using the automatic focus algorithm. This seriously affects the user experience.
[0072] The target focus motor position in the preset point information is the position of the focus motor when the user focuses the image corresponding to the specific target object to be photographed to be clear through automatic focus and / or manual focus. Therefore, when the focus motor of the camera moves with reference to the focus motor position in the preset point information to complete the focusing, the image captured by the camera is the image expected by the user.
[0073] For example, when the user determines the preset point by manually adjusting the parameters of the camera, the image targeted is a near-field target. Then, when the camera controls the movement of the focus motor according to the focus motor position in the preset point information to focus, the camera also focuses on the near-field target. This avoids the situation that when the automatic focus algorithm is used for focusing, the user actually wants to control the camera to focus on a near-field target, but the camera focuses on a distant target, or the user actually wants to control the camera to focus on a distant target, but the camera focuses on a near-field target.
[0074] Since the focusing function of the camera is achieved by the focus motor controlling the movement of the focus lens group through the transmission structure, the existence of the transmission structure will produce a return difference, that is, when the camera focuses clearly on the same picture, when the focus motor focuses from different movement directions, the feedback value of the final position reached is different.
[0075] Therefore, when the camera obtains the focus instruction for the camera, it can also obtain the current position of the camera's focus motor, and then determine the direction of the camera's focus motor to be moved according to the obtained current position of the camera's focus motor and the target focus motor position in the preset point information, and use it as the first target movement direction to determine whether the direction of the focus motor to be moved during this focusing is consistent with the final focus movement direction of the focus motor when the preset point is set.
[0076] In one implementation, the return difference can be determined by the user by testing each lens separately. Each lens has a corresponding precise return difference. The return difference determined in this way can be described as a precise return difference.
[0077] In another embodiment, the return difference can also be determined by the user testing the return differences of N samples of the same lens, taking the larger return difference value as the universal return difference of the lens, or the user roughly estimates a larger return difference based on experience as the universal return difference of the lens. The return difference determined in this way can be described as the universal return difference.
[0078] The return difference test method may include: after the focus motor moves from two movement directions to the same preset point, the focus motor return difference is determined by comparing the picture clarity images corresponding to the two movement directions. Of course, other methods for determining the return difference may also be used to determine the return difference of the lens, which is not specifically limited here.
[0079] In addition, due to the focal depth of the lens, the image is clear to the naked eye within a certain position range before and after the focus motor position when the focus is clearest. This position range is described as the focus threshold. Therefore, after the camera obtains the current position of the camera's focus motor, it can also determine the difference between the current position of the focus motor and the target focus motor position, and then determine whether the difference is within the focus threshold.
[0080] The focus threshold may be a focus threshold of each lens at different temperatures and focal lengths tested by the user in sections, or a smaller focus threshold selected by the user based on experience, which is not specifically limited here.
[0081] After determining the first target movement direction, the final focus movement direction, and the difference between the current position of the focus motor and the target focus motor position, the camera can control the focus motor movement based on the relationship between the first target movement direction and the final focus movement direction, and the relationship between the difference between the current position and the target focus motor position and a preset focus threshold.
[0082] In the solution provided in the embodiment of the present application, the camera controls the movement of the focus motor to complete the focusing directly based on the first target movement direction and the last focus movement direction, as well as the size relationship between the difference between the current position and the target focus motor position and the preset focus threshold, and does not use the automatic focus algorithm for focusing. Therefore, it avoids the problem that the focus motor needs to switch back and forth between different driving directions when using the automatic focus algorithm for focusing, thereby improving the life of the focus motor. At the same time, because when focusing, it is only necessary to obtain the target focus motor position, the last focus movement direction of the focus motor when setting the preset point, and the current position of the focus motor to focus, there is no need to wait until the camera pan and zoom motor move to the pan position and zoom motor position corresponding to the preset point selected by the user before focusing, thus improving the focusing speed and achieving fast focusing.
[0083] As an implementation manner of an embodiment of the present invention, the above-mentioned controlling the movement of the focus motor based on the first target movement direction and the last focus movement direction, and the magnitude relationship between the difference between the current position and the target focus motor position and a preset focus threshold value may include:
[0084] When the first target movement direction is the same as the final focus movement direction and the difference between the current position and the target focus motor position is not greater than a preset focus threshold, the focus motor is maintained at the current position; when the first target movement direction is different from the final focus movement direction, or the difference between the current position and the target focus motor position is greater than a preset focus threshold, the focus motor is controlled to move to the target focus motor position.
[0085] When the direction of movement of the camera's focus motor, that is, the first target movement direction, is the same as the final focus movement direction of the focus motor when the user sets the preset point, there is no return difference between the movement of the focus motor and the movement of the focus motor when the user sets the preset point during this focusing, so the camera can directly control the focus motor to move to the target focus motor position.
[0086] Furthermore, because the difference between the current position of the focus motor and the target focus motor position is not greater than the preset focus threshold, although the target focus motor position may be the optimal focus motor position, the focused image is also clear when the focus motor is at the current position.
[0087] Therefore, when the first target movement direction is the same as the last focus movement direction, and the difference between the current position of the focus motor and the target focus motor position is not greater than the preset focus threshold, during this focusing, there is no return difference between the movement of the focus motor and the movement of the focus motor when the user sets the preset point. At the same time, when the focus motor is in the current position, the focused picture is also clear, so the camera can directly maintain the focus motor in the current position to complete the focusing, without controlling the focus motor to move.
[0088] When the difference between the current position and the target focus motor position is greater than the preset focus threshold, when the focus motor of the camera is in the current position, the image corresponding to the scene to be shot captured by the camera is blurred, so it is necessary to control the focus motor to move to the target focus motor position so that the camera can capture a clear image corresponding to the scene to be shot.
[0089] When the difference between the current position and the target focus motor position is not greater than the preset focus threshold, in theory, the image corresponding to the scene to be shot is clear and does not need to move. However, when the first target movement direction is different from the final focus movement direction, if the focus motor is kept at the current position to complete the focus, then when the focus motor completes this focus, its movement direction can be considered to be the first target movement direction, and the first target movement direction is different from the final focus movement direction. That is to say, when the user sets the preset point and focuses this time, the same scene is actually focused from different movement directions. The actual positions where the two finally complete the focus are not the same, and it is impossible to guarantee that the image focused this time is exactly the same as the image to be focused when the user sets the preset point. Therefore, in this case, the camera's focus motor needs to move to ensure that the final movement direction when the focus is completed is consistent with the final focus movement direction, and at the same time, the focus motor moves to the target focus click position.
[0090] Therefore, when the difference between the current position and the target focus motor position is greater than the preset focus threshold, the first target movement direction is different from the final focus movement direction; or, when the difference between the current position and the target focus motor position is greater than the preset focus threshold, the first target movement direction is the same as the final focus movement direction; or, when the difference between the current position and the target focus motor position is not greater than the preset focus threshold, the first target movement direction is different from the final focus movement direction.
[0091] That is, when the first target movement direction is different from the final focus movement direction, or when the difference between the current position and the target focus motor position is greater than the preset focus threshold, the camera will control the camera's focus motor to move to the target focus motor position to compensate for the return difference caused by the transmission structure when the focus motor focuses from different movement directions.
[0092] Among them, due to the existence of the focus threshold, when the focus motor is located in a position range where the distance from the target focus motor position is less than the preset focus threshold, the image corresponding to the target object to be photographed focused by the camera is clear. Therefore, the specific method for the above-mentioned camera to control the focus motor to move to the target focus motor position can be to control the focus motor to move to the precise target focus motor position, or to control the focus motor to move to a position range around the target focus motor position.
[0093] Therefore, in one embodiment, the camera can determine the focus position interval according to the target focus motor position of the focus motor and the preset focus threshold, that is, [target focus motor position-preset focus threshold, target focus motor position+preset focus threshold]. When the focus motor is located in the focus position interval, the image corresponding to the target object to be photographed focused by the camera is clear. Therefore, when the camera controls the focus motor to move to the target focus motor position, it can determine a focus motor position from the focus position interval as the target focus motor position, and then control the focus motor to move to the target focus motor position to complete the focusing.
[0094] For example, the target focus motor position and the preset focus threshold are 900 and 20 respectively, so the focus position interval is [880, 920]. Therefore, when the camera controls the focus motor to move to the target focus motor position, it can specifically control the focus motor to move to a focus motor position in [880, 920].
[0095] In the solution provided by the embodiment of the present application, when the camera controls the focus motor of the camera to move, the influence of the return difference caused by different movement directions and the focus threshold are fully considered. When the first target movement direction is the same as the last focus movement direction, and the difference between the current position of the focus motor and the target focus motor position is not greater than the focus threshold, the focus motor can be kept at the current position without moving, further extending the life of the focus motor. When the difference between the current position of the focus motor and the target focus motor position is greater than the focus threshold, or when the first target movement direction is different from the last focus movement direction, the focus motor of the camera can be controlled to move to the target focus motor position to compensate for the return difference caused by the transmission structure when the focus motor focuses from different movement directions, thereby completing the focusing and obtaining a clear image.
[0096] As an implementation manner of an embodiment of the present invention, when the difference between the current position and the target focus motor position is greater than a preset focus threshold, controlling the focus motor to move to the target focus motor position may include:
[0097] In a case where the first target motion direction is the same as the final focus motion direction, the focus motor is controlled to move to the target focus motor position according to the final focus motion direction.
[0098] When the difference between the current position and the target focus motor position is greater than the preset focus threshold, when the focus motor of the camera is in the current position, the picture corresponding to the scene to be shot captured by the camera is blurred, so it is necessary to control the focus motor to move to the target focus motor position to focus on a clear picture.
[0099] Because the first target movement direction is the same as the final focus movement direction, there is no return difference between the movement of the focus motor this time and the movement of the focus camera when setting the preset point. Therefore, the camera can directly control the focus motor to move to the target focus motor position in the final focus movement direction.
[0100] In the solution provided by the embodiment of the present application, when the difference between the current position and the target focus motor position is greater than the preset focus threshold, and when the first target movement direction is the same as the last focus movement direction, the camera can directly control the focus motor of the camera to move to the target focus motor position according to the last focus movement direction. In this way, the movement direction of the focus motor to the preset point during this focusing is consistent with the movement direction of the focus motor when the user sets the preset point, so that the focus motor focuses on the same scene from the same movement direction when the user sets the preset point and the current focusing, ensuring that the actual positions of the two focus motors are consistent when the focusing is completed, so as to accurately focus on the scene that is to be clearly focused when the user sets the preset point.
[0101] As an implementation method of the embodiment of the present invention, Figure 2 As shown, in the case where the first target movement direction is different from the final focus movement direction, the above-mentioned controlling the focus motor to move to the target focus motor position may include:
[0102] S201, controlling the focus motor to move to a target focus position;
[0103] As mentioned above, when the first target movement direction is different from the final focus movement direction, regardless of whether the difference between the current position and the target focus motor position is greater than the preset focus threshold, the camera will control the camera's focus motor to move to the target focus click position.
[0104] At the same time, when the camera controls the focus motor to move, it must ensure that the movement direction of the focus motor when completing the focus needs to be consistent with the final focus movement direction. Therefore, the camera can first control the focus motor to move to the target focus position, where the target focus position can be the sum of the target focus motor position and the return difference of the focus motor.
[0105] In the case where the return difference is a precise return difference, because the first target movement direction is different from the final focus movement direction, when the camera controls the focus motor to move to the target focus position in the first target movement direction, there is a return difference between the current movement of the focus motor and the movement of the focus motor when setting the preset point. And because the target focus position is the sum of the target focus motor position and the precise return difference of the focus motor, and the return difference is the precise return difference corresponding to the lens, when the camera controls the focus motor to move to the target focus position in the first target movement direction, it can accurately compensate for the return difference caused by the inconsistency of the two movement directions between the movement of the focus motor during this focusing and the movement of the focus motor when setting the preset point. Therefore, when the focus motor moves to the target focus position, it has actually moved to the target focus motor position accurately, that is, the focusing has been completed.
[0106] When the return difference is a universal return difference, because the target focus position is the sum of the target focus motor position and the universal return difference of the focus motor, and the universal return difference is greater than the precise return difference corresponding to each lens in this lens, when the camera controls the focus motor to move to the target focus position in the first target movement direction, the focus motor actually moves a further distance after reaching the target focus motor position, that is, the position of the focus motor at this time has actually exceeded the target focus motor position.
[0107] In one embodiment, when the return difference is a universal return difference, in order to further ensure that after the camera controls the focus motor to move to the target focus position in the first target movement direction, the position of the focus motor has exceeded the target focus motor position, the electronic device can increase the compensation amount of the preset position distance on the basis of the sum of the target focus motor position and the return difference of the focus motor, that is, determine the sum of the target focus motor position, the return difference of the focus motor and the compensation amount as the target focus position.
[0108] S202, controlling the focus motor to move from the target focus position to the target focus motor position according to the final focus movement direction.
[0109] When the return difference is a precise return difference, because the focus motor has actually moved precisely to the target focus motor position when it moves to the target focus position, that is, the focusing has been completed. In other words, when the return difference is a precise return difference, the target focus position movement is the target focus motor position. At this time, the camera controls the focus motor in the final focus movement direction, and when it moves from the target focus position to the target focus motor position, the focus motor can be kept at the target focus position.
[0110] When the return difference is a universal return difference, when the camera controls the focus motor to move to the target focus position in the first target movement direction, the focus motor actually moves a further distance after moving to the target focus motor position. Therefore, in order to make the focus motor move to the target focus motor position, the camera needs to control the focus motor to move from the target focus position to the target focus motor position in the final focus movement direction, that is, change the movement direction of the focus motor and move to the target focus motor position to complete the focusing. At this time, the final movement direction of the focus motor is the same as the final focus movement direction when the preset point is set, and there is no return difference.
[0111] In the solution provided in the embodiment of the present application, when the direction of the focus motor to be moved is different from the final focus movement direction of the focus motor when the preset point is set, the camera can control the focus motor to first move to a position after the target focus motor position in the direction of the move, and then change the movement direction and move back to the target focus motor position in the reverse direction, thereby ensuring that the final movement direction of the focus motor is consistent with the final movement direction of the focus motor when the preset point is set during this focusing, thereby ensuring that the current focusing can be accurately focused on the scene that the user wants to focus clearly when setting the preset point.
[0112] As an implementation method of an embodiment of the present invention, the preset point information may also include the target zoom motor position and the final zoom movement direction of the zoom motor when setting the preset point; in this case, the preset point information table may be in the form of the following table:
[0113]
[0114] Correspondingly, such as Figure 3 As shown, the above-mentioned control of the movement of the zoom motor of the camera based on the position of the zoom motor may include:
[0115] S301, obtaining the current position of the zoom motor of the camera, and determining the direction of movement of the zoom motor of the camera according to the current position of the zoom motor of the camera and the target zoom motor position as the second target movement direction;
[0116] Similarly, since the camera's zoom function is achieved by the zoom motor controlling the movement of the zoom lens group through the transmission structure, the existence of the transmission structure will produce a return difference, that is, when the camera lens is zoomed to the same zoom ratio, when the zoom motor zooms from different movement directions, the feedback value of the final position reached is different.
[0117] Therefore, when the camera controls the movement of the zoom motor based on the position of the zoom motor, it can determine the direction of the camera's zoom motor to move according to the acquired current position of the zoom motor and the position of the zoom motor included in the preset point information, and use it as the second target movement direction to determine whether the direction of the zoom motor to move during this zoom is consistent with the final zoom movement direction of the zoom motor when the preset point is set.
[0118] S302: When the second target movement direction is the same as the final magnification movement direction, control the magnification motor to move to the target magnification motor position according to the final magnification movement direction.
[0119] When the camera's zoom motor's current direction of movement, that is, the second target movement direction, is the same as the last zoom movement direction of the zoom motor when the user sets the preset point, there is no return distance difference between the movement of the zoom motor and the movement of the zoom motor when the user sets the preset point during this zoom, so the camera can directly control the zoom motor to move to the zoom motor position included in the preset point information.
[0120] S303, when the second target movement direction is different from the last zoom movement direction, controlling the zoom motor to move to a target zoom position;
[0121] At the same time, when the camera controls the zoom motor to move, it must ensure that the movement direction of the zoom motor when completing the zoom needs to be consistent with the final zoom movement direction. Therefore, the camera can first control the zoom motor to move to the target zoom position, where the target zoom position can be the sum of the zoom motor position in the preset point information and the return difference of the zoom motor.
[0122] Among them, the method for determining the return difference of the zoom motor is similar to the method for determining the return difference of the focus motor, which will not be repeated here.
[0123] In the case where the return difference is a precise return difference, because the second target movement direction is different from the final zoom movement direction, when the camera controls the zoom motor to move to the target zoom position in the second target movement direction, there is a return difference between the current movement of the zoom motor and the movement of the zoom motor when the preset point is set. And because the target zoom position is the sum of the zoom motor position in the preset point information and the return difference of the zoom motor, the return difference is the precise return difference corresponding to the lens, so when the camera controls the zoom motor to move to the target zoom position in the second target movement direction, it just compensates for the return difference caused by the inconsistency between the two movement directions of the zoom motor when the preset point is set. Therefore, when the zoom motor moves to the target zoom position, it has actually moved accurately to the zoom motor position in the preset point information, that is, the zoom has been completed.
[0124] When the return difference is a universal return difference, because the target magnification position is the sum of the magnification motor position in the preset point information and the universal return difference of the magnification motor, and the universal return difference is greater than the precise return difference corresponding to each lens in this lens, when the camera controls the magnification motor to move to the target magnification position in the second target movement direction, the magnification motor actually moves a further distance after moving to the magnification motor position in the preset point information, that is, the position of the magnification motor at this time has actually exceeded the magnification motor position in the preset point information.
[0125] In one embodiment, when the return difference is a universal return difference, in order to further ensure that after the camera controls the magnification motor to move to the target magnification position in the second target motion direction, the position of the magnification motor has exceeded the magnification motor position in the preset point information, the electronic device may add a compensation amount for the preset position distance based on the sum of the magnification motor position in the preset point information and the return difference of the magnification motor, that is, determine the sum of the magnification motor position in the preset point information, the return difference of the magnification motor and the compensation amount as the target magnification position.
[0126] S304, controlling the power changing motor to move from the target power changing position to the target power changing motor position according to the final power changing movement direction.
[0127] When the return difference is a precise return difference, because the zoom motor has actually moved precisely to the zoom motor position in the preset point information when it moves to the target zoom position, the zoom has been completed. In other words, when the return difference is a precise return difference, the target zoom position movement is the zoom motor position in the preset point information. At this time, the camera controls the zoom motor in the final zoom movement direction, and when it moves from the target zoom position to the zoom motor position in the preset point information, the zoom motor can actually be kept at the target zoom position.
[0128] In the case where the return difference is a universal return difference, when the camera controls the zoom motor to move to the target zoom position in the second target movement direction, the zoom motor actually moves a further distance after moving to the zoom motor position in the preset point information. Therefore, in order to make the zoom motor move to the zoom motor position in the preset point information, the camera needs to control the zoom motor in the last zoom movement direction, from the target zoom position to the zoom motor position in the preset point information, that is, change the movement direction of the zoom motor, and move to the zoom motor position in the preset point information to complete the zoom. At this time, the final movement direction of the zoom motor is the same as the final zoom movement direction when the preset point is set, and there is no return difference.
[0129] In the solution provided by the embodiment of the present application, when the camera controls the zoom motor to move, it can first determine whether the direction of the zoom motor of the camera to be moved this time is the same as the final zoom movement direction of the zoom motor when the user sets the preset point. If they are the same, the camera can directly control the zoom motor to move to the zoom motor position according to the final zoom movement direction, while ensuring that the zoom can be accurately zoomed to the desired zoom ratio when the user sets the preset point, and also achieves rapid zoom. If they are different, the camera can control the zoom motor to move to the zoom motor position included in the preset point information according to the direction to be moved, and then change the movement direction and move back to the zoom motor position included in the preset point information, so as to ensure that the final movement direction of the zoom motor is consistent with the final movement direction of the zoom motor when the preset point is set, so as to ensure that the zoom can be accurately zoomed to the desired zoom ratio when the user sets the preset point.
[0130] As an implementation method of an embodiment of the present invention, the preset point information may further include the temperature when the preset point is set; in this case, the preset point information table may be in the form of the following table:
[0131]
[0132] Accordingly, before acquiring the current position of the focus motor of the camera and determining the direction of movement of the focus motor of the camera according to the current position of the focus motor of the camera and the target focus motor position, the method may further include:
[0133] The current temperature is obtained, and based on the target focus motor position, the current temperature, and the temperature when the preset point is set, the compensated focus motor position is calculated according to a preset temperature compensation formula as the updated target focus motor position.
[0134] Because the focus value of the same lens is different at different temperatures, the effect of temperature on the focus motor position needs to be considered when controlling the movement of the focus motor according to the target focus motor position in the preset point information. For example, for the target object to be photographed corresponding to preset point 1, when the temperature is t1, when the focus motor in the camera moves to the target focus motor position F1, a clear picture corresponding to the target object to be photographed can be obtained. However, when the temperature changes, due to the change in the lens focus value, when the focus motor in the camera moves to the target focus motor position F1, the picture corresponding to the target object to be photographed obtained may not meet the clarity requirements.
[0135] Therefore, when the camera obtains the preset point information of the camera indicated by the focus instruction, it can also obtain the current temperature when the focus instruction is received. If the current temperature is the same as the temperature when the preset point is set, the camera can control the focus motor of the camera to move according to the target focus motor position in the preset point information to complete the focus. If the current temperature is different from the temperature when the preset point is set, the camera can calculate the compensated focus motor position based on the focus motor position, current temperature, and temperature when the preset point is set included in the preset point information according to the preset temperature compensation formula, that is, according to the difference between the temperature when the preset point is set and the current temperature, adjust the focus motor position in the preset point information to compensate for the change in the lens focal length value caused by the temperature change.
[0136] The preset temperature compensation formula may be a temperature compensation formula obtained by a user by pre-testing the focus values of the same lens at different temperatures, and then using simulation fitting according to different focus values at different temperatures. Alternatively, if the lens manufacturer provides the temperature compensation formula for the lens, the temperature compensation formula corresponding to the lens may be directly obtained, which is not specifically limited here.
[0137] In the solution provided in the embodiment of the present application, the camera can further consider the influence of temperature on the focal length value of the lens when controlling the movement of the focus motor. The compensated focus motor position can be calculated according to a preset temperature compensation formula based on the focus motor position in the preset point information, the current temperature, and the temperature when the preset point is set, so as to compensate for the change in the focal length value of the lens caused by the temperature change, thereby accurately determining the position where the focus motor should be when focusing is completed.
[0138] As an implementation method of an embodiment of the present invention, the above-mentioned preset point information may further include: a target pan / tilt position; wherein the target pan / tilt position may be recorded as a pan / tilt horizontal angle and a pan / tilt vertical angle. In this case, the preset point information table may be in the form of the following table:
[0139]
[0140] Accordingly, the method may further include:
[0141] Control the pan / tilt motor of the camera to move to the target pan / tilt position.
[0142] In the case where the camera has a pan / tilt head, the above-mentioned preset point information may also save the position information of the pan / tilt head when the preset point information is set. In this way, while the camera controls the movement of the focus motor and the zoom motor, it can also simultaneously control the movement of the pan / tilt head motor to make the horizontal angle and vertical angle of the pan / tilt head the same as the horizontal angle and vertical angle of the pan / tilt head in the preset point information, that is, the pan / tilt head is controlled to move to the pan / tilt head position in the preset point information according to the preset point information.
[0143] In the solution provided in the embodiment of the present application, the camera can also control the pan / tilt to move to the target pan / tilt position in the preset point information, because the target pan / tilt position in the preset point information represents the direction and angle that the camera is facing when the user is shooting the target object to be photographed corresponding to the preset point information. Therefore, the camera controls the pan / tilt to move to the target pan / tilt position in the preset point information, which can well ensure that the target object to be photographed corresponding to the preset point information is located in the shooting picture.
[0144] Below Figure 4 Taking the focusing method of the camera in this application as an example, the following is described in detail:
[0145] S401, obtaining preset point information and temperature;
[0146] When the camera obtains the focus instruction for the camera, the preset point information and the current temperature of the camera indicated by the focus instruction can be obtained, wherein the preset point information may include: the target pan / tilt position, the target zoom motor position, the target focus motor position, the last focus movement direction of the focus motor when setting the preset point, the last zoom movement direction of the zoom motor when setting the preset point, and the temperature when setting the preset point. The above preset point information can be stored in the camera in the form of a preset point information table as shown in the following table.
[0147]
[0148] S402, performing temperature compensation on the position of the focus motor;
[0149] Because the focus value of the same lens is different at different temperatures, when controlling the focus motor to move according to the preset point information, it is necessary to consider the influence of temperature on the position of the focus motor. Therefore, the camera can calculate the compensated focus motor position based on the target focus motor position, the current temperature, and the temperature when the preset point is set according to the preset temperature compensation formula, that is, perform temperature compensation on the position of the focus motor.
[0150] S403, determining whether the direction of the focus motor to be moved is consistent with the last focus movement direction in the preset point information;
[0151] Because the focus motor uses a transmission mechanism to control the movement of the focus lens group, and the transmission structure will produce a return difference, so when the focus motor focuses from different movement directions, the feedback value of the final position is different. Therefore, the camera can first determine whether the direction of the focus motor to be moved is consistent with the movement direction of the focus motor in the preset point information.
[0152] S404, first move to the target focus position, and then move in the opposite direction to the focus motor position after compensation;
[0153] If the direction of the focus motor to be moved is inconsistent with the movement direction of the focus motor in the preset point information, a return difference will be generated when the camera controls the focus motor to move to the compensated focus motor position according to the direction of the focus motor to be moved. Therefore, the camera can control the focus motor to move to the target focus position first, and then move in the opposite direction to the compensated focus motor position. That is, the camera can control the focus motor to move to the target focus position according to the direction of the focus motor to be moved, and then change the movement direction and move in the opposite direction back to the compensated focus motor position, thereby ensuring that the final movement direction of the focus motor is consistent with the final movement direction of the focus motor for setting the preset point during this focusing, thereby ensuring that the current focusing can be accurately focused on the scene that the user wants to focus clearly when setting the preset point.
[0154] S405, determining whether the difference between the position of the focus motor after temperature compensation and the current position of the focus motor is greater than a preset focus threshold;
[0155] If the direction of movement of the focus motor is consistent with the movement direction of the focus motor in the preset point information, the camera can further determine whether the difference between the position of the focus motor after temperature compensation and the current position of the focus motor is greater than the preset focus threshold to determine whether the focus motor needs to move.
[0156] S406, directly moving to the focus motor position after compensation;
[0157] If the difference between the position of the focus motor after temperature compensation and the current position of the focus motor is greater than a preset threshold, the camera can directly control the focus motor to move to the compensated focus motor position.
[0158] S407, keeping the focus motor at the current position;
[0159] If the difference between the position of the focus motor after temperature compensation and the current position of the focus motor is not greater than the preset threshold, it means that the current position is within the focus threshold corresponding to the compensated focus motor position, that is, although the compensated focus motor position may be the best focus motor position, when the focus motor is at the current position, the focused image is also clear. Therefore, when the direction of the focus motor to be moved is consistent with the direction of movement of the focus motor in the preset point information, and the difference between the current position and the compensated focus motor position is not greater than the preset focus threshold, during this focusing, there is no return difference between the movement of the focus motor and the movement of the focus motor when the user sets the preset point. At the same time, when the focus motor is at the current position, the focused image is also clear, so the camera can directly keep the focus motor at the current position to complete the focusing, without controlling the focus motor of the camera to move.
[0160] S408, determining whether the direction of movement of the zoom motor to be moved is consistent with the movement direction of the zoom motor in the preset point information;
[0161] While the camera controls the movement of the focusing motor, it can also control the movement of the zoom motor. The zoom motor also uses a transmission mechanism to control the movement of the zoom lens group, so there is also a problem of return difference. Therefore, after obtaining the preset point information and temperature, the camera can also determine whether the direction of movement of the zoom motor is consistent with the movement direction of the zoom motor in the preset point information.
[0162] S409, directly moving to the target zoom motor position in the preset point information;
[0163] If the direction of the zoom motor to be moved is consistent with the movement direction of the zoom motor in the preset point information, the camera can directly control the zoom motor to move to the zoom motor position in the preset point information.
[0164] S410, first move to the target zoom position, and then move in the opposite direction to the target zoom motor position in the preset point information;
[0165] If the direction of the zoom motor to be moved is inconsistent with the movement direction of the zoom motor in the preset point information, a return difference will be generated when the camera controls the zoom motor to move to the zoom motor position in the preset point information according to the direction of the zoom motor to be moved. Therefore, the camera can control the zoom motor to move to the target zoom position first, and then move in the opposite direction to the zoom motor position in the preset point information. That is, the camera can control the zoom motor to move to the target zoom position according to the direction of the zoom motor to be moved, and then change the movement direction and move in the opposite direction back to the zoom motor position in the preset point information, thereby ensuring that the final movement direction of the zoom motor is consistent with the final movement direction of the zoom motor for setting the preset point during this zoom change, thereby ensuring that the zoom can be accurately changed to the desired zoom ratio when the user sets the preset point during this zoom change.
[0166] S411, the PTZ moves directly to the target PTZ position in the preset point information;
[0167] While the camera controls the movement of the focus motor and the zoom motor, it can also control the pan / tilt head to move directly to the pan / tilt head position in the preset point information according to the preset point information.
[0168] In the solution provided by the embodiment of the present application, the camera can calculate the compensated focus motor position according to the preset temperature compensation formula based on the target focus motor position, current temperature, and temperature when the preset point is set in the preset point information, that is, determine the position where the focus motor should be when focusing is completed, and then the camera can control the movement of the focus motor of the camera based on the compensated focus motor position to complete focusing. The problem that the focus motor needs to switch back and forth in different driving directions when focusing with the automatic focusing algorithm is avoided, thereby improving the life of the focus motor. At the same time, because when focusing, only the target focus motor position, the last focus movement direction, the current temperature, and the temperature when the preset point is set in the preset point information need to be obtained, there is no need to wait until the camera pan, zoom motor and focus motor move to the target pan position and target zoom motor position corresponding to the preset point selected by the user before focusing, and the focus motor directly moves to the compensated focus motor position to achieve focusing without repeated back and forth movement, thereby improving the focusing speed and achieving fast focusing.
[0169] And due to the existence of depth of field, there are targets at different distances in a scene to be shot, and the automatic focus algorithm cannot ensure that both the near-view and far-view targets are clearly focused at the same time. It may focus on the near-view target or the far-view target. Therefore, the automatic focus method may result in that the target that the user actually wants to control the camera to focus on is the near-view target, but when the camera uses the automatic focus algorithm, it focuses on the far-view target, thereby affecting the user experience. In the solution provided by the embodiment of the present application, because the target focus motor position in the preset point information is the parameter corresponding to the camera when the picture of the scene to be shot is clear as expected by the user, when the focus motor of the camera moves with reference to the target focus motor position in the preset point information, the scene focused by the camera is the scene to be shot as expected by the user, and there will be no situation where the target that the user actually wants to control the camera to focus on is the near-view target, but the camera focuses on the far-view target, or the target that the user actually wants to control the camera to focus on is the far-view target, but the camera focuses on the near-view target.
[0170] In addition, when the camera controls the movement of the zoom motor and the focus motor of the camera, the influence of the return difference and the focus threshold caused by the movement direction is fully considered. By controlling the movement mode of the zoom motor and the focus motor, the change of the lens focal length value caused by the temperature change is compensated and the influence of the return difference on the motor movement is eliminated, thereby completing the focusing and obtaining a clear image. In addition, in the solution provided by the embodiment of the present application, the zoom motor and the focus motor will only change direction when the direction to be moved is inconsistent with the direction in the preset point information, that is, there is only a 50% probability of changing direction, so the life of the zoom motor and the focus motor is greatly improved.
[0171] Corresponding to the above-mentioned focusing method of a camera, an embodiment of the present application further provides a focusing device of a camera. The following is an introduction to a focusing device of a camera provided in an embodiment of the present application.
[0172] like Figure 5 As shown, a focusing device for a camera, the device comprising:
[0173] The information acquisition module 510 is used to acquire the preset point information of the camera indicated by the focus instruction when a focus instruction for the camera is acquired, wherein the preset point information at least includes: a target focus motor position and a final focus movement direction of the focus motor when setting the preset point;
[0174] A first movement direction determining module 520, configured to obtain a current position of the focus motor of the camera, and determine a direction of movement of the focus motor of the camera according to the current position of the focus motor of the camera and the target focus motor position, as a first target movement direction;
[0175] The focus motor control module 530 is used to control the focus motor movement based on the first target movement direction and the last focus movement direction, and the size relationship between the difference between the current position and the target focus motor position and a preset focus threshold.
[0176] It can be seen that in the solution provided by the embodiment of the present application, the camera can obtain the preset point information of the camera indicated by the focus instruction when obtaining the focus instruction for the camera, wherein the preset point information at least includes: the target focus motor position and the final focus movement direction of the focus motor when setting the preset point; obtain the current position of the focus motor of the camera, and determine the direction of the focus motor to be moved of the camera according to the current position of the focus motor of the camera and the target focus motor position, as the first target movement direction; based on the first target movement direction and the final focus movement direction, and the size relationship between the difference between the current position and the target focus motor position and the preset focus threshold, control the movement of the focus motor. Since the camera controls the movement of the focus motor to complete the focusing directly based on the first target movement direction and the final focus movement direction, and the size relationship between the difference between the current position and the target focus motor position and the preset focus threshold, and does not use the automatic focus algorithm for focusing, it avoids the problem that the focus motor needs to switch back and forth between different driving directions when using the automatic focus algorithm for focusing, thereby improving the life of the focus motor. At the same time, because when focusing, it is only necessary to obtain the target focus motor position, the last focus movement direction of the focus motor when setting the preset point, and the current position of the focus motor, there is no need to wait until the camera pan and zoom motor move to the pan position and zoom motor position corresponding to the preset point selected by the user before focusing. Therefore, the focusing speed is improved and fast focusing is achieved.
[0177] As an implementation of the embodiment of the present application, the focus motor control module 530 may include:
[0178] a first control unit, configured to maintain the focus motor at the current position when the first target motion direction is the same as the last focus motion direction and the difference between the current position and the target focus motor position is not greater than a preset focus threshold;
[0179] The second control unit is used to control the focus motor to move to the target focus motor position when the first target movement direction is different from the final focus movement direction, or when the difference between the current position and the target focus motor position is greater than a preset focus threshold.
[0180] As an implementation manner of an embodiment of the present application, the second control unit can be specifically used to control the focus motor to move to the target focus motor position according to the final focus movement direction when the first target movement direction is the same as the final focus movement direction; control the focus motor to move to the target focus position when the first target movement direction is different from the final focus movement direction; control the focus motor to move from the target focus position to the target focus motor position according to the final focus movement direction, wherein the target focus position is the sum of the target focus motor position and the return difference of the focus motor.
[0181] As an implementation of the embodiment of the present application, the preset point information may further include: the target zoom motor position and the final zoom movement direction of the zoom motor when setting the preset point; the device may further include:
[0182] A second movement direction determination module is used to obtain the current position of the zoom motor of the camera, and determine the direction of movement of the zoom motor of the camera according to the current position of the zoom motor of the camera and the target zoom motor position as the second target movement direction;
[0183] A magnification motor control module, used to control the magnification motor to move to the target magnification motor position in the final magnification motion direction when the second target motion direction is the same as the final magnification motion direction; and to control the magnification motor to move to the target magnification position when the second target motion direction is different from the final magnification motion direction, and to control the magnification motor to move from the target magnification position to the target magnification motor position in the final magnification motion direction, wherein the target magnification position is the sum of the target magnification motor position and the return difference of the magnification motor.
[0184] As an implementation of the embodiment of the present application, the preset point information may further include: the temperature when the preset point is set; the device may further include:
[0185] The temperature compensation module is used to obtain the current temperature and calculate the compensated focus motor position as the updated target focus motor position according to a preset temperature compensation formula based on the target focus motor position, the current temperature and the temperature when the preset point is set.
[0186] As an implementation of the embodiment of the present application, the preset point information may further include: a target PTZ position; the device may further include:
[0187] The pan / tilt control module is used to control the pan / tilt motor of the camera to move to the target pan / tilt position.
[0188] The present application also provides a camera, such as Figure 6 As shown, it includes: a pan / tilt motor 601, a zoom motor 602, a focus motor 603, a processor 604 and a memory 605:
[0189] Memory 605, used for storing computer programs;
[0190] The processor 604 is used to implement the camera focusing method steps described in any of the above embodiments when executing the program stored in the memory 605.
[0191] It can be seen that in the solution provided by the embodiment of the present application, the camera can obtain the preset point information of the camera indicated by the focus instruction when obtaining the focus instruction for the camera, wherein the preset point information at least includes: the target focus motor position and the final focus movement direction of the focus motor when setting the preset point; obtain the current position of the focus motor of the camera, and determine the direction of the focus motor to be moved of the camera according to the current position of the focus motor of the camera and the target focus motor position, as the first target movement direction; based on the first target movement direction and the final focus movement direction, and the size relationship between the difference between the current position and the target focus motor position and the preset focus threshold, control the movement of the focus motor. Since the camera controls the movement of the focus motor to complete the focusing directly based on the first target movement direction and the final focus movement direction, and the size relationship between the difference between the current position and the target focus motor position and the preset focus threshold, and does not use the automatic focus algorithm for focusing, it avoids the problem that the focus motor needs to switch back and forth between different driving directions when using the automatic focus algorithm for focusing, thereby improving the life of the focus motor. At the same time, because when focusing, it is only necessary to obtain the target focus motor position, the last focus movement direction of the focus motor when setting the preset point, and the current position of the focus motor, there is no need to wait until the camera pan and zoom motor move to the pan position and zoom motor position corresponding to the preset point selected by the user before focusing. Therefore, the focusing speed is improved and fast focusing is achieved.
[0192] In addition, the camera may further include a communication bus and / or a communication interface, and the processor 604, the communication interface, and the memory 605 communicate with each other via the communication bus.
[0193] The communication bus mentioned in the above camera can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0194] The communication interface is used for communication between the above-mentioned camera and other devices.
[0195] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0196] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0197] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the focusing method steps of the camera described in any of the above embodiments are implemented.
[0198] In another embodiment provided by the present application, a computer program product including instructions is also provided. When the computer program product is run on a computer, the computer executes the focusing method of a camera described in any one of the above embodiments.
[0199] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that contains one or more available media integrated. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), etc.
[0200] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0201] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, camera, computer-readable storage medium, and computer program product embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0202] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A camera focusing method, It is characterized in that The method comprises: When a focus instruction for a camera is obtained, the preset point information of the camera indicated by the focus instruction is obtained, wherein the preset point information at least includes: a target focus motor position and a final focus movement direction of the focus motor when setting the preset point; Acquire the current position of the focus motor of the camera, and determine the direction of the focus motor of the camera to be moved according to the current position of the focus motor of the camera and the target focus motor position as the first target movement direction; Controlling the focus motor movement based on the first target movement direction and the last focus movement direction, and the magnitude relationship between the difference between the current position and the target focus motor position and a preset focus threshold; The controlling the movement of the focus motor based on the first target movement direction and the last focus movement direction, and the magnitude relationship between the difference between the current position and the target focus motor position and a preset focus threshold, includes: When the first target motion direction is the same as the last focus motion direction and the difference between the current position and the target focus motor position is not greater than a preset focus threshold, maintaining the focus motor at the current position; When the first target movement direction is different from the last focus movement direction, or when the difference between the current position and the target focus motor position is greater than a preset focus threshold, the focus motor is controlled to move to the target focus motor position.
2. The method according to claim 1, It is characterized in that In a case where the difference between the current position and the target focus motor position is greater than a preset focus threshold, controlling the focus motor to move to the target focus motor position comprises: In a case where the first target motion direction is the same as the final focus motion direction, the focus motor is controlled to move to the target focus motor position according to the final focus motion direction.
3. The method according to claim 1, It is characterized in that In a case where the first target motion direction is different from the final focus motion direction, controlling the focus motor to move to the target focus motor position comprises: Controlling the focus motor to move to a target focus position, wherein the target focus position is the sum of the target focus motor position and the return difference of the focus motor; The focus motor is controlled to move from the target focus position to the target focus motor position according to the final focus movement direction.
4. The method according to claim 1, It is characterized in that The preset point information also includes: the target zoom motor position and the final zoom movement direction of the zoom motor when setting the preset point; the method also includes: Acquire the current position of the zoom motor of the camera, and determine the direction of movement of the zoom motor of the camera according to the current position of the zoom motor of the camera and the target zoom motor position as the second target movement direction; When the second target movement direction is the same as the final zoom movement direction, controlling the zoom motor to move to the target zoom motor position according to the final zoom movement direction; When the second target movement direction is different from the final magnification movement direction, the magnification motor is controlled to move to the target magnification position, and the magnification motor is controlled to move from the target magnification position to the target magnification motor position according to the final magnification movement direction, wherein the target magnification position is the sum of the target magnification motor position and the return difference of the magnification motor.
5. The method according to any one of claims 1 to 4, It is characterized in that The preset point information also includes: the temperature when setting the preset point; Before acquiring the current position of the focus motor of the camera and determining the direction of the focus motor of the camera to be moved according to the current position of the focus motor of the camera and the target focus motor position, the method further includes: The current temperature is obtained, and based on the target focus motor position, the current temperature, and the temperature when the preset point is set, the compensated focus motor position is calculated according to a preset temperature compensation formula as the updated target focus motor position.
6. The method according to any one of claims 1 to 4, It is characterized in that The preset point information also includes: the target PTZ position; the method also includes: Control the pan / tilt motor of the camera to move to the target pan / tilt position.
7. A focusing device for a camera, It is characterized in that The device comprises: An information acquisition module, configured to acquire, when a focus instruction for a camera is acquired, preset point information of the camera indicated by the focus instruction, wherein the preset point information at least includes: a target focus motor position and a final focus movement direction of the focus motor when setting the preset point; A first movement direction determination module, used for acquiring the current position of the focus motor of the camera, and determining the direction of the focus motor of the camera to be moved as the first target movement direction according to the current position of the focus motor of the camera and the target focus motor position; a focus motor control module, configured to control the focus motor movement based on the first target movement direction and the last focus movement direction, and a magnitude relationship between a difference between the current position and the target focus motor position and a preset focus threshold; Wherein, the focusing motor control module comprises: a first control unit, configured to maintain the focus motor at the current position when the first target motion direction is the same as the last focus motion direction and the difference between the current position and the target focus motor position is not greater than a preset focus threshold; The second control unit is used to control the focus motor to move to the target focus motor position when the first target movement direction is different from the final focus movement direction, or when the difference between the current position and the target focus motor position is greater than a preset focus threshold.
8. The device according to claim 7, It is characterized in that The second control unit is specifically configured to control the focus motor to move to the target focus motor position according to the final focus movement direction when the first target movement direction is the same as the final focus movement direction; and control the focus motor to move to the target focus position when the first target movement direction is different from the final focus movement direction; Controlling the focus motor to move from the target focus position to the target focus motor position according to the final focus movement direction, wherein the target focus position is the sum of the target focus motor position and the return difference of the focus motor; or, The preset point information also includes: the target zoom motor position and the final zoom movement direction of the zoom motor when setting the preset point; the device also includes: A second movement direction determination module is used to obtain the current position of the zoom motor of the camera, and determine the direction of movement of the zoom motor of the camera according to the current position of the zoom motor of the camera and the target zoom motor position as the second target movement direction; A zoom motor control module, used for controlling the zoom motor to move to the target zoom motor position according to the last zoom movement direction when the second target movement direction is the same as the last zoom movement direction; controlling the zoom motor to move to the target zoom position when the second target movement direction is different from the last zoom movement direction, and controlling the zoom motor to move from the target zoom position to the target zoom motor position according to the last zoom movement direction, wherein the target zoom position is the sum of the target zoom motor position and the return difference of the zoom motor; or, The preset point information also includes: the temperature when the preset point is set; the device also includes: A temperature compensation module, used to obtain the current temperature, and based on the target focus motor position, the current temperature, and the temperature when the preset point is set, calculate the compensated focus motor position according to a preset temperature compensation formula as the updated target focus motor position; or, The preset point information also includes: the target PTZ position; the device also includes: The pan / tilt control module is used to control the pan / tilt motor of the camera to move to the target pan / tilt position.
9. A camera, It is characterized in that The camera includes a pan / tilt motor, a zoom motor, a focus motor, a processor and a memory, wherein: Memory, used to store computer programs; A processor, used to implement the method described in any one of claims 1 to 6 when executing the program stored in the memory.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Focusing method of simple electric lens
CN105245781A
Focusing method and apparatus, cameras and camera system
CN105763795A
Focusing presetting bit rectification method
CN107664805A
Focusing regulator, video camera device, focusing regulation program and storage medium
CN1434342A
Camera system
JP2005099084A
