Focusing method and device, projection device and storage medium
Patent Information
- Application Number
- CN202210799146.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-06
- Publication Date
- 2026-11-03
- Estimated Expiration
- 2042-07-06
AI Technical Summary
In existing projector focusing methods, overfitting and prediction errors in the distance-focal length correspondence result in low focusing accuracy.
Using a pre-built calculation model, the number of motor steps corresponding to the clearest point of projection is determined based on the current projection distance of the projection device. Multiple projection images are captured during the motor's movement. By comparing the clarity of the images, the method of determining the target position and the adjustment position is used. The position of the clearest point of the target is determined by comparing the clarity of the motor at the target position and the adjustment position.
This improves focusing accuracy, avoids motor step misjudgment and step loss problems, and achieves precise and efficient focusing.
Smart Images

Figure CN117412008B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of projection technology, and more specifically, to a focusing method, apparatus, projection device, and storage medium. Background Technology
[0002] With the rapid development of projector technology, projectors have begun to enter thousands of households. The most important function of a projector is its focusing function. How to achieve fast and accurate focusing to present users with a clear projected image has become an urgent problem to be solved.
[0003] In existing technologies, focusing is often achieved by using the relationship between distance and focal length. However, this relationship often suffers from problems such as overfitting and prediction errors, resulting in low focusing accuracy. Summary of the Invention
[0004] The purpose of this application is to address the shortcomings of the prior art by providing a focusing method, apparatus, projection device, and storage medium to solve the problem of low focusing accuracy in the prior art.
[0005] To achieve the above objectives, the technical solutions adopted in the embodiments of this application are as follows: In a first aspect, embodiments of this application provide a focusing method, including: Based on the current projection distance of the projection device, a pre-built calculation model is used to determine the number of motor steps corresponding to the clear projection point of the projection device at the current projection distance. The drive motor moves the number of motor steps to reach the target position, and at least two projected images are taken at preset time intervals during the motor movement, and the clarity of each projected image is determined; If the clarity of each projected image increases sequentially according to the shooting time of each projected image, then the target clear point position is determined based on the clarity of the image captured when the motor is at the target position and the clarity of the image captured when the motor is in the adjusted position, and the motor is moved to the target clear point position. The adjusted position is determined based on the target position and the preset number of adjustment steps.
[0006] Optionally, determining the target sharpness point position based on the sharpness of the captured image corresponding to the motor at the target position and the sharpness of the captured image corresponding to the motor at the adjusted position includes: The first adjustment position is determined based on the target position and the preset number of adjustment steps; Determine whether the image sharpness corresponding to the motor at the target position is greater than the image sharpness corresponding to the motor at the first adjustment position; If so, then the target location is determined to be the target clear point location.
[0007] Optionally, after determining whether the sharpness of the image captured when the motor is at the target position is greater than the sharpness of the image captured when the motor is at the first adjustment position, the method further includes: If the image captured when the motor is at the target position has a lower resolution than the image captured when the motor is at the first adjustment position, then a second adjustment position is determined based on the first adjustment position and the preset number of adjustment steps. Determine whether the image sharpness corresponding to the motor being in the first adjustment position is greater than the image sharpness corresponding to the motor being in the second adjustment position; If not, a new second adjustment position is determined based on the second adjustment position and the preset adjustment steps, and it is determined whether the clarity of the image captured when the motor is in the second adjustment position is greater than the clarity of the image captured when the motor is in the new second adjustment position. This step is repeated until the clarity of the image captured when the motor is in the second adjustment position is greater than the clarity of the image captured when the motor is in the new second adjustment position. Then, the second adjustment position is determined as the target clear point position.
[0008] Optionally, determining the sharpness of each projected image includes: The first sharpness index of the target projection image is determined based on the convolution of each pixel of the target projection image, wherein the target projection image is any one of the projection images. A second sharpness index of the target projection image is determined based on the grayscale value of each pixel in the target projection image; The third sharpness index of the target projection image is determined based on the coordinates of each pixel in the target projection image. The sharpness of the target projected image is obtained by weighted summation of the first sharpness index, the second sharpness index, and the third sharpness index.
[0009] Optionally, after the drive motor moves the motor steps to reach the target position, and at least two projected images are captured at preset time intervals during the motor movement, the method further includes: If the clarity of each projected image does not increase sequentially according to the shooting time of each projected image, the position of the motor is moved to the initial position, and the motor is driven to move by the number of motor steps corresponding to the clearest point of the projection at the current projection distance.
[0010] Optionally, before determining the number of motor steps corresponding to the sharpest projection point at the current projection distance using a pre-built calculation model, the method further includes: Acquire sample data from at least one sample projection device at various sample projection distances, the sample data including: sample projection distance and the number of projection clarity point motor steps corresponding to the sample projection distance; The sample data from each sample projection device is integrated and processed to obtain the target sample data; Based on the target sample data, curve fitting is performed to obtain the computational model.
[0011] Optionally, acquiring sample data from at least one sample projection device at each sample projection distance includes: Based on the target projection specification distance and the target sampling distance, determine multiple sampling points and the corresponding sample projection distance for each sampling point; Based on each sampling point, the calibrated slide rail device controls each sample projection device to move to its respective sampling point; The calibration process is performed based on each sampling point and the corresponding sample projection distance to obtain sample data of each sample projection device at each sample projection distance.
[0012] Optionally, the calibration process based on each sampling point and the corresponding sample projection distance to obtain sample data for each sample projection device at each sample projection distance includes: The calibration slide rail device is controlled to move the target sample projection device to the position of the target sampling point, and the projection distance collected by the sensor on the target sample projection device at the target sampling point is obtained. During the movement of the motor of the target sample projection device from the first position to the second position, at least two first projection images are captured at a preset time interval, and the sharpness of each first projection image is calculated. The target sample projection device is any one of the at least one sample projection device, the target sampling point is any one of the plurality of sampling points, the first position is the initial position of the focusing system of the target sample projection device, and the second position is the maximum position of the focusing system of the target sample projection device. During the process of the motor of the target sample projection device moving from the second position to the first position, at least two second projection images are captured at preset time intervals, and the sharpness of each second projection image is calculated. If the difference between the maximum sharpness of each first projected image and the maximum sharpness of each second projected image satisfies the sharpness threshold, and the number of calibrations of the target sample projection device at the target sampling point satisfies the preset number of calibrations, then the calibration of the target sample projection device at the target sampling point is determined to be complete. Based on the position of the clear point of the projection of the target sample projection device at the target sample projection distance corresponding to the target sampling point, the number of motor steps of the clear point of the projection of the target sample projection device at the target sample projection distance is determined, and the number of motor steps of the clear point of the projection and the projection distance collected by the sensor are used as a sample data of the target sample projection device at the target sample projection distance.
[0013] Optionally, the step of integrating and processing the sample data from each sample projection device to obtain the target sample data includes: After removing the extreme values of the motor steps for the clearest point of the projection at the same projection distance in the sample data of each sample projection device, the average value is calculated to obtain the motor steps for the clearest point of the target projection at each sample projection distance. After removing the extreme values of the projection distances collected by each sensor in the sample data of each sample projection device, the average value is calculated to obtain the target sample projection distance under each sample projection distance; The target sample data is obtained based on the number of motor steps of the target projection clear point under each sample projection distance and the target sample projection distance under each sample projection distance.
[0014] Optionally, the step of performing curve fitting based on the target sample data to obtain the target computational model includes: Based on the target sample data, curve fitting is performed to obtain the initial calculation model; The target calculation model is obtained by performing compensation processing based on the initial calculation model.
[0015] Optionally, the step of performing compensation processing based on the initial calculation model to obtain the target calculation model includes: Based on the preset projection distance, the initial calculation model is used to obtain the predicted number of motor steps for the projection point of the projection device at the projection distance. Obtain the actual number of motor steps for the projected clear point at the projection distance using the projection device; The compensation value of the initial calculation model is determined based on the actual number of motor steps for the projected clear point and the predicted number of motor steps for the projected clear point. The initial calculation model is updated based on the compensation value to obtain the target calculation model.
[0016] Optionally, the step of performing compensation processing based on the initial calculation model to obtain the target calculation model includes: Based on the target projection distance interval, the target projection distance interval is divided into multiple projection distance sub-intervals; Based on the clarity of each projected image captured in each projection distance sub-interval, determine the motor position corresponding to the maximum clarity of the projected image in each projection distance sub-interval; The compensation value for each projection distance sub-interval is determined based on the motor position corresponding to the maximum clarity of the projected image in each projection distance sub-interval. The initial calculation model is updated using the compensation values under each projection distance sub-interval to obtain the target calculation model.
[0017] Optionally, the step of performing curve fitting based on the target sample data to obtain an initial calculation model includes: The initial calculation model is obtained by constructing the correspondence between the projection distance of each sample in the target sample data and the number of motor steps of the projection clear point corresponding to each projection distance.
[0018] Secondly, embodiments of this application also provide a focusing device, including: a determining module; The determining module is used to determine the number of motor steps corresponding to the clear projection point of the projection device at the current projection distance based on the obtained current projection distance of the projection device and using a pre-built calculation model. The determining module is used to drive the motor to move the number of motor steps to reach the target position, and to take at least two projected images at preset time intervals during the motor movement, and to determine the clarity of each projected image; The determining module is used to determine the target clear point position based on the clarity of the image captured when the motor is at the target position and the clarity of the image captured when the motor is in the adjusted position, if the clarity of each projected image increases sequentially according to the shooting time of each projected image, and then move the motor to the target clear point position. The adjusted position is determined based on the target position and a preset number of adjustment steps.
[0019] Optionally, the determining module is specifically used to determine the first adjustment position based on the target position and the preset number of adjustment steps; Determine whether the image sharpness corresponding to the motor at the target position is greater than the image sharpness corresponding to the motor at the first adjustment position; If so, then the target location is determined to be the target clear point location.
[0020] Optionally, the determining module is further configured to determine a second adjustment position based on the first adjustment position and the preset number of adjustment steps if the clarity of the captured image corresponding to the motor at the target position is less than the clarity of the captured image corresponding to the motor at the first adjustment position. Determine whether the image sharpness corresponding to the motor being in the first adjustment position is greater than the image sharpness corresponding to the motor being in the second adjustment position; If not, a new second adjustment position is determined based on the second adjustment position and the preset adjustment steps, and it is determined whether the clarity of the image captured when the motor is in the second adjustment position is greater than the clarity of the image captured when the motor is in the new second adjustment position. This step is repeated until the clarity of the image captured when the motor is in the second adjustment position is greater than the clarity of the image captured when the motor is in the new second adjustment position. Then, the second adjustment position is determined as the target clear point position.
[0021] Optionally, the determining module is specifically used to determine a first sharpness index of the target projection image based on the convolution of each pixel of the target projection image, wherein the target projection image is any one of the projection images; A second sharpness index of the target projection image is determined based on the grayscale value of each pixel in the target projection image; The third sharpness index of the target projection image is determined based on the coordinates of each pixel in the target projection image. The sharpness of the target projected image is obtained by weighted summation of the first sharpness index, the second sharpness index, and the third sharpness index.
[0022] Optionally, the device further includes an adjustment module; The adjustment module is used to move the motor to its initial position if the clarity of each projected image does not increase sequentially according to the shooting time of each projected image, and then drive the motor to move the number of motor steps according to the number of motor steps corresponding to the clearest point of the projection device at the current projection distance.
[0023] Optionally, the device further includes: an acquisition module and a processing module; The acquisition module is used to acquire sample data of at least one sample projection device at each sample projection distance. The sample data includes: sample projection distance and the number of projection clarity point motor steps corresponding to the sample projection distance. The acquisition module is used to integrate and process the sample data from each sample projection device to acquire the target sample data. The processing module is used to perform curve fitting based on the target sample data to obtain a calculation model.
[0024] Optionally, the acquisition module is specifically used for Based on the target projection specification distance and the target sampling distance, determine multiple sampling points and the corresponding sample projection distance for each sampling point; Based on each sampling point, the calibrated slide rail device controls each sample projection device to move to its respective sampling point; The calibration process is performed based on each sampling point and the corresponding sample projection distance to obtain sample data of each sample projection device at each sample projection distance.
[0025] Optionally, the acquisition module is specifically used for The calibration slide rail device is controlled to move the target sample projection device to the position of the target sampling point, and the projection distance collected by the sensor on the target sample projection device at the target sampling point is obtained. During the movement of the motor of the target sample projection device from the first position to the second position, at least two first projection images are captured at a preset time interval, and the sharpness of each first projection image is calculated. The target sample projection device is any one of the at least one sample projection device, the target sampling point is any one of the plurality of sampling points, the first position is the initial position of the focusing system of the target sample projection device, and the second position is the maximum position of the focusing system of the target sample projection device. During the process of the motor of the target sample projection device moving from the second position to the first position, at least two second projection images are captured at preset time intervals, and the sharpness of each second projection image is calculated. If the difference between the maximum sharpness of each first projected image and the maximum sharpness of each second projected image satisfies the sharpness threshold, and the number of calibrations of the target sample projection device at the target sampling point satisfies the preset number of calibrations, then the calibration of the target sample projection device at the target sampling point is determined to be complete. Based on the position of the clear point of the projection of the target sample projection device at the target sample projection distance corresponding to the target sampling point, the number of motor steps of the clear point of the projection of the target sample projection device at the target sample projection distance is determined, and the number of motor steps of the clear point of the projection and the projection distance collected by the sensor are used as a sample data of the target sample projection device at the target sample projection distance.
[0026] Optionally, the acquisition module is specifically used for After removing the extreme values of the motor steps for the clearest point of the projection at the same projection distance in the sample data of each sample projection device, the average value is calculated to obtain the motor steps for the clearest point of the target projection at each sample projection distance. After removing the extreme values of the projection distances collected by each sensor in the sample data of each sample projection device, the average value is calculated to obtain the target sample projection distance under each sample projection distance; The target sample data is obtained based on the number of motor steps of the target projection clear point under each sample projection distance and the target sample projection distance under each sample projection distance.
[0027] Optionally, the processing module is specifically used for Based on the target sample data, curve fitting is performed to obtain the initial calculation model; The target calculation model is obtained by performing compensation processing based on the initial calculation model.
[0028] Optionally, the processing module is specifically used for Based on the preset projection distance, the initial calculation model is used to obtain the predicted number of motor steps for the projection point of the projection device at the projection distance. Obtain the actual number of motor steps for the projected clear point at the projection distance using the projection device; The compensation value of the initial calculation model is determined based on the actual number of motor steps for the projected clear point and the predicted number of motor steps for the projected clear point. The initial calculation model is updated based on the compensation value to obtain the target calculation model.
[0029] Optionally, the processing module is specifically used for Based on the target projection distance interval, the target projection distance interval is divided into multiple projection distance sub-intervals; Based on the clarity of each projected image captured in each projection distance sub-interval, determine the motor position corresponding to the maximum clarity of the projected image in each projection distance sub-interval; The compensation value for each projection distance sub-interval is determined based on the motor position corresponding to the maximum clarity of the projected image in each projection distance sub-interval. The initial calculation model is updated using the compensation values under each projection distance sub-interval to obtain the target calculation model.
[0030] Optionally, the processing module is specifically used for The initial calculation model is obtained by constructing the correspondence between the projection distance of each sample in the target sample data and the number of motor steps of the projection clear point corresponding to each projection distance.
[0031] Thirdly, embodiments of this application provide a projection device, including: a processor, a storage medium, and a bus. The storage medium stores machine-readable instructions executable by the processor. When the projection device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of the method provided in the first aspect.
[0032] Fourthly, embodiments of this application provide a storage medium storing a computer program that, when executed by a processor, performs the steps of the method provided in the first aspect.
[0033] The beneficial effects of this application are: This application provides a focusing method, apparatus, projection device, and storage medium. The method includes: determining the number of motor steps corresponding to the projection point of the projection device at the current projection distance using a pre-built calculation model based on the current projection distance of the projection device; driving the motor to move the motor steps to reach the target position, and taking at least two projection images at preset time intervals during the motor movement, and determining the sharpness of each projection image; if the sharpness of each projection image increases sequentially according to the shooting time of each projection image, then determining the target sharp point position based on the sharpness of the image corresponding to the motor at the target position and the sharpness of the image corresponding to the motor at the adjustment position, and moving the motor to the target sharp point position, wherein the adjustment position is determined based on the target position and the preset adjustment steps. This method, through a pre-built computational model, can accurately and efficiently calculate the number of motor steps corresponding to the sharpest point of projection at the given projection distance, based on the obtained projection distance of the projection device. This allows for motor focusing based on the number of motor steps. Furthermore, during focusing, an adjustment position can be introduced. By comparing the sharpness of images captured at the target position and the adjustment position, the target sharpest point position corresponding to the motor can be determined. This effectively avoids the problems of misjudgment of motor steps and motor step loss that can occur when focusing solely relies on the correspondence between projection distance and motor steps built by the computational model. Therefore, the accuracy of the determined motor step count can be improved, and based on the accurate motor step count, the accuracy of the focusing results can be significantly enhanced.
[0034] Secondly, by using a preset calibration method to collect target sample data for training the computational model, the sample data collection can be automated, improving both the accuracy and efficiency of the collected sample data.
[0035] In addition, by dividing the projection distance into intervals and performing compensation and correction on multiple intervals, the initial calculation model is corrected, resulting in a more accurate target calculation model and reducing the problem of deviations in calculation results caused by wear and tear of the projection equipment. Attached Figure Description
[0036] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0037] Figure 1 A flowchart illustrating a focusing method provided in this application embodiment. Figure 1 ; Figure 2 A flowchart illustrating a focusing method provided in this application embodiment. Figure 2 ; Figure 3 A flowchart illustrating a focusing method provided in this application embodiment. Figure 3 ; Figure 4 A flowchart illustrating a focusing method provided in this application embodiment. Figure 4 ; Figure 5 A schematic diagram illustrating the relationship between motor position and projection device resolution, provided in an embodiment of this application; Figure 6 A flowchart illustrating a focusing method provided in this application embodiment. Figure 5 ; Figure 7 This is a schematic diagram of a calibration slide rail device provided in an embodiment of this application; Figure 8 A flowchart illustrating a focusing method provided in this application embodiment. Figure 6 ; Figure 9 A flowchart illustrating a focusing method provided in this application embodiment. Figure 7 ; Figure 10 A flowchart illustrating a focusing method provided in this application embodiment. Figure 8 ; Figure 11 A flowchart illustrating a focusing method provided in this application embodiment. Figure 9 ; Figure 12 A flowchart illustrating a focusing method provided in this application embodiment. Figure 10 ; Figure 13 A flowchart illustrating a focusing method provided in this application embodiment. Figure 10 one; Figure 14 This is a schematic diagram of a projection distance interval division provided in an embodiment of this application; Figure 15 This is a schematic diagram of the structure of a projection device provided in an embodiment of this application. Detailed Implementation
[0038] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the accompanying drawings in this application are for illustrative and descriptive purposes only and are not intended to limit the scope of protection of this application. Furthermore, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of this application. It should be understood that the operations in the flowcharts may not be implemented in sequence, and steps without logical contextual relationships may be reversed or implemented simultaneously. In addition, those skilled in the art, guided by the content of this application, may add one or more other operations to the flowcharts, or remove one or more operations from the flowcharts.
[0039] Furthermore, the described embodiments are merely some, not all, of the embodiments of this application. The components of the embodiments of this application described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0040] It should be noted that the term "comprising" will be used in the embodiments of this application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.
[0041] Figure 1 A flowchart illustrating a focusing method provided in this application embodiment. Figure 1 The execution subject of this method can be a projection device, which has data processing capabilities; for example... Figure 1 As shown, the method may include: S101. Based on the current projection distance of the projection device, a pre-built calculation model is used to determine the number of motor steps corresponding to the clear projection point of the projection device at the current projection distance.
[0042] The projection equipment here can refer to a projector. During use, a projector usually needs to be focused to make the projected image clearer and improve the user's viewing experience.
[0043] The current projection distance of a projection device can refer to the current distance between the projection device and the projection wall. If the position of the projection device is determined, the position of the projection wall is also determined, so the current projection distance of the projection device can be obtained directly.
[0044] Before obtaining the current projection distance of the projection device, the distance sensor and camera of the projection device can be initialized and debugged to ensure that the projection device reads data normally. If the projection device reads data normally, the distance between the position of the projection wall and the current position of the projection device can be collected in real time to obtain the current projection distance.
[0045] If data reading is abnormal, the circuit can be reset, the distance sensor and camera can be reinitialized, and the system can be re-tested. If the data reading is still abnormal after multiple tests, a prompt message can be sent to the user to remind them to repair the projection equipment in a timely manner.
[0046] Optionally, based on the constructed calculation model, the current projection distance of the projection device is input into the calculation model to obtain the number of motor steps corresponding to the clear projection point of the projection device at the current projection distance. The calculation model includes a pre-constructed correspondence between projection distance and motor steps. Based on the input current projection distance, according to the correspondence between projection distance and motor steps, the number of motor steps corresponding to the clear projection point of the projection device at the current projection distance can be obtained.
[0047] S102, drive the motor to move the motor steps to reach the target position, and take at least two projected images at preset time intervals during the motor movement, and determine the clarity of each projected image.
[0048] The number of motor steps corresponding to the point of sharpness at the current projection distance can be understood as the number of motor steps the projector takes to achieve the highest projection sharpness at the current projection distance.
[0049] Optionally, based on the determined number of motor steps, the motor can be driven to move from the current position to the maximum position of the focusing system by the determined number of motor steps to reach the target position. The target position is not a fixed position. When the determined number of motor steps is different, the target position reached is also different. That is, the position reached after the motor moves by the determined number of motor steps can be called the target position.
[0050] During the movement of the motor, at least two projected images can be captured at preset intervals. For example, a projected image can be captured at a fixed time T, with one projected image captured every T time, and the sharpness of each projected image can be calculated.
[0051] S103. If the clarity of each projected image increases sequentially according to the shooting time of each projected image, then the target clear point position is determined based on the clarity of the image captured when the motor is at the target position and the clarity of the image captured when the motor is at the adjustment position. The motor is then moved to the target clear point position, and the adjustment position is determined based on the target position and the preset adjustment steps.
[0052] In one feasible approach, the sharpness of each projected image can be calculated to determine whether the sharpness of each projected image increases sequentially with the shooting time of the projected images. That is, assuming that projected image 1, projected image 2, and projected image 3 are taken sequentially at preset intervals, and the sharpness of projected image 1 is a, the sharpness of projected image 2 is b, and the sharpness of projected image 3 is c, then if c>b>a, it can be determined that the sharpness of each projected image increases sequentially with the shooting time of each projected image.
[0053] Optionally, under the condition that the sharpness of each projected image increases sequentially, the captured image taken when the motor is at the target position can be obtained, and the sharpness of the captured image taken when the motor is at the target position can be calculated.
[0054] In one feasible approach, to prevent the risk of losing focus, after the motor reaches the target position, it can still be driven to move a preset number of steps to reach the adjustment position. An image of the motor at the adjustment position is then captured, and the image's sharpness is calculated. The sharpness of the image at the adjustment position is compared with the sharpness of the image at the target position to determine the location of the target sharp point.
[0055] By introducing an adjustment position, and based on the sharpness of the image captured at the adjustment position and the sharpness of the image captured at the target position, the target motor position corresponding to the point of sharp projection at the current projection distance can be determined more accurately. Thus, the motor can be adjusted to the target motor position to complete the focusing. Based on the focused projection device, the projection device can have good projection sharpness at any projection distance.
[0056] In summary, the focusing method provided in this embodiment includes: determining the number of motor steps corresponding to the projection point of the projection device at the current projection distance using a pre-built calculation model based on the current projection distance of the projection device; driving the motor to move the number of motor steps to reach the target position, and taking at least two projection images at a preset time interval during the motor movement, and determining the sharpness of each projection image; if the sharpness of each projection image increases sequentially according to the shooting time of each projection image, then determining the target sharp point position based on the sharpness of the image corresponding to the motor at the target position and the sharpness of the image corresponding to the motor at the adjustment position, and moving the motor to the target sharp point position, wherein the adjustment position is determined based on the target position and the preset number of adjustment steps. This method, through a pre-built computational model, can accurately and efficiently calculate the number of motor steps corresponding to the sharpest point of projection at the given projection distance, based on the obtained projection distance of the projection device. This allows for motor focusing based on the number of motor steps. Furthermore, during focusing, an adjustment position can be introduced. By comparing the sharpness of images captured at the target position and the adjustment position, the target sharpest point position corresponding to the motor can be determined. This effectively avoids the problems of misjudgment of motor steps and motor step loss that can occur when focusing solely relies on the correspondence between projection distance and motor steps built by the computational model. Therefore, the accuracy of the determined motor step count can be improved, and based on the accurate motor step count, the accuracy of the focusing results can be significantly enhanced.
[0057] Figure 2 A flowchart illustrating a focusing method provided in this application embodiment. Figure 2 Optionally, in step S103, determining the target sharp point position based on the sharpness of the captured image when the motor is at the target position and the sharpness of the captured image when the motor is in the adjusted position may include: S201. Determine the first adjustment position based on the target position and the preset number of adjustment steps.
[0058] Optionally, based on the target position, a preset number of adjustment steps are added to determine the first adjustment position. That is, when the motor is at the target position, the motor can continue to be driven to move the preset number of adjustment steps to reach the first adjustment position.
[0059] It is worth noting that the selection of the preset adjustment steps needs to be confirmed by the optical mechanism structure. The theoretical basis for its value is the minimum change in sharpness that can be caused by changes in the motor that can be perceived by the human eye.
[0060] S202. Determine whether the image sharpness corresponding to the motor being in the target position is greater than the image sharpness corresponding to the motor being in the first adjustment position.
[0061] In one feasible approach, when the image captured by the motor at the target position has a higher resolution than the image captured by the motor at the first adjustment position, the projected image of the projection device at the current projection distance can be considered to be the clearest when the motor is at the target position. In this case, the target position can be determined as the location of the target clear point.
[0062] S203. If so, then the target location is determined as the target clear point location.
[0063] Optionally, the drive motor can be driven from the first adjustment position back to the target position, that is, the drive motor reaches the target clear point position, at which point focusing is completed, and the projected image of the projection device at the current projection distance reaches the clearest.
[0064] Figure 3 A flowchart illustrating a focusing method provided in this application embodiment. Figure 3 Optionally, in step S202, after determining whether the sharpness of the image captured when the motor is in the target position is greater than the sharpness of the image captured when the motor is in the first adjustment position, this method may further include: S301. If the image resolution corresponding to the motor at the target position is less than the image resolution corresponding to the motor at the first adjustment position, then determine the second adjustment position based on the first adjustment position and the preset adjustment steps.
[0065] In another possible implementation, when the image captured by the motor at the target position has a lower resolution than the image captured by the motor at the first adjustment position, the motor can be driven to move a preset number of adjustment steps based on the first adjustment position to reach the second adjustment position.
[0066] S302. Determine whether the image sharpness corresponding to the motor in the first adjustment position is greater than the image sharpness corresponding to the motor in the second adjustment position.
[0067] Similarly, it can be determined whether the image captured when the motor is in the first adjustment position is clearer than the image captured when the motor is in the second adjustment position. Here, "first" and "second" have no actual meaning; they are merely names used to distinguish between the different adjustment positions.
[0068] S303. If not, then based on the second adjustment position and the preset adjustment steps, determine a new second adjustment position, and determine whether the clarity of the image captured when the motor is in the second adjustment position is greater than the clarity of the image captured when the motor is in the new second adjustment position. Repeat this step until the clarity of the image captured when the motor is in the second adjustment position is greater than the clarity of the image captured when the motor is in the new second adjustment position. Then, determine the second adjustment position as the target clear point position.
[0069] Optionally, if the clarity of the image captured by the motor at the first adjustment position is greater than the clarity of the image captured by the motor at the second adjustment position, the first adjustment position can be used as the target clear point position. If the clarity of the image captured by the motor at the first adjustment position is less than the clarity of the image captured by the motor at the second adjustment position, the drive motor can be moved a preset number of adjustment steps based on the second adjustment position to reach a new second adjustment position. The clarity of the image captured by the motor at the new second adjustment position is compared with the clarity of the image captured at the second adjustment position. This process is repeated until the clarity of the image captured by the motor at the previous position (current position) is greater than the clarity of the image captured at the next position (the position reached after moving a preset number of adjustment steps from the current position). Then, the previous position is used as the target clear point position.
[0070] After the motor reaches the target position, the position of the motor is adjusted multiple times by introducing a preset number of adjustment steps. The clarity of the images taken at the previous and next positions is used as feedback data to improve the accuracy of the determined target position of the motor and avoid the problem of the motor losing its steps.
[0071] Figure 4 A flowchart illustrating a focusing method provided in this application embodiment. Figure 4 Optionally, in step S102, determining the sharpness of each projected image may include: S401. Determine the first sharpness index of the target projection image based on the convolution of each pixel of the target projection image, wherein the target projection image is any one of the projection images.
[0072] To improve the accuracy of the calculated sharpness of the projected image, this embodiment introduces multiple sharpness evaluation indicators and performs weighted calculations on each indicator to obtain the sharpness of the projected image.
[0073] It should be noted that the projection sharpness calculation method provided in this embodiment is also applicable to the following embodiments, and the sharpness calculation of any projected image or captured image involved in this application can be performed in this way.
[0074] The calculation of the sharpness of the target projection image is used as an example for illustration. The target projection image can be any projection image or captured image involved in this application.
[0075] The first method uses the Laplacian gradient function evaluation method. This involves calculating the convolution of the Laplacian operator at each pixel in the target projection image and then accumulating the results pixel by pixel to obtain the first sharpness index of the target projection image. The calculation formula is as follows:
[0076] in, This refers to the convolution of the Laplacian operator at pixel (x, y).
[0077] S402. Determine the second sharpness index of the target projection image based on the grayscale value of each pixel of the target projection image.
[0078] The second method is to use the entropy function evaluation method. The entropy function, based on statistical characteristics, is an important indicator for measuring the richness of image information. Information theory dictates that the information content of an image *f* is measured by its information entropy D(f). The calculation formula is as follows:
[0079] Here, Pi is the probability of a pixel with gray value i appearing in the image, and L is the total number of gray levels (usually 256). According to Shannon's information theory, the maximum information content occurs when entropy is maximized. Applying this principle to the focusing process, the larger D(f) is, the clearer the image. However, the entropy function is not very sensitive and can easily produce results contrary to reality depending on the image content.
[0080] Using the above formula, the second sharpness index of the target projected image can be calculated based on the grayscale value of each pixel.
[0081] S403. Determine the third sharpness index of the target projection image based on the coordinates of each pixel in the target projection image.
[0082] The third method is the gray-level variance product function evaluation method. When fully focused, the image is the clearest and contains the most high-frequency components. Therefore, gray-level changes can be used as the basis for focus evaluation. The gray-level variance product function overcomes the problem of low sensitivity of the gray-level variance (SMD) function near the focus while retaining the computational performance of the SMD function. The function is defined as follows:
[0083] The x and y coordinates are pixel coordinates. The principle is to multiply the two gray level differences in the neighborhood of each pixel and then accumulate them pixel by pixel.
[0084] Using the above formula, the third sharpness index of the target projected image can be calculated based on the coordinates of each pixel in the target projected image.
[0085] S404. The first sharpness index, the second sharpness index, and the third sharpness index of the target projected image are weighted and summed to obtain the sharpness of the target projected image.
[0086] Based on this, the sharpness of the target projection image It should be noted that, taking into account the merits of each evaluation function, the values of the three coefficients a1, b1, and c1 can be c1>a1>b1.
[0087] It is worth noting that the more evaluation functions introduced, the more complex the evaluation system becomes, and the more difficult it is to tune the parameters.
[0088] Optionally, in step S102, after driving the motor to move the motor steps to reach the target position and taking at least two projected images at preset time intervals during the motor movement, the method may further include: if the clarity of each projected image does not increase sequentially according to the shooting time of each projected image, then the position of the motor is moved back to the initial position, and the motor is driven to move the motor steps again according to the number of motor steps corresponding to the clearest point of the projection device at the current projection distance.
[0089] Figure 5 This is a schematic diagram illustrating the relationship between motor position and projection device sharpness in an embodiment of this application. In some embodiments, if the sharpness of each projected image captured during the process of moving the motor to the target position does not increase sequentially in a positive direction, it may be due to an error between the actual position of the focusing motor of the projection device and the software step counting. In this case, another relationship can be introduced, namely the relationship between 'motor position and projection device sharpness', such as... Figure 6 As shown, the relationship between them is an approximate 'Gaussian distribution' curve. The better the approximation of the curve, the better the design and manufacturing level of the optical mechanism. The number of motor steps corresponding to the peak of the curve is the location of the best point of clarity under the current distance projection, where the x-axis direction is the number of motor steps and the y-axis direction is the clarity of the projection device.
[0090] If the clarity of each projected image does not increase sequentially according to the shooting time of each projected image, the motor position can be reset to 0, and the step count can be restarted to drive the motor to move the number of steps.
[0091] Figure 6 A flowchart illustrating a focusing method provided in this application embodiment. Figure 5 Optionally, before determining the number of motor steps corresponding to the sharpest projection point at the current projection distance using a pre-built calculation model, the method of this application may further include: S601. Obtain sample data from at least one sample projection device at each sample projection distance. The sample data includes: the sample projection distance and the number of motor steps for the projection clarity point corresponding to the sample projection distance.
[0092] This embodiment describes the training process of the computational model used in step S101.
[0093] Figure 7This is a schematic diagram of a calibration slide rail device provided in an embodiment of this application. Figure 7 As shown, the calibration slide rail device may include: a calibration slide rail control terminal, a calibration slide rail, a sample projection device placed on the calibration slide rail, and a projection wall / screen. The calibration slide rail control terminal is used to control the movement of the calibration slide rail to move the sample projection device.
[0094] The sample projection device may include: a camera and a distance sensor. The distance sensor is used to collect the current projection distance of the sample projection device, and the camera is used to capture the projected image at the projection distance.
[0095] Selection of ranging sensor: Consider using a laser ranging sensor or other sensors with strong anti-interference capabilities to avoid the influence of environmental factors on ranging.
[0096] Camera module selection: Because it is necessary to shoot moving images, a high-definition high-speed camera should be selected so that it can be more sensitive to changes in image clarity during the focusing process.
[0097] In some embodiments, at least one sample projection device can be moved to each sample projection distance by controlling the movement of the calibration slide rail, and a projected image can be captured at each sample projection distance. The number of motor steps for the projection clarity point corresponding to the sample projection distance can be determined, and sample data of at least one sample projection device at each sample projection distance can be obtained.
[0098] S602. Integrate and process the sample data from each sample projection device to obtain the target sample data.
[0099] S603. Based on the target sample data, perform curve fitting to obtain the calculation model.
[0100] Optionally, the sample data from each sample projection device can be processed, which may involve integrating multiple sets of sample data from each sample projection device to ultimately obtain target sample data that includes sample data from all sample projection devices.
[0101] Since the target sample data may be in tabular form, containing data pairs, curve fitting of the target sample data can yield the curve showing the relationship between the projected distance and the number of motor steps, thus obtaining the calculation model.
[0102] Figure 8 A flowchart illustrating a focusing method provided in this application embodiment. Figure 6 Optionally, in step S601, acquiring sample data from at least one sample projection device at each sample projection distance may include: S801. Based on the target projection specification distance and the target sampling distance, determine multiple sampling points and the sample projection distance corresponding to each sampling point.
[0103] The target projection specification distance T can refer to the factory parameters of the projection device, specifically the range of projection distance values set for the device. Target sampling distance. If a preset minimum sampling distance is set, then the number of sampling points can be obtained from this. Since the sampling distance is fixed, multiple sampling points can be determined separately, and the distance between the location of the sampling point and the projection wall is the sample projection distance corresponding to the sampling point.
[0104] S802. Based on each sampling point, the calibrated slide rail device controls each sample projection device to move to its respective sampling point.
[0105] Optionally, the target projection specification distance, target sampling distance, and number of sampling points determined above can be input as input parameters to the calibration slide rail control terminal, thereby driving the calibration slide rail to move each sample projection device to each sampling point.
[0106] S803. Based on each sampling point and the corresponding sample projection distance, perform calibration processing to obtain sample data of each sample projection device at each sample projection distance.
[0107] When each sample projection device is located at each sampling point, multiple calibration processes are performed at each sampling point to obtain sample data for each sample projection device at each sample projection distance. Specifically, one sampling point corresponds to one sample projection distance. When the sample projection device is located at the target sampling point, the distance between the projection device and the projection wall is the sample projection distance corresponding to that target sampling point.
[0108] Figure 9 A flowchart illustrating a focusing method provided in this application embodiment. Figure 7 Optionally, in step S803, calibration processing is performed based on each sampling point and the corresponding sample projection distance to obtain sample data for each sample projection device at each sample projection distance, which may include: S901, control the calibration slide rail device to move the target sample projection device to the position of the target sampling point, and obtain the projection distance collected by the sensor on the target sample projection device at the target sampling point.
[0109] This embodiment describes in detail the calibration process of the target sample projection device at the target sampling point. The target sample projection device can be calibrated according to this process at each of its sampling points. Furthermore, any sample projection device can be calibrated using the same method as the target sample projection device.
[0110] Optionally, the target sample projection device can be moved to the target sampling point position by controlling the movement of the calibration slide rail. At the target sampling point position, the projection distance of the target sample projection device can be collected by the distance measuring sensor, that is, the distance between the target sample projection device and the projection wall.
[0111] S902. During the process of the motor of the target sample projection device moving from the first position to the second position, at least two first projection images are captured at a preset time interval, and the clarity of each first projection image is calculated. The target sample projection device is any one of at least one sample projection device, the target sampling point is any one of multiple sampling points, the first position is the initial position of the focusing system of the target sample projection device, and the second position is the maximum position of the focusing system of the target sample projection device.
[0112] Optionally, when the target sample projection device is at the target sampling point position, the motor can be driven to move from the first position to the second position, where the first position is the initial position of the focusing system and the second position is the maximum position of the focusing system, that is, the motor is driven to move forward to traverse the entire motor stroke, and at least two first projection images are captured at preset intervals during the movement, and the clarity of each first projection image is calculated. The specific calculation method can be performed in steps S401-S404.
[0113] S903. During the process of the motor of the target sample projection device moving from the second position to the first position, at least two second projection images are captured at a preset time interval, and the clarity of each second projection image is calculated.
[0114] Once the motor reaches the second position, it can be reversed to drive the motor to move from the second position to the first position, i.e., move in the opposite direction. During the movement, at least two second projected images are captured, and the sharpness of each second projected image is calculated.
[0115] S904. If the difference between the maximum sharpness of each first projected image and the maximum sharpness of each second projected image meets the sharpness threshold, and the number of calibrations of the target sample projection device at the target sampling point meets the preset number of calibrations, then the calibration of the target sample projection device at the target sampling point is determined to be completed.
[0116] Optionally, the highest sharpness can be selected from the sharpness of each first projected image, and the highest sharpness can be selected from the sharpness of each second projected image. If the difference between the highest sharpness selected from the sharpness of each first projected image and the highest sharpness selected from the sharpness of each second projected image satisfies the sharpness threshold, and the number of calibrations performed by the target sample projection device at the target sampling point satisfies the preset number of calibrations, that is, when the target sample device performs a preset number of calibrations at the target sample sampling point, and the difference between the highest sharpness selected from the sharpness of each first projected image and the highest sharpness selected from the sharpness of each second projected image in each calibration satisfies the sharpness threshold, then the calibration of the target sample projection device at the target sampling point ends.
[0117] Based on this, the target sample projection device can be moved to a new sampling point by controlling the movement of the calibration slide rail. The above steps are repeated to complete the calibration of the target sample projection device at the new sampling point. This process is repeated sequentially to complete the calibration of the target sample projection device at all sampling points.
[0118] S905. Based on the position of the clear point of the projection of the target sample projection device at the target sample projection distance corresponding to the target sampling point, determine the number of motor steps of the clear point of the projection of the target sample projection device at the target sample projection distance, and take the number of motor steps of the clear point of the projection and the projection distance collected by the sensor as a sample data of the target sample projection device at the target sample projection distance.
[0119] Optionally, the position of the projection clarity point determined by the target sample projection device during calibration at the target sampling point can be obtained. This can be based on the clarity of the projection image captured during calibration at the target sampling point, with the position of the motor at the point of maximum projection image clarity taken as the projection clarity point position. The position of the motor can be read in real time. Based on the projection clarity point position of the target sample projection device at the target sample projection distance and the 0 position of the motor, the number of motor steps at the projection clarity point of the target sample projection device at the target sample projection distance can be obtained.
[0120] Optionally, the number of motor steps corresponding to the clearest projection point, and the projection distance collected by the sensor at this time, can be used as a sample data of the target sample projection device at the target sample projection distance.
[0121] By repeating the above steps and performing multiple calibrations, multiple sample data of the target sample projection device at the target sample projection distance can be obtained. By calibrating the target sample projection device at each sample projection distance, sample data of the target sample projection device at each sample projection distance can be obtained. Furthermore, by calibrating each sample projection device in the above manner, sample data of each sample projection device can be obtained.
[0122] Figure 10 A flowchart illustrating a focusing method provided in this application embodiment. Figure 8 Optionally, in step S602, integrating and processing the sample data from each sample projection device to obtain the target sample data may include: S1001. After removing the extreme values of the number of motor steps for the clearest point of the projection at the same projection distance in the sample data of each sample projection device, calculate the average value to obtain the number of motor steps for the clearest point of the target projection at each sample projection distance.
[0123] Since the sample data of each sample projection device includes the set sample projection distance and the number of motor steps for the clear projection point at the sample projection distance, the sample data of each sample projection device can be integrated. The extreme values of the number of motor steps for the clear projection point at the same sample projection distance of each sample projection device can be removed and the average value can be calculated to obtain the number of motor steps for the clear projection point at each sample projection distance.
[0124] S1002. After removing the extreme values of the projection distances collected by each sensor in the sample data of each sample projection device, calculate the average value to obtain the target sample projection distance under each sample projection distance.
[0125] Since the sample projection distance is calculated based on the projection specification distance and the set minimum sampling distance, it is not the actual projection distance collected. Only the projection distance of the sample projection device collected by the sensor at the sampling point can be used as the sample projection distance.
[0126] Similarly, the same processing can be applied to the projection distances collected by the sensors in the sample data of each sample projection device to obtain the target sample projection distance under each sample projection distance.
[0127] S1003. Based on the number of motor steps of the target projection clear point under each sample projection distance and the target sample projection distance under each sample projection distance, obtain the target sample data.
[0128] Optionally, the target projection clear point motor steps under each of the above sample projection distances and the target sample projection distance under each sample projection distance can be combined to obtain the target sample data. That is, the target sample data includes multiple sets of data, each set of data including: target sample projection distance and target projection clear point motor steps.
[0129] Figure 11 A flowchart illustrating a focusing method provided in this application embodiment. Figure 9 Optionally, in step S603, curve fitting is performed based on the target sample data to obtain the target calculation model, which may include: S1101. Based on the target sample data, perform curve fitting to obtain the initial calculation model.
[0130] In one feasible approach, curve fitting can be performed based on the aforementioned target sample data to construct a mapping relationship between the projected distance and the number of motor steps, thereby obtaining an initial calculation model.
[0131] The reason it is called the initial calculation model is that there may be errors in the assembly and casting process of the projection equipment, which will cause errors in the target sample data obtained by calibrating the target sample projection equipment. As a result, the calculation model obtained by fitting will have certain errors for different projection equipment, and the calculation model cannot be used as the final model.
[0132] S1102. Perform compensation processing based on the initial calculation model to obtain the target calculation model.
[0133] Optionally, the obtained initial calculation model can be compensated to eliminate errors and obtain the target calculation model.
[0134] Figure 12 A flowchart illustrating a focusing method provided in this application embodiment. Figure 10 Optionally, in step S1102, the compensation process based on the initial calculation model to obtain the target calculation model may include: S1201. Based on the preset projection distance, the initial calculation model is used to obtain the predicted number of motor steps for the projection clear point at the projection distance.
[0135] In one feasible approach, the trained initial computational model can be used first, and a preset projection distance can be input to infer the number of motor steps M of the predicted projection clarity point at that projection distance.
[0136] S1202. Obtain the actual number of motor steps for the projected clear point at the projection distance.
[0137] Then, using the aforementioned calibration slide rail device, based on the above-mentioned method of calibrating the sample projection device, the projection device is moved to the projection distance, and the actual number of motor steps M' of the projection clear point at the projection distance is obtained.
[0138] S1203. Determine the compensation value of the initial calculation model based on the actual number of motor steps for the projected clear point and the predicted number of motor steps for the projected clear point.
[0139] Therefore, the compensation value of the initial calculation model is O = M' - M, which means that the compensation value of the initial calculation model is obtained by subtracting the predicted number of steps of the projection clear point motor from the actual number of steps of the projection clear point motor.
[0140] S1204. Update the initial calculation model based on the compensation value to obtain the target calculation model.
[0141] Optionally, the target calculation model can be obtained by correcting the parameters of the initial calculation model based on the compensation value.
[0142] Figure 13 A flowchart illustrating a focusing method provided in this application embodiment. Figure 10 Optionally, in step S1204, the compensation process based on the initial calculation model to obtain the target calculation model may include: S1301. Based on the target projection distance interval, divide the target projection distance interval to obtain multiple projection distance sub-intervals.
[0143] As projection equipment is used for a longer period of time, the focusing system will experience aging and wear, which will directly affect the software step counting, causing the correspondence of the initial calculation model to deviate and affecting the focusing speed.
[0144] Experiments revealed that wear conditions may vary for each projection device. At the same projection distance, the direction and magnitude of the deviation of the motor steps at the clearest projection point differ, which in turn affects the initial calculation model, i.e., the compensation value O.
[0145] To characterize the accuracy of the corresponding relationship of the calculation model after wear as much as possible, this embodiment adopts the idea of segmented calibration, dividing the target projection distance interval into multiple projection distance sub-intervals.
[0146] Figure 14 This is a schematic diagram illustrating the division of projection distance intervals according to an embodiment of this application. Optionally, the division of projection distance intervals can be determined according to the specifications of the specific projection equipment. For example, 40-inch to 120-inch corresponds to K1m and K2m, which can be divided into Q segments. The number of calibration points I is then determined accordingly, i.e., Q=I.
[0147] like Figure 14 As shown, the selection of point Q has been verified, and the optimal location is at the center of its region. It should be noted that while the value of Q improves the curve fitting effect, it also increases the learning cost of the model. Therefore, in this embodiment, Q can be set to 3.
[0148] S1302. Based on the clarity of each projected image captured in each projection distance sub-interval, determine the motor position corresponding to the maximum clarity of the projected image in each projection distance sub-interval.
[0149] For each projection distance sub-interval, the motor position at which the sharpness of each projected image captured in each projection distance sub-interval is maximized can be obtained, thereby obtaining the actual number of motor steps at the point of sharpness in each projection distance sub-interval.
[0150] S1303. Determine the compensation value for each projection distance sub-interval based on the motor position corresponding to the maximum clarity of the projected image in each projection distance sub-interval.
[0151] Optionally, an initial calculation model can be used to calculate the number of motor steps for the predicted projection clear point under each projection distance sub-interval, and then the compensation value under each projection distance sub-interval can be calculated with reference to the calculation in step S1203.
[0152] S1304. Update the initial calculation model using the compensation values under each projection distance sub-interval to obtain the target calculation model.
[0153] Based on the above compensation process, the target calculation model can be obtained as follows:
[0154] in, This represents the initial computational model. express Figure 14 The compensation value corresponding to the first segment of the region. express Figure 14 The compensation value corresponding to the second segment of the region. R = (K2 - K1) / Q.
[0155] The target calculation model can be obtained based on the above method, and the target calculation model includes calculation models corresponding to different projection distance intervals.
[0156] Therefore, for any projection device, when the projection distance of the projection device is input into the target calculation model, the number of motor steps of the projection clarity point of the projection device under the projection distance can be calculated according to the projection distance interval in which the projection distance is located and the calculation model corresponding to the projection distance interval.
[0157] Optionally, curve fitting is performed based on the target sample data to obtain an initial calculation model, which may include: constructing the correspondence between the projection distance of each sample in the target sample data and the number of motor steps of the projection clear point corresponding to each sample projection distance, to obtain the initial calculation model.
[0158] In summary, the focusing method provided in this embodiment includes: determining the number of motor steps corresponding to the projection point of the projection device at the current projection distance using a pre-built calculation model based on the current projection distance of the projection device; driving the motor to move the number of motor steps to reach the target position, and taking at least two projection images at a preset time interval during the motor movement, and determining the sharpness of each projection image; if the sharpness of each projection image increases sequentially according to the shooting time of each projection image, then determining the target sharp point position based on the sharpness of the image corresponding to the motor at the target position and the sharpness of the image corresponding to the motor at the adjustment position, and moving the motor to the target sharp point position, wherein the adjustment position is determined based on the target position and the preset number of adjustment steps. This method, through a pre-built computational model, can accurately and efficiently calculate the number of motor steps corresponding to the sharpest point of projection at the given projection distance, based on the obtained projection distance of the projection device. This allows for motor focusing based on the number of motor steps. Furthermore, during focusing, an adjustment position can be introduced. By comparing the sharpness of images captured at the target position and the adjustment position, the target sharpest point position corresponding to the motor can be determined. This effectively avoids the problems of misjudgment of motor steps and motor step loss that can occur when focusing solely relies on the correspondence between projection distance and motor steps built by the computational model. Therefore, the accuracy of the determined motor step count can be improved, and based on the accurate motor step count, the accuracy of the focusing results can be significantly enhanced.
[0159] Secondly, by using a preset calibration method to collect target sample data for training the computational model, the sample data collection can be automated, improving both the accuracy and efficiency of the collected sample data.
[0160] In addition, by dividing the projection distance into intervals and performing compensation and correction on multiple intervals, the initial calculation model is corrected, resulting in a more accurate target calculation model and reducing the problem of deviations in calculation results caused by wear and tear of the projection equipment.
[0161] The following describes the apparatus, equipment, and storage medium used to implement the focusing method provided in this application. The specific implementation process and technical effects are described above and will not be repeated below.
[0162] This application also provides a focusing device, the function of which corresponds to the steps performed by the above-described method. This device can be understood as the projection device described above, and optionally, the device may include: a determining module; The determination module is used to determine the number of motor steps corresponding to the clear projection point of the projection device at the current projection distance based on the obtained current projection distance of the projection device and using a pre-built calculation model. The determination module is used to drive the motor to move the motor a number of steps to reach the target position, and to take at least two projected images at preset time intervals during the motor movement, and to determine the clarity of each projected image; The determination module is used to determine the target sharp point position based on the sharpness of the image captured when the motor is at the target position and the sharpness of the image captured when the motor is in the adjustment position, if the sharpness of each projected image increases sequentially according to the shooting time of each projected image. Then, the motor is moved to the target sharp point position, and the adjustment position is determined according to the target position and the preset adjustment steps.
[0163] Optionally, the determining module is specifically used to determine the first adjustment position based on the target position and the preset number of adjustment steps; Determine whether the image sharpness corresponding to the motor being in the target position is greater than the image sharpness corresponding to the motor being in the first adjustment position; If so, then the target location is determined as the clear point location of the target.
[0164] Optionally, the determining module is further configured to determine a second adjustment position based on the first adjustment position and a preset number of adjustment steps if the resolution of the captured image corresponding to the motor at the target position is less than the resolution of the captured image corresponding to the motor at the first adjustment position. Determine whether the image sharpness corresponding to the motor in the first adjustment position is greater than the image sharpness corresponding to the motor in the second adjustment position; If not, then based on the second adjustment position and the preset number of adjustment steps, determine a new second adjustment position, and determine whether the clarity of the image captured when the motor is in the second adjustment position is greater than the clarity of the image captured when the motor is in the new second adjustment position. Repeat this step until the clarity of the image captured when the motor is in the second adjustment position is greater than the clarity of the image captured when the motor is in the new second adjustment position, then determine the second adjustment position as the target clear point position.
[0165] Optionally, the determining module is specifically used to determine the first sharpness index of the target projected image based on the convolution of each pixel of the target projected image, wherein the target projected image is any one of the projected images; The second sharpness index of the target projection image is determined based on the grayscale value of each pixel. The third sharpness index of the target projection image is determined based on the coordinates of each pixel in the target projection image. The sharpness of the target projected image is obtained by weighted summation of the first sharpness index, the second sharpness index, and the third sharpness index.
[0166] Optionally, the device also includes an adjustment module; The adjustment module is used to move the motor to its initial position if the sharpness of each projected image does not increase sequentially according to the shooting time of each projected image, and then drive the motor to move the motor step number according to the number of motor steps corresponding to the sharp point of the projection at the current projection distance.
[0167] Optionally, the device further includes: an acquisition module and a processing module; The acquisition module is used to acquire sample data of at least one sample projection device at each sample projection distance. The sample data includes: the sample projection distance and the number of motor steps of the projection clear point corresponding to the sample projection distance. The acquisition module is used to integrate and process the sample data from each sample projection device to acquire the target sample data; The processing module is used to perform curve fitting based on the target sample data to obtain a computational model.
[0168] Optionally, the acquisition module is specifically used for Based on the target projection specification distance and the target sampling distance, determine multiple sampling points and the corresponding sample projection distance for each sampling point; Based on each sampling point, the calibrated slide rail device controls each sample projection device to move to its respective sampling point; The calibration process is performed based on each sampling point and the corresponding sample projection distance to obtain the sample data of each sample projection device at each sample projection distance.
[0169] Optionally, the acquisition module is specifically used for The control calibration slide rail device moves the target sample projection device to the position of the target sampling point and obtains the projection distance collected by the sensor on the target sample projection device at the target sampling point; During the process of the motor of the target sample projection device moving from the first position to the second position, at least two first projection images are captured at a preset time interval, and the clarity of each first projection image is calculated. The target sample projection device is any one of at least one sample projection device, the target sampling point is any one of multiple sampling points, the first position is the initial position of the focusing system of the target sample projection device, and the second position is the maximum position of the focusing system of the target sample projection device. During the process of the motor of the target sample projection device moving from the second position to the first position, at least two second projection images are captured at preset time intervals, and the sharpness of each second projection image is calculated. If the difference between the maximum sharpness of each first projected image and the maximum sharpness of each second projected image meets the sharpness threshold, and the number of calibrations of the target sample projection device at the target sampling point meets the preset number of calibrations, then the calibration of the target sample projection device at the target sampling point is determined to be complete. Based on the position of the clear point of the projection of the target sample at the target sample projection distance corresponding to the target sampling point, the number of motor steps of the clear point of the projection of the target sample at the target sample projection distance is determined, and the number of motor steps of the clear point of the projection and the projection distance collected by the sensor are used as a sample data of the target sample projection device at the target sample projection distance.
[0170] Optionally, the acquisition module is specifically used for After removing the extreme values of the motor steps for the clearest point of the projection at the same projection distance in the sample data of each sample projection device, the average value is calculated to obtain the motor steps for the clearest point of the target projection at each sample projection distance. After removing the extreme values of the projection distances collected by each sensor in the sample data of each sample projection device, the average value is calculated to obtain the target sample projection distance under each sample projection distance; The target sample data is obtained based on the number of motor steps of the target projection clear point under each sample projection distance and the target sample projection distance under each sample projection distance.
[0171] Optionally, the processing module is specifically used for Based on the target sample data, curve fitting is performed to obtain the initial calculation model; The target calculation model is obtained by performing compensation processing based on the initial calculation model.
[0172] Optionally, the processing module is specifically used for Based on the preset projection distance, the initial calculation model is used to obtain the predicted number of motor steps for the projection point at the projection distance. Obtain the actual number of motor steps for the projected sharp point at the projection distance; The compensation value of the initial calculation model is determined based on the actual number of motor steps for the projected clear point and the predicted number of motor steps for the projected clear point. The initial calculation model is updated based on the compensation value to obtain the target calculation model.
[0173] Optionally, the processing module is specifically used for Based on the target projection distance interval, the target projection distance interval is divided into multiple projection distance sub-intervals; Based on the clarity of each projected image captured in each projection distance sub-interval, determine the motor position corresponding to the maximum clarity of the projected image in each projection distance sub-interval; The compensation value for each projection distance sub-interval is determined based on the motor position corresponding to the maximum clarity of the projected image in each projection distance sub-interval. The initial calculation model is updated using the compensation values under each projection distance sub-interval to obtain the target calculation model.
[0174] Optionally, the processing module is specifically used for The initial calculation model is obtained by constructing the correspondence between the projection distance of each sample in the target sample data and the number of motor steps of the projection clear point corresponding to each projection distance.
[0175] The above-described device is used to execute the method provided in the foregoing embodiments, and its implementation principle and technical effect are similar, so they will not be described again here.
[0176] These modules can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more digital signal processors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs). Alternatively, when a module is implemented using processing element scheduler code, the processing element can be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. Furthermore, these modules can be integrated together as a system-on-a-chip (SOC).
[0177] The modules described above can be connected or communicate with each other via wired or wireless connections. Wired connections can include metal cables, optical fibers, hybrid cables, or any combination thereof. Wireless connections can include connections via LAN, WAN, Bluetooth, ZigBee, or NFC, or any combination thereof. Two or more modules can be combined into a single module, and any module can be divided into two or more units. Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems and devices described above can be referred to the corresponding processes in the method embodiments, and will not be repeated here.
[0178] Figure 15 This is a schematic diagram of the structure of a projection device provided in an embodiment of this application, such as... Figure 15 As shown, the device may include: a processor 801 and a memory 802.
[0179] The memory 802 is used to store programs, and the processor 801 calls the programs stored in the memory 802 to execute the above method embodiments. The specific implementation and technical effects are similar, and will not be described again here.
[0180] The memory 802 stores program code, which, when executed by the processor 801, causes the processor 801 to perform various steps in the methods according to various exemplary embodiments of this application described in the "Exemplary Methods" section above.
[0181] The processor 801 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.
[0182] Memory 802, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic memory, magnetic disk, optical disk, etc. Memory is any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. In the embodiments of this application, memory 802 may also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.
[0183] Optionally, this application also provides a program product, such as a computer-readable storage medium, including a program that, when executed by a processor, performs the above-described method embodiments.
[0184] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0185] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0186] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in a combination of hardware and software functional units.
[0187] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
Claims
1. A focusing method, characterized in that, include: Based on the current projection distance of the projection device, a pre-built target calculation model is used to determine the number of motor steps corresponding to the clear projection point of the projection device at the current projection distance. The drive motor moves the number of motor steps to reach the target position, and at least two projected images are taken at preset time intervals during the motor movement, and the clarity of each projected image is determined; If the clarity of each projected image increases sequentially according to the shooting time of each projected image, then the target clear point position is determined based on the clarity of the image captured when the motor is at the target position and the clarity of the image captured when the motor is in the adjustment position, and the motor is moved to the target clear point position. The adjustment position is determined based on the target position and the preset adjustment steps. Determining the target sharpness point position based on the sharpness of the image captured when the motor is at the target position and the sharpness of the image captured when the motor is adjusted includes: A first adjustment position is determined based on the target position and a preset number of adjustment steps; wherein, the determination includes: based on the target position, the preset number of adjustment steps is added to the target position to determine the first adjustment position; Determine whether the image sharpness corresponding to the motor at the target position is greater than the image sharpness corresponding to the motor at the first adjustment position; If so, then the target location is determined to be the target clear point location; If the image captured when the motor is at the target position has a lower resolution than the image captured when the motor is at the first adjustment position, then a second adjustment position is determined based on the first adjustment position and the preset number of adjustment steps. Determine whether the image sharpness corresponding to the motor being in the first adjustment position is greater than the image sharpness corresponding to the motor being in the second adjustment position; If not, a new second adjustment position is determined based on the second adjustment position and the preset adjustment steps, and it is determined whether the clarity of the image captured when the motor is in the second adjustment position is greater than the clarity of the image captured when the motor is in the new second adjustment position. This step is repeated until the clarity of the image captured when the motor is in the second adjustment position is greater than the clarity of the image captured when the motor is in the new second adjustment position. Then, the second adjustment position is determined as the target clear point position.
2. The method according to claim 1, characterized in that, Determining the sharpness of each projected image includes: The first sharpness index of the target projection image is determined based on the convolution of each pixel of the target projection image, wherein the target projection image is any one of the projection images. A second sharpness index of the target projection image is determined based on the grayscale value of each pixel of the target projection image; The third sharpness index of the target projection image is determined based on the coordinates of each pixel in the target projection image. The sharpness of the target projected image is obtained by weighted summation of the first sharpness index, the second sharpness index, and the third sharpness index.
3. The method according to claim 1, characterized in that, After the drive motor moves the motor steps to reach the target position, and at least two projected images are captured at preset time intervals during the motor movement, the method further includes: If the clarity of each projected image does not increase sequentially according to the shooting time of each projected image, the position of the motor is moved to the initial position, and the motor is driven to move by the number of motor steps corresponding to the clearest point of the projection at the current projection distance.
4. The method according to claim 1, characterized in that, Before determining the number of motor steps corresponding to the sharpest projection point of the projection device at the current projection distance using a pre-built target calculation model, the method further includes: Acquire sample data from at least one sample projection device at various sample projection distances, the sample data including: sample projection distance and the number of projection clarity point motor steps corresponding to the sample projection distance; The sample data from each sample projection device is integrated and processed to obtain the target sample data; Based on the target sample data, curve fitting is performed to obtain the target calculation model.
5. The method according to claim 4, characterized in that, The acquisition of sample data from at least one sample projection device at each sample projection distance includes: Based on the target projection specification distance and the target sampling distance, determine multiple sampling points and the corresponding sample projection distance for each sampling point; Based on each sampling point, the calibrated slide rail device controls each sample projection device to move to its respective sampling point; The calibration process is performed based on each sampling point and the corresponding sample projection distance to obtain sample data of each sample projection device at each sample projection distance.
6. The method according to claim 5, characterized in that, The calibration process, based on each sampling point and the corresponding sample projection distance, yields sample data for each sample projection device at each sample projection distance, including: The calibration slide rail device is controlled to move the target sample projection device to the position of the target sampling point, and the projection distance collected by the sensor on the target sample projection device at the target sampling point is obtained. During the movement of the motor of the target sample projection device from the first position to the second position, at least two first projection images are captured at a preset time interval, and the sharpness of each first projection image is calculated. The target sample projection device is any one of the at least one sample projection device, the target sampling point is any one of the plurality of sampling points, the first position is the initial position of the focusing system of the target sample projection device, and the second position is the maximum position of the focusing system of the target sample projection device. During the process of the motor of the target sample projection device moving from the second position to the first position, at least two second projection images are captured at preset time intervals, and the sharpness of each second projection image is calculated. If the difference between the maximum sharpness of each first projected image and the maximum sharpness of each second projected image satisfies the sharpness threshold, and the number of calibrations of the target sample projection device at the target sampling point satisfies the preset number of calibrations, then the calibration of the target sample projection device at the target sampling point is determined to be complete. Based on the position of the clear point of the projection of the target sample projection device at the target sample projection distance corresponding to the target sampling point, the number of motor steps of the clear point of the projection of the target sample projection device at the target sample projection distance is determined, and the number of motor steps of the clear point of the projection and the projection distance collected by the sensor are used as a sample data of the target sample projection device at the target sample projection distance.
7. The method according to any one of claims 4-6, characterized in that, The process of integrating and processing sample data from each sample projection device to obtain target sample data includes: After removing the extreme values of the motor steps for the clearest point of the projection at the same projection distance in the sample data of each sample projection device, the average value is calculated to obtain the motor steps for the clearest point of the target projection at each sample projection distance. After removing the extreme values from the projection distances collected by each sensor in the sample data of each sample projection device, the average value is calculated to obtain the target sample projection distance under each sample projection distance; The target sample data is obtained based on the number of motor steps of the target projection clear point under each sample projection distance and the target sample projection distance under each sample projection distance.
8. The method according to claim 7, characterized in that, The step of performing curve fitting based on the target sample data to obtain the target calculation model includes: Based on the target sample data, curve fitting is performed to obtain the initial calculation model; The target calculation model is obtained by performing compensation processing based on the initial calculation model.
9. The method according to claim 8, characterized in that, The step of performing compensation processing based on the initial calculation model to obtain the target calculation model includes: Based on the preset projection distance, the initial calculation model is used to obtain the predicted number of motor steps for the projection point of the projection device at the projection distance. Obtain the actual number of motor steps for the projected clear point at the projection distance using the projection device; The compensation value of the initial calculation model is determined based on the actual number of motor steps for the projected clear point and the predicted number of motor steps for the projected clear point. The initial calculation model is updated based on the compensation value to obtain the target calculation model.
10. The method according to claim 8, characterized in that, The step of performing compensation processing based on the initial calculation model to obtain the target calculation model includes: Based on the target projection distance interval, the target projection distance interval is divided into multiple projection distance sub-intervals; Based on the clarity of each projected image captured in each projection distance sub-interval, determine the motor position corresponding to the maximum clarity of the projected image in each projection distance sub-interval; The compensation value for each projection distance sub-interval is determined based on the motor position corresponding to the maximum clarity of the projected image in each projection distance sub-interval. The initial calculation model is updated using the compensation values under each projection distance sub-interval to obtain the target calculation model.
11. The method according to claim 8, characterized in that, The step of performing curve fitting based on the target sample data to obtain the initial calculation model includes: The initial calculation model is obtained by constructing the correspondence between the projection distance of each sample in the target sample data and the number of motor steps of the projection clear point corresponding to each projection distance.
12. A focusing device, characterized in that, include: Determine the module; The determining module is used to determine the number of motor steps corresponding to the clear projection point of the projection device at the current projection distance based on the obtained current projection distance of the projection device and using a pre-built target calculation model. The determining module is used to drive the motor to move the number of motor steps to reach the target position, and to take at least two projected images at preset time intervals during the motor movement, and to determine the clarity of each projected image; The determining module is used to determine the target clear point position based on the clarity of the image captured when the motor is at the target position and the clarity of the image captured when the motor is in the adjusted position if the clarity of each projected image increases sequentially according to the shooting time of each projected image, and then move the motor to the target clear point position. The adjusted position is determined according to the target position and the preset number of adjustment steps. The determining module is specifically used to determine the first adjustment position based on the target position and the preset number of adjustment steps; This includes: determining the first adjustment position by adding the preset adjustment steps based on the target position; Determine whether the image sharpness corresponding to the motor at the target position is greater than the image sharpness corresponding to the motor at the first adjustment position; If so, then the target location is determined to be the target clear point location; If the image captured when the motor is at the target position has a lower resolution than the image captured when the motor is at the first adjustment position, then a second adjustment position is determined based on the first adjustment position and the preset number of adjustment steps. Determine whether the image sharpness corresponding to the motor being in the first adjustment position is greater than the image sharpness corresponding to the motor being in the second adjustment position; If not, a new second adjustment position is determined based on the second adjustment position and the preset adjustment steps, and it is determined whether the clarity of the image captured when the motor is in the second adjustment position is greater than the clarity of the image captured when the motor is in the new second adjustment position. This step is repeated until the clarity of the image captured when the motor is in the second adjustment position is greater than the clarity of the image captured when the motor is in the new second adjustment position. Then, the second adjustment position is determined as the target clear point position.
13. A projection device, characterized in that, include: The device includes a processor, a storage medium, and a bus. The storage medium stores program instructions executable by the processor. When the projection device is running, the processor communicates with the storage medium via the bus, and the processor executes the program instructions to perform the steps of the focusing method as described in any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, performs the steps of the focusing method as described in any one of claims 1 to 11.
Citation Information
Patent Citations
Automatic focusing system and method and projector
CN110087049A
Automatic distance-step calibration method and system for projection equipment
CN111970500A
