Adjusting method and device for automatic zooming
By automatically adjusting the driving mechanism of the camera and lens, high-precision and rapid automatic magnification are achieved, solving the problem of time-consuming and low accuracy in the prior art adjustment, ensuring multi-station consistency and repeatability accuracy.
Patent Information
- Application Number
- CN202411303812.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2044-09-19
AI Technical Summary
The existing automatic zoom device cannot achieve accurate zoom adjustment through the manual control motor adjustment method, and the adjustment takes a long time, and there is a problem that multiple station consistency and repeatability accuracy cannot be guaranteed.
The method of automatically adjusting three driving mechanisms is adopted. The first driving mechanism is used to drive the overall movement of the camera and the lens to realize the adjustment of the working distance and focus; the second driving mechanism is used to drive the camera to adjust the rear intercept; the third driving mechanism is used to drive the lens to rotate and realize the adjustment of the front focal length. By calculating the moving distance of the driving mechanism, it is automatically adjusted until the target magnification is reached, and the automatic magnification is completed.
High-precision and rapid adjustment are achieved, ensuring multi-station consistency and repeatability accuracy.
Smart Images

Figure CN119946422A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of visual inspection, and more specifically, to an automatic magnification adjustment method and device. Background Art
[0002] In visual inspection, due to the different sizes and resolutions of the inspected products, there are different requirements for the cameras and lenses of the visual inspection equipment. In the actual inspection process, when the products to be inspected change frequently, in order to avoid the need to constantly change the configuration of the inspection instrument, the lens is generally made into a compatible structure during the design process of the inspection instrument to ensure that it can be adjusted without disassembling the lens to adapt to different inspection environment requirements.
[0003] At present, the automatic magnification device involves the front focal length, back intercept, working distance and focus adjustment. It is impossible to achieve precise magnification adjustment through human-controlled motor adjustment, and the adjustment is time-consuming. There is a problem that the consistency and repeatability of multiple stations cannot be guaranteed. Summary of the invention
[0004] In response to at least one defect or improvement need in the prior art, the present invention provides an automatic magnification adjustment method and device, which solves the problem that precise magnification adjustment cannot be achieved through manual motor control, the adjustment takes a long time, and there is an inability to ensure consistency and repeatability of multiple stations. High-precision and rapid adjustment is achieved, and consistency and repeatability of multiple stations are ensured.
[0005] To achieve the above-mentioned purpose, according to the first aspect of the present invention, there is provided a method for adjusting automatic magnification, the method comprising: acquiring a detection image of the object to be inspected, and determining the current magnification based on the detection image; calculating the absolute value of the difference between the current magnification and the target magnification, and determining it as the absolute difference; when the absolute difference is greater than a preset difference, calculating the moving distance of the driving mechanism, wherein the driving mechanism comprises a first driving shaft for driving the overall movement of the camera and the lens, a second driving shaft for driving the camera movement, and a third driving shaft for driving the lens rotation; automatically adjusting the driving mechanism according to the moving distance until the target magnification is reached to complete the automatic magnification, wherein the moving distance comprises a first moving distance of the first driving shaft, a second moving distance of the second driving shaft, and a third moving distance of the third driving shaft.
[0006] In an exemplary embodiment, the calculation of the moving distance of the driving mechanism includes: obtaining a fitting function between magnification and working distance; determining a first distance of the fitting function at the target magnification value, wherein the first distance is the working distance from the lens to the object to be inspected when the magnification is the target magnification; determining a second distance of the fitting function at the current magnification value, wherein the second distance is the working distance from the lens to the object to be inspected when the magnification is the current magnification; determining a third distance of the fitting function at the set magnification value, wherein the set magnification is obtained by removing a set error from the target magnification; and determining the first moving distance in the moving distance based on the first distance, the second distance, and the third distance.
[0007] In an exemplary embodiment, calculating the moving distance of the drive mechanism includes: determining the current axis position and moving direction of the second drive axis; based on the current magnification and the target magnification, determining the second moving distance in the moving distance in combination with the current axis position and the moving direction.
[0008] In an exemplary embodiment, the calculation of the moving distance of the driving mechanism includes: obtaining the absolute position of the first axis of the third driving axis when the lens magnification is a first magnification; obtaining the absolute position of the second axis of the third driving axis when the lens magnification is a second magnification; calculating the target magnification absolute position according to the target magnification, the absolute position of the first axis and the absolute position of the second axis; determining the third moving distance in the moving distance through the target magnification absolute position and the current position of the axis of the third driving axis.
[0009] In an exemplary embodiment, before acquiring a detection image of the object to be inspected and determining the current magnification according to the detection image, the method further includes: automatically exposing the object to be inspected according to target brightness; and automatically focusing the automatically exposed object to be inspected according to target clarity.
[0010] In an exemplary embodiment, after acquiring a detection image of the object to be inspected and determining the current magnification based on the detection image, the method further includes: calculating the absolute value of the difference between the current mapping and the target mapping, and determining it as an absolute error; when the absolute error is greater than a preset error, calculating the moving distance of the drive mechanism; and automatically adjusting the drive mechanism according to the moving distance until the target mapping is reached to complete automatic magnification change.
[0011] In an exemplary embodiment, automatically adjusting the drive mechanism according to the moving distance until the target magnification is reached to complete automatic magnification change includes: controlling the first drive shaft to drive the camera and the lens to move the first moving distance as a whole; controlling the second drive shaft to drive the camera to move the second moving distance; controlling the third drive shaft to drive the lens to rotate and move the third moving distance.
[0012] According to the second aspect of the present invention, there is also provided an automatic magnification adjustment device, which comprises: an acquisition unit, for acquiring a detection image of an object to be inspected, and determining a current magnification based on the detection image; a determination unit, for calculating the absolute value of the difference between the current magnification and the target magnification, and determining it as an absolute difference; a first calculation unit, for calculating the moving distance of a driving mechanism when the absolute difference is greater than a preset difference, wherein the driving mechanism comprises a first driving shaft for driving the overall movement of a camera and a lens, a second driving shaft for driving the movement of the camera, and a third driving shaft for driving the rotation of the lens; a first adjustment unit, for automatically adjusting the driving mechanism according to the moving distance until the target magnification is reached to complete the automatic magnification change, wherein the moving distance comprises a first moving distance of the first driving shaft, a second moving distance of the second driving shaft, and a third moving distance of the third driving shaft.
[0013] According to a third aspect of the present invention, there is further provided a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned automatic magnification adjustment method when running.
[0014] According to a fourth aspect of the present invention, there is also provided an electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor executes the automatic magnification adjustment method through the computer program.
[0015] In general, the above technical solutions conceived by the present invention can achieve the following beneficial effects compared with the prior art:
[0016] The present invention provides an automatic zoom adjustment method, which automatically adjusts three driving mechanisms. The first driving mechanism is used to drive the camera and the lens to move as a whole to achieve working distance adjustment and focusing; the second driving mechanism is used to drive the camera to move to achieve back focus adjustment; the third driving mechanism is used to drive the lens to rotate to achieve front focal length adjustment, thereby achieving high-precision and rapid adjustment and ensuring multi-station consistency and repeatability. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 A schematic flow chart of an optional automatic zoom adjustment method provided in an embodiment of the present application;
[0019] Figure 2 A schematic flow chart of another optional automatic zoom adjustment method provided in an embodiment of the present application;
[0020] Figure 3 A schematic diagram of the structure of an optional automatic zoom adjustment device provided in an embodiment of the present application;
[0021] Figure 4 A schematic diagram of the structure of an optional electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0023] The terms "first", "second", "third", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0024] According to one aspect of the embodiments of the present application, a method for adjusting automatic magnification is provided. Figure 1 The automatic zoom adjustment method provided in the embodiment of the present application is described.
[0025] Figure 1 is a flow chart of an optional automatic zoom adjustment method provided in an embodiment of the present application, such as Figure 1 As shown, the process of the method may include the following steps:
[0026] S102, collecting a detection image of the object to be detected, and determining a current magnification according to the detection image;
[0027] S104, calculating the absolute value of the difference between the current magnification and the target magnification, and determining it as the absolute difference;
[0028] S106, when the absolute difference is greater than a preset difference, calculating a moving distance of a driving mechanism, wherein the driving mechanism includes a first driving shaft for driving the camera and the lens to move as a whole, a second driving shaft for driving the camera to move, and a third driving shaft for driving the lens to rotate;
[0029] S108, automatically adjusting the driving mechanism according to the moving distance until the target magnification is reached to complete automatic magnification change, wherein the moving distance includes a first moving distance of the first driving axis, a second moving distance of the second driving axis, and a third moving distance of the third driving axis.
[0030] The automatic magnification adjustment method provided in the embodiment of the present application is applicable to situations in visual inspection where the configuration of the inspection instrument needs to be adjusted when the object to be inspected (for example, the product to be inspected) changes. The inspection instrument here may be an automatic magnification device, and the automatic magnification device may involve front focal length, back focus, working distance and focus adjustment when performing configuration adjustment.
[0031] Optionally, in this embodiment, in order to avoid the need to constantly change the configuration of the detection instrument, during the design process of the detection instrument, the lens is generally made into a compatible structure to ensure that it can be adjusted without disassembling the lens to adapt to different detection environment requirements. When performing visual inspection, the drive mechanism can be automatically adjusted by the automatic zoom device to achieve the target magnification.
[0032] When adjusting the automatic zoom, the camera can first capture the inspection image of the object to be inspected and determine the current magnification, and then calculate the absolute value of the difference between the current magnification and the target magnification to be adjusted, and determine it as the absolute difference. When the absolute difference is greater than the preset difference, the moving distance of the three driving mechanisms for automatic zoom adjustment is calculated. Specifically, the driving mechanism includes a first driving shaft for driving the overall movement of the camera and the lens, a second driving shaft for driving the camera movement, and a third driving shaft for driving the lens rotation. Further, the moving distance includes a first moving distance of the first driving shaft, a second moving distance of the second driving shaft, and a third moving distance of the third driving shaft.
[0033] After determining the moving distance of each driving mechanism, the driving mechanism can be automatically adjusted according to the moving distance until the target magnification is reached to complete automatic magnification change (that is, the absolute value of the difference between the current magnification and the target magnification to be adjusted is not greater than the preset difference).
[0034] In an alternative example, Figure 2 A flow chart of another optional automatic zoom adjustment method provided in an embodiment of the present application is shown as follows: Figure 2 As shown, after the automatic zoom adjustment is turned on, the object to be inspected can be automatically exposed to improve the detection brightness, and automatic focus can be performed to improve the clarity of the detection. After the above preprocessing is completed, the detection image of the object to be inspected can be collected to determine whether the absolute value of the difference between the current magnification and the target magnification is greater than the preset error (or determine whether the absolute value of the difference between the current mapping and the target mapping is greater than the preset error). If it is less than the preset error, it means that the current magnification meets the visual detection requirements, and the automatic zoom can be ended and the visual detection can be turned on. If the absolute value of the difference between the current magnification and the target magnification is greater than the preset error (or the absolute value of the difference between the current mapping and the target mapping is greater than the preset error), the moving distance of the driving mechanism can be calculated. If the automatic zoom adjustment cannot meet the detection accuracy, the adjustment operation can be performed n times in a preset time until the target magnification is reached to complete the automatic zoom, that is, the absolute value of the difference between the current magnification and the target magnification to be adjusted is not greater than the preset difference.
[0035] Through the above steps S102 to S108, a detection image of the object to be inspected is collected, and the current magnification is determined according to the detection image; the absolute value of the difference between the current magnification and the target magnification is calculated and determined as the absolute difference; when the absolute difference is greater than the preset difference, the moving distance of the driving mechanism is calculated, wherein the driving mechanism includes a first driving shaft for driving the overall movement of the camera and the lens, a second driving shaft for driving the camera movement, and a third driving shaft for driving the lens rotation; the driving mechanism is automatically adjusted according to the moving distance until the target magnification is reached to complete the automatic magnification change, wherein the moving distance includes a first moving distance of the first driving shaft, a second moving distance of the second driving shaft, and a third moving distance of the third driving shaft, and by automatically adjusting the three driving mechanisms, the first driving mechanism is used to drive the overall movement of the camera and the lens to achieve working distance adjustment and focusing; the second driving mechanism is used to drive the camera movement to achieve the adjustment of the back focus, and the third driving mechanism is used to drive the lens rotation to achieve the adjustment of the front focal length, thereby achieving high-precision and rapid adjustment, and ensuring multi-station consistency and repeatability.
[0036] In an exemplary embodiment, calculating the moving distance of the driving mechanism includes:
[0037] S11, obtaining a fitting function between magnification and working distance;
[0038] S12, determining a first distance of the fitting function at the target magnification value, wherein the first distance is a working distance from the lens to the object to be inspected when the magnification is the target magnification;
[0039] S13, determining a second distance of the fitting function at the current magnification value, wherein the second distance is a working distance from the lens to the object to be inspected when the magnification is the current magnification;
[0040] S14, determining a third distance of the fitting function at the set magnification value, wherein the set magnification is obtained by subtracting a set error from the target magnification;
[0041] S15, determining the first moving distance among the moving distances based on the first distance, the second distance, and the third distance.
[0042] In this embodiment, when calculating the moving distance of the driving mechanism, the first moving distance of the first driving mechanism may be calculated first. The first driving mechanism drives the camera and the lens to move as a whole to achieve adjustment of the working distance and focus.
[0043] Exemplarily, the first moving distance of the first driving mechanism is calculated in the following manner: a fitting function between the magnification and the working distance can be obtained, and the first distance of the fitting function under the target magnification value is determined, where the first distance is the working distance from the lens to the object to be inspected when the magnification is the target magnification. After determining the first distance, the second distance of the fitting function under the current magnification value can be determined, that is, the working distance from the lens to the object to be inspected when the magnification is the current magnification. Finally, the third distance of the fitting function under the set magnification value is determined, that is, the magnification value obtained by removing the set error from the target magnification. The first moving distance in the moving distance is determined based on the first distance, the second distance, and the third distance.
[0044] Specifically, the fitting function f(x) is obtained through the relationship between the magnification and the working distance, and the fitting function can be expressed as: f(x) = 130.3*x^-0.9249-0.3258*x^6+4*x^5-20.41*x^4+56.27*x^3-91.74*x^2+92.51*x^3
[0045] D=|f(x1)-f(x0)|-|f(x0)-f(x2)|-0.05;
[0046] Among them, x is the magnification; x0 is the target magnification; x1 is the current magnification; x2 is the target magnification minus the movement error (empirical value), that is, the set magnification; D is the first moving distance. f(x0) is the working distance from the lens to the object to be inspected when the magnification is the target magnification, f(x1) is the working distance from the lens to the object to be inspected when the magnification is the current magnification, and f(x2) is the working distance under the set magnification value.
[0047] Through this embodiment, the first moving distance of the moving distance of the driving mechanism is calculated to achieve adjustment of the working distance and focus, thereby improving the clarity and accuracy of visual inspection.
[0048] In an exemplary embodiment, calculating the moving distance of the driving mechanism includes:
[0049] S21, determining the current position and moving direction of the second driving shaft;
[0050] S22, determining a second moving distance in the moving distance based on the current magnification and the target magnification in combination with the current position of the axis and the moving direction.
[0051] In this embodiment, when calculating the moving distance of the driving mechanism, the second moving distance of the second driving mechanism may be calculated, and the second driving mechanism drives the camera to move to achieve adjustment of the back intercept.
[0052] Optionally, the current position and moving direction of the second drive shaft can be determined, and based on the current magnification and the target magnification, the second moving distance in the moving distance is determined in combination with the current position and moving direction of the shaft. The second moving distance can be calculated by the following formula: D = p + x * ((ab) / 0.01); wherein a is the target magnification; b is the current magnification; p is the current position of the shaft of the second drive mechanism; x is the moving direction of the shaft of the second drive mechanism; and D is the third moving distance.
[0053] Through this embodiment, the second moving distance in the moving distance of the driving mechanism is calculated to adjust the back intercept, thereby improving the accuracy of visual detection.
[0054] In one embodiment, calculating the moving distance of the driving mechanism includes:
[0055] S31, obtaining a first axis absolute position of the third driving axis when the lens magnification is a first magnification;
[0056] S32, obtaining a second axis absolute position of the third driving axis when the lens magnification is a second magnification;
[0057] S33, calculating the target magnification absolute position according to the target magnification, the first axis absolute position and the second axis absolute position;
[0058] S34, determining the third moving distance among the moving distances according to the target magnification absolute position and the current axis position of the third driving axis.
[0059] In this embodiment, when calculating the moving distance of the driving mechanism, the third moving distance of the third driving mechanism may be calculated, and the third driving mechanism drives the lens to rotate to achieve adjustment of the front intercept.
[0060] Optionally, the first axis absolute position of the third driving axis when the lens magnification is the first magnification and the second axis absolute position of the third driving axis when the lens magnification is the second magnification can be obtained. Then, the target magnification absolute position can be calculated according to the target magnification, the first axis absolute position and the second axis absolute position, and the third moving distance in the moving distance can be determined by the target magnification absolute position and the current axis position of the third driving axis.
[0061] For example, the target magnification absolute position can be calculated by the following formula:
[0062] D=a*0.5*(p2-p1)+0.5*(3*p1-p2); wherein a is the target magnification; p1 is the absolute position of the axis when the lens magnification is 1 (i.e., the absolute position of the first axis); p2 is the absolute position of the axis when the lens magnification is 3 (i.e., the absolute position of the second axis); and D is the absolute position of the target magnification.
[0063] Further, the third moving distance may be determined by a difference between the target magnification absolute position and the current axis position of the third driving axis.
[0064] Through this embodiment, the third moving distance in the moving distance of the driving mechanism is calculated to adjust the front intercept and complete the automatic magnification change, thereby ensuring the consistency and repeatability of multiple stations.
[0065] In one embodiment, before acquiring a detection image of the object to be detected and determining the current magnification according to the detection image, the method further includes:
[0066] S41, automatically exposing the object to be inspected according to the target brightness;
[0067] S42, automatically focusing the object to be inspected after automatic exposure according to the target definition.
[0068] In this embodiment, before collecting the inspection image of the object to be inspected, the object to be inspected can be automatically exposed according to the set target brightness to improve the brightness of the object to be inspected. Further, the object to be inspected after automatic exposure can be automatically focused according to the set target clarity to improve the clarity of the collected image of the object to be inspected, which is convenient for the subsequent automatic adjustment of visual inspection, thereby improving the high precision of rapid adjustment.
[0069] In an exemplary embodiment, after acquiring a detection image of the object to be detected and determining a current magnification according to the detection image, the method further includes:
[0070] S51, calculating the absolute value of the difference between the current mapping and the target mapping, and determining it as an absolute error;
[0071] S52, when the absolute error is greater than a preset error, calculating the moving distance of the driving mechanism;
[0072] S53, automatically adjusting the driving mechanism according to the moving distance until the target mapping is reached and automatic magnification is completed.
[0073] In an exemplary embodiment, automatically adjusting the driving mechanism according to the moving distance until the target magnification is reached to complete the automatic magnification change includes:
[0074] S61, controlling the first driving shaft to drive the camera and the lens to move as a whole the first moving distance;
[0075] S62, controlling the second driving shaft to drive the camera to move the second moving distance;
[0076] S63, controlling the third driving shaft to drive the lens to rotate and move the third moving distance.
[0077] In this embodiment, the driving mechanism can be automatically adjusted according to the moving distance until the target magnification is reached to complete the automatic magnification change. The automatic adjustment here can be performed multiple times until the difference between the current magnification and the target magnification satisfies the adjustment accuracy.
[0078] Specifically, when adjusting the driving mechanism, the three driving mechanisms can be adjusted separately according to the moving distance. For example, the first driving shaft can be controlled according to the first moving distance to drive the camera and the lens to move as a whole to the first driving shaft target position to adjust the working distance and complete the focus; the second driving shaft can be controlled according to the second moving distance to drive the camera to move to the second driving shaft target position to adjust the back focus; the third driving shaft can be controlled according to the third moving distance to drive the rotation movement to the third driving shaft target position to adjust the front focal length.
[0079] Through this embodiment, the automatic zoom adjustment device is used to achieve front focal length, back focus, working distance and focus adjustment, and then achieve the target magnification, so as to achieve high-precision and rapid adjustment and ensure multi-station consistency and repeatability.
[0080] According to another aspect of the embodiments of the present application, an adjustment device for implementing the above-mentioned automatic magnification adjustment method is also provided. Figure 3 is a schematic structural diagram of an optional automatic magnification adjustment device according to an embodiment of the present application, such as Figure 3 As shown, the device may include:
[0081] An acquisition unit 302 is used to acquire an inspection image of the object to be inspected and determine a current magnification according to the inspection image;
[0082] A determination unit 304 is used to calculate the absolute value of the difference between the current magnification and the target magnification, and determine it as the absolute difference;
[0083] A first calculation unit 306, configured to calculate a moving distance of a driving mechanism when the absolute difference is greater than a preset difference, wherein the driving mechanism includes a first driving shaft for driving the camera and the lens to move as a whole, a second driving shaft for driving the camera to move, and a third driving shaft for driving the lens to rotate;
[0084] The first adjustment unit 308 is used to automatically adjust the driving mechanism according to the moving distance until the target magnification is reached to complete automatic magnification change, wherein the moving distance includes a first moving distance of the first driving axis, a second moving distance of the second driving axis, and a third moving distance of the third driving axis.
[0085] It should be noted that the acquisition unit 302 in this embodiment can be used to execute the above step S102, the determination unit 304 in this embodiment can be used to execute the above step S104, the first calculation unit 306 in this embodiment can be used to execute the above step S106, and the first adjustment unit 308 in this embodiment can be used to execute the above step S108.
[0086] Through the above module, a detection image of the object to be inspected is collected, and the current magnification is determined according to the detection image; the absolute value of the difference between the current magnification and the target magnification is calculated and determined as the absolute difference; when the absolute difference is greater than the preset difference, the moving distance of the driving mechanism is calculated, wherein the driving mechanism includes a first driving shaft for driving the overall movement of the camera and the lens, a second driving shaft for driving the camera movement, and a third driving shaft for driving the lens rotation; the driving mechanism is automatically adjusted according to the moving distance until the target magnification is reached to complete the automatic magnification change, wherein the moving distance includes a first moving distance of the first driving shaft, a second moving distance of the second driving shaft, and a third moving distance of the third driving shaft. By automatically adjusting the three driving mechanisms, the first driving mechanism is used to drive the overall movement of the camera and the lens to achieve working distance adjustment and focusing; the second driving mechanism is used to drive the camera movement to achieve the adjustment of the back focus, and the third driving mechanism is used to drive the lens rotation to achieve the adjustment of the front focal length, thereby achieving high-precision and rapid adjustment, and ensuring multi-station consistency and repeatability.
[0087] In an exemplary embodiment, the computing unit comprises:
[0088] An acquisition module, used for acquiring a fitting function between magnification and working distance;
[0089] A first determination module is used to determine a first distance of the fitting function at the target magnification value, wherein the first distance is a working distance from the lens to the object to be inspected when the magnification is the target magnification;
[0090] A second determination module is used to determine a second distance of the fitting function at the current magnification value, wherein the second distance is a working distance from the lens to the object to be inspected when the magnification is the current magnification;
[0091] A third determination module is used to determine a third distance of the fitting function under the set magnification value, wherein the set magnification is obtained by removing a set error from the target magnification;
[0092] The fourth determining module is used to determine the first moving distance in the moving distance based on the first distance, the second distance and the third distance.
[0093] In an exemplary embodiment, the computing unit comprises:
[0094] a fifth determination module, configured to determine a current shaft position and a moving direction of the second driving shaft;
[0095] The sixth determination module is used to determine a second moving distance in the moving distance based on the current magnification and the target magnification in combination with the current position of the axis and the moving direction.
[0096] In an exemplary embodiment, the computing unit comprises:
[0097] A first acquisition module, used for acquiring a first axis absolute position of the third driving axis when the lens magnification is a first magnification;
[0098] A second acquisition module, used for acquiring a second axis absolute position of the third driving axis when the lens magnification is a second magnification;
[0099] a seventh determination module, configured to calculate the target magnification absolute position according to the target magnification, the first axis absolute position and the second axis absolute position;
[0100] An eighth determination module is used to determine the third moving distance in the moving distance according to the target magnification absolute position and the current axis position of the third driving axis.
[0101] In an exemplary embodiment, the apparatus further comprises:
[0102] An automatic exposure unit, used for automatically exposing the object to be inspected according to the target brightness;
[0103] The automatic focusing unit is used to automatically focus the object to be inspected after automatic exposure according to the target clarity.
[0104] In an exemplary embodiment, the apparatus further comprises:
[0105] A second calculation unit, used to calculate the absolute value of the difference between the current mapping and the target mapping, and determine it as an absolute error;
[0106] a third calculation unit, configured to calculate the moving distance of the driving mechanism when the absolute error is greater than a preset error;
[0107] The second adjustment unit is used to automatically adjust the driving mechanism according to the moving distance until the target mapping is reached to complete the automatic magnification change.
[0108] In an exemplary embodiment, the first adjusting unit comprises:
[0109] A first control module, used for controlling the first driving shaft to drive the camera and the lens to move the first moving distance as a whole;
[0110] A second control module, used for controlling the second driving shaft to drive the camera to move the second moving distance;
[0111] The third control module is used to control the third driving shaft to drive the lens to rotate and move the third moving distance.
[0112] It should be noted here that the examples and scenarios implemented by the above-mentioned modules and corresponding steps are the same, but are not limited to the contents disclosed in the above-mentioned embodiments. It should be noted that the above-mentioned modules as part of the device can run in a hardware environment and can be implemented by software or hardware, wherein the hardware environment includes a network environment.
[0113] According to another aspect of the embodiments of the present application, a storage medium is further provided. Optionally, in this embodiment, the storage medium can be used to execute the program code of any of the automatic zoom adjustment methods in the embodiments of the present application.
[0114] Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps:
[0115] S1, collecting a detection image of the object to be detected, and determining the current magnification according to the detection image.
[0116] S2, calculating the absolute value of the difference between the current magnification and the target magnification, and determining it as the absolute difference.
[0117] S3, when the absolute difference is greater than a preset difference, calculating the moving distance of the driving mechanism, wherein the driving mechanism includes a first driving shaft for driving the overall movement of the camera and the lens, a second driving shaft for driving the camera movement, and a third driving shaft for driving the lens rotation.
[0118] S4, automatically adjusting the driving mechanism according to the moving distance until the target magnification is reached to complete the automatic magnification change, wherein the moving distance includes a first moving distance of the first driving axis, a second moving distance of the second driving axis, and a third moving distance of the third driving axis.
[0119] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, which will not be described in detail in this embodiment.
[0120] Among them, computer-readable storage media may include, but are not limited to, any type of disk, including floppy disks, optical disks, DVDs, CD-ROMs, microdrives and magneto-optical disks, ROMs, RAMs, EPROMs, EEPROMs, DRAMs, VRAMs, flash memory devices, magnetic or optical cards, nanosystems (including molecular memory ICs), or any type of medium or device suitable for storing instructions and / or data.
[0121] According to another aspect of the embodiments of the present application, an electronic device for implementing the above-mentioned automatic magnification adjustment method is also provided. The electronic device may be a server, a terminal, or a combination thereof.
[0122] Figure 4 is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application, such as Figure 4 As shown, it includes a processor 402, a communication interface 404, a memory 406 and a communication bus 408, wherein the processor 402, the communication interface 404, and the memory 406 communicate with each other through the communication bus 408, wherein:
[0123] Memory 406, used to store computer programs;
[0124] The processor 402 is used to implement the following steps when executing the computer program stored in the memory 406:
[0125] S1, collecting a detection image of the object to be detected, and determining the current magnification according to the detection image.
[0126] S2, calculating the absolute value of the difference between the current magnification and the target magnification, and determining it as the absolute difference.
[0127] S3, when the absolute difference is greater than a preset difference, calculating the moving distance of the driving mechanism, wherein the driving mechanism includes a first driving shaft for driving the overall movement of the camera and the lens, a second driving shaft for driving the camera movement, and a third driving shaft for driving the lens rotation.
[0128] S4, automatically adjusting the driving mechanism according to the moving distance until the target magnification is reached to complete the automatic magnification change, wherein the moving distance includes a first moving distance of the first driving axis, a second moving distance of the second driving axis, and a third moving distance of the third driving axis.
[0129] Optionally, the communication bus may be a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 The communication interface is used for communication between the electronic device and other devices.
[0130] The memory may include RAM, or may include nonvolatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0131] As an example, the memory 406 may include, but is not limited to, the acquisition unit 302, the determination unit 304, the first calculation unit 306, and the first adjustment unit 308 in the automatic variable magnification adjustment device. In addition, it may also include, but is not limited to, other module units in the automatic variable magnification adjustment device, which will not be described in detail in this example.
[0132] The above-mentioned processor can be a general-purpose processor, which can include but not be limited to: CPU (Central Processing Unit), NP (Network Processor), etc.; it can also be DSP (Digital Signal Processing), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0133] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.
[0134] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0135] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0136] In the several embodiments provided in the present application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0137] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0138] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0139] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM), random access memory (RAM), mobile hard disk, disk or optical disk and other media that can store program code.
[0140] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable memory, which can include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0141] The above is only an exemplary embodiment of the present disclosure, and the scope of the present disclosure cannot be limited thereto. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the specification and practicing the disclosure here, those skilled in the art will easily think of the implementation scheme of the present disclosure. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the technical field not recorded in the present disclosure. The description and examples are regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.
[0142] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0143] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for adjusting automatic magnification, characterized in that: include: Acquire a detection image of the object to be detected, and determine the current magnification according to the detection image; Calculating the absolute value of the difference between the current magnification and the target magnification, and determining it as the absolute difference; When the absolute difference is greater than a preset difference, calculating the moving distance of the driving mechanism, wherein the driving mechanism includes a first driving shaft for driving the camera and the lens to move as a whole, a second driving shaft for driving the camera to move, and a third driving shaft for driving the lens to rotate; The driving mechanism is automatically adjusted according to the moving distance until the target magnification is reached to complete automatic magnification change, wherein the moving distance includes a first moving distance of the first driving axis, a second moving distance of the second driving axis, and a third moving distance of the third driving axis.
2. The automatic variable magnification adjustment method according to claim 1, characterized in that: The calculation of the moving distance of the driving mechanism comprises: Obtain the fitting function between magnification and working distance; Determine a first distance of the fitting function at the target magnification value, wherein the first distance is a working distance from the lens to the object to be inspected when the magnification is the target magnification; Determine a second distance of the fitting function at the current magnification value, wherein the second distance is a working distance from the lens to the object to be inspected when the magnification is the current magnification; Determining a third distance of the fitting function at the set magnification value, wherein the set magnification is obtained by subtracting a set error from the target magnification; The first moving distance among the moving distances is determined based on the first distance, the second distance, and the third distance.
3. The automatic variable magnification adjustment method according to claim 1, characterized in that: The calculation of the moving distance of the driving mechanism comprises: Determining the current position and moving direction of the second drive shaft; Based on the current magnification and the target magnification, a second moving distance in the moving distance is determined in combination with the current position of the axis and the moving direction.
4. The automatic variable magnification adjustment method according to claim 1, characterized in that: The calculation of the moving distance of the driving mechanism comprises: Acquire the absolute position of the first axis of the third driving axis when the lens magnification is the first magnification; Acquire the second axis absolute position of the third driving axis when the lens magnification is the second magnification; Calculating the target magnification absolute position according to the target magnification, the first axis absolute position and the second axis absolute position; The third moving distance among the moving distances is determined by the target magnification absolute position and the current axis position of the third driving axis.
5. The automatic variable magnification adjustment method according to claim 1, characterized in that: Before acquiring a detection image of the object to be detected and determining the current magnification according to the detection image, the method further includes: Automatically exposing the object to be inspected according to the target brightness; The object to be inspected after automatic exposure is automatically focused according to the target clarity.
6. The automatic variable magnification adjustment method according to claim 1, characterized in that: After acquiring the detection image of the object to be detected and determining the current magnification according to the detection image, the method further includes: Calculate the absolute value of the difference between the current mapping and the target mapping, and determine it as the absolute error; When the absolute error is greater than a preset error, calculating the moving distance of the driving mechanism; The driving mechanism is automatically adjusted according to the moving distance until the target mapping is reached to complete the automatic magnification change.
7. The automatic variable magnification adjustment method according to any one of claims 1 to 6, characterized in that: The step of automatically adjusting the driving mechanism according to the moving distance until the target magnification is reached and the automatic magnification change is completed includes: Controlling the first driving shaft to drive the camera and the lens to move the first moving distance as a whole; Controlling the second driving shaft to drive the camera to move the second moving distance; The third driving shaft is controlled to drive the lens to rotate and move the third moving distance.
8. An automatic variable magnification adjustment device, characterized in that: include: An acquisition unit, used for acquiring an inspection image of the object to be inspected, and determining a current magnification according to the inspection image; A determination unit, used to calculate the absolute value of the difference between the current magnification and the target magnification, and determine it as the absolute difference; a first calculation unit, configured to calculate a moving distance of a driving mechanism when the absolute difference is greater than a preset difference, wherein the driving mechanism comprises a first driving shaft for driving the camera and the lens to move as a whole, a second driving shaft for driving the camera to move, and a third driving shaft for driving the lens to rotate; The first adjustment unit is used to automatically adjust the driving mechanism according to the moving distance until the target magnification is reached to complete automatic magnification change, wherein the moving distance includes a first moving distance of the first driving axis, a second moving distance of the second driving axis, and a third moving distance of the third driving axis.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method according to any one of claims 1 to 7 when executed.
10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 7 through the computer program.
Citation Information
Patent Citations
Realization method and device for automatically zooming of lens of early-stage cancer detector
CN103777337A
High-resolution microscopic visual imaging device and control method
CN104410775A
A synchronous focusing method and device
CN109698902A
Synchronous focusing method and device during zoom process, storage medium and electronic terminal
CN110045562A
Rapid automatic focusing method and device based on fixed scene
CN111741210A
Cited By
Imaging lens magnification adjusting system and adjusting method
CN121165279A