Camera-based focusing method, apparatus, computer device, and storage medium
By establishing a spherical coordinate system on the camera device and calculating the object distance, the problem of long focusing time caused by external ranging devices is solved, and a fast and convenient focusing process is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-14
- Publication Date
- 2026-03-27
AI Technical Summary
In existing technologies, camera devices require an external rangefinder during zooming, and multiple measurements to estimate the object distance result in long focusing times and inconvenience.
By establishing a spherical coordinate system at the initial setting position of the camera device, the calibration angle position and object distance value of each preset calibration point are obtained, and the second object distance value is calculated by combining the angular position of the target object, thus achieving rapid focusing.
It can quickly and accurately calculate the distance between the camera and the target object without the need for an external rangefinder, improving focusing speed and ease of use.
Smart Images

Figure CN116389899B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer vision, and in particular to a focusing method and device based on a camera device, a computer device, and a storage medium. BACKGROUND
[0002] With the continuous development of video monitoring technology, camera devices have been widely applied to various fields. After installation, in order to keep the images captured by the camera device clear during zooming, zoom tracking is needed, that is, the focusing motor in the camera device is changed synchronously according to the change of the zoom motor position. The zoom motor position determines the optical magnification, and when the optical magnification is larger, the focusing motor has a larger range of focus point changes, and it is more difficult to find the focus point. This results in poor smoothness of zoom tracking, long focusing time, and other problems.
[0003] The current focusing method is to obtain an estimated object distance value by means of an external distance measuring device. For example, an external laser distance measuring device is used to emit laser to the target object and receive the reflected laser, and the estimated object distance value is obtained by measuring multiple times according to the time difference between the emission and reception of the laser, and then focusing is performed according to the estimated object distance value to achieve better results. The defect of this scheme is that an external distance measuring device is needed to participate in the measurement of the estimated object distance value multiple times, resulting in a long focusing time and inconvenient use.
[0004] At present, there is no effective solution to the problem that in the related art, an external distance measuring device is needed to participate in the measurement of the estimated object distance value multiple times, resulting in a long focusing time and inconvenient use. SUMMARY
[0005] In this embodiment, a focusing method and device based on a camera device, a computer device, and a storage medium are provided to solve the problem that in the related art, an external distance measuring device is needed to participate in the measurement of the estimated object distance value multiple times, resulting in a long focusing time and inconvenient use.
[0006] In a first aspect, a focusing method based on a camera device is provided in this embodiment, comprising:
[0007] Establishing a spherical coordinate system based on an initial setting position of the camera device;
[0008] Obtaining a calibration angle position of each preset calibration point relative to the camera device and a corresponding first object distance value;
[0009] Obtaining a target angle position of a target object relative to the camera device in the spherical coordinate system; determining a second object distance value corresponding to the target angle position according to the target angle position, the calibration angle position, and the first object distance value;
[0010] focus the camera device according to the second object distance value.
[0011] In some embodiments, the method further comprises:
[0012] Before acquiring the angular position of the target object and the corresponding first object distance value, performing spherical calibration on the camera device based on each preset calibration point in the spherical coordinate system.
[0013] In some embodiments, the method further comprises:
[0014] After focusing the camera device according to the second object distance value, updating the target angular position and the corresponding second object distance value into the result of the spherical calibration.
[0015] In some embodiments, the spherical calibration on the camera device based on each preset calibration point comprises:
[0016] Setting the position of the calibration point in the spherical coordinate system based on a calibration principle to obtain a calibration angular position;
[0017] Performing scanning focusing on the calibration point one by one to obtain the corresponding first object distance value of the calibration point at the calibration angular position.
[0018] In some embodiments, the determination of the second object distance value corresponding to the target angular position according to the target angular position, the calibration angular position, and the first object distance value comprises:
[0019] Selecting a matched reference calibration point from the calibration points according to the calibration angular position and a preset included angle range threshold to obtain the calibration angular position and the first object distance value of the reference calibration point;
[0020] Determining the weight corresponding to the reference calibration point according to the calibration angular position of the reference calibration point and the target angular position of the target object;
[0021] Determining the second object distance value corresponding to the target angular position according to the weight and the first object distance value of the reference calibration point.
[0022] In some embodiments, the method further comprises:
[0023] Determining a spatial rectangular coordinate system corresponding to the spherical coordinate system and determining the conversion relationship between the spatial rectangular coordinate system and the spherical coordinate system.
[0024] In some embodiments, the determination of the weight of the reference calibration point according to the calibration angular position of the reference calibration point and the target angular position of the target object comprises:
[0025] Converting the reference angle position of the reference calibration point and the target angle position of the target object into the spatial rectangular coordinate system based on the conversion relationship, and determining an included angle between each reference calibration point and the target object;
[0026] Determining the weight of the reference calibration point according to the included angle.
[0027] In a second aspect, the embodiment provides a camera-based focusing device, comprising: an establishing module, a first obtaining module, a second obtaining module, and a focusing module;
[0028] The establishing module is configured to establish a spherical coordinate system based on an initial setting position of the camera.
[0029] The first obtaining module is configured to obtain a calibration angle position of each preset calibration point relative to the camera and a corresponding first object distance value; the camera completes spherical calibration based on each preset calibration point in the spherical coordinate system.
[0030] The second obtaining module is configured to obtain a target angle position of a target object relative to the camera in the spherical coordinate system; and determine a second object distance value corresponding to the target angle position according to the target angle position, the calibration angle position, and the first object distance value.
[0031] The camera is focused according to the second object distance value.
[0032] In a third aspect, the embodiment provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the camera-based focusing method of the first aspect when executing the computer program.
[0033] In a fourth aspect, the embodiment provides a storage medium having a computer program stored thereon, and the program is executable by a processor to implement the camera-based focusing method of the first aspect.
[0034] Compared with the related art, the camera-based focusing method, device, computer device and storage medium provided in the embodiment establish a spherical coordinate system based on the initial setting position of the camera, acquire the calibration angle position of each preset calibration point relative to the camera and the corresponding first object distance value, acquire the target angle position of a target object relative to the camera in the spherical coordinate system, determine the second object distance value corresponding to the target angle position according to the target angle position, the calibration angle position and the first object distance value, and focus the camera according to the second object distance value, thereby solving the problem in the related art that an external ranging device needs to be involved and the estimated object distance value needs to be obtained through multiple measurements, resulting in a long focusing time and inconvenient use. The camera-based focusing method, device, computer device and storage medium provided in the embodiment use the camera that has completed spherical calibration to estimate the second object distance value of the target object relative to the camera, thereby realizing fast focusing of the camera without the aid of an external ranging device and facilitating use.
[0035] The details of one or more embodiments of the present application are presented in the following drawings and description to make other features, objects and advantages of the present application more apparent. BRIEF DESCRIPTION OF DRAWINGS
[0036] The drawings described herein are intended to provide further understanding of the present application, and constitute a part of the present application. The illustrative embodiments of the present application and their description serve to explain the present application, and do not constitute an improper limitation on the present application. In the drawings:
[0037] Figure 1 is a hardware structure block diagram of a terminal device of the camera-based focusing method provided by an embodiment of the present application;
[0038] Figure 2 is a flowchart of the camera-based focusing method provided by an embodiment of the present application;
[0039] Figure 3 is a flowchart of determining the second object distance value corresponding to the target angle position provided by an embodiment of the present application;
[0040] Figure 4 is a structure block diagram of the camera-based focusing device provided by an embodiment of the present application.
[0041] In the figure: 102, a processor; 104, a memory; 106, a transmission device; 108, an input and output device; 210, an establishment module; 220, a first acquisition module; 230, a second acquisition module; 240, a focusing module. DETAILED DESCRIPTION
[0042] To make the purpose, technical solution and advantages of the present application more apparent, the present application is described and explained below in combination with the drawings and embodiments.
[0043] Unless otherwise defined, technical terms or scientific terms used in the present application shall have the same meaning as those commonly understood by a person of ordinary skill in the art to which the present application belongs. The terms "one", "a", "an", "the", "these", and similar terms in the present application do not mean "only one" or "exactly one", but can mean "one or more". The terms "include", "contain", "have", and any variant thereof in the present application are intended to cover the non-exclusive inclusion; for example, a process, method, and system, product or device containing a series of steps or modules (units) are not limited to the listed steps or modules (units), but can include steps or modules (units) not listed, or can include other steps or modules (units) inherent to the process, method, product or device. The terms "connect", "connect", "couple" and the like in the present application are not limited to physical or mechanical connection, but can include electrical connection, whether direct or indirect. The term "multiple" in the present application means two or more. The term "and / or" describes the association between the associated objects, which means that there can be three relationships, for example, "A and / or B" can mean that A exists alone, A and B exist together, and B exists alone. Generally, the character " / " represents the relationship between the objects before and after it as "or". The terms "first", "second", "third" and the like in the present application are only used to distinguish similar objects, and do not represent a specific order of the objects.
[0044] The method embodiments provided in the present embodiment can be executed in a terminal, a computer or a similar computing device. For example, the method embodiments are executed on a terminal, Figure 1 is a hardware structure block diagram of the terminal based on the focusing method of the camera device of the present embodiment. As shown in Figure 1 , the terminal can include one or more (only one is shown in Figure 1 ) processor 102 and memory 104 for storing data, wherein the processor 102 can include but not limited to processing device such as microprocessor MCU or programmable logic device FPGA. The above terminal can also include transmission device 106 for communication function and input / output device 108. Those skilled in the art can understand that Figure 1 The structure shown is only schematic, which does not limit the structure of the above terminal. For example, the terminal can include more or less components than Figure 1 shown, or have a different configuration from Figure 1 shown.
[0045] The memory 104 can be used to store computer programs, such as software programs of application software and modules, such as the computer program corresponding to the camera-based focusing method in the embodiment. The processor 102 can execute various functional applications and data processing, i.e., implement the method described above, by running the computer program stored in the memory 104. The memory 104 can include a high-speed random access memory, and can further include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory 104 can further include memories remotely arranged with respect to the processor 102, which can be connected to the terminal through a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0046] The transmission device 106 is configured to receive or send data via a network. The network includes a wireless network provided by a communication provider of the terminal. In an example, the transmission device 106 includes a network interface controller (NIC) which can be connected to other network devices through a base station so as to communicate with the Internet. In an example, the transmission device 106 can be a radio frequency (RF) module configured to communicate with the Internet in a wireless manner.
[0047] In the embodiment, a camera-based focusing method is provided, Figure 2 A flowchart of the camera-based focusing method in the embodiment is shown in FIG. 2, which includes the following steps: Figure 2
[0048] In step S210, a spherical coordinate system is established based on an initial setting position of the camera.
[0049] In step S220, a calibration angle position of each preset calibration point relative to the camera and a corresponding first object distance value are obtained.
[0050] In step S230, a target angle position of a target object in the spherical coordinate system relative to the camera is obtained, and a second object distance value corresponding to the target angle position is determined according to the target angle position, the calibration angle position, and the first object distance value.
[0051] In step S240, the camera is focused according to the second object distance value.
[0052] It should be noted that the camera equipment includes but is not limited to a camera, a ball camera, and a gun-ball integrated machine, etc. In use, the camera device generally needs to be installed in the environment for use. After installation, a spherical coordinate system can be established based on the initial setting position of the camera equipment. The initial setting position refers to the original position of the camera equipment after installation without movement, or a position specified by the user.
[0053] The spherical coordinate system is established, and specifically, when the camera equipment is at the initial setting position, the position of the optical center of the camera equipment is the origin of the coordinate system of the spherical coordinate system; the X-axis direction, the Y-axis direction, and the Z-axis direction of the spherical coordinate system can be set according to different use environments, and no limitation is made in this regard. The spherical coordinate system (English: Spherical coordinate system) is a three-dimensional orthogonal coordinate system that uses spherical coordinates to represent the position of a point in three-dimensional space. Assuming P(x, y, z) is a point in space, the P point can be determined by three ordered numbers . The distance from the origin O of the coordinate system to the P point is r, the zenith angle (θ) between the connecting line from the origin O to the P point and the positive Z-axis, and the projection line of the connecting line from the origin O to the P point in the XOY plane and the positive X-axis These three numbers are called the spherical coordinates of the P point. Obviously, The range of r is r∈[0, +∞), θ∈[0, π],
[0054] The camera equipment needs to be pre-calibrated after first installation or long-term use. Specifically, the camera equipment can be calibrated based on the calibration points in a unified coordinate system. The unified coordinate system can be a world coordinate system, a spherical coordinate system, etc. After calibration, the calibration angle position and the corresponding first object distance value of each preset calibration point relative to the camera equipment can be obtained. In other embodiments, the calibration angle position and the corresponding first object distance value of each preset calibration point relative to the camera equipment can also be set in advance by using a ranging setting, a neural network model, etc. No limitation is made in this regard.
[0055] In use, the camera equipment needs to focus on the target object; first, the target angle position of the target object relative to the camera equipment in the spherical coordinate system is obtained; then, the second object distance value corresponding to the target angle position is calculated according to the target angle position, the calibration angle position, and the first object distance value; the second object distance value is the accurate object distance from the camera equipment to the target object. Finally, the camera equipment can be quickly focused according to the second object distance value, without the aid of an external ranging device, which is convenient to use.
[0056] By the above steps, first, a spherical coordinate system is established based on the initial setting position of the camera device; the spherical coordinate system is taken as the calculation basis for subsequent processing; then the calibration angle position of each preset calibration point relative to the camera device and the corresponding first object distance value are obtained; according to the calibration angle position and the first object distance value, the second object distance value corresponding to the target angle position of the target object relative to the camera device in the spherical coordinate system is determined; that is, the estimated object distance between the camera device and the target object is quickly and accurately obtained without the aid of an external ranging device, which is convenient to use; and the problem of long focusing time and inconvenient use caused by the need for an external ranging device to participate in multiple measurements to obtain the estimated object distance value is solved.
[0057] The above steps are described in detail as follows:
[0058] The camera device needs to complete spherical calibration after first installation or long-term use. In some embodiments, for the spherical calibration that needs to be done after the camera device is first installed or used for a long time, the specific process can be: before the angle position of the camera device and the corresponding first object distance value are obtained, the camera device is calibrated based on each preset calibration point in the spherical coordinate system.
[0059] Among them, the spherical surface is a spherical surface with a specified calibration radius in the spherical coordinate system, such as: the calibration radius is 1; that is, it is considered as a spherical surface with the center of the spherical coordinate system as the center and a radius of 1 meter. The calibration points are uniformly set on the spherical surface in advance; after scanning and focusing on all calibration points, the spherical calibration is completed. After spherical calibration, the calibration angle position of each preset calibration point relative to the camera device can be obtained; and the first object distance value corresponding to each calibration angle position. In other embodiments, due to the installation position of the camera device and the shooting angle limitation of the camera, there is only a part of the calibration points that can be scanned, and then after scanning and focusing on all the calibration points that can be scanned by the camera device, the spherical calibration can also be completed.
[0060] In some embodiments, the spherical calibration of the camera device based on each preset calibration point includes the following steps:
[0061] The position of the calibration point in the spherical coordinate system is set based on the calibration principle to obtain the calibration angle position;
[0062] The calibration points are scanned and focused one by one to obtain the first object distance value corresponding to the calibration points at the calibration angle position.
[0063] Specifically, the calibration principle is: 36 calibration angle positions are set in the pan direction of the camera device; 18 calibration angle positions are set in the tilt direction of the camera device; a total of 648 calibration points are set. The calibration angle positions of these calibration points in the spherical coordinate system can be represented as shown in Table 1; the camera device scans and focuses on the calibration points one by one, and after focusing clearly, the first object distance value corresponding to the calibration point at the calibration angle position is obtained. That is, after the calibration of each calibration point is completed, two data will be obtained; the calibration angle position and the first object distance value. The above calibration process does not need to rely on an external ranging device and can quickly complete the calibration.
[0064] Further, in order to facilitate the call, the calibration angle position and the corresponding first object distance value can be stored in the database by constructing a mapping relationship. When used, it can be directly called from the database.
[0065] In other embodiments, since the positions of the calibration points are pre-set, the calibration angle position and the standard object distance of the calibration point are known, and after the first object distance value is obtained, the first object distance value of the calibration point can be compared with the standard object distance of the calibration point. If it does not meet the requirements, the calibration point needs to be re-calibrated; the accuracy of the calibration can be improved.
[0066] Table 1
[0067]
[0068] In some of the embodiments, as shown in Figure 3 determining the second object distance value corresponding to the target angle position according to the target angle position, the calibration angle position, and the first object distance value in step S230 includes the following steps:
[0069] In step S231, the matching reference calibration point is selected from the calibration points according to the calibration angle position and the preset included angle range threshold, to obtain the calibration angle position and the first object distance value of the reference calibration point.
[0070] In step S232, the weight corresponding to the reference calibration point is determined according to the calibration angle position of the reference calibration point and the target angle position of the target object.
[0071] In step S233, the second object distance value corresponding to the target angle position is determined according to the weight and the first object distance value of the reference calibration point.
[0072] Specifically, the included angle range threshold is pre-set, and the greater the value, the more the number of reference calibration points selected, and the more accurate the second object distance value calculated; the smaller the value, the fewer the number of reference calibration points selected, and the second object distance value may not be calculated. Further, taking the calibration angle position as the center, the calibration points within the included angle range threshold are selected from the calibration points as the reference calibration points. In one of the embodiments, the included angle range threshold can be set as: to For example, the included angle range threshold is
[0073] Since the reference calibration point is also a calibration point, the calibration angle position and the first object distance value of the reference calibration point can be directly obtained.
[0074] Each reference calibration point corresponds to a weight. The closer the reference calibration point to the target object, the greater the weight. In the embodiment, the weight can be calculated from the weight and the first object distance value of the reference calibration point; the position relationship between the target object and the reference calibration point can be more accurately reflected, thereby improving the accuracy of the second object distance value calculation. In other embodiments, the weight can be replaced by an empirical parameter, which is not limited.
[0075] In some of the embodiments, in order to simplify the calculation amount and improve the efficiency, the focusing method based on the camera device further includes the following steps:
[0076] Based on the initial setting position of the camera device, a space rectangular coordinate system is established, and a conversion relationship between the space rectangular coordinate system and the spherical coordinate system is determined.
[0077] Specifically, the space rectangular coordinate system can be a right-handed space rectangular coordinate system; the coordinate system origin of the space rectangular coordinate system coincides with the coordinate system origin of the spherical coordinate system. Then the conversion relationship between the space rectangular coordinate system (x, y, z) and the spherical coordinate system can be:
[0078]
[0079] In some of the embodiments, the step S232 of determining the weight of the reference calibration point according to the calibration angle position of the reference calibration point and the target angle position of the target object includes the following steps:
[0080] Based on the conversion relationship, the calibration angle position of the reference calibration point and the target angle position of the target object are converted to the space rectangular coordinate system, and the included angle between each reference calibration point and the target object is determined.
[0081] According to the included angle, the weight of the reference calibration point is determined.
[0082] Specifically, for the calibration angle position of the reference calibration point being a point Based on the conversion relationship, the conversion to the spatial rectangular coordinate system is The calibrated angular position of the reference calibration point is point b Based on the conversion relationship, the conversion to the spatial rectangular coordinate system is
[0083] Using the coordinate operation of the spatial vector:
[0084]
[0085] The inverse cosine operation is performed on the above formula to obtain the included angle of points a and b.
[0086] In this embodiment, the reciprocal of the included angle is taken as the weight corresponding to the reference calibration point.
[0087] In a preferred embodiment, the calculation process of the second object distance value can be:
[0088] The included angle range threshold is The target object k has five reference calibration points w, e, r, t, and u. The included angles with the target object k are ∠kw, ∠ke, ∠kr, ∠kt, and ∠ku, respectively. Then the weights corresponding to each reference calibration point are ∠kw -1 , ∠ke -1 , ∠kr -1 , ∠kt -1 , and ∠ku -1 .
[0089] The estimated second object distance value = (∠kw -1 × the calibrated angular position of point w + ∠ke -1 × the calibrated angular position of point e + ∠kr -1 × the calibrated angular position of point r + ∠kt -1 × the calibrated angular position of point t + ∠ku -1 × the calibrated angular position of point u) / (∠kw -1 + ∠ke -1 + ∠kr -1 + ∠kt -1 + ∠ku -1 ).
[0090] In some embodiments, the focusing method based on the camera further includes:
[0091] After focusing the camera according to the second object distance value, the target angular position and the corresponding second object distance value are updated to the result of the spherical calibration.
[0092] After each use, the target angle position and the corresponding second object distance value can be continuously learned and stored, and the object distance value of each position on the spherical surface in the spherical coordinate system can be continuously improved, thereby improving the focusing effect and efficiency. For example, in the spherical coordinate system, the target angle position After focusing, the above data is stored to obtain Table 2.
[0093] Table 2
[0094]
[0095] In other embodiments, the above-mentioned focusing method based on the camera device can be applied to the control of the zoom lens in the field of video conferencing, security, etc.
[0096] It should be noted that the steps shown in the above process or the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from here.
[0097] In this embodiment, a focusing device based on a camera device is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and the description of which has been described above. The terms "module", "unit", "sub-unit" and the like used below can be a combination of software and / or hardware that can implement a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware or a combination of software and hardware is also possible and is conceived.
[0098] Figure 4 is a structural block diagram of the focusing device based on the camera device of the present embodiment, as Figure 4 shown, the device comprises: a establishing module 210, a first obtaining module 220, a second obtaining module 230 and a focusing module 240;
[0099] The establishing module 210 is configured to establish a spherical coordinate system based on the initial setting position of the camera device.
[0100] The first obtaining module 220 is configured to obtain the calibration angle position of each preset calibration point relative to the camera device and the corresponding first object distance value; the camera device completes spherical calibration based on each preset calibration point in the spherical coordinate system.
[0101] The second obtaining module 230 is configured to obtain the target angle position of the target object relative to the camera device in the spherical coordinate system; and determine the second object distance value corresponding to the target angle position according to the target angle position, the calibration angle position and the first object distance value.
[0102] The camera device is focused according to the second object distance value.
[0103] By means of the above device, the second distance value between the camera device and the target object is obtained without the help of an external ranging device, and the camera device is quickly focused according to the second distance value, which is convenient to use; the problem that an external ranging device needs to be involved in related technologies to obtain an estimated distance value through multiple measurements, resulting in a long focusing time and inconvenient use is solved.
[0104] In some embodiments thereof, based on the above, the calibration module is further used for Figure 4
[0105] The calibration module is configured to, before obtaining the angle position of the camera device and the corresponding first distance value, perform spherical calibration on the camera device based on each preset calibration point in the spherical coordinate system.
[0106] In some embodiments thereof, based on the above, the storage module is further used for Figure 4 The storage module is configured to, after focusing the camera device according to the second distance value, update the target angle position and the corresponding second distance value into the result of the spherical calibration
[0107] In some embodiments thereof, the calibration module is further configured to set the position of the calibration point in the spherical coordinate system based on a calibration principle to obtain a calibration angle position.
[0108] The calibration point is scanned and focused one by one to obtain the corresponding first distance value of the calibration point at the calibration angle position.
[0109] In some embodiments thereof, the second acquisition module 230 is further configured to select a matched reference calibration point from the calibration point according to the calibration angle position and a preset included angle range threshold to obtain the calibration angle position and the first distance value of the reference calibration point.
[0110] According to the calibration angle position of the reference calibration point and the target angle position of the target object, a weight corresponding to the reference calibration point is determined.
[0111] According to the weight and the first distance value of the reference calibration point, a second distance value corresponding to the target angle position is determined.
[0112] In some embodiments thereof, based on the above, the conversion module is further used for
[0113] Figure 4 The conversion module is configured to determine a spatial rectangular coordinate system corresponding to the spherical coordinate system and determine the conversion relationship between the spatial rectangular coordinate system and the spherical coordinate system.
[0114] The conversion module is configured to determine a spatial rectangular coordinate system corresponding to the spherical coordinate system and determine the conversion relationship between the spatial rectangular coordinate system and the spherical coordinate system.
[0115] In some embodiments, the second obtaining module 230 is further configured to convert the calibration angle position of the reference calibration point and the target angle position of the target object into a spatial rectangular coordinate system based on the conversion relationship, and determine an included angle between each reference calibration point and the target object.
[0116] According to the included angle, the weight of the reference calibration point is determined.
[0117] It should be noted that each of the above modules can be a functional module or a program module, and can be implemented by software or hardware. For the modules implemented by hardware, each of the above modules can be located in the same processor; or each of the above modules can also be located in different processors in any combination.
[0118] In the embodiment, a computer device is also provided, which includes a memory and a processor. The memory stores a computer program, and the processor is configured to execute the computer program to perform the steps in any of the above method embodiments.
[0119] Optionally, the computer device can further include a transmission device and an input / output device, wherein the transmission device is connected with the processor, and the input / output device is connected with the processor.
[0120] Optionally, in the embodiment, the processor can be configured to execute the following steps by the computer program:
[0121] S1, establishing a spherical coordinate system based on an initial setting position of the camera device;
[0122] S2, obtaining a calibration angle position of each preset calibration point relative to the camera device and a corresponding first object distance value;
[0123] S3, obtaining a target angle position of a target object relative to the camera device in the spherical coordinate system; and determining a second object distance value corresponding to the target angle position according to the target angle position, the calibration angle position and the first object distance value;
[0124] S4, focusing the camera device according to the second object distance value.
[0125] It should be noted that the specific examples in the embodiment can refer to the examples described in the above embodiments and optional implementation manners, which will not be described herein again.
[0126] In addition, in combination with the focusing method based on the camera device provided in the above embodiments, a storage medium can also be provided to implement the focusing method based on the camera device in the embodiment. The storage medium stores a computer program; and the computer program is executed by a processor to implement any of the focusing methods based on the camera device in the above embodiments.
[0127] It is to be understood that the specific embodiments described herein are merely illustrative of the application and are not to be taken in a limiting sense. All other embodiments falling within the scope of the application are contemplated and are within the scope of the application.
[0128] It is apparent that the drawings depicted are only a few examples of the application and that many other embodiments of the application can be made without departing from the scope of the application disclosed herein. Furthermore, it should be understood that the drawings are not necessarily drawn to scale and that, unless otherwise indicated, they are merely intended to aid in the description of the principles of the application. In addition, it should be understood that every structure coupled to or constructed in the combination of structures is intended to be part of the present application, even though the various structures can have been produced and sold separately. The components of the described embodiment, as outlined in the specification, can be used interchangeably in other embodiments of the application. The employee of the present disclosure is not to be limited in scope and application to only the embodiments described but is applicable for use in manners that are particularly adapted to achieve the ends and advantages of the application or other closely related embodiments.
[0129] The word "exemplary" is used herein to mean serving as an example, instance, or illustration. Any implementation described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other implementations. The disclosure is not intended to be limited to the implementations described herein but is to be accorded the full scope of the claims, and any equivalents thereof.
[0130] The embodiments described above are presented only to better illustrate the present application and are not to be taken as limiting the scope of the patent protection. It should be understood that numerous variations and modifications can be made to the embodiments described and illustrated without departing from the underlying inventive concepts. Accordingly, the scope of protection is not to be limited to the specific embodiments described herein, but is in accordance with the following claims as well as the full scope of equivalents to which such claims are entitled.
Claims
1. A focusing method based on a camera device, characterized in that, include: Establish a spherical coordinate system based on the initial setting position of the camera equipment; Obtain the calibration angle position of each preset calibration point relative to the camera device and the corresponding first object distance value; Obtain the target angular position of the target object relative to the camera device in the spherical coordinate system; determine the second object distance value corresponding to the target angular position based on the target angular position, the calibrated angular position, and the first object distance value; The camera device is focused according to the second object distance value; The step of determining the second object distance value corresponding to the target angle position based on the target angle position, the calibrated angle position, and the first object distance value includes: Based on the calibration angle position and the preset included angle range threshold, a matching reference calibration point is selected from the calibration point to obtain the calibration angle position and the first object distance value of the reference calibration point; The weight corresponding to the reference calibration point is determined based on the calibration angle position of the reference calibration point and the target angle position of the target object. Based on the weight of the reference calibration point and the first object distance value, a second object distance value corresponding to the target angular position is determined.
2. The focusing method based on a camera device according to claim 1, characterized in that, Also includes: Before obtaining the angular position of the camera device and the corresponding first object distance value, the camera device is spherically calibrated in the spherical coordinate system based on each preset calibration point.
3. The focusing method based on a camera device according to claim 2, characterized in that, Also includes: After focusing the camera device according to the second object distance value, the target angle position and the corresponding second object distance value are updated in the spherical calibration result.
4. The focusing method based on a camera device according to claim 2, characterized in that, The step of performing spherical calibration on the camera device based on each preset calibration point includes: Based on the calibration principle, the position of the calibration point in the spherical coordinate system is set to obtain the calibration angle position; The calibration points are scanned and focused one by one to obtain the first object distance value corresponding to the calibration point at the calibration angle position.
5. The focusing method based on a camera device according to claim 1, characterized in that, Also includes: Determine the spatial rectangular coordinate system corresponding to the spherical coordinate system, and determine the transformation relationship between the spatial rectangular coordinate system and the spherical coordinate system.
6. The focusing method based on a camera device according to claim 5, characterized in that, The step of determining the weight of the reference calibration point based on the calibration angle position of the reference calibration point and the target angle position of the target object includes: Based on the transformation relationship, the calibration angle position of the reference calibration point and the target angle position of the target object are transformed into the spatial rectangular coordinate system, and the angle between each reference calibration point and the target object is determined. The weight of the reference calibration point is determined based on the included angle.
7. A focusing device based on a camera equipment, characterized in that, include: The module includes a setup module, a first acquisition module, a second acquisition module, and a focusing module. The establishment module is used to establish a spherical coordinate system based on the initial setting position of the camera device; The first acquisition module is used to acquire the calibration angle position of each preset calibration point relative to the camera device and the corresponding first object distance value; the camera device completes spherical calibration based on each preset calibration point in the spherical coordinate system; The second acquisition module is used to acquire the target angular position of the target object relative to the camera device in the spherical coordinate system; and to determine a second object distance value corresponding to the target angular position based on the target angular position, the calibrated angular position, and the first object distance value. The second acquisition module is further configured to select a matching reference calibration point from the calibration point based on the calibration angle position and a preset included angle range threshold, to obtain the calibration angle position and a first object distance value of the reference calibration point; determine the weight corresponding to the reference calibration point based on the calibration angle position of the reference calibration point and the target angle position of the target object; and determine the second object distance value corresponding to the target angle position based on the weight of the reference calibration point and the first object distance value. The camera device is focused based on the second object distance value.
8. A computer device, comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the steps of the focusing method based on the camera device as described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the focusing method based on the camera device as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Focusing method and device and camera equipment
CN111405193A
Correcting and focusing method and system for included angle of optical axis, and dual-camera equipment
WO2016155074A1