A focal length adjustment method, device, equipment and storage medium
By using point cloud data and parameters of the image acquisition device to determine the set of focal lengths to be selected, the existing technology's problems of large amounts of calculation and inability to quickly obtain high-definition focal lengths are solved, and efficient focal length adjustment is achieved when tracking high-speed moving target objects.
Patent Information
- Application Number
- CN202410585368.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-13
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-05-13
AI Technical Summary
The existing automatic focusing algorithm searches for the photo with the highest definition within the maximum and minimum focal length ranges of the image acquisition device, resulting in a large amount of calculation and the inability to quickly obtain the focal length corresponding to high definition, especially when tracking high-speed moving target objects. Meet clarity needs.
By obtaining the point cloud data collected by lidar and the image collected by image acquisition equipment, the target distance is determined based on the point cloud data, and the set of focal lengths to be selected is determined based on the parameters of the image acquisition equipment and the size and proportion of the target object. Image clarity determines the target focal length, narrows the focal length adjustment range, and reduces the amount of calculation.
It improves the efficiency and accuracy of focus adjustment, can quickly obtain high-definition focal length, meets the definition requirements of high-speed moving target objects, and reduces the amount of calculation.
Smart Images

Figure CN118175422B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of image processing technology, and in particular to a focus adjustment method, device, equipment and storage medium. Background Art
[0002] With the rapid development of image processing technology and computer technology, auto-focus algorithms have entered the digital age based on image analysis and have begun to be applied in various fields, playing an increasingly important role.
[0003] The existing automatic focusing algorithm searches for the photo with the highest clarity within the range of the maximum focal length and the minimum focal length of the image acquisition device to determine the focal length. This means that the clarity data of a lot of images needs to be obtained, which requires a lot of calculations.
[0004] When tracking a high-speed moving target object, different focal lengths need to be switched based on the definition requirements of the target object. However, the existing focal length adjustment method has the problem of being unable to quickly obtain the focal length corresponding to high definition in the above situation due to the large amount of calculation. Summary of the invention
[0005] The embodiments of the present application provide a focus adjustment method, device, equipment and storage medium, which can improve the focus adjustment efficiency and accuracy, thereby meeting the clarity requirements of high-speed moving target objects.
[0006] According to one aspect of the present application, a focal length adjustment method is provided, comprising:
[0007] Obtain point cloud data collected by the laser radar and images collected by the image acquisition device;
[0008] determining a target distance between an image acquisition device and a target object based on the point cloud data;
[0009] Determine a set of focal lengths to be selected according to a target distance between an image acquisition device and a target object, parameters of the image acquisition device, a size of the target object, and a proportion of the target object in the image;
[0010] The target focal length is determined according to the clarity of the images in the image set corresponding to the focus set to be selected.
[0011] According to another aspect of the present application, a focus adjustment device is provided, the focus adjustment device comprising:
[0012] An acquisition module, used to acquire point cloud data collected by the laser radar and images collected by the image acquisition device;
[0013] A target distance determination module, used to determine the target distance between the image acquisition device and the target object according to the point cloud data;
[0014] A module for determining a set of focal lengths to be selected, used to determine a set of focal lengths to be selected based on a target distance between an image acquisition device and a target object, parameters of the image acquisition device, a size of the target object, and a proportion of the target object in the image;
[0015] The target focal length determination module is used to determine the target focal length according to the clarity of the images in the image set corresponding to the focus set to be selected.
[0016] According to another aspect of the present application, an electronic device is provided, the electronic device comprising:
[0017] at least one processor; and
[0018] a memory communicatively connected to at least one processor; wherein,
[0019] The memory stores a computer program that can be executed by at least one processor, and the computer program is executed by at least one processor so that the at least one processor can execute the focal length adjustment method described in any embodiment of the present application.
[0020] According to another aspect of the present application, a computer-readable storage medium is provided, which stores computer instructions, and the computer instructions are used to enable a processor to implement the focal length adjustment method described in any embodiment of the present application when executed.
[0021] According to another aspect of the present application, a computer program product is provided, including a computer program / instruction, which implements the focus adjustment method described in any embodiment of the present application when executed by a processor.
[0022] The embodiment of the present application obtains point cloud data collected by a laser radar and an image collected by an image acquisition device; determines the target distance between the image acquisition device and the target object according to the point cloud data; determines a set of to-be-selected focal lengths according to the target distance between the image acquisition device and the target object, image acquisition device parameters, target object size, and the proportion of the target object in the image; and determines the target focal length according to the clarity of the image in the image set corresponding to the to-be-selected focal length set, thereby solving the problem of large amount of calculation caused by searching for the highest-definition photo in the range of the maximum focal length and the minimum focal length of the image acquisition device to determine the focal length, and can narrow the focal length adjustment range, thereby reducing the amount of calculation. In addition, since the focal length needs to be frequently switched when tracking a target object moving at high speed, if the method of searching for the highest-definition photo in the range of the maximum focal length and the minimum focal length of the image acquisition device to determine the focal length is adopted, the problem of not being able to quickly obtain the focal length corresponding to the high definition will occur. Since the technical solution provided by the embodiment of the present invention can narrow the focal length adjustment range, reduce the amount of calculation, and improve the efficiency of focal length adjustment, the focal length corresponding to the high definition can be quickly obtained to meet the clarity requirements of the target object moving at high speed.
[0023] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0025] Figure 1 is a flow chart of a focal length adjustment method provided in Example 1 of the present application;
[0026] Figure 2 is a flow chart of a focal length adjustment method provided in Embodiment 2 of the present application;
[0027] Figure 3 is a flow chart of a focal length adjustment method provided in Embodiment 3 of the present application;
[0028] Figure 4 is a flow chart of a focal length adjustment method provided in Embodiment 4 of the present application;
[0029] Figure 5 is a flow chart of a focal length adjustment method provided in Embodiment 5 of the present application;
[0030] Figure 6 is a flow chart of a focal length adjustment method provided in Example 6 of the present application;
[0031] Figure 7 is a structural schematic diagram of a focal length adjustment device provided in Embodiment 7 of the present application;
[0032] Figure 8 It is a structural diagram of an electronic device in Example 8 of the present application. DETAILED DESCRIPTION
[0033] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings 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 should fall within the scope of protection of the present application.
[0034] It should be noted that the terms "first", "second", etc. in the specification and claims 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 of the present application described herein can be implemented in an order other than those 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.
[0035] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0036] For the convenience of understanding, the background technology is now described in detail.
[0037] In the scenario of multi-sensor hybrid perception, since the position of the target object is constantly changing and the target object is not unique, the image acquisition device needs to constantly adjust its focal length. Especially when the target object occupies a small proportion of the acquisition area, in order to make the target object relatively clear, it is usually necessary to "focus closer", that is, change the focal length of the image acquisition device. In particular, for high-speed moving target objects (such as fast-moving drones / spacecraft in the sky; motor vehicles traveling on highways), since the position of high-speed moving target objects is constantly changing, in order to ensure the clarity of the target object, the focal length of the image acquisition device needs to be constantly and quickly adjusted, otherwise the clarity of the target object will be directly affected due to the problem of focal length.
[0038] However, the existing focal length adjustment method is to evaluate the clarity of the image itself, and find the photo with the highest clarity within the range of maximum focal length and minimum focal length to determine the focal length. This means that it is necessary to obtain the clarity data of a lot of images, and the amount of calculation is large. In addition, a simple image acquisition device generally evaluates the clarity of the entire image (the image acquisition device generally cannot identify the target object alone). In the case of tracking a high-speed moving target object, the clarity requirement of the target object is higher than the clarity requirement of the entire image. Moreover, if there are multiple target objects at different positions in the acquisition area, it is necessary to switch to different focal lengths based on the clarity requirements of the target object. However, in the existing focal length adjustment method, in the above situation, there is a problem that the focal length corresponding to high clarity cannot be quickly obtained.
[0039] Embodiment 1
[0040] Figure 1 This is a flow chart of a focus adjustment method provided in the first embodiment of the present application. This embodiment is applicable to the focus adjustment in the scene of tracking a target object moving at a high speed. The method can be performed by the focus adjustment device in the embodiment of the present application, and the device can be implemented in software and / or hardware. Figure 1 As shown, the method specifically comprises the following steps:
[0041] S110, acquiring point cloud data collected by the laser radar and images collected by the image acquisition device.
[0042] The image acquisition device may be a camera.
[0043] It should be noted that the embodiment of the present application provides a tracking system, which includes: a laser radar, an image acquisition device, and a computing platform. The acquisition areas of the laser radar and the image acquisition device may not be exactly the same, but the acquisition areas of the laser radar and the image acquisition device must overlap, and the target object must be in the overlapping area. Preferably, the acquisition areas of the laser radar and the image acquisition device overlap as much as possible, that is, the proportion of the overlapping area is as high as possible.
[0044] The focal length adjustment method provided in the embodiment of the present application is executed by a computing platform, and the laser radar and image acquisition device are used for target object tracking. The laser radar and image acquisition device are connected to the computing platform through corresponding communication interfaces. After the laser radar acquires point cloud data, the point cloud data is sent to the computing platform through the communication interface. Similarly, after the image acquisition device acquires an image, the image is sent to the computing platform through the communication interface. The computing platform performs automatic focusing and image tracking of the image acquisition device lens through the point cloud data provided by the laser radar and the image video stream data provided by the image acquisition device.
[0045] Among them, the laser radar is generally a multi-line laser radar, which scans at a fixed frequency, obtains obstacle angle and distance data and transmits them to the computing platform through a protocol. The computing platform parses the protocol and processes it.
[0046] Among them, the image acquisition device is used for image video stream acquisition. It can automatically focus on dynamic target objects through a variable-focus lens and keep tracking the target objects through high-definition resolution and high frame rate data streams.
[0047] Specifically, the laser radar and the image acquisition device are jointly calibrated in advance, and then the point cloud data collected by the laser radar and the images collected by the image acquisition device are obtained.
[0048] S120: determining a target distance between the image acquisition device and the target object according to the point cloud data.
[0049] Specifically, the method of determining the target distance between the image acquisition device and the target object based on the point cloud data may be: determining the distance between the laser radar and the target object based on the point cloud data; determining the target distance between the image acquisition device and the target object based on the positional relationship between the laser radar and the image acquisition device and the distance between the laser radar and the target object. The method of determining the target distance between the image acquisition device and the target object based on the point cloud data may also be: determining the distance between the laser radar and the target object based on the point cloud data; determining the first distance between the image acquisition device and the target object based on the positional relationship between the laser radar and the image acquisition device and the distance between the laser radar and the target object; recognizing the image to obtain the second distance between the image acquisition device and the target object; determining the target distance between the image acquisition device and the target object based on the first distance between the image acquisition device and the target object and the second distance between the image acquisition device and the target object.
[0050] Optionally, determining a target distance between an image acquisition device and a target object according to the point cloud data includes:
[0051] Determine the distance between the LiDAR and the target object based on the point cloud data;
[0052] The target distance between the image acquisition device and the target object is determined based on the positional relationship between the laser radar and the image acquisition device and the distance between the laser radar and the target object.
[0053] It should be noted that the laser radar and the image acquisition device are calibrated to obtain the positional relationship between the laser radar and the image acquisition device.
[0054] Specifically, a method for determining the distance between the laser radar and the target object based on the point cloud data may be: determining the position coordinates of the target object based on the point cloud data, and determining the distance between the laser radar and the target object based on the position coordinates of the target object.
[0055] Optionally, determining a target distance between an image acquisition device and a target object according to the point cloud data includes:
[0056] Determine the distance between the LiDAR and the target object based on the point cloud data;
[0057] Determine a first distance between the image acquisition device and the target object according to a positional relationship between the laser radar and the image acquisition device and a distance between the laser radar and the target object;
[0058] Recognize the image to obtain a second distance between the image acquisition device and the target object;
[0059] A target distance between the image acquisition device and the target object is determined according to a first distance between the image acquisition device and the target object and a second distance between the image acquisition device and the target object.
[0060] Specifically, the method of determining the distance between the laser radar and the target object based on the point cloud data may be: determining the position coordinates of the target object based on the point cloud data, and determining the distance between the laser radar and the target object based on the position coordinates of the target object. Among them, the method of determining the position coordinates of the target object based on the point cloud data may be: clustering the point cloud data to obtain the position coordinates of the target object. The method of determining the position coordinates of the target object based on the point cloud data may also be: inputting the point cloud data into a trained target object detection model to obtain a detection result, wherein the detection result includes: the position coordinates of the target object.
[0061] It should be noted that, if the image acquisition device is a binocular camera, the second distance between the image acquisition device and the target object can be determined based on the image acquired by the binocular camera.
[0062] Among them, the positional relationship between the laser radar and the image acquisition device includes: the distance between the laser radar and the image acquisition device, the installation angle of the laser radar and the installation angle of the image acquisition device.
[0063] Specifically, the method for determining the first distance between the image acquisition device and the target object based on the positional relationship between the laser radar and the image acquisition device and the distance between the laser radar and the target object can be: determining the first distance between the image acquisition device and the target object based on the distance between the laser radar and the image acquisition device, the installation angle of the laser radar, the installation angle of the image acquisition device, and the distance between the laser radar and the target object.
[0064] Specifically, the method for determining the target distance between the image acquisition device and the target object based on the first distance between the image acquisition device and the target object and the second distance between the image acquisition device and the target object may be: the average of the first distance and the second distance is determined as the target distance. The method for determining the target distance between the image acquisition device and the target object based on the first distance between the image acquisition device and the target object and the second distance between the image acquisition device and the target object may also be: the maximum value of the first distance and the second distance is determined as the target distance. The method for determining the target distance between the image acquisition device and the target object based on the first distance between the image acquisition device and the target object and the second distance between the image acquisition device and the target object may also be: the minimum value of the first distance and the second distance is determined as the target distance.
[0065] S130, determining a set of focal lengths to be selected according to a target distance between an image acquisition device and a target object, parameters of the image acquisition device, a size of the target object, and a proportion of the target object in the image.
[0066] Among them, the focal length of the image acquisition device refers to the distance from the optical center of the lens to the light focusing focus when parallel light is incident.
[0067] The image acquisition device parameters may include: the imaging width of the target surface of the image acquisition device. The target object size may be the actual width of the target object. The proportion of the target object in the image may be obtained by: identifying the image to obtain a detection frame corresponding to the target object, and determining the ratio of the area of the detection frame corresponding to the target object to the total area of the image as the proportion of the target object in the image.
[0068] Specifically, the method for determining the set of focal lengths to be selected based on the target distance between the image acquisition device and the target object, the image acquisition device parameters, the target object size, and the proportion of the target object in the image can be: determining the initial focal length based on the target distance between the image acquisition device and the target object, the image acquisition device parameters, the target object size, and the proportion of the target object in the image; and determining the set of focal lengths to be selected based on the initial focal length and a preset value.
[0069] S140, determining a target focal length according to the clarity of images in an image set corresponding to the to-be-selected focal length set.
[0070] Specifically, the method of determining the target focal length according to the clarity of the images in the image set corresponding to the to-be-selected focal length set may be: determining the focal length corresponding to the image with the greatest clarity in the image set corresponding to the to-be-selected focal length set as the target focal length. The method of determining the target focal length according to the clarity of the images in the image set corresponding to the to-be-selected focal length set may also be: obtaining no less than 3 reference focal lengths from the to-be-selected focal length set according to a unit length, and determining the target focal length according to each reference focal length and the clarity of the image corresponding to each reference focal length.
[0071] The technical solution of this embodiment determines a set of to-be-selected focal lengths according to the target distance between the image acquisition device and the target object, the image acquisition device parameters, the size of the target object, and the proportion of the target object in the image, and determines the target focal length according to the clarity of the image in the image set corresponding to the to-be-selected focal length set, thereby solving the problem of large amount of calculation caused by searching for the photo with the highest clarity in the range of the maximum focal length and the minimum focal length of the image acquisition device to determine the focal length, and can narrow the focal length adjustment range, thereby reducing the amount of calculation. In addition, since the focal length needs to be frequently switched when tracking a target object moving at high speed, if the method of searching for the photo with the highest clarity in the range of the maximum focal length and the minimum focal length of the image acquisition device to determine the focal length is adopted, the problem of not being able to quickly obtain the focal length corresponding to the high definition will occur. Since the technical solution provided by the embodiment of the present invention can narrow the focal length adjustment range, reduce the amount of calculation, and improve the efficiency of focal length adjustment, the focal length corresponding to the high definition can be quickly obtained to meet the clarity requirements of the target object moving at high speed.
[0072] Embodiment 2
[0073] Figure 2 This is a flow chart of a focal length adjustment method provided in Embodiment 2 of the present application, based on the above embodiment. Figure 2 As shown, the method includes:
[0074] S210, acquiring point cloud data collected by the laser radar and images collected by the image acquisition device.
[0075] S220, determining a target distance between the image acquisition device and the target object according to the point cloud data.
[0076] S230, determining an initial focal length according to the distance between the image acquisition device and the target object, parameters of the image acquisition device, the size of the target object, the proportion of the target object in the image, and a first formula.
[0077] The image acquisition device parameter is a target surface imaging parameter of the image acquisition device. For example, the image acquisition device parameter is a target surface imaging width of the image acquisition device.
[0078] Specifically, the method for determining the initial focal length according to the distance between the image acquisition device and the target object, the image acquisition device parameters, the size of the target object, the proportion of the target object in the image, and the first formula can be: obtaining the first product of the distance between the image acquisition device and the target object, the image acquisition device parameters, and the proportion of the target object in the image, and determining the ratio of the first product to the size of the target object as the initial focal length.
[0079] Optionally, the image acquisition device parameters include: image acquisition device target surface imaging width;
[0080] The first formula is:
[0081] ;
[0082] in, is the initial focal length, is the distance between the image acquisition device and the target object, is the imaging width of the target surface of the image acquisition device, is the target object size, is the proportion of the target object in the image.
[0083] In an embodiment of the present application, when tracking a moving target object, the target distance is determined based on the point cloud data collected by the lidar and the image collected by the image acquisition device, the computing platform determines a set of candidate focal lengths based on the target distance, image acquisition device parameters, target object size, and the proportion of the target object in the image, the motor drives the lens to complete focusing, and the target focal length is found based on the clarity of the image corresponding to each candidate focal length in the set of candidate focal lengths to complete automatic focusing, and the computing platform continuously performs cluster detection based on the image of the target object currently obtained to maintain tracking and identification of the moving target object.
[0084] S240, determining a set of focal lengths to be selected according to the initial focal length and preset parameters.
[0085] Specifically, the method of determining the set of focal lengths to be selected based on the initial focal length and the preset parameter may be: if the preset parameter is h and the initial focal length is f, then the set of focal lengths to be selected is determined to be composed of focal length fh, focal length f, and focal length f+h. The method of determining the set of focal lengths to be selected based on the initial focal length and the preset value may also be: the initial focal length and the preset parameter determine the minimum and maximum focal lengths to be selected in the set of focal lengths to be selected, and the set of focal lengths to be selected is generated based on the minimum and maximum focal lengths to be selected. For example, if the preset parameter is h and the initial focal length is f, then the set of focal lengths to be selected is determined to be , where fh is the lower limit of the focal length to be selected, and f+h is the upper limit of the focal length to be selected. The method of determining the focal length set to be selected according to the initial focal length and the preset parameters can also be: if the preset parameters include the first preset parameter and the second preset parameter , then the minimum candidate focal length in the candidate focal length set is determined as , the maximum focal length to be selected is , and then determine the set of focal lengths to be selected as The method of determining the focal length set to be selected according to the initial focal length and the preset parameters can also be: if the preset parameters include the first preset parameter and the second preset parameter , then it is determined that the candidate focal length set only includes the candidate focal length: , , .
[0086] S250, determining a target focal length according to the clarity of images in an image set corresponding to the to-be-selected focal length set.
[0087] Optionally, the preset parameters include: a first preset parameter and the second preset parameter , the focal length set to be selected is , is the initial focal length;
[0088] Determining a target focal length according to the clarity of an image in an image set corresponding to the to-be-selected focal length set includes:
[0089] Obtain at least 3 reference focal lengths from the candidate focal length set according to unit length, and the reference focal lengths include at least or ;
[0090] Obtaining the clarity of the reference image corresponding to each reference focal length in the to-be-selected focal length set;
[0091] The target focal length is determined according to the clarity of the reference image corresponding to each reference focal length in the set of focal lengths to be selected.
[0092] The first preset parameter and the second preset parameter may be the same or different, and the embodiment of the present application does not limit this. The unit length may be a preset length.
[0093] Specifically, at least three reference focal lengths are obtained from the set of candidate focal lengths according to the unit length, and the reference focal lengths include at least or The method can be: is the first reference focal length, based on At least 2 reference focal lengths are selected from the focal length set according to the unit length. At least 3 reference focal lengths are obtained from the focal length set according to the unit length, and the reference focal lengths include at least or The method can also be: is the first reference focal length, based on and unit length to select no less than 2 reference focal lengths from the set of candidate focal lengths.
[0094] In a specific example, the set of focal lengths to be selected is [9.5-10.5]. If the unit length is 0.1, the reference focal lengths include: 9.5, 9.6, 9.7, ..., 10.5. If the unit length is 0.4, the reference focal lengths can be: 9.5, 9.9, 10.3; or: 9.7, 10.1, 10.5.
[0095] Specifically, the method of determining the target focal length according to the clarity of the reference image corresponding to each reference focal length in the set of focal lengths to be selected may be: determining the reference focal length corresponding to the reference image with the greatest clarity as the target focal length. The method of determining the target focal length according to the clarity of the reference image corresponding to each reference focal length in the set of focal lengths to be selected may also be: obtaining the functional relationship between the focal length in the set of focal lengths to be selected and the clarity of the corresponding image by linear fitting, determining the focal length corresponding to the image with the greatest clarity in the set of focal lengths to be selected according to the functional relationship between the focal length and the clarity of the corresponding image, and determining the focal length corresponding to the image with the greatest clarity in the set of focal lengths to be selected as the target focal length.
[0096] The technical solution of this embodiment can more accurately locate the set of focal lengths to be selected and improve the efficiency of focal length adjustment by determining the initial focal length based on the distance between the image acquisition device and the target object, the image acquisition device parameters, the size of the target object, the proportion of the target object in the image, and the first formula.
[0097] The technical solution of this embodiment obtains point cloud data collected by the laser radar and images collected by the image acquisition device; determines the target distance between the image acquisition device and the target object according to the point cloud data; determines the initial focal length according to the distance between the image acquisition device and the target object, the image acquisition device parameters, the size of the target object, the proportion of the target object in the image and the first formula; determines the focus set to be selected according to the initial focal length and the preset parameters; determines the target focal length according to the clarity of the image in the image set corresponding to the focus set to be selected, which solves the problem of large amount of calculation caused by finding the highest definition photo in the range of the maximum focal length and the minimum focal length of the image acquisition device to determine the focal length, and can narrow the focal length adjustment range, thereby reducing the amount of calculation. In addition, since the focal length needs to be switched frequently when tracking a target object moving at high speed, if the method of finding the highest definition photo in the range of the maximum focal length and the minimum focal length of the image acquisition device to determine the focal length is adopted, the problem of not being able to quickly obtain the focal length corresponding to the high definition will occur. Since the technical solution provided by the embodiment of the present invention can narrow the focal length adjustment range, reduce the amount of calculation, and improve the efficiency of focal length adjustment, the focal length corresponding to the high definition can be quickly obtained to meet the clarity requirements of the target object moving at high speed.
[0098] Embodiment 3
[0099] Figure 3 This is a flow chart of a focus adjustment method provided in the third embodiment of the present application, which specifically explains how to obtain the clarity of the image through an overall evaluation method based on the above-mentioned first and second embodiments. Figure 3 As shown, the method includes:
[0100] S310, acquiring point cloud data collected by the laser radar and images collected by the image acquisition device.
[0101] S320, determining a target distance between the image acquisition device and the target object according to the point cloud data.
[0102] S330, determining a set of focal lengths to be selected according to a target distance between the image acquisition device and the target object, image acquisition device parameters, a size of the target object, and a proportion of the target object in the image.
[0103] S340, obtaining no less than three reference focal lengths from the set of focal lengths to be selected according to unit length.
[0104] Among them, the reference focal length includes at least or .
[0105] It should be noted that the preset parameters include: the first preset parameter and the second preset parameter , the focal length set to be selected is , is the initial focal length.
[0106] S350, dividing the reference image into a plurality of sub-images according to the pixels, and defining a sub-image set, where the sub-image set includes all the sub-images.
[0107] It should be noted that the embodiment of the present application adopts an overall evaluation method to determine the clarity of the reference image, that is, the clarity of the reference image is determined based on all pixels in the reference image.
[0108] The sub-images in the sub-image set do not overlap.
[0109] Specifically, the reference image may be divided into a plurality of sub-images according to the pixels by dividing the reference image according to a preset window size to obtain a plurality of sub-images. For example, if the window size is 3×3, the reference image may be divided according to a 3×3 window to obtain a plurality of sub-images, each of which includes 9 pixels.
[0110] S360, obtaining an image clarity evaluation operator corresponding to the sub-image according to the grayscale value of the center point in the sub-image and the grayscale values of the pixels adjacent to the center point in the sub-image.
[0111] Among them, the image clarity evaluation operator is used to quantify the clarity of the corresponding image.
[0112] Specifically, the method for obtaining the image clarity evaluation operator corresponding to the sub-image based on the grayscale value of the center point in the sub-image and the grayscale values of the adjacent pixel points of the center point in the sub-image can be: the adjacent pixel points of the center point in the sub-image are screened to obtain a reference point set, and the image clarity evaluation operator corresponding to the sub-image is obtained based on the grayscale value of the center point in the sub-image and the grayscale value of each reference point in the reference point set.
[0113] Optionally, determining an image clarity evaluation operator corresponding to the sub-image according to the grayscale value of the center point of the sub-image and the grayscale values of pixels adjacent to the center point of the sub-image includes:
[0114] Defining reference points in the sub-image, where the reference points in the sub-image include at least some of the neighboring pixels of the center point of the sub-image;
[0115] The image clarity evaluation operator corresponding to the sub-image is determined according to the grayscale value of the center point of the sub-image, the grayscale value of the reference point in the sub-image, and the second formula; the second formula is:
[0116] ;
[0117] in, Represents the grayscale value of a single reference point in the sub-image, Represents the grayscale values of all reference points in the sub-image, represents the number of reference points in the sub-image, Represents the gray value of the center point of the sub-image, Based on The preset value is set according to the numerical value.
[0118] The value of R can be Preferably, R= .
[0119] It should be noted that the reference point in the sub-image includes at least part of the adjacent pixels of the center point of the sub-image. For example, if the size of the sub-image is 3×3, the sub-image includes 9 pixels, namely: the center point, the adjacent pixels above the center point, the adjacent pixels below the center point, the adjacent pixels to the left of the center point, the adjacent pixels to the right of the center point, the adjacent pixels to the upper left of the center point, the adjacent pixels to the lower right of the center point, the adjacent pixels to the lower left of the center point, and the adjacent pixels to the upper right of the center point. The adjacent pixels above the center point, the adjacent pixels below the center point, the adjacent pixels to the left of the center point, the adjacent pixels to the right of the center point, the adjacent pixels to the lower left of the center point, and the adjacent pixels to the upper right of the center point are determined as the reference points in the sub-image.
[0120] Optionally, the reference points include: upper adjacent pixel points of the center point, lower adjacent pixel points of the center point, left adjacent pixel points of the center point, right adjacent pixel points of the center point, lower left adjacent pixel points of the center point, and upper right adjacent pixel points of the center point;
[0121] The second formula is:
[0122] ;
[0123] in, For sub-image The gray value of the center point, is the gray value of the adjacent pixel above the center point, is the gray value of the adjacent pixel below the center point, is the gray value of the pixel adjacent to the left of the center point, is the gray value of the pixel adjacent to the lower left of the center point, is the gray value of the pixel adjacent to the upper right of the center point, is the gray value of the pixel adjacent to the right of the center point, sub-image The coordinates of the center point are (x,y), For sub-image The image clarity evaluation operator is The value range is [5,7].
[0124] in, The value of is the total number of sub-image reference points. Preferably, =6.
[0125] The second formula can be written as shown in Table 1:
[0126] Table 1
[0127]
[0128] As shown in Table 2, Table 2 is a sub-image, including 9 pixels in the upper left corner of the image. The gray value of each pixel in the sub-image is arranged according to the position of each pixel in the sub-image:
[0129] Table 2
[0130]
[0131] Among them, R5 is the grayscale value of the center point of the sub-image, R2 is the grayscale value of the upper adjacent pixel point of the center point of the sub-image, R8 is the grayscale value of the lower adjacent pixel point of the center point of the sub-image, R4 is the grayscale value of the left adjacent pixel point of the center point of the sub-image, R6 is the grayscale value of the right adjacent pixel point of the center point of the sub-image, R1 is the grayscale value of the upper left adjacent pixel point of the center point of the sub-image, R7 is the grayscale value of the lower left adjacent pixel point of the center point of the sub-image, R3 is the grayscale value of the upper right adjacent pixel point of the center point of the sub-image, and R9 is the grayscale value of the lower right adjacent pixel point of the center point of the sub-image.
[0132] The image clarity evaluation operator corresponding to the sub-image shown in Table 2 = R2+R3+R4+R6+R7+R8–6*R5.
[0133] S370, determining the clarity of the reference image according to the image clarity evaluation operator corresponding to each sub-image in the sub-image set.
[0134] Optionally, determining the definition of the reference image according to an image definition evaluation operator corresponding to each sub-image in the sub-image set includes:
[0135] The definition of the target image is determined according to the image definition evaluation operator of each sub-image in the sub-image set and the third formula, wherein the third formula is:
[0136] ;
[0137] in, For sub-image , For sub-image The image clarity evaluation operator is is the total number of sub-images, The preset value is set based on the overall evaluation method or the local evaluation method.
[0138] It should be noted that the value of S when the overall evaluation method is used to determine the clarity of the reference image is different from the value of S when the local evaluation method is used to determine the clarity of the reference image. Since the embodiment of the present application adopts an overall evaluation method, in the overall evaluation method, the value of the focal length does not affect the final number of sub-images. This is because, no matter what the value of the focal length is, the number of pixels in the image remains unchanged. Therefore, based on the image with a constant number of pixels, the number of sub-images obtained is a constant value. Therefore, in the above-mentioned evaluation method, comparison can be made by absolute value. Therefore, the value of S in the embodiment of the present application can be a preset positive integer, and preferably, the value of S can be 1.
[0139] S380, determining a target focal length according to the clarity of a reference image corresponding to each reference focal length in the set of focal lengths to be selected.
[0140] The technical solution of this embodiment adopts an overall evaluation method to determine the clarity of the reference image corresponding to each reference focal length in the set of candidate focal lengths, which can improve the accuracy of the target focal length.
[0141] Embodiment 4
[0142] Figure 4 This is a flow chart of a focus adjustment method provided in the fourth embodiment of the present application, which specifically explains how to obtain the clarity of an image through a local evaluation method based on the above-mentioned first and second embodiments. Figure 4 As shown, the method includes:
[0143] S410, acquiring point cloud data collected by the laser radar and images collected by the image acquisition device.
[0144] S420: Determine a target distance between the image acquisition device and the target object according to the point cloud data.
[0145] S430, determining a set of focal lengths to be selected according to a target distance between the image acquisition device and the target object, image acquisition device parameters, a size of the target object, and a proportion of the target object in the image.
[0146] S440, obtaining no less than three reference focal lengths from the set of focal lengths to be selected according to unit length.
[0147] Among them, the reference focal length includes at least or .
[0148] It should be noted that the preset parameters include: the first preset parameter and the second preset parameter , the focal length set to be selected is , is the initial focal length.
[0149] S450, dividing the reference image to obtain a target image, where the target image includes an image of a target object.
[0150] Specifically, the method of dividing the reference image to obtain the target image may be: identifying the reference image to obtain the region to which the target object belongs in the reference image, and dividing the reference image according to the region to which the target object belongs in the reference image to obtain the target image. For example, the target image in the reference image may be extracted according to the region to which the target object belongs in the reference image.
[0151] Specifically, the method of dividing the reference image to obtain the target image may be: determining the position information of the target object according to the laser point cloud, intercepting the reference image according to the position of the target object, and obtaining the target image including the target object in the reference image.
[0152] It should be noted that, if the focal length is longer, the target object in the reference image is larger, that is, the target image includes more pixels. Conversely, if the focal length is shorter, the target object in the reference image is smaller, that is, the target image includes fewer pixels.
[0153] It should be noted that by calculating only the clarity of the target image containing the target object, it is more in line with the principle of giving priority to the clarity of the target object, and effectively improves the clarity of the target object. Compared with the overall evaluation, the calculation speed of the image clarity is improved and the amount of calculation is reduced.
[0154] S460, dividing the target image into a plurality of sub-images according to the pixels, and defining a sub-image set, the sub-image set including all the sub-images.
[0155] The sub-images do not overlap.
[0156] Specifically, the target image may be divided into a plurality of sub-images according to the pixels by dividing the pixels in the target image according to a preset window size to obtain a plurality of sub-images.
[0157] It should be noted that if the focal length is shortened, the larger the target object in the reference image, the more pixels the target image includes, and the more sub-images there are in the sub-image set. If the focal length is shortened, the smaller the target object in the reference image, the fewer pixels the target image includes, and the fewer sub-images there are in the sub-image set.
[0158] S470, obtaining an image clarity evaluation operator corresponding to the sub-image according to the grayscale value of the center point in the sub-image and the grayscale values of the pixels adjacent to the center point in the sub-image.
[0159] Among them, the image clarity evaluation operator is used to quantify the clarity of the corresponding image.
[0160] Optionally, determining an image clarity evaluation operator corresponding to the sub-image according to the grayscale value of the center point of the sub-image and the grayscale values of pixels adjacent to the center point of the sub-image includes:
[0161] Defining reference points in the sub-image, where the reference points in the sub-image include at least some of the neighboring pixels of the center point of the sub-image;
[0162] The image clarity evaluation operator corresponding to the sub-image is determined according to the grayscale value of the center point of the sub-image, the grayscale value of the reference point in the sub-image, and the second formula; the second formula is:
[0163] ;
[0164] in, Represents the grayscale value of a single reference point in the sub-image, Represents the grayscale values of all reference points in the sub-image, represents the number of reference points in the sub-image, Represents the gray value of the center point of the sub-image, Based on The preset value is set according to the numerical value.
[0165] The value of R can be Preferably, R= .
[0166] Optionally, the reference points include upper adjacent pixel points of the center point, lower adjacent pixel points of the center point, left adjacent pixel points of the center point, right adjacent pixel points of the center point, lower left adjacent pixel points of the center point, and upper right adjacent pixel points of the center point;
[0167] The second formula is:
[0168] ;
[0169] in, For sub-image The gray value of the center point, is the gray value of the adjacent pixel above the center point, is the gray value of the adjacent pixel below the center point, is the gray value of the pixel adjacent to the left of the center point, is the gray value of the pixel adjacent to the lower left of the center point, is the gray value of the pixel adjacent to the upper right of the center point, is the gray value of the pixel adjacent to the right of the center point, sub-image The coordinates of the center point are (x,y), For sub-image The image clarity evaluation operator is The value range is [5,7].
[0170] S480, determining the clarity of the reference image according to the image clarity evaluation operator corresponding to each sub-image in the sub-image set.
[0171] Optionally, determining the definition of the reference image according to an image definition evaluation operator corresponding to each sub-image in the sub-image set includes:
[0172] The definition of the target image is determined according to the image definition evaluation operator of each sub-image in the sub-image set and the third formula, wherein the third formula is:
[0173] ;
[0174] in, For sub-image , For sub-image The image clarity evaluation operator is is the total number of sub-images, The preset value is set based on the overall evaluation method or the local evaluation method.
[0175] It should be noted that the value of S when the reference image clarity is determined by the overall evaluation method is different from the value of S when the reference image clarity is determined by the local evaluation method. Since the embodiment of the present application adopts the local evaluation method, the value of the focal length directly affects the number of pixels of the target image, and thus directly affects the number of sub-images. Therefore, in the above evaluation method, it is more reasonable to use relative values for evaluation.
[0176] Optionally, if the local evaluation method is selected, .
[0177] S490, determining a target focal length according to the clarity of a reference image corresponding to each reference focal length in the set of focal lengths to be selected.
[0178] The technical solution of this embodiment adopts a local evaluation method to determine the clarity of the reference image corresponding to each reference focal length in the set of candidate focal lengths, which can reduce the amount of calculation and improve the efficiency of focal length adjustment.
[0179] The embodiment of the present application proposes a focusing method when tracking a fast-moving target object. The method provided by the embodiment of the present application can achieve fast focusing. Since the target object has the characteristic of fast movement, fast focusing is required. If the focusing speed is slow, the target object cannot be tracked. The fast-moving target object can be a drone or a high-speed vehicle.
[0180] Embodiment 5
[0181] Figure 5 This is a flowchart of a focal length adjustment method provided in Embodiment 5 of the present application, which specifically explains how to determine the target focal length by defining a comparison method based on the above Embodiments 1 to 4. Figure 5 As shown, the method includes:
[0182] S510, acquiring point cloud data collected by the laser radar and images collected by the image acquisition device;
[0183] S520, determining a target distance between the image acquisition device and the target object according to the point cloud data;
[0184] S530, determining a set of focal lengths to be selected according to a target distance between the image acquisition device and the target object, parameters of the image acquisition device, a size of the target object, and a proportion of the target object in the image;
[0185] S540: Obtain at least three reference focal lengths from the set of focal lengths to be selected according to unit length.
[0186] Among them, the reference focal length includes at least or ;
[0187] S550, obtaining the clarity of the reference image corresponding to each reference focal length in the to-be-selected focal length set.
[0188] S560: Define the reference focal length corresponding to the reference image with the maximum clarity as the target focal length.
[0189] Specifically, the reference focal length corresponding to the reference image with the highest definition may be determined as the target focal length by comparing the definition of each reference image in all reference images and determining the reference focal length corresponding to the reference image with the highest definition as the target focal length.
[0190] In a specific example, the focal length set to be selected is [9.5-10.5], the unit length is 0.1, and the reference focal lengths include: 9.5, 9.6, 9.7, ..., 10.4, 10.5. Obtain the clarity of the reference image corresponding to the reference focal length 9.5, the clarity of the reference image corresponding to the reference focal length 9.6, the clarity of the reference image corresponding to the reference focal length 9.7, ..., the clarity of the reference image corresponding to the reference focal length 10.4, and the clarity of the reference image corresponding to the reference focal length 10.5. If the clarity of the reference image corresponding to the reference focal length 9.6 is greater than the clarity of the reference images corresponding to other reference focal lengths, the reference focal length 9.6 is determined as the target focal length.
[0191] The technical solution of this embodiment determines the target focal length by comparing the clarity of the reference image corresponding to the reference focal length, which can improve the accuracy of the target focal length.
[0192] Embodiment 6
[0193] Figure 6 This is a flowchart of a focal length adjustment method provided in Embodiment 6 of the present application, which specifically explains how to determine the target focal length by defining a fitting method based on the above Embodiments 1 to 4. Figure 6 As shown, the method includes:
[0194] S610, acquiring point cloud data collected by the laser radar and images collected by the image acquisition device;
[0195] S620, determining a target distance between the image acquisition device and the target object according to the point cloud data;
[0196] S630, determining a set of focal lengths to be selected according to a target distance between the image acquisition device and the target object, parameters of the image acquisition device, a size of the target object, and a proportion of the target object in the image;
[0197] S640, obtaining at least three reference focal lengths from the set of candidate focal lengths according to unit length, wherein the reference focal lengths include at least or ;
[0198] S650, obtaining the clarity of the reference image corresponding to each reference focal length in the to-be-selected focal length set;
[0199] S660, taking all reference focal lengths and the clarity of the corresponding reference images as parameters, a functional relationship between the focal lengths and the clarity of the corresponding images in the candidate focal length set is obtained by linear fitting, and the focal length corresponding to the maximum clarity in the candidate focal length set is obtained by the functional relationship, and the focal length is defined as the target focal length.
[0200] Specifically, taking all the reference focal lengths and the clarity of the corresponding reference images as parameters, the method for obtaining the functional relationship between the focal length and the clarity of the corresponding image in the focal length set to be selected by linear fitting can be: taking all the reference focal lengths and the clarity of the corresponding reference images as parameters and inputting them into the fourth formula, obtaining the functional relationship between the focal length and the clarity of the corresponding image in the focal length set to be selected.
[0201] Optionally, taking three reference focal lengths as an example, the fitting method includes the following contents:
[0202] Focal length set to be selected The three reference focal lengths are , , ;
[0203] Obtain the clarity of images corresponding to three reference focal lengths;
[0204] The target focal length is determined according to the three reference focal lengths, the clarity of the image corresponding to each reference focal length, and the fourth formula, wherein the fourth formula is:
[0205] ;
[0206] in, is the target focal length, Reference focal length The clarity of the corresponding reference image, Reference focal length The clarity of the corresponding reference image, Reference focal length The clarity of the corresponding reference image, is the first fitting coefficient, is the second fitting coefficient.
[0207] It should be noted that if the first preset parameter and the second preset parameter Equal, both , then the fourth formula can also be:
[0208] ;
[0209] Among them, the three reference focal lengths are: , is the target focal length, Reference focal length The clarity of the corresponding reference image, Reference focal length The clarity of the corresponding reference image, Reference focal length The clarity of the corresponding reference image, is the first fitting coefficient, is the second fitting coefficient.
[0210] It should be noted that the clarity of the reference image corresponding to each of the three reference focal lengths is substituted into the above formula to calculate the target focal length: , according to the calculated target focal length , driving the motor to move and complete automatic focusing.
[0211] In a specific example, the three reference focal lengths are , given the reference images corresponding to the three reference focal lengths, the clarity calculation formula is used to calculate: reference focal length The clarity of the corresponding reference image , reference focal length The clarity of the corresponding reference image , reference focal length The clarity of the corresponding reference image , we can get the following three points:
[0212] ;
[0213] If a two-dimensional coordinate axis is established, the horizontal axis is the focal length and the vertical axis is the corresponding image clarity value.
[0214] Substitute the above three points into the following formula to calculate the target focal length :
[0215] ;
[0216] Based on the calculated target focal length , driving the motor to move and complete automatic focusing.
[0217] In a specific example, after the laser radar and image acquisition device are installed, joint calibration is performed, the laser radar collects point cloud data, the point cloud data is clustered to identify the target object, and the first distance between the image acquisition device and the target object is calculated based on the position coordinates of the target object. For moving target objects, the computing platform gives continuous distances corresponding to the laser radar frame rate. The image acquisition device collects image data, identifies the image, obtains the position coordinates of the target object, and calculates the second distance between the image acquisition device and the target object based on the position coordinates of the target object. The first distance and the second distance measured by the laser radar and the image acquisition device are fused to obtain the target distance. The initial focal length is determined based on the target distance between the image acquisition device and the target object, the image acquisition device parameters, the target object size, and the proportion of the target object in the image, and the PID controls the lens motor to move to the initial focal length. Among them, the calculation formula for determining the initial focal length based on the target distance between the image acquisition device and the target object, the image acquisition device parameters, the target object size, and the proportion of the target object in the image is:
[0218] ;
[0219] in, is the initial focal length, is the distance between the image acquisition device and the target object, is the imaging width of the target surface of the image acquisition device, is the target object size, is the proportion of the target object in the image. The lens motor is controlled by the PID algorithm to move from the current focal length to the initial focal length. The set of candidate focal lengths is determined based on the initial focal length and preset parameters. Three reference focal lengths are obtained from the set of candidate focal lengths according to the unit length. The three reference focal lengths are , , The image clarity evaluation operator is used to calculate the clarity of the image frames corresponding to the three focal lengths. The functional relationship between the focal length and the corresponding image clarity in the candidate focal length set is obtained by linear fitting. The focal length corresponding to the maximum clarity in the candidate focal length set, that is, the target focal length, is obtained through the functional relationship.
[0220] Among them, the image clarity evaluation operator is used to obtain The clarity of the reference images corresponding to the three reference focal lengths includes the following steps:
[0221] Control the lens motor to move to the reference focal length , collect the lens motor movement to the reference focal length The captured image is determined as a reference image, and the reference image is divided to obtain a sub-image set.
[0222] The clarity of the reference image is determined according to the image clarity evaluation operator of each sub-image in the sub-image set and the following formula:
[0223] ;
[0224] in, For sub-image , For sub-image The image clarity evaluation operator is is the total number of sub-images, The preset value is set based on the overall evaluation method or the local evaluation method.
[0225] It should be noted that The larger the value, the clearer the reference image.
[0226] It should be noted that during the UAV image tracking process, due to the real-time changes in the UAV's flight distance, the focal length of the image acquisition device needs to be adjusted in real time to ensure the tracking of the UAV's image. The quality of the automatic focusing algorithm directly affects the focusing efficiency and has a relatively large impact on UAV tracking.
[0227] In order to solve the above problems, the embodiments of the present application determine a set of candidate focal lengths by real-time fusion of target distance, image acquisition device parameters, target object size and the proportion of the target object in the image based on the laser radar and image acquisition device visual ranging; obtain no less than 3 reference focal lengths from the set of candidate focal lengths according to unit length, and determine the target focal length by fitting, thereby keeping tracking of the moving target object.
[0228] Embodiment 7
[0229] Figure 7This is a schematic diagram of the structure of a focus adjustment device provided in Embodiment 7 of the present application. This embodiment is applicable to the case of focus adjustment. The device can be implemented in software and / or hardware. The device can be integrated in any device that provides a focus adjustment function, such as Figure 7 As shown, the focal length adjustment device specifically includes: an acquisition module 710, a target distance determination module 720, a to-be-selected focal length set determination module 730 and a target focal length determination module 740.
[0230] The acquisition module is used to acquire point cloud data collected by the laser radar and images collected by the image acquisition device;
[0231] A target distance determination module, used to determine the target distance between the image acquisition device and the target object according to the point cloud data;
[0232] A module for determining a set of focal lengths to be selected, used to determine a set of focal lengths to be selected based on a target distance between an image acquisition device and a target object, parameters of the image acquisition device, a size of the target object, and a proportion of the target object in the image;
[0233] The target focal length determination module is used to determine the target focal length according to the clarity of the images in the image set corresponding to the focus set to be selected.
[0234] The above-mentioned product can execute the method provided by any embodiment of the present application, and has the corresponding functional modules and beneficial effects of the execution method.
[0235] The technical solution of this embodiment obtains point cloud data collected by a laser radar and images collected by an image acquisition device; determines the target distance between the image acquisition device and the target object based on the point cloud data; determines a set of candidate focal lengths based on the target distance between the image acquisition device and the target object, image acquisition device parameters, target object size, and the proportion of the target object in the image; and determines the target focal length based on the clarity of images in an image set corresponding to the set of candidate focal lengths. This solves the problem that existing methods for adjusting focal length are inefficient and easily affected by the image quality of the image acquisition device, resulting in inaccurate final focal lengths, and achieves the effect of improving the accuracy of the final focal length while improving the efficiency of focal length adjustment.
[0236] Embodiment 8
[0237] Figure 8A schematic diagram of the structure of an electronic device 10 that can be used to implement the eighth embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0238] like Figure 8 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. The input / output (I / O) interface 15 is also connected to the bus 14.
[0239] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0240] The processor 11 may be a variety of general and / or dedicated processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a focus adjustment method.
[0241] In some embodiments, the focus adjustment method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the focus adjustment method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the focus adjustment method in any other appropriate manner (e.g., by means of firmware).
[0242] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0243] The computer programs for implementing the methods of the present application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer programs are executed by the processor, the functions / operations specified in the flow charts and / or block diagrams are implemented. The computer programs may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0244] In the context of the present application, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer 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 foregoing.
[0245] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0246] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0247] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0248] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution of this application can be achieved, and this document is not limited here.
[0249] An embodiment of the present invention further provides a computer program product, including a computer program, wherein when the computer program is executed by a processor, the focus adjustment method according to any embodiment of the present invention is implemented.
[0250] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.
Claims
1. A focal length adjustment method, characterized in that: Applied to a tracking system, the tracking system includes: a laser radar and an image acquisition device, and the focal length adjustment method includes: Obtain point cloud data collected by the laser radar and images collected by the image acquisition device; determining a target distance between an image acquisition device and a target object based on the point cloud data; Determine a set of focal lengths to be selected according to a target distance between the image acquisition device and the target object, image acquisition device parameters, a size of the target object, and a proportion of the target object in the image; Determining a target focal length according to the clarity of an image in an image set corresponding to the set of focal lengths to be selected; Determining a set of focal lengths to be selected according to a target distance between the image acquisition device and the target object, image acquisition device parameters, a target object size, and a proportion of the target object in the image includes: Determining an initial focal length according to a target distance between the image acquisition device and the target object, image acquisition device parameters, an actual width of the target object, a proportion of the target object in the image, and a first formula; Determine a set of focal lengths to be selected according to the initial focal length and preset parameters; The image acquisition device parameters include: image acquisition device target surface imaging width; The first formula is: ; in, is the initial focal length, is the target distance between the image acquisition device and the target object, is the imaging width of the target surface of the image acquisition device, is the actual width of the target object, is the proportion of the target object in the image.
2. The method according to claim 1, characterized in that Determining a target distance between an image acquisition device and a target object according to the point cloud data includes: Determine the distance between the laser radar and the target object according to the point cloud data; The target distance between the image acquisition device and the target object is determined according to the positional relationship between the laser radar and the image acquisition device and the distance between the laser radar and the target object.
3. The method according to claim 1, characterized in that Determining a target distance between an image acquisition device and a target object according to the point cloud data includes: Determine the distance between the laser radar and the target object according to the point cloud data; Determine a first distance between the image acquisition device and the target object according to a positional relationship between the laser radar and the image acquisition device and a distance between the laser radar and the target object; Recognize the image to obtain a second distance between the image acquisition device and the target object; A target distance between the image acquisition device and the target object is determined according to a first distance between the image acquisition device and the target object and a second distance between the image acquisition device and the target object.
4. The method according to any one of claims 1 to 3, characterized in that: The preset parameters include: the first preset parameter and the second preset parameter , the focal length set to be selected is , is the initial focal length; Determining a target focal length according to the clarity of an image in an image set corresponding to the set of to-be-selected focal lengths includes: At least three reference focal lengths are obtained from the set of focal lengths to be selected according to unit length, and the reference focal lengths include at least or ; Obtaining the clarity of a reference image corresponding to each reference focal length in the set of to-be-selected focal lengths; The target focal length is determined according to the clarity of the reference image corresponding to each reference focal length in the set of candidate focal lengths.
5. The method according to claim 4, characterized in that Obtaining the clarity of the reference image corresponding to each reference focal length in the set of candidate focal lengths includes: defining an overall evaluation method, including the following contents: Dividing the reference image into a plurality of sub-images according to pixel points, and defining a sub-image set, wherein the sub-image set includes all sub-images; Obtaining an image clarity evaluation operator corresponding to the sub-image according to the grayscale value of the center point in the sub-image and the grayscale values of the pixels adjacent to the center point in the sub-image, wherein the image clarity evaluation operator is used to quantify the clarity of the corresponding image; The definition of the reference image is determined according to the image definition evaluation operator corresponding to each sub-image in the sub-image set.
6. The method according to claim 4, characterized in that Obtaining the clarity of an image corresponding to each reference focal length in the set of candidate focal lengths includes: defining a local evaluation method, including the following contents: Dividing the reference image to obtain a target image, wherein the target image includes an image of a target object; Dividing the target image into a plurality of sub-images according to pixel points, and defining a sub-image set, wherein the sub-image set includes all sub-images; Obtaining an image clarity evaluation operator corresponding to the sub-image according to the grayscale value of the center point in the sub-image and the grayscale values of the pixels adjacent to the center point in the sub-image, wherein the image clarity evaluation operator is used to quantify the clarity of the corresponding image; The definition of the reference image is determined according to the image definition evaluation operator corresponding to each sub-image in the sub-image set.
7. The method according to claim 5 or 6, characterized in that: The image clarity evaluation operator corresponding to the sub-image is determined according to the grayscale value of the center point of the sub-image and the grayscale values of the pixels adjacent to the center point of the sub-image, including: Defining reference points in the sub-image, wherein the reference points in the sub-image include at least some of the neighboring pixels of the center point of the sub-image; The image clarity evaluation operator corresponding to the sub-image is determined according to the grayscale value of the center point of the sub-image, the grayscale value of the reference point in the sub-image, and the second formula; the second formula is: ; in, Represents the grayscale value of a single reference point in the sub-image, Represents the grayscale values of all reference points in the sub-image, represents the number of reference points in the sub-image, Represents the gray value of the center point of the sub-image, Based on The default value is set by the value of For sub-image Image clarity evaluation operator.
8. The method according to claim 7, characterized in that The reference points include the upper adjacent pixel point of the center point, the lower adjacent pixel point of the center point, the left adjacent pixel point of the center point, the right adjacent pixel point of the center point, the lower left adjacent pixel point of the center point, and the upper right adjacent pixel point of the center point; The second formula is: ; in, For sub-image The gray value of the center point, is the gray value of the adjacent pixel above the center point, is the gray value of the adjacent pixel below the center point, is the gray value of the pixel adjacent to the left of the center point, is the gray value of the pixel adjacent to the lower left of the center point, is the gray value of the pixel adjacent to the upper right of the center point, is the gray value of the pixel adjacent to the right of the center point, sub-image The coordinates of the center point are (x,y), For sub-image The image clarity evaluation operator is The value range is [5,7].
9. The method according to claim 5, 6 or 8, characterized in that: Determining the clarity of the reference image according to the image clarity evaluation operator corresponding to each sub-image in the sub-image set includes: The definition of the reference image is determined according to the image definition evaluation operator of each sub-image in the sub-image set and the third formula, wherein the third formula is: ; in, For sub-image , For sub-image The image clarity evaluation operator is is the total number of sub-images, The default value is set based on the overall evaluation method or the local evaluation method. Reference focal length The resolution of the corresponding reference image.
10. The method according to claim 9, characterized in that If the local evaluation method is selected, .
11. The method according to claim 4, characterized in that Determining a target focal length according to the clarity of a reference image corresponding to each reference focal length in the set of focal lengths to be selected includes: Defining a comparison method includes: defining a reference focal length corresponding to a reference image with the greatest clarity as a target focal length; or A fitting method is defined, including: taking all reference focal lengths and the clarity of corresponding reference images as parameters, obtaining a functional relationship between the focal lengths and the clarity of corresponding images in a set of candidate focal lengths by linear fitting, obtaining a focal length corresponding to a maximum clarity value in the set of candidate focal lengths by the functional relationship, and defining the focal length as a target focal length.
12. The method according to claim 11, characterized in that The fitting method includes the following contents: Focal length set to be selected The three reference focal lengths are , , ; Obtaining the clarity of images corresponding to the three reference focal lengths; The target focal length is determined according to the three reference focal lengths, the clarity of the image corresponding to each reference focal length, and a fourth formula, wherein the fourth formula is: ; in, is the target focal length, Reference focal length The clarity of the corresponding reference image, Reference focal length The clarity of the corresponding reference image, Reference focal length The clarity of the corresponding reference image, is the first fitting coefficient, is the second fitting coefficient.
13. A focal length adjustment device, characterized in that: Applied to a tracking system, the tracking system comprises: a laser radar and an image acquisition device, and the focus adjustment device comprises: An acquisition module, used to acquire point cloud data collected by the laser radar and images collected by the image acquisition device; A target distance determination module, used to determine the target distance between the image acquisition device and the target object according to the point cloud data; A module for determining a set of focal lengths to be selected, configured to determine a set of focal lengths to be selected based on a target distance between the image acquisition device and the target object, image acquisition device parameters, a size of the target object, and a proportion of the target object in the image; A target focal length determination module, used to determine the target focal length according to the clarity of the images in the image set corresponding to the set of focal lengths to be selected; The module for determining the set of focal lengths to be selected is specifically used for: Determine an initial focal length according to the distance between the image acquisition device and the target object, image acquisition device parameters, the actual width of the target object, the proportion of the target object in the image, and a first formula; Determine a set of focal lengths to be selected according to the initial focal length and preset parameters; The image acquisition device parameters include: image acquisition device target surface imaging width; The first formula is: ; in, is the initial focal length, is the distance between the image acquisition device and the target object, is the imaging width of the target surface of the image acquisition device, is the actual width of the target object, is the proportion of the target object in the image.
14. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the focus adjustment method according to any one of claims 1 to 12.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the focus adjustment method according to any one of claims 1 to 12 when executed.
Citation Information
Patent Citations
Terminal focusing method and device, and terminal
CN106412437A
Target ranging system and method based on image and laser radar fusion
CN112396650A
