Projector automatic focusing method and device based on camera
By using a camera in the projector to acquire multiple projection images, calculating the relative clarity and throw ratio, and making fine adjustments, the problems of inaccurate focusing and high hardware cost in the existing technology are solved, and high-precision autofocus of the projector is achieved. .
Patent Information
- Application Number
- CN202410984115.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-07-22
AI Technical Summary
When the existing camera-based projector autofocus method controls the motor to reach the clearest position of the picture, it does not consider the gap between the motor and the lens, the rotational inertia of the motor and the blurring of the picture caused by motion, resulting in errors in the clarity evaluation method and affecting focus. Accuracy, and relying on stepper motor count value control may cause out-of-step and increase hardware costs.
Acquire multiple projection images of the projector along the focus movement direction through the camera, calculate the sharpness value and determine the maximum sharpness value, record the corresponding projection image and control the projector to stop rotating, calculate the relative size of the throw ratio, and use the sharpness calculation function and The throw ratio relative size function is fine-tuned near the sharpest position to ensure that the projector reaches the sharpest focus position.
It achieves accurate focusing of the projector, reduces hardware costs, improves focusing accuracy and stability, and avoids errors caused by motor inertia and frictional torque.
Smart Images

Figure CN118741065A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of projector auto-focusing, and in particular to a camera-based projector auto-focusing method and device. Background Art
[0002] A projector is a device used to project images or videos onto a large screen or wall. It usually consists of a light source, a lens, and an image processor. Projectors are widely used in education, business presentations, and home theaters. Using a projector, you can magnify and project images or video content from devices such as computers, DVD players, and game consoles, thereby achieving a larger viewing area and allowing viewers to see image details more clearly.
[0003] If the projection distance and focal length of the projector are not appropriate during use, the projector will be out of focus, causing the image displayed by the projector to be blurry, affecting the viewing experience. At present, projectors generally have two modes of adjustment: manual adjustment and automatic adjustment: manual adjustment relies on the human eye to judge the image, and the remote control controls the movement of the projector's motor, which in turn drives the movement of the lens to complete the focus operation; automatic adjustment relies on the camera or TOF (time offlight) sensor installed on the projector to sense the projection distance or image clarity, and automatically controls the movement of the motor until it is appropriate to complete the focus operation.
[0004] The patent document with publication number: CN106231201A discloses an automatic focusing method and device, which can calculate the clarity of the feature image by extracting the feature image in the image data uploaded by the camera, then find the feature image with the highest clarity, and control the drive motor to rotate to the rotation angle corresponding to the feature image with the highest clarity, thereby realizing automatic focusing of the projector.
[0005] Patent document with publication number: CN107277381A discloses a camera focusing method and device, which obtains multiple images under different references by adjusting a stepper motor, and then calculates the optimal clarity value based on the multiple images to achieve rapid focusing of the camera.
[0006] The patent document with publication number: CN110740302A discloses a method and a device for positioning the defocus direction of a projector, which projects a marking pattern onto a projection surface, photographs the marking pattern on the projection surface and obtains a marking pattern image after processing, calculates the horizontal clarity value of the marking pattern image and the vertical clarity value of the marking pattern image, and locates the defocus direction of the projector according to the horizontal clarity value of the marking pattern image and the vertical clarity value of the marking pattern image and the corresponding positioning device, thereby determining the defocus direction of the projector optical machine, that is, providing an accurate left or right focusing direction for the optical machine focusing, thereby enabling the optical machine to directly adjust the focal length in the defocus direction.
[0007] In summary, the current camera-based autofocus method does not take into account the gap between the motor and the lens gear, the motor's rotational inertia, and the image blur caused by the motor's movement when controlling the motor to reach the clearest position. These problems will lead to errors in the image clarity evaluation method, and the motor cannot accurately stop at the clearest position.
[0008] In addition, this method relies on the count value of the stepper motor to control the stepper motor to move to the clearest position. When the friction torque of the lens rotation is large, it is easy to lose step, thus affecting the focus accuracy. An angle sensor is installed on the motor. When the camera obtains the projection picture clarity evaluation value, the angle of the motor can be recorded to obtain the clearest focus position. This method will increase hardware costs. Summary of the invention
[0009] To this end, the present application provides a camera-based projector automatic focusing method and device to solve the problem of inaccurate focusing of the projector focusing method in the prior art.
[0010] In order to achieve the above objectives, this application provides the following technical solutions:
[0011] In a first aspect, a camera-based projector auto-focus method comprises:
[0012] Step 1: Acquire multiple projection images when the projector rotates along the focus moving direction through a camera;
[0013] Step 2: Calculating the clarity values of the plurality of projection images according to a clarity calculation function, and determining a maximum clarity value;
[0014] Step 3: Record the projection picture corresponding to the maximum definition value, and control the projector to stop rotating;
[0015] Step 4: Calculate the relative size of the projection ratio of the projection picture corresponding to the maximum clarity value to obtain a first projection ratio;
[0016] Step 5: Obtain the projection image after the projector stops rotating through the camera, and calculate the relative size of the projection ratio to obtain the second projection ratio;
[0017] Step 6: Determine whether to end focusing according to the difference between the first projection ratio and the second projection ratio.
[0018] Optionally, in step 1, the process of determining the focus moving direction is:
[0019] Step 101: Acquire multiple projection images when the projector rotates in any direction through a camera;
[0020] Step 102: Calculating the clarity values of the plurality of projection images according to a clarity calculation function to obtain a plurality of clarity values;
[0021] Step 103: Determine the focus moving direction according to the plurality of clarity value sequences.
[0022] Optionally, the step 103 is specifically as follows:
[0023] If the plurality of clarity value sequences first increase and then decrease, the focus movement direction is appropriate; if the plurality of clarity value sequences decrease, the focus movement direction is opposite to that of the focus movement direction.
[0024] Optionally, in step 2, the maximum definition value is determined as follows:
[0025] If the clarity value sequence of multiple projection images first increases and then decreases, the projector is controlled to reverse, and the camera is controlled to continuously shoot the projection images projected by the projector, and the clarity value of the current projection image is calculated. If the difference between the clarity value of the current projection image and the maximum clarity value in the clarity value sequence is within the threshold range, the clarity value of the current projection image is the maximum clarity value.
[0026] Optionally, in step 2, the clarity calculation function is Laplace variance, Sobel gradient, Fourier transform or Brenner gradient.
[0027] Optionally, in step 4 or step 5, the relative size of the projection ratio is an average value of distances between multiple feature points in the projection picture.
[0028] Optionally, the step 6 is specifically:
[0029] Step 601: determining whether the difference between the first projection ratio and the second projection ratio is less than a threshold value,
[0030] Step 602: If the difference is less than the threshold, then the focusing is terminated;
[0031] Step 603: If the difference is greater than the threshold, the projector is controlled to move along the direction of the maximum definition value and the projection image is re-photographed;
[0032] Step 604: Calculate the relative size of the projection ratio of the re-shot projection image, and obtain the second projection ratio again, until the difference between the first projection ratio and the second projection ratio is less than a threshold.
[0033] In a second aspect, a camera-based projector auto-focus device comprises:
[0034] A projection picture acquisition module, used to acquire multiple projection pictures when the projector rotates along the focus movement direction through a camera;
[0035] A clarity value calculation module, used to calculate the clarity values of the plurality of projection images according to a clarity calculation function, and determine a maximum clarity value;
[0036] Projection picture determination module: records the projection picture corresponding to the maximum definition value, and controls the projector to stop rotating;
[0037] A projection ratio relative size calculation module, used to calculate the projection ratio relative size of the projection picture corresponding to the maximum clarity value, to obtain a first projection ratio;
[0038] and obtaining, through the camera, a projection picture after the projector stops rotating, and calculating the relative size of the projection ratio to obtain a second projection ratio;
[0039] A difference calculation module is used to determine whether to end focusing according to the difference between the first projection ratio and the second projection ratio.
[0040] In a third aspect, a computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of a camera-based projector autofocus method.
[0041] In a fourth aspect, a computer program product includes a computer program or instructions, which, when executed by a processor, implement the steps of a camera-based projector autofocus method.
[0042] Compared with the prior art, this application has at least the following beneficial effects:
[0043] The present application provides a camera-based projector autofocus method and device, which obtains multiple projection images when the projector rotates along the focus movement direction through the camera; calculates the clarity values of multiple projection images according to the clarity calculation function, and determines the maximum clarity value; records the projection image corresponding to the maximum clarity value, and controls the projector to stop rotating; calculates the relative size of the projection ratio of the projection image corresponding to the maximum clarity value to obtain a first projection ratio; obtains the projection image after the projector stops rotating through the camera, and calculates the relative size of the projection ratio to obtain a second projection ratio; determines whether to end the focus according to the difference between the first projection ratio and the second projection ratio. The present application first uses the clarity calculation function to align the projector to the vicinity of the clearest position, and then uses the projection ratio relative size function to make fine adjustments near the clearest position, so that the projector can reach the clearest focus position. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more intuitively illustrate the prior art and the present application, exemplary drawings are given below. It should be understood that the specific shapes and structures shown in the drawings should not generally be regarded as limiting conditions for implementing the present application; for example, those skilled in the art are capable of easily making conventional adjustments or further optimizations to the addition / reduction / attribution division, specific shapes, positional relationships, connection methods, dimensional ratios, etc. of certain units (components) based on the technical concepts and exemplary drawings disclosed in the present application.
[0045] Figure 1 A basic flow chart of a camera-based projector auto-focus method provided in Embodiment 1 of the present application;
[0046] Figure 2 A determination flow chart of a camera-based projector auto-focus method provided in Embodiment 1 of the present application;
[0047] Figure 3 A schematic diagram of the relationship between the clarity calculation function value and the focal length provided in Example 1 of the present application;
[0048] Figure 4 A schematic diagram of the relationship between projection ratio and focal length provided in Example 1 of the present application. DETAILED DESCRIPTION
[0049] The present application is further described below in detail through specific embodiments in conjunction with the accompanying drawings.
[0050] In the description of this application: unless otherwise specified, the meaning of "plurality" is two or more. The terms "first", "second", "third", etc. in this application are intended to distinguish the objects referred to, and do not have special meanings in terms of technical connotations (for example, they should not be understood as emphasizing the importance or order, etc.). Expressions such as "including", "comprising", "having", etc. also mean "not limited to" (certain units, components, materials, steps, etc.).
[0051] The terms such as "upper", "lower", "left", "right", "middle", etc. cited in this application are usually used to indicate the general relative position relationship for the purpose of intuitive understanding by referring to the drawings, and are not absolute limitations on the position relationship in the actual product.
[0052] Embodiment 1
[0053] See also Figure 1 and Figure 2 This embodiment provides a camera-based projector automatic focusing method, including:
[0054] S1: Acquire multiple projection images when the projector rotates along the focus moving direction through the camera;
[0055] Specifically, when focusing starts, since the focus moving direction is unclear, it is necessary to determine the focus moving direction first:
[0056] S101: Acquire multiple projection images P when the projector rotates in any direction through a camera;
[0057] S102: calculating the clarity values of a plurality of projection images P according to the clarity calculation function f1 to obtain a plurality of clarity values;
[0058] More specifically, this embodiment provides a clarity calculation function f1, which can be used to quantify the clarity value of the picture. The clearer the picture, the larger the function value. Since the focus is too close or too far, the picture will be blurred, so the clarity calculation function f1 is a single-peak function relative to the focal length value.
[0059] S103: Determine a focus moving direction according to a plurality of clarity value sequences.
[0060] More specifically, if the plurality of clarity value sequences first increase and then decrease, the focus movement direction is appropriate; if the plurality of clarity value sequences decrease, the focus movement direction is opposite.
[0061] S2: Calculate the clarity values of multiple projection images according to the clarity calculation function f1, and determine the maximum clarity value f1 (P m );
[0062] Specifically, determine the maximum clarity value f1(Pm )hour:
[0063] Since the clarity calculation function f1 has a single peak, if the clarity value sequence of multiple projection images first rises and then falls, it means that the clearest position P has been passed. m Therefore, it is necessary to control the motor of the projector to reverse, and at the same time control the camera to continuously shoot the projection screen P projected by the projector, and calculate the clarity value of the current projection screen P. If the clarity value of the current projection screen is the same as the maximum clarity value f1(P m ) is within the threshold range, it means that it is close to the clearest position P m Therefore, the clarity value of the current projection image can be determined as the maximum clarity value f1(p m ).
[0064] Specifically, the clarity calculation function f1 is Laplace variance, Sobel gradient, Fourier transform or Brenner gradient.
[0065] S3: Record the projection image P (p m ), and control the projector to stop rotating;
[0066] S4: Calculate the relative size of the projection ratio of the projection picture corresponding to the maximum clarity value to obtain a first projection ratio;
[0067] See also Figure 3 , the calculated value of the clarity calculation function f1 is not in a one-to-one relationship with the focal length. Near the peak value of f1, the slope of f1 relative to the focal length is small, and the change in clarity value caused by the focal length movement is also small, so it is easy to focus inaccurately near the peak value. Therefore, this embodiment provides another function f2, which is used to calculate the relative size of the projection ratio. Because the projection ratio of the projector will change during the focusing process, the projection ratio also changes monotonically from the minimum to the maximum focal length, such as Figure 4 As shown in the figure. The projection ratio is reflected in the image captured by the camera, showing two points on the projection image. As the projection ratio increases, the distance between the two points on the camera image decreases. Therefore, the change in the projection ratio can be reflected by measuring the distance between the two points.
[0068] Specifically, the relative size of the projection ratio is the average distance between multiple feature points in the projected image. m ) value, then we can use the current f2(p) value and the peak f2(p m ) to determine the relationship between P and P m , thereby determining the rotation direction of the projector motor.
[0069] S5: obtaining a projection image after the projector stops rotating through a camera, and calculating a relative size of the projection ratio to obtain a second projection ratio;
[0070] S6: Determine whether to end focusing according to the difference between the first projection ratio and the second projection ratio.
[0071] Since the f2 function is a monotonic function, we can judge that P m The size of P controls the motor to move along P m Then, the current image P is captured again and the f2(p) value of the current projection image P is calculated. If P m and P is less than the threshold, the entire focusing process can be ended; if P m If P is greater than the threshold, the motor continues to move toward P m Fine-tune until P m and P is less than the threshold.
[0072] Specifically:
[0073] S601: Determine whether the difference between the first projection ratio and the second projection ratio is less than a threshold;
[0074] S602: If the difference is less than the threshold, the focusing is terminated;
[0075] S603: If the difference is greater than the threshold, the projector is controlled to move in the direction of the maximum definition value and the projection image is re-photographed;
[0076] S604: Calculate the relative size of the projection ratio of the re-shot projection image, and obtain the second projection ratio again, until the difference between the first projection ratio and the second projection ratio is less than a threshold.
[0077] The camera-based projector autofocus method provided in this embodiment takes into account the gap between the projector lens and the motor, the inertia of the lens and the friction resistance, which makes it difficult to align the autofocus process in one go. Therefore, the autofocus process is divided into two steps: the first step is to align to the vicinity of the clearest position, and the second step is to gradually approach the clearest position through several fine adjustments. This embodiment also takes into account that when the projection focal length changes, the projection ratio of the projector will also change accordingly, and the change in the projection ratio is reflected in the photos captured by the camera, that is, the change in the pixel distance between the marking points. Therefore, by measuring the distance between the marking points in the photo, the corresponding relationship of the focal length can be indirectly obtained.
[0078] When searching for the clearest position, this embodiment records the photo of the clearest position and obtains the distance between the marking points of the photo of the clearest position. When fine-tuning near the clearest position, by comparing the distance between the current marking points with the distance between the clearest marking points, the difference between the distance value and the distance value of the marking points of the current picture is used to determine whether the focal length is too far or too close, so that the direction of the motor movement can be controlled to continuously move toward the focal length of the clearest position.
[0079] In summary, this embodiment first uses the clarity calculation function to align the projector to the vicinity of the clearest position, and then uses the projection ratio relative size function to perform fine adjustments near the clearest position, so that the projector can reach the clearest focus position.
[0080] Embodiment 2
[0081] This embodiment provides a camera-based projector automatic focusing device, comprising:
[0082] A projection picture acquisition module, used to acquire multiple projection pictures when the projector rotates along the focus movement direction through a camera;
[0083] A clarity value calculation module, used to calculate the clarity values of the plurality of projection images according to a clarity calculation function, and determine a maximum clarity value;
[0084] Projection picture determination module: records the projection picture corresponding to the maximum definition value, and controls the projector to stop rotating;
[0085] A projection ratio relative size calculation module, used to calculate the projection ratio relative size of the projection picture corresponding to the maximum clarity value, to obtain a first projection ratio;
[0086] and obtaining, through the camera, a projection picture after the projector stops rotating, and calculating the relative size of the projection ratio to obtain a second projection ratio;
[0087] A difference calculation module is used to determine whether to end focusing according to the difference between the first projection ratio and the second projection ratio.
[0088] For the specific implementation content of each module in a camera-based projector automatic focusing device, please refer to the above definition of a camera-based projector automatic focusing method, which will not be repeated here.
[0089] Embodiment 3
[0090] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of a camera-based projector auto-focusing method are implemented.
[0091] Embodiment 4
[0092] This embodiment provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements the steps of a camera-based projector auto-focusing method.
[0093] The technical features of the above embodiments may be arbitrarily combined (as long as there is no contradiction in the combination of these technical features). To make the description concise, not all possible combinations of the technical features in the above embodiments are described; these embodiments that are not explicitly written should also be considered to be within the scope of this specification.
Claims
1. A camera-based projector automatic focusing method, characterized in that: include: Step 1: Acquire multiple projection images when the projector rotates along the focus moving direction through a camera; Step 2: Calculating the clarity values of the plurality of projection images according to a clarity calculation function, and determining a maximum clarity value; Step 3: Record the projection picture corresponding to the maximum definition value, and control the projector to stop rotating; Step 4: Calculate the relative size of the projection ratio of the projection picture corresponding to the maximum clarity value to obtain a first projection ratio; Step 5: Obtain the projection image after the projector stops rotating through the camera, and calculate the relative size of the projection ratio to obtain the second projection ratio; Step 6: Determine whether to end focusing according to the difference between the first projection ratio and the second projection ratio.
2. The camera-based projector auto-focusing method according to claim 1, characterized in that: In step 1, the process of determining the focus moving direction is: Step 101: Acquire multiple projection images when the projector rotates in any direction through a camera; Step 102: Calculating the clarity values of the plurality of projection images according to a clarity calculation function to obtain a plurality of clarity values; Step 103: Determine the focus moving direction according to the plurality of clarity value sequences.
3. The camera-based projector auto-focusing method according to claim 2, characterized in that: The step 103 is specifically as follows: If the plurality of clarity value sequences first increase and then decrease, the focus movement direction is appropriate; if the plurality of clarity value sequences decrease, the focus movement direction is opposite to that of the focus movement direction.
4. The camera-based projector auto-focusing method according to claim 1, characterized in that: In step 2, the maximum definition value is determined as follows: If the clarity value sequence of multiple projection images first increases and then decreases, the projector is controlled to reverse, and the camera is controlled to continuously shoot the projection images projected by the projector, and the clarity value of the current projection image is calculated. If the difference between the clarity value of the current projection image and the maximum clarity value in the clarity value sequence is within the threshold range, the clarity value of the current projection image is the maximum clarity value.
5. The camera-based projector auto-focusing method according to claim 1, characterized in that: In step 2, the clarity calculation function is Laplace variance, Sobel gradient, Fourier transform or Brenner gradient.
6. The camera-based projector auto-focusing method according to claim 1, characterized in that: In step 4 or step 5, the relative size of the projection ratio is an average value of distances between multiple feature points in the projection image.
7. The camera-based projector auto-focus method according to claim 1, characterized in that: The step 6 is specifically as follows: Step 601: determining whether the difference between the first projection ratio and the second projection ratio is less than a threshold value, Step 602: If the difference is less than the threshold, then the focusing is terminated; Step 603: If the difference is greater than the threshold, the projector is controlled to move along the direction of the maximum definition value and the projection image is re-photographed; Step 604: Calculate the relative size of the projection ratio of the re-shot projection image, and obtain the second projection ratio again, until the difference between the first projection ratio and the second projection ratio is less than a threshold.
8. A camera-based projector auto-focus device, characterized in that: include: A projection picture acquisition module, used to acquire multiple projection pictures when the projector rotates along the focus movement direction through a camera; A clarity value calculation module, used to calculate the clarity values of the plurality of projection images according to a clarity calculation function, and determine a maximum clarity value; Projection picture determination module: records the projection picture corresponding to the maximum definition value, and controls the projector to stop rotating; A projection ratio relative size calculation module, used to calculate the projection ratio relative size of the projection picture corresponding to the maximum clarity value, to obtain a first projection ratio; and obtaining, through the camera, a projection picture after the projector stops rotating, and calculating the relative size of the projection ratio to obtain a second projection ratio; A difference calculation module is used to determine whether to end focusing according to the difference between the first projection ratio and the second projection ratio.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Automatic focusing method and device
CN106231201A
Camera focusing method and device
CN107277381A
Positioning method and positioning device for out-of-focus direction of projector
CN110740302A
Gap compensation method, gap compensation device and projection device
CN107277477A
Projection equipment keystone correction method and device, projection equipment and medium
CN112422939A
Cited By
Projection apparatus and control method of projection apparatus
CN119743585A
