A focusing method, device, equipment and medium
By calculating the number of focusing motor steps between tracking target areas, real-time and rapid focusing of targets in the monitoring scene is achieved, focusing blur and jitter problems are solved, and the clarity of the evidence chain is improved.
Patent Information
- Application Number
- CN202410813676.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2044-06-21
AI Technical Summary
In surveillance scenarios, existing technology is difficult to achieve real-time and rapid tracking and focusing of targets. Especially when the position of the target changes, it is easy to cause focus blur or tracking and focus jitter, affecting the clarity of the evidence chain.
By determining the distance between the first area and the second area of the tracking target, the corresponding number of focusing motor steps is calculated, and these steps are used to control the focusing motor to quickly focus on the target to ensure clear tracking of the target in the monitoring scene.
It achieves real-time and rapid focusing on the monitoring target, avoids focus blur and tracking focus jitter, and improves the clarity of the evidence chain and monitoring efficiency.
Smart Images

Figure CN118381999B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of camera technology, and in particular to a focusing method, device, equipment and medium. Background Art
[0002] With the application of artificial intelligence technology and the development of the Internet of Things, the monitoring and security industry will develop in the direction of intelligence and digitization. Intelligence and digitization put forward high requirements for focus, focusing on the level of tracking and focusing. Real-time and rapid focus on the target is the most difficult point for many intelligent businesses, because the evidence chain of monitoring business requires clear capture and video stream of designated targets such as faces and license plates. Summary of the invention
[0003] The embodiments of the present application provide a focusing method, apparatus, device and medium for realizing rapid focusing of another area by utilizing one area of a tracking target in a monitoring scene.
[0004] A focusing method provided in an embodiment of the present application includes:
[0005] When there is a tracking target in the monitoring scene of the camera, determining a first area of the tracking target;
[0006] Determine a first focus motor step number corresponding to a first object distance between a first area of the tracking target and the camera; and determine a second focus motor step number corresponding to a distance between a first position and a second position, wherein the first position is the position of the first area of the tracking target, the distance between the first position and the second position is equal to the distance between the position of the first area of the tracking target and the position of the second area of the tracking target in a first direction, and a line connecting the first position and the second position is parallel to a second direction;
[0007] The first focus motor step number and the second focus motor step number are used to determine a third focus motor step number corresponding to a second object distance between the second position and the camera; and the focus motor is controlled to focus on a second area of the tracking target according to the third focus motor step number.
[0008] The embodiment of the present application uses the method to, when confirming that there is a tracking target in the monitoring scene of the camera, determine the first area of the tracking target, and further determine the first focusing motor step corresponding to the first object distance between the first area and the camera, and then determine the second focusing motor step corresponding to the distance between the first position and the second position, wherein the first position is the position of the first area of the tracking target, and the distance between the first position and the second position is equal to the distance between the position of the first area of the tracking target and the position of the second area of the tracking target, so that the first focusing motor step and the second focusing motor step can be used to determine the third focusing motor step corresponding to the second object distance between the second position and the camera; and then the focusing motor can be controlled according to the third focusing motor step to focus on the second area of the tracking target, so that, for the tracking target in the monitoring scene, it is achieved to use one area to quickly focus on another area, and then it is possible to achieve real-time and rapid tracking and focusing of the monitoring target in the monitoring scene, and solve the problem of blurred target focus or obvious tracking and focusing jitter in intelligent services.
[0009] In some implementations, determining a first number of focus motor steps corresponding to the first object distance includes:
[0010] Controlling a focus motor of the camera to focus on a first area of the tracking target;
[0011] The number of steps of the focus motor of the camera when the focus motor focuses on the first area of the tracking target is obtained as the first number of steps of the focus motor corresponding to the first object distance.
[0012] In some implementations, determining the number of second focus motor steps corresponding to the distance between the first position and the second position includes:
[0013] Acquire a current focal length of a zoom motor corresponding to when the focus motor of the camera focuses on a first area of the tracking target;
[0014] Determine, according to an object distance curve pre-set for the camera, a plurality of object distances corresponding to the current focal length of the zoom motor, and determine the number of focus motor steps corresponding to each of the plurality of object distances;
[0015] Determine the number of focus motor steps corresponding to a unit object distance based on the number of focus motor steps corresponding to each object distance among the plurality of object distances;
[0016] The number of focusing motor steps corresponding to the unit object distance is used to determine the number of focusing motor steps corresponding to the distance in the first direction between the position of the first area of the tracking target and the position of the second area of the tracking target, and the number of focusing motor steps is used as the second number of focusing motor steps corresponding to the distance between the first position and the second position.
[0017] In some implementations, determining a third focus motor step corresponding to a second object distance between the second position and the camera using the first focus motor step and the second focus motor step includes:
[0018] Determine the field of view of the lens of the camera corresponding to the first area in the first direction by using the monitoring picture of the monitoring scene and the field of view of the lens of the camera;
[0019] The third focus motor step corresponding to the second object distance between the second position and the camera is determined by using the field of view angle of the lens of the camera corresponding to the first area in the first direction, the first focus motor step number and the second focus motor step number.
[0020] In some implementations, determining the field of view angle of the lens of the camera corresponding to the first area in the first direction by using the monitoring screen of the monitoring scene and the field of view angle of the lens of the camera includes:
[0021] Determine the field of view angle of the lens of the camera corresponding to the center point position of the monitoring screen of the monitoring scene in the first direction, and the entire field of view angle of the lens of the camera corresponding to the monitoring screen in the first direction;
[0022] and determining the distance between the first area and the center point of the monitoring screen, and the proportion of the distance between the first area and the monitoring screen in the first direction;
[0023] Based on the field of view angle of the camera lens in the first direction corresponding to the center point position of the monitoring screen of the monitoring scene, the entire field of view angle of the camera lens in the first direction corresponding to the monitoring screen, and the proportion, the field of view angle of the camera lens in the first direction corresponding to the first area is determined.
[0024] In some embodiments, the method further comprises:
[0025] Setting at least one monitoring area in the monitoring scenario;
[0026] A linear region in the at least one monitoring region is determined; and the tracking target is a tracking target located in the linear region.
[0027] In some embodiments, a distance in a first direction between a position of the first area of the tracking target and a position of the second area of the tracking target is a preset length;
[0028] Alternatively, the method further comprises:
[0029] Respectively determining the coordinate position of the center point of the first area of the tracking target and the coordinate position of the center point of the second area of the tracking target;
[0030] Based on the center point coordinate position of the first area of the tracking target and the center point coordinate position of the second area of the tracking target, a distance in a first direction between the position of the first area of the tracking target and the position of the second area of the tracking target is determined.
[0031] A focusing device provided in an embodiment of the present application includes:
[0032] The first unit is configured to determine a first area of a tracking target when there is a tracking target in the monitoring scene of the camera,
[0033] A second unit is used to determine a first focus motor step number corresponding to a first object distance between a first area of the tracking target and the camera; and determine a second focus motor step number corresponding to a distance between a first position and a second position, wherein the first position is a position of the first area of the tracking target, the distance between the first position and the second position is equal to a distance between a position of the first area of the tracking target and a position of the second area of the tracking target in a first direction, and a line connecting the first position and the second position is parallel to a second direction;
[0034] The third unit is used to determine the third focusing motor step corresponding to the second object distance between the second position and the camera by using the first focusing motor step and the second focusing motor step; and control the focusing motor to focus on the second area of the tracking target according to the third focusing motor step.
[0035] Another embodiment of the present application provides an electronic device, which includes a memory and a processor, wherein the memory is used to store program instructions, and the processor is used to call the program instructions stored in the memory and execute any of the above methods according to the obtained program.
[0036] Another embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable the computer to execute any of the above methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1 A schematic diagram of the overall process of a focusing method provided in an embodiment of the present application;
[0039] Figure 2 A schematic diagram of an object distance curve provided in an embodiment of the present application;
[0040] Figure 3 A schematic diagram of a specific flow chart of a method for focusing on the face of a pedestrian provided in an embodiment of the present application;
[0041] Figure 4 A schematic diagram of a monitoring scenario provided in an embodiment of the present application;
[0042] Figure 5 A schematic diagram of a linear region in a monitoring scenario provided in an embodiment of the present application;
[0043] Figure 6 A schematic diagram of the principle of determining the linear region provided in the embodiment of the present application;
[0044] Figure 7 A schematic diagram of the principle of how to determine the number of Focus motor steps corresponding to the face position provided in the embodiment of the present application;
[0045] Figure 8 A schematic diagram of the principle of how to determine the field of view angle θ of the camera lens in the vertical direction corresponding to the position of a person's foot provided in an embodiment of the present application;
[0046] Fig. 9 A schematic diagram of a specific process of a method for focusing on a license plate of a motor vehicle provided in an embodiment of the present application;
[0047] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0048] Fig.11 A schematic structural diagram of a focusing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] 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 without creative work are within the scope of protection of this application.
[0050] The embodiments of the present application provide a focusing method, apparatus, device and medium for realizing rapid focusing of another area by utilizing one area of a tracking target in a monitoring scene.
[0051] Among them, the method and the device, equipment, and medium are based on the same application concept. Since the principles of solving problems by the method and the device, equipment, and medium are similar, the implementation of the device, equipment, medium, and method can refer to each other, and the repeated parts will not be repeated.
[0052] The terms "first", "second", etc. (if any) in the specification and claims of the embodiments of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in a sequence other than the content illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0053] The following examples and embodiments are to be understood as illustrative examples only. Although this specification may refer to "one", "an" or "some" examples or embodiments in several places, this does not mean that each such reference relates to the same example or embodiment, nor does it mean that the feature applies only to a single example or embodiment. Individual features of different embodiments may also be combined to provide other embodiments. In addition, terms such as "including" and "comprising" should be understood as not limiting the described embodiments to consist only of those features that have been mentioned; such examples and embodiments may also include features, structures, units, modules, etc. that are not specifically mentioned.
[0054] The following is a detailed description of each embodiment of the present application in conjunction with the accompanying drawings. It should be noted that the display order of the embodiments of the present application only represents the order of the embodiments, and does not represent the advantages and disadvantages of the technical solutions provided by the embodiments.
[0055] The embodiments of the present application propose to realize real-time and rapid tracking and focusing of the target focus area in an intelligent monitoring scenario based on an area outside the target focus area of the object, and can avoid the problem of target focus blur or obvious tracking and focusing jitter caused by the influence of the background area of the target focus area on the target focus area.
[0056] See also Figure 1 , a focusing method provided in an embodiment of the present application includes:
[0057] S01. When a tracking target exists in a monitoring scene of a camera, determining a first area of the tracking target;
[0058] The tracking target, such as a person, a motor vehicle, a non-motor vehicle, etc., can be set according to actual needs.
[0059] The first area of the tracking target is, for example, a foot area of a person, or a wheel area of a motor vehicle, etc., and can be specifically set according to actual needs.
[0060] There are many ways to specifically identify the tracking target and the first area of the tracking target, such as identification based on a preset model, which are not limited in the embodiments of the present application.
[0061] S02, determining a first focusing motor step number corresponding to a first object distance between a first area of the tracking target and the camera; and determining a second focusing motor step number corresponding to a distance between a first position and a second position.
[0062] The first position is the position of the first area of the tracking target, the distance between the first position and the second position is equal to the distance between the position of the first area of the tracking target (for example, the center position of the first area) and the position of the second area of the tracking target (for example, the center position of the second area) in the first direction, and the line connecting the first position and the second position is parallel to the second direction.
[0063] That is to say, in the embodiment of the present application, the distance between the first position and the second position in the second direction is equivalent to the distance between the position of the first area of the tracking target and the position of the second area of the tracking target in the first direction, and then the third focusing motor steps corresponding to the second object distance between the second position and the camera can be equivalent to the focusing motor steps corresponding to the object distance between the second area of the tracking target and the camera, thereby achieving rapid focusing on the second area of the tracking target.
[0064] In some implementations, the first position is a position where the tracking target contacts a ground area, such as a foot position of a person or a wheel position of a motor vehicle.
[0065] The second area, for example, is a face area, that is, a target area for focus. Therefore, in the embodiment of the present application, the foot area of a person can be used to achieve rapid focus on the face area.
[0066] In some embodiments, the first direction is perpendicular to the second direction.
[0067] In some embodiments, the first direction may be, for example, a vertical direction, or other directions, depending on actual needs;
[0068] In some implementations, the second direction may be, for example, a horizontal direction, or other directions, depending on actual needs.
[0069] S03. Determine a third focusing motor step corresponding to a second object distance between the second position and the camera by using the first focusing motor step and the second focusing motor step; and control the focusing motor to focus on a second area of the tracking target according to the third focusing motor step.
[0070] That is to say, after determining the third focus motor step corresponding to the second object distance between the second position and the camera, the embodiment of the present application can use the third focus motor step as the focus motor step corresponding to the object distance of the second area of the tracking target, thereby controlling the focus motor to focus on the second area of the tracking target according to the focus motor step corresponding to the object distance of the second area of the tracking target.
[0071] In some implementations, determining a first number of focus motor steps corresponding to the first object distance includes:
[0072] Controlling a focus motor of the camera to focus on a first area of the tracking target;
[0073] The number of steps of the focus motor of the camera when the focus motor focuses on the first area of the tracking target is obtained as the first number of steps of the focus motor corresponding to the first object distance.
[0074] For example, after identifying the foot region of a person, the number of steps of the corresponding focusing motor is obtained by focusing on the foot region, and the number of steps is used as the first number of steps of the focusing motor.
[0075] In some implementations, determining the number of second focus motor steps corresponding to the distance between the first position and the second position includes:
[0076] Acquire a current focal length of a zoom motor corresponding to when the focus motor of the camera focuses on a first area of the tracking target;
[0077] Determine, according to an object distance curve pre-set for the camera, a plurality of object distances corresponding to the current focal length of the zoom motor, and determine the number of focus motor steps corresponding to each of the plurality of object distances;
[0078] Determine the number of focus motor steps corresponding to a unit object distance based on the number of focus motor steps corresponding to each object distance among the plurality of object distances;
[0079] The number of focusing motor steps corresponding to the unit object distance is used to determine the number of focusing motor steps corresponding to the distance in the first direction between the position of the first area of the tracking target and the position of the second area of the tracking target, and the number of focusing motor steps is used as the second number of focusing motor steps corresponding to the distance between the first position and the second position.
[0080] The object distance curve described in the embodiment of the present application is also called a zoom following curve, for example Figure 2 As shown in the figure, the lens manufacturer will provide the object distance curve of the camera lens at different object distances when leaving the factory. The physical meaning of this curve can be understood as follows: at a specified object distance, the zoom motor and focus motor change position according to the curve corresponding to the object distance, so that the tracked target is clear throughout the entire process in the captured image.
[0081] For example, Figure 2 Four object distance curves are shown, which are the object distance curves corresponding to different object distances of the preset camera lens (the object distances are 3 meters, 5 meters, 10 meters, and infinity, and the INF curve is the curve with an object distance of infinity). The horizontal axis is the Zoom motor step (also called the number of steps), and the vertical axis is the Focus motor step. Figure 2 It can be seen that each object distance curve is similar in trend and shape, but the separation becomes greater as the focal length increases (i.e. the vertical coordinate becomes larger), and the linear adjustment range and ratio between the corresponding object distances are very different.
[0082] Therefore, in some embodiments, according to the object distance curve pre-set for the camera, multiple object distances corresponding to the current focal length of the zoom motor are determined, and the number of focus motor steps corresponding to each of the multiple object distances is determined:
[0083] The multiple object distances, for example, 80m, 70m;
[0084] The number of focusing motor steps corresponding to each of the plurality of object distances is, for example, respectively expressed as Fstep 80m 、Fstep 70m ;
[0085] Based on the number of focus motor steps corresponding to each object distance in the plurality of object distances, the number of focus motor steps corresponding to a unit object distance is determined:
[0086] The unit object distance, for example 1m, can of course also be set to a unit object distance of other lengths according to actual needs;
[0087] The number of focusing motor steps corresponding to the unit object distance is determined, for example, by the following formula 1:
[0088] Formula 1;
[0089] Regarding the focus motor steps corresponding to the unit object distance, the focus motor steps corresponding to the distance in the first direction between the position of the first area of the tracking target and the position of the second area of the tracking target are determined, and the focus motor steps are used as the second focus motor steps corresponding to the distance between the first position and the second position:
[0090] For example, the number of focus motor steps corresponding to the unit object distance is used to determine the number of focus motor steps corresponding to the distance in the first direction between the position of the first area of the tracking target and the position of the second area of the tracking target. For example, the number of focus motor steps corresponding to the height of a person of 1.6 m is calculated as 1.6 multiplied by E. 1m .
[0091] In some implementations, determining a third focus motor step corresponding to a second object distance between the second position and the camera using the first focus motor step and the second focus motor step includes:
[0092] Determine the field of view of the lens of the camera corresponding to the first area in the first direction by using the monitoring picture of the monitoring scene and the field of view of the lens of the camera;
[0093] The third focus motor step corresponding to the second object distance between the second position and the camera is determined by using the field of view angle of the lens of the camera corresponding to the first area in the first direction, the first focus motor step number and the second focus motor step number.
[0094] The field of view angle in the first direction is, for example, represented by θ;
[0095] In some implementations, the third focus motor step corresponding to the second object distance between the second position and the camera is determined using the field of view angle of the lens of the camera corresponding to the first area in the first direction, the first focus motor step number, and the second focus motor step number, for example, by using the following formula 2:
[0096] Formula 2:
[0097] Among them, a represents the number of steps of the first focusing motor, b represents the number of steps of the second focusing motor, and c represents the number of steps of the third focusing motor.
[0098] In some implementations, determining the field of view angle of the lens of the camera corresponding to the first area in the first direction by using the monitoring screen of the monitoring scene and the field of view angle of the lens of the camera includes:
[0099] Determine the field of view angle of the lens of the camera corresponding to the center point position of the monitoring screen of the monitoring scene in the first direction, and the entire field of view angle of the lens of the camera corresponding to the monitoring screen in the first direction;
[0100] and determining the distance between the first area and the center point of the monitoring screen, and the proportion of the distance between the first area and the monitoring screen in the first direction;
[0101] Based on the field of view angle of the camera lens in the first direction corresponding to the center point position of the monitoring screen of the monitoring scene, the entire field of view angle of the camera lens in the first direction corresponding to the monitoring screen, and the proportion, the field of view angle of the camera lens in the first direction corresponding to the first area is determined.
[0102] In some embodiments, the field of view angle of the camera lens in the first direction corresponding to the center point position of the monitoring screen of the monitoring scene is, for example, a vertical angle x;
[0103] The entire field of view angle of the lens of the camera corresponding to the monitoring image in the first direction, for example, a vertical angle y;
[0104] The distance between the first area and the center point of the monitoring screen is, for example, the pixel distance H1 in the vertical direction from the center point of the human foot area to the center of the screen;
[0105] Assume that the pixel height of the monitoring image in the vertical direction is H2;
[0106] Then, the proportion, i.e. z= H1 / H2;
[0107] Based on the field of view of the lens of the camera corresponding to the center point position of the monitoring screen of the monitoring scene in the first direction, the entire field of view of the lens of the camera corresponding to the monitoring screen in the first direction, and the proportion, the field of view of the lens of the camera corresponding to the first area in the first direction is determined, for example, by using the following formula three:
[0108] Formula 3;
[0109] If the tracking target is in the lower center of the picture, the field of view angle of the camera lens corresponding to the first area in the first direction is ;
[0110] If the tracking target is in the upper center of the picture, the field of view angle of the lens of the camera corresponding to the first area in the first direction is .
[0111] In some embodiments, the method further comprises:
[0112] Setting at least one monitoring area in the monitoring scenario;
[0113] A linear region in the at least one monitoring region is determined; and the tracking target is a tracking target located in the linear region.
[0114] The linear region is the region where the number of focus motor steps changes linearly as the tracking target moves, for example, a ground region such as a driveway or lawn.
[0115] In some embodiments, a distance in a first direction between a position of the first area of the tracking target and a position of the second area of the tracking target is a preset length;
[0116] Alternatively, the method further comprises:
[0117] Respectively determining the coordinate position of the center point of the first area of the tracking target and the coordinate position of the center point of the second area of the tracking target;
[0118] Based on the center point coordinate position of the first area of the tracking target and the center point coordinate position of the second area of the tracking target, a distance in a first direction between the position of the first area of the tracking target and the position of the second area of the tracking target is determined.
[0119] The preset length, for example, the height of a person takes a preset fixed value of 1.6m, 1.8m, etc. Of course, in the embodiment of the present application, the height of a person can also be determined in real time, and the actual height of a person can be identified by methods such as image target recognition, so as to determine the position of the first area of the tracking target and the distance between the position of the second area of the tracking target in the first direction.
[0120] The following uses a monitoring target as a person to illustrate the focusing method provided in the embodiment of the present application. Example
[0121] See also Figure 3, a focusing method provided in an embodiment of the present application includes:
[0122] S101. Set a monitoring scene.
[0123] For example, monitoring a road section and nearby buildings, pedestrians, etc. Figure 4 As shown;
[0124] In addition, the monitoring screen can be further divided into detection areas in advance, and target detection rules can be set.
[0125] Among them, the detection area, for example, can divide the monitoring screen into 9 areas, and set one or more of them as the detection area for tracking the target, which can be determined according to actual needs, so as to achieve more efficient and more targeted target detection and focusing;
[0126] The target detection rules, for example, set the tracking target to be one or more of a person, a machine (motor vehicle), a non-motor vehicle, etc., can be set to monitor only pedestrians, or only motor vehicles, or both people and machines can be monitored. The specific setting can be determined according to actual needs.
[0127] S102, determining a linear region in a monitoring scenario;
[0128] Furthermore, in order to improve the target detection efficiency and thus improve the focusing efficiency, target detection can be performed only on the linear areas in the monitoring image. That is, one or more areas can be selected from the detection area as linear areas, and only the linear areas can be used to determine whether there is a tracking target.
[0129] For example, see Figure 5 , lanes and the ground areas beside the lanes (except the areas occupied by buildings) can be used as linear areas.
[0130] In some embodiments, when saving the settings for the monitoring scene, the camera can focus on the monitoring scene once, obtain the Focus motor position information (i.e., the number of Focus motor steps, which also represents the object distance of different areas) corresponding to all detection areas on the monitoring screen, and identify the number of Focus motor steps corresponding to the object distance of the position with the best clarity corresponding to each detection area.
[0131] For example, for any detection area, the Focus motor position information corresponding to the detection area may be the number of Focus motor steps corresponding to the object distance at the center point of the detection area.
[0132] Alternatively, for any detection area, when there is a tracking target in the detection area, the Focus motor position information corresponding to the detection area may also be the Focus motor position information corresponding to the object distance of the tracking target. In the case where there are multiple tracking targets in a detection area, for example, the object distance of a tracking target corresponding to the maximum clarity value found by the focusing algorithm may represent the object distance of the detection area, and the number of Focus motor steps corresponding to the object distance may be used as the Focus motor position information corresponding to the detection area.
[0133] Regarding how to identify the linear region, for example, the linear region can be determined based on a change rate threshold of the Focus motor position.
[0134] Specifically, for example, the change rate of the Focus motor position in the horizontal and vertical directions (the motor position actually represents the object distance) is preset to 5%. For any detection area, when the target pedestrian being tracked in the area moves, the Focus motor position also changes accordingly. If the direction and rate of change of the Focus motor position at the same object distance do not differ by more than 5%, then the area can be determined to be a linear area. For example, see Figure 6 , the pedestrian moves from point A to point B and point C respectively, and the object distances corresponding to points A, B and C are a1, a2 and a3 respectively. Taking the lateral position change of the Focus motor as an example, if the rate of change of the Focus motor position corresponding to a1 to a2, and the rate of change of the Focus motor position corresponding to a2 to a3, are both less than 5%, then the area where the pedestrian is located is determined to be a linear area. In other words, the linear area described in the embodiments of the present application refers to the area where the target walks or drives, which is basically an area where the object distance such as the road changes relatively linearly. If the change in the stepping of the Focus motor in a region shows relative equidistant, or shows relative equidistant intervals, the region can be judged to be a linear region. Of course, in actual applications, there can be other methods for judging linear areas, which are not limited in the embodiments of the present application.
[0135] S103, determine whether there is a tracking target in the linear area, if yes, execute step S104; otherwise, continue to execute step S103, for example, wait for a preset time to determine again whether there is a tracking target in the linear area.
[0136] For each linear region, it is identified whether there is a tracking target therein, such as a human or a machine. In this embodiment, it is assumed that a pedestrian is detected.
[0137] S104, determining the position of the person's feet;
[0138] For example, the coordinates of the center point of the foot area of the person (eg, pixel coordinates) are determined as the foot position of the person.
[0139] S105, determining the first Focus motor step number corresponding to the object distance of the person's foot position;
[0140] For example, the Focus motor is controlled to focus on the position of the person's feet, and the number of steps of the Focus motor at this time is read as the first number of steps of the Focus motor.
[0141] S106, determining the second Focus motor step number corresponding to the distance between the first position point and the second position point, wherein the first position point is the position of a person's foot, a line connecting the first position point and the second position point is parallel to a horizontal line, and the distance between the second position point and the first position point is the height of the person.
[0142] For example Figure 7 As shown in the figure, the foot position of a person is point A, i.e., the first position point. In the horizontal direction, there is a second position point, i.e., point A'. The actual distance between point A and point A' is the height of the person, where a represents the object distance at point A, b represents the actual distance between point A and point A', c represents the object distance at point A', and d represents the object distance at the position of the face. It can be seen that since b is equivalent to the height of the person, d is equivalent to c, so the number of Focus motor steps corresponding to the object distance at point A' can be used as the number of Focus motor steps corresponding to the object distance at the position of the face.
[0143] It should be noted that, since the number of steps of the Focus motor represents the object distance, in the above formula 2, a, b, and c can also represent the number of steps of the Focus motor.
[0144] In some embodiments, in order to improve efficiency, the distance between the second position point and the first position point can adopt a preset value. For example, when the target is a person, the distance between the second position point and the first position point can be 1.6m or 1.8m. For another example, when the target is a motor vehicle, because the focus is mainly on the license plate, half of the vehicle height can be used as the distance between the second position point and the first position point, such as 1.0m.
[0145] Of course, in practical applications, in order to ensure that the numerical values are more accurate, for example: for pedestrian targets, the distance between the human feet and the human face can be calculated based on the coordinate position of the human feet (such as the pixel coordinates of the center point of the circumscribed rectangular area of the feet) and the coordinate position of the human face (such as the pixel coordinates of the center point of the circumscribed rectangular area of the face), as the vertical distance between the second position point and the first position point; for motor vehicles, the vertical distance between the wheel and the license plate can be calculated based on the coordinate position of the wheel (such as the pixel coordinates of the center point of the circumscribed rectangular area of the wheel) and the coordinate position of the license plate (such as the pixel coordinates of the center point of the circumscribed rectangular area of the license plate), as the distance between the second position point and the first position point.
[0146] Then, regarding determining the second Focus motor step number corresponding to the distance between the first position point and the second position point, for example:
[0147] Assume that in the current linear region, the number of Focus motor steps at the actual background object distance (i.e., the object distance corresponding to the global clear point of the current linear region image) under the current zoom motor steps (i.e., the current focal length) is 500, and the object distance is 80m; then, assuming that the separation ratios of the object distance curves of 70m, 60m...1m corresponding to the current focal length (i.e., the difference in the number of Focus motor steps of each object distance curve when the number of zoom motor steps is the same) are all 1, take the subdivision of the Focus motor steps between 80m and 70m as an example, the number of Focus motor steps corresponding to the unit object distance can be obtained:
[0148]
[0149] That is, the above formula reflects the following physical meaning: for an object distance of 80m, the position of the Focus motor under the current zoom motor steps is compared with the position of the Focus motor under the current zoom motor steps for an object distance of 70m. For every 1m change in the object distance, the corresponding change in the number of Focus motor steps is E 1m .
[0150] Then, the number of Focus motor steps corresponding to a person of 1.6m in height is 1.6 times E. 1m ;
[0151] Similarly, the number of Focus motor steps corresponding to a person 1.8 meters tall is 1.8 times E. 1m .
[0152] In some implementations, an average of the number of Focus motor steps corresponding to a person with a height of 1.6 m and the number of Focus motor steps corresponding to a person with a height of 1.8 m may be used as the second number of Focus motor steps.
[0153] S107, determining a third Focus motor step number corresponding to the object distance at the second position point, and using the third Focus motor step number as the Focus motor step number corresponding to the object distance at the person's face position, and controlling the Focus motor to focus on the person's face according to the Focus motor step number corresponding to the object distance at the person's face position.
[0154] See also Figure 8 ,For example:
[0155] First, according to the frame size of the entire monitoring screen and the PT angle of the camera lens, determine the vertical field of view angle θ of the camera lens corresponding to the position of the person's feet:
[0156] Obtain the PT angle of the center point (i.e., point O) of the picture, including the horizontal angle and the vertical angle (in this embodiment, only the vertical angle may be used);
[0157] Figure 8 Point A in the middle represents the position of a person’s feet;
[0158] So, if Figure 8 As shown, the person is at the lower center of the picture. If the vertical field of view of the camera lens corresponding to the center point of the picture (i.e., point O) is x degrees, and the vertical field of view of the entire picture is y degrees, then in the vertical direction, the angle deviation from the center point of the entire picture to the person's feet, that is, the difference in the vertical field of view from point O to point A, is y multiplied by (H1 / H2). Therefore, the vertical field of view of the camera lens corresponding to the position of the person's feet is Among them, H1 represents the distance from point O to point A in the vertical direction (which can be determined according to the pixel coordinates of point O and point A), and H2 represents the size of the entire screen in the vertical direction. The units of H1 and H2 can both be pixels.
[0159] Similarly, if the person is in the upper center of the picture, the vertical field of view of the camera lens corresponding to the person's feet is .
[0160] Finally, combined with the cosine theorem, Figure 7 As shown, we can get
[0161] At this time, a can also be understood as the object distance of the human foot (the object distance of the human foot can be determined according to the coordinates of the center point of the human foot area, and the specific method is not limited in the embodiments of the present application), b is, for example, a preset 1.6m or 1.8m, and then the object distance c of the point A' is obtained, and the Focus motor steps corresponding to c (the preset object distance curve can be used, combined with the current focal length and the object distance c, to determine the Focus motor steps corresponding to c) are used as the Focus motor steps corresponding to the point with equal object distance (i.e., the face position, where the point A' position is at the same object distance as the face position), and then the Focus motor steps are used to achieve rapid focusing on the face.
[0162] Subsequently, the target image or video may be captured, and step S103 may be continued at intervals of a preset time.
[0163] The following uses a motor vehicle as the monitoring target to illustrate the focusing method provided in the embodiment of the present application, wherein explanations and examples similar to those in the above-mentioned embodiment 1 are not repeated herein. Example
[0164] See also Fig. 9 , a focusing method provided in an embodiment of the present application includes:
[0165] S201, setting monitoring scene;
[0166] S202, determining a linear region under a monitoring scenario;
[0167] S203, determine whether there is a tracking target in the linear area, if yes, execute step S204; otherwise, continue to execute step S203, for example, wait for a preset time to determine again whether there is a tracking target in the linear area.
[0168] In this embodiment, it is assumed that a motor vehicle is detected within the current linear region;
[0169] S204, determining wheel position;
[0170] For example, determine the pixel coordinates of the center position of the wheel area.
[0171] S205, determining the first Focus motor step number corresponding to the object distance of the wheel position;
[0172] S206. Determine the second Focus motor step number corresponding to the distance between the first position point and the second position point, wherein the first position point is the wheel position, the line connecting the first position point and the second position point is parallel to the horizontal line, and the distance between the second position point and the first position point is the distance between the wheel and the license plate, which can be a preset value, or the distance in the vertical direction from the actually detected coordinates of the center point of the wheel area to the coordinates of the center point of the license plate.
[0173] S207, determining a third Focus motor step number corresponding to the object distance of the second position point, and using the third Focus motor step number as the Focus motor step number corresponding to the object distance of the license plate, and controlling the Focus motor to focus on the license plate according to the Focus motor step number corresponding to the object distance of the license plate.
[0174] Subsequently, the target image or video may be captured, and step S203 may be continued at intervals of a preset time.
[0175] It should be noted that the above examples are respectively described with people and motor vehicles as detection targets, but are not limited thereto, and are also applicable to targets such as non-motor vehicles. In addition, the above embodiments may also add a step of identifying the type of tracking target. For example, when the tracking target is identified in the linear region, if the tracking target is determined to be a person, step S104 and subsequent steps in embodiment 1 are executed, and if the tracking target is determined to be a motor vehicle, step S204 and subsequent steps in embodiment 2 are executed. Similarly, if it is determined to be another type of tracking target, the corresponding subsequent processing steps are executed, which will not be repeated.
[0176] The following is an introduction to the equipment or device provided in the embodiments of the present application, in which the explanations or examples of technical features that are the same or corresponding to those described in the above method will not be repeated later.
[0177] An electronic device provided in an embodiment of the present application is, for example, a camera or a device inside the camera. Fig.10 , the electronic device includes, for example:
[0178] The processor 600 is used to read the program in the memory 620 and execute the following process:
[0179] When there is a tracking target in the monitoring scene of the camera, determining a first area of the tracking target;
[0180] Determine a first focus motor step number corresponding to a first object distance between a first area of the tracking target and the camera; and determine a second focus motor step number corresponding to a distance between a first position and a second position, wherein the first position is the position of the first area of the tracking target, the distance between the first position and the second position is equal to the distance between the position of the first area of the tracking target and the position of the second area of the tracking target in a first direction, and a line connecting the first position and the second position is parallel to a second direction;
[0181] The first focus motor step number and the second focus motor step number are used to determine a third focus motor step number corresponding to a second object distance between the second position and the camera; and the focus motor is controlled to focus on a second area of the tracking target according to the third focus motor step number.
[0182] In some implementations, determining a first number of focus motor steps corresponding to the first object distance includes:
[0183] Controlling a focus motor of the camera to focus on a first area of the tracking target;
[0184] The number of steps of the focus motor of the camera when the focus motor focuses on the first area of the tracking target is obtained as the first number of steps of the focus motor corresponding to the first object distance.
[0185] In some implementations, determining the number of second focus motor steps corresponding to the distance between the first position and the second position includes:
[0186] Acquire a current focal length of a zoom motor corresponding to when the focus motor of the camera focuses on a first area of the tracking target;
[0187] Determine, according to an object distance curve pre-set for the camera, a plurality of object distances corresponding to the current focal length of the zoom motor, and determine the number of focus motor steps corresponding to each of the plurality of object distances;
[0188] Determine the number of focus motor steps corresponding to a unit object distance based on the number of focus motor steps corresponding to each object distance among the plurality of object distances;
[0189] The number of focusing motor steps corresponding to the unit object distance is used to determine the number of focusing motor steps corresponding to the distance in the first direction between the position of the first area of the tracking target and the position of the second area of the tracking target, and the number of focusing motor steps is used as the second number of focusing motor steps corresponding to the distance between the first position and the second position.
[0190] In some implementations, determining a third focus motor step corresponding to a second object distance between the second position and the camera using the first focus motor step and the second focus motor step includes:
[0191] Determine the field of view of the lens of the camera corresponding to the first area in the first direction by using the monitoring picture of the monitoring scene and the field of view of the lens of the camera;
[0192] The third focus motor step corresponding to the second object distance between the second position and the camera is determined by using the field of view angle of the lens of the camera corresponding to the first area in the first direction, the first focus motor step number and the second focus motor step number.
[0193] In some implementations, determining the field of view angle of the lens of the camera corresponding to the first area in the first direction by using the monitoring screen of the monitoring scene and the field of view angle of the lens of the camera includes:
[0194] Determine the field of view angle of the lens of the camera corresponding to the center point position of the monitoring screen of the monitoring scene in the first direction, and the entire field of view angle of the lens of the camera corresponding to the monitoring screen in the first direction;
[0195] and determining the distance between the first area and the center point of the monitoring screen, and the proportion of the distance between the first area and the monitoring screen in the first direction;
[0196] Based on the field of view angle of the camera lens in the first direction corresponding to the center point position of the monitoring screen of the monitoring scene, the entire field of view angle of the camera lens in the first direction corresponding to the monitoring screen, and the proportion, the field of view angle of the camera lens in the first direction corresponding to the first area is determined.
[0197] In some implementations, the processor 600 is further configured to read a program in the memory 620 and execute the following process:
[0198] Setting at least one monitoring area in the monitoring scenario;
[0199] A linear region in the at least one monitoring region is determined; and the tracking target is a tracking target located in the linear region.
[0200] In some embodiments, a distance in a first direction between a position of the first area of the tracking target and a position of the second area of the tracking target is a preset length;
[0201] Alternatively, the processor 600 is further configured to read a program in the memory 620 and execute the following process:
[0202] Respectively determining the coordinate position of the center point of the first area of the tracking target and the coordinate position of the center point of the second area of the tracking target;
[0203] Based on the center point coordinate position of the first area of the tracking target and the center point coordinate position of the second area of the tracking target, a distance in a first direction between the position of the first area of the tracking target and the position of the second area of the tracking target is determined.
[0204] The transceiver 610 is configured to receive and send data under the control of the processor 600 .
[0205] Among them, Fig.10 In the embodiment, the bus architecture may include any number of interconnected buses and bridges, specifically one or more processors represented by processor 600 and various circuits of memory represented by memory 620 are linked together. The bus architecture may also link together various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface provides an interface. The transceiver 610 may be a plurality of components, namely, a transmitter and a receiver, providing a unit for communicating with various other devices on a transmission medium, including wireless channels, wired channels, optical cables, and other transmission media. For different user devices, the user interface 630 may also be an interface capable of externally and internally connecting required devices, and the connected devices include but are not limited to a keypad, a display, a speaker, a microphone, a joystick, and the like.
[0206] The processor 600 is responsible for managing the bus architecture and general processing, and the memory 620 can store data used by the processor 600 when performing operations.
[0207] In some embodiments, the processor 600 may be a CPU (central processing unit), an ASIC (Application Specific Integrated Circuit), an FPGA (Field-Programmable Gate Array) or a CPLD (Complex Programmable Logic Device), and the processor may also adopt a multi-core architecture.
[0208] The processor calls the computer program stored in the memory to execute any of the methods provided in the embodiments of the present application according to the obtained executable instructions. The processor and the memory can also be arranged physically separately.
[0209] It should be noted here that the above-mentioned device provided in the embodiment of the present application can implement all the method steps implemented in the above-mentioned method embodiment, and can achieve the same technical effect. The parts and beneficial effects of this embodiment that are the same as those in the method embodiment will not be described in detail here.
[0210] See also Fig.11 , a focusing device provided in an embodiment of the present application, such as a camera or a device inside a camera, includes:
[0211] The first unit 11 is used to determine a first area of the tracking target when there is a tracking target in the monitoring scene of the camera,
[0212] The second unit 12 is used to determine a first focus motor step number corresponding to a first object distance between a first area of the tracking target and the camera; and determine a second focus motor step number corresponding to a distance between a first position and a second position, wherein the first position is a position of the first area of the tracking target, the distance between the first position and the second position is equal to a distance between a position of the first area of the tracking target and a position of the second area of the tracking target in a first direction, and a line connecting the first position and the second position is parallel to a second direction;
[0213] The third unit 13 is used to determine the third focusing motor step corresponding to the second object distance between the second position and the camera by using the first focusing motor step and the second focusing motor step; and control the focusing motor to focus on the second area of the tracking target according to the third focusing motor step.
[0214] In some implementations, determining a first number of focus motor steps corresponding to the first object distance includes:
[0215] Controlling a focus motor of the camera to focus on a first area of the tracking target;
[0216] The number of steps of the focus motor of the camera when the focus motor focuses on the first area of the tracking target is obtained as the first number of steps of the focus motor corresponding to the first object distance.
[0217] In some implementations, determining the number of second focus motor steps corresponding to the distance between the first position and the second position includes:
[0218] Acquire a current focal length of a zoom motor corresponding to when the focus motor of the camera focuses on a first area of the tracking target;
[0219] Determine, according to an object distance curve pre-set for the camera, a plurality of object distances corresponding to the current focal length of the zoom motor, and determine the number of focus motor steps corresponding to each of the plurality of object distances;
[0220] Determine the number of focus motor steps corresponding to a unit object distance based on the number of focus motor steps corresponding to each object distance among the plurality of object distances;
[0221] The number of focusing motor steps corresponding to the unit object distance is used to determine the number of focusing motor steps corresponding to the distance in the first direction between the position of the first area of the tracking target and the position of the second area of the tracking target, and the number of focusing motor steps is used as the second number of focusing motor steps corresponding to the distance between the first position and the second position.
[0222] In some implementations, determining a third focus motor step corresponding to a second object distance between the second position and the camera using the first focus motor step and the second focus motor step includes:
[0223] Determine the field of view of the lens of the camera corresponding to the first area in the first direction by using the monitoring picture of the monitoring scene and the field of view of the lens of the camera;
[0224] The third focus motor step corresponding to the second object distance between the second position and the camera is determined by using the field of view angle of the lens of the camera corresponding to the first area in the first direction, the first focus motor step number and the second focus motor step number.
[0225] In some implementations, determining the field of view angle of the lens of the camera corresponding to the first area in the first direction by using the monitoring screen of the monitoring scene and the field of view angle of the lens of the camera includes:
[0226] Determine the field of view angle of the lens of the camera corresponding to the center point position of the monitoring screen of the monitoring scene in the first direction, and the entire field of view angle of the lens of the camera corresponding to the monitoring screen in the first direction;
[0227] and determining the distance between the first area and the center point of the monitoring screen, and the proportion of the distance between the first area and the center point of the monitoring screen in the first direction;
[0228] Based on the field of view angle of the camera lens in the first direction corresponding to the center point position of the monitoring screen of the monitoring scene, the entire field of view angle of the camera lens in the first direction corresponding to the monitoring screen, and the proportion, the field of view angle of the camera lens in the first direction corresponding to the first area is determined.
[0229] In some implementations, the first unit 11 is further configured to:
[0230] Setting at least one monitoring area in the monitoring scenario;
[0231] A linear region in the at least one monitoring region is determined; and the tracking target is a tracking target located in the linear region.
[0232] In some embodiments, a distance in a first direction between a position of the first area of the tracking target and a position of the second area of the tracking target is a preset length;
[0233] Alternatively, the second unit 12 is further configured to:
[0234] Respectively determining the coordinate position of the center point of the first area of the tracking target and the coordinate position of the center point of the second area of the tracking target;
[0235] Based on the center point coordinate position of the first area of the tracking target and the center point coordinate position of the second area of the tracking target, a distance in a first direction between the position of the first area of the tracking target and the position of the second area of the tracking target is determined.
[0236] It should be noted that the division of units in the embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional unit in each embodiment of the present application may be integrated into a processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0237] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0238] Any of the devices or apparatuses provided in the embodiments of the present application may specifically be a desktop computer, a portable computer, a smart phone, a tablet computer, a personal digital assistant (PDA), etc. It may include a central processing unit (CPU), a memory, an input / output device, etc. The input device may include a keyboard, a mouse, a touch screen, etc. The output device may include a display device, such as a liquid crystal display (LCD), a cathode ray tube (CRT), etc.
[0239] The memory may include a read-only memory (ROM) and a random access memory (RAM), and provides the processor with program instructions and data stored in the memory. In the embodiment of the present application, the memory may be used to store the program of any of the methods provided in the embodiment of the present application.
[0240] The processor calls the program instructions stored in the memory, and the processor is used to execute any of the methods provided in the embodiments of the present application according to the obtained program instructions.
[0241] The present application embodiment also provides a computer program product or computer program, which includes a computer instruction, which is stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction so that the computer device performs any of the methods described in the above embodiments. The program product can use any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0242] The embodiment of the present application provides a computer-readable storage medium for storing computer program instructions used by the apparatus provided in the embodiment of the present application, which includes a program for executing any of the methods provided in the embodiment of the present application. The computer-readable storage medium may be a non-transitory computer-readable medium.
[0243] The computer-readable storage medium can be any available medium or data storage device that can be accessed by a computer, including but not limited to magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc.), optical storage (such as CD, DVD, BD, HVD, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, non-volatile memory (NANDFLASH), solid-state drive (SSD)), etc.
[0244] It should be understood that:
[0245] The access technology through which entities in the communication network transmit traffic can be any suitable current or future technology, such as WLAN (Wireless Local Access Network), WiMAX (Worldwide Interoperability for Microwave Access), LTE, LTE-A, 5G, Bluetooth, infrared, etc.; in addition, the embodiments can also apply wired technology, for example, IP-based access technology, such as a wired network or a fixed line.
[0246] Embodiments suitable for being implemented as software code or a portion thereof and running using a processor or processing functionality are independent of the software code and may be specified using any known or future developed programming language, such as a high-level programming language such as objective-C, C, C++, C#, Java, Python, Javascript, other scripting languages, etc., or a low-level programming language such as machine language or assembler.
[0247] The implementation of the embodiments is hardware independent and may be implemented using any known or future developed hardware technology or any mixture thereof, such as a microprocessor or CPU (central processing unit), MOS (metal oxide semiconductor), CMOS (complementary MOS), BiMOS (bipolar MOS), BiCMOS (bipolar CMOS), ECL (emitter coupled logic) and / or TTL (transistor-transistor logic).
[0248] Embodiments may be implemented as separate devices, apparatuses, units, components, or functions, or in a distributed manner, for example, one or more processors or processing functions may be used or shared in a process, or one or more processing segments or processing portions may be used and shared in a process, wherein one physical processor or more than one physical processor may be used to implement one or more processing portions dedicated to a specific process as described.
[0249] The device may be implemented by a semiconductor chip, a chipset, or a (hardware) module including such a chip or chipset.
[0250] The embodiments may also be implemented as any combination of hardware and software, such as ASIC (Application Specific IC (Integrated Circuit)) components, FPGA (Field Programmable Gate Array) or CPLD (Complex Programmable Logic Device) components or DSP (Digital Signal Processor) components.
[0251] The embodiments may also be implemented as a computer program product including a computer usable medium having computer readable program code embodied therein, the computer readable program code being adapted to perform the processes as described in the embodiments, wherein the computer usable medium may be a non-transitory medium.
[0252] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program codes.
[0253] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0254] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0255] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0256] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A focusing method, characterized in that: The method comprises: When there is a tracking target in the monitoring scene of the camera, determining a first area of the tracking target; Determine a first focus motor step number corresponding to a first object distance between a first area of the tracking target and the camera; and determine a second focus motor step number corresponding to a distance between a first position and a second position, wherein the first position is the position of the first area of the tracking target, the distance between the first position and the second position is equal to the distance between the position of the first area of the tracking target and the position of the second area of the tracking target in a first direction, and a line connecting the first position and the second position is parallel to a second direction; Determine a third focus motor step corresponding to a second object distance between the second position and the camera by using the first focus motor step and the second focus motor step; and control the focus motor to focus on a second area of the tracking target according to the third focus motor step; Wherein, using the first focus motor step number and the second focus motor step number to determine a third focus motor step number corresponding to a second object distance between the second position and the camera comprises: Determine the field of view of the lens of the camera corresponding to the first area in the first direction by using the monitoring picture of the monitoring scene and the field of view of the lens of the camera; The third focus motor step corresponding to the second object distance between the second position and the camera is determined by using the field of view angle of the lens of the camera corresponding to the first area in the first direction, the first focus motor step number and the second focus motor step number.
2. The method according to claim 1, characterized in that The determining of the first number of focusing motor steps corresponding to the first object distance comprises: Controlling a focus motor of the camera to focus on a first area of the tracking target; The number of steps of the focus motor of the camera when the focus motor focuses on the first area of the tracking target is obtained as the first number of steps of the focus motor corresponding to the first object distance.
3. The method according to claim 2, characterized in that The step of determining the second focusing motor step corresponding to the distance between the first position and the second position comprises: Acquire a current focal length of a zoom motor corresponding to when the focus motor of the camera focuses on a first area of the tracking target; Determine, according to an object distance curve pre-set for the camera, a plurality of object distances corresponding to the current focal length of the zoom motor, and determine the number of focus motor steps corresponding to each of the plurality of object distances; Determine the number of focus motor steps corresponding to a unit object distance based on the number of focus motor steps corresponding to each object distance among the plurality of object distances; The number of focusing motor steps corresponding to the unit object distance is used to determine the number of focusing motor steps corresponding to the distance in the first direction between the position of the first area of the tracking target and the position of the second area of the tracking target, and the number of focusing motor steps is used as the second number of focusing motor steps corresponding to the distance between the first position and the second position.
4. The method according to claim 1, characterized in that: The determining the field of view angle of the lens of the camera corresponding to the first area in the first direction by using the monitoring picture of the monitoring scene and the field of view angle of the lens of the camera includes: Determine the field of view angle of the lens of the camera corresponding to the center point position of the monitoring screen of the monitoring scene in the first direction, and the entire field of view angle of the lens of the camera corresponding to the monitoring screen in the first direction; and determining the distance between the first area and the center point of the monitoring screen, and the proportion of the distance between the first area and the center point of the monitoring screen in the first direction; Based on the field of view angle of the camera lens in the first direction corresponding to the center point position of the monitoring screen of the monitoring scene, the entire field of view angle of the camera lens in the first direction corresponding to the monitoring screen, and the proportion, the field of view angle of the camera lens in the first direction corresponding to the first area is determined.
5. The method according to claim 1, characterized in that The method further comprises: Setting at least one monitoring area in the monitoring scenario; A linear region in the at least one monitoring region is determined; and the tracking target is a tracking target located in the linear region.
6. The method according to claim 1, characterized in that The distance between the position of the first area of the tracking target and the position of the second area of the tracking target in the first direction is a preset length; Alternatively, the method further comprises: Respectively determining the coordinate position of the center point of the first area of the tracking target and the coordinate position of the center point of the second area of the tracking target; Based on the center point coordinate position of the first area of the tracking target and the center point coordinate position of the second area of the tracking target, a distance in a first direction between the position of the first area of the tracking target and the position of the second area of the tracking target is determined.
7. A focusing device, characterized in that: The device comprises: The first unit is configured to determine a first area of a tracking target when there is a tracking target in the monitoring scene of the camera, A second unit is used to determine a first focus motor step number corresponding to a first object distance between a first area of the tracking target and the camera; and determine a second focus motor step number corresponding to a distance between a first position and a second position, wherein the first position is a position of the first area of the tracking target, the distance between the first position and the second position is equal to a distance between a position of the first area of the tracking target and a position of the second area of the tracking target in a first direction, and a line connecting the first position and the second position is parallel to a second direction; a third unit, configured to determine a third focus motor step corresponding to a second object distance between the second position and the camera by using the first focus motor step and the second focus motor step; and control the focus motor to focus on a second area of the tracking target according to the third focus motor step; Wherein, using the first focus motor step number and the second focus motor step number to determine a third focus motor step number corresponding to a second object distance between the second position and the camera comprises: Determine the field of view of the lens of the camera corresponding to the first area in the first direction by using the monitoring picture of the monitoring scene and the field of view of the lens of the camera; The third focus motor step corresponding to the second object distance between the second position and the camera is determined by using the field of view angle of the lens of the camera corresponding to the first area in the first direction, the first focus motor step number and the second focus motor step number.
8. An electronic device, characterized in that: include: A memory for storing program instructions; A processor, configured to call the program instructions stored in the memory, and execute the method according to any one of claims 1 to 6 according to the obtained program.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable the computer to execute the method according to any one of claims 1 to 6.
