Automatic focusing and focusing method and system for camera

By using laser rangefinders and image processing technology, the camera's focus and autofocus values ​​are automatically calculated and adjusted, solving the problem of camera focus and autofocus flexibility during port crane unloading and achieving efficient image clarity control.

CN121509814APending Publication Date: 2026-02-10ZHEJIANG EMERGEN ROBOT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511843759.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-09
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

During the unloading process of port cranes, the focusing and adjustment of cameras in existing technologies need to be manually adjusted, which cannot flexibly cope with containers of different weights and sizes, resulting in low work efficiency and frequent triggering of autofocus, causing the image to be out of focus.

Method used

The distance between the camera and the target is calculated using a laser rangefinder. Combined with image processing and camera SDK functions, the camera's focus and adjustment values ​​are automatically calculated and adjusted to achieve automatic control of image sharpness.

Benefits of technology

It enables automatic focusing and autofocus of camera images, avoids out-of-focus images, improves work efficiency, and can flexibly handle containers of different weights and sizes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121509814A_ABST
    Figure CN121509814A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of camera shooting, in particular to an automatic focusing and focusing method for a camera, and the method comprises the steps: respectively obtaining a first image and a corresponding focusing value, and a second image and a corresponding focusing value through two times of calibration; processing the first image and the second image, and calculating the maximum magnification proportion coefficient of the target object displayed on the display; the target object is controlled to move, and the distance between the camera and the target object is obtained through the laser range finder; obtaining the display length of the target object on the display based on the distance, and calculating an amplification proportion coefficient of the current target object; then, according to the magnification proportion coefficient of the current target object, a focusing value needing to be adjusted of the camera is calculated; calculating an image distance value according to the camera focal length and the distance L, and obtaining a focusing value of the camera based on the image distance value; and controlling the camera according to the focusing value and the focusing value to realize image acquisition of the target object at the current distance. According to the invention, the focusing value and the focusing value of the camera can be automatically adjusted, and images shot by the camera are clear.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of camera shooting technology, and more particularly to an automatic focusing and autofocusing method and system for cameras. Background Technology

[0002] During unloading at port terminals, large cranes are used to lift containers from cargo ships and transfer them to storage areas. During unloading, operators working in the crane cab rely primarily on a centralized system of multiple monitoring cameras installed on the crane to handle the containers. During the lifting process, operators must manually adjust the camera's focus and zoom levels based on the distance between the container and the camera to ensure the monitoring image remains clear at all times.

[0003] When the grabber is at its lowest position, the container is furthest from the camera. Initial position adjustment is performed first. The operator must manually adjust the camera's focus value to center the container in the monitoring frame, then trigger the camera's built-in "autofocus" function to ensure a clear image. As the crane begins operation, the operator must manually adjust the camera's focus value based on parameters such as the container's lifting height, the crane's lifting distance, lifting time, and lifting speed, and trigger the autofocus function again until the container is lifted to the target position. For example, with a lifting height of 45m, setting the crane's lifting distance to 6m, lifting speed to 3m / s, and lifting time to 2s, repeating this adjustment 7 to 9 times will lift the container to the target position. The existing technology has the following drawbacks:

[0004] 1. When the crane lifts the container at a fixed speed, the distance between the container and the camera will continuously change. The camera's focus and adjustment need to be dynamically adjusted according to the distance between the container and the camera. In order to avoid the camera's focus value and the distance between the container and the camera, the container needs to be lifted at a preset lifting speed. During peak port operations, it is difficult to flexibly handle containers of different weights and sizes, resulting in low work efficiency.

[0005] 2. Using intermittent focusing will trigger the camera's internal autofocus. However, autofocus cannot adjust to the correct focus in one go. When the camera's autofocus is frequently triggered, the autofocus correction process will cause the image to be out of focus, which will affect the operation of the crane. Summary of the Invention

[0006] The present invention aims to solve at least one of the technical problems existing in the prior art.

[0007] Therefore, this invention proposes an automatic focusing and autofocusing method for cameras, which automatically adjusts the camera's focus and autofocus values, resulting in clear images and high work efficiency.

[0008] According to an embodiment of the present invention, an autofocusing and focusing method for a camera includes the following steps:

[0009] S1. Move the target object to a first distance L1, acquire an image of the target object, and obtain the first image and the corresponding first focus value ZoomMax;

[0010] S2, move the target object to the second distance L2, perform image acquisition on the target object, and obtain the second image and the corresponding second focus value ZoomMin;

[0011] S3, process the first image and the second image, and calculate the maximum magnification factor ZMax of the target object displayed on the display;

[0012] S4. Control the movement of the target object and obtain the distance L between the camera and the target object through a laser rangefinder;

[0013] S5, based on the distance L, obtain the length of the target object displayed on the display, and calculate the magnification factor Z of the current target object;

[0014] S6. Based on the first focus value ZoomMax and the second focus value ZoomMin, and combined with the magnification factor Z of the target object displayed on the monitoring monitor, calculate the focus value Zoom that the camera needs to adjust.

[0015] S7, calculate the image distance value based on the camera focal length f and distance L, and obtain the camera's focus value based on the image distance value;

[0016] S8, control the camera according to the focus value and the adjustment value to realize image acquisition of the target object at the current distance.

[0017] The beneficial effects of this invention are that the automatic focusing and autofocusing method for cameras of this invention calculates the distance L using a laser rangefinder, and then calculates the magnification factor Z, focal length, and image distance of the current target object, thereby automatically controlling the camera's focusing and autofocusing values. Moreover, the images captured by the camera are clear, avoiding the blurring of the image caused by the automatic focusing correction process, and effectively improving work efficiency.

[0018] According to one embodiment of the present invention, the first distance L1 is less than the second distance L2.

[0019] According to an embodiment of the present invention, step S3 specifically includes:

[0020] Based on the first image, obtain the first pixel value PLMax of the target object;

[0021] The second pixel value PLMin of the target object is obtained based on the second image;

[0022] The maximum magnification factor ZMax of the target object displayed on the monitor is calculated based on the first pixel value PLMax and the second pixel value PLMin. The calculation formula is as follows:

[0023] ZMax = PLMax / PLMin.

[0024] According to an embodiment of the present invention, step S5 includes the following steps:

[0025] The length of the target object displayed on the monitor is calculated based on the distance L, using the following formula:

[0026]

[0027] The formula for calculating the magnification factor Z of the target object, based on its length displayed on the monitor, is as follows:

[0028] .

[0029] According to one embodiment of the present invention, the zoom value that the camera needs to adjust in step S6 is calculated by calling the camera's internal SDK function. The calculation formula is as follows:

[0030] Zoom=Fzoom(ZoomMax,ZoomMin, ZMax,Z).

[0031] According to an embodiment of the present invention, step S7 specifically includes the following steps:

[0032] Based on the required focus value Zoom, call the camera's SDK function to obtain the camera's focal length f=FFocal(zoom) corresponding to the focus value Zoom;

[0033] Based on the camera's focal length f and distance L, the image distance value v is calculated, and the camera's focus value focus=Focus(v) is obtained based on the image distance value v.

[0034] An autofocusing and focusing system for a camera according to an embodiment of the present invention, the system comprising:

[0035] camera;

[0036] An industrial computer is connected to the camera;

[0037] A laser rangefinder is connected to the industrial control computer.

[0038] The display is connected to the camera;

[0039] The industrial control computer is configured to implement the autofocus and focusing method for the camera as described above.

[0040] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.

[0041] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0042] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0043] Figure 1 This is a flowchart of the method according to Embodiment 1 of the present invention.

[0044] Figure 2 This is a schematic diagram of the system structure of Embodiment 2 of the present invention.

[0045] In the diagram, 21 is a camera; 22 is an industrial computer; 23 is a laser rangefinder; 24 is a monitor; and 10 is a computer device. Detailed Implementation

[0046] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, illustrating only the basic structure of the invention, and therefore only show the components relevant to the invention.

[0047] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," "counterclockwise," "axial," "radial," and "circumferential," etc., indicating orientation or positional relationships, are based on the orientation or positional relationships shown in the accompanying drawings and are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Furthermore, features defined with "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, unless otherwise stated, "a plurality of" means two or more.

[0048] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.

[0049] Example 1

[0050] Taking unloading at a port terminal as an example, this application proposes an automatic focusing and autofocusing method for a camera, such as... Figure 1 As shown, the method includes the following steps:

[0051] S1. Move the target object to a first distance L1, acquire an image of the target object, and obtain the first image and the corresponding first focus value ZoomMax.

[0052] S2, move the target object to the second distance L2, perform image acquisition on the target object, obtain the second image and the corresponding second focus value ZoomMin, wherein the first distance L1 is less than the second distance L2, the first distance L1 is set to 7m~10m, and the second distance is set to 40m~45m.

[0053] It should be noted that the target object in this embodiment is a shipping container. In the initial steps, the container is first moved to the closest distance to the camera, i.e., the first distance. The camera's built-in background program then focuses and adjusts the focus, allowing the container to occupy as much of the display screen as possible, obtaining the first image and acquiring the corresponding first focus value, ZoomMax. Next, the container is moved to the farthest distance from the camera, i.e., the second distance, which can be the container's lifting height. The camera's built-in background program then focuses and adjusts the focus, allowing the container to occupy as much of the display screen as possible, obtaining the second image and acquiring the corresponding second focus value, ZoomMin.

[0054] S3, processes the first and second images, and calculates the maximum magnification factor ZMax of the target object displayed on the monitor; specifically:

[0055] The first pixel value PLMax of the target object is obtained based on the first image. The first pixel value PLMax of the target object is the length of the container displayed on the monitor.

[0056] The second pixel value PLMin of the target object is obtained based on the second image. The second pixel value PLMin of the target object is the length of the container displayed on the monitor.

[0057] The maximum magnification factor ZMax of the target object displayed on the monitor is calculated based on the first pixel value PLMax and the second pixel value PLMin. The calculation formula is as follows:

[0058] ZMax = PLMax / PLMin.

[0059] S4. Control the movement of the target object and obtain the distance L between the camera and the target object through a laser rangefinder;

[0060] S5, based on the distance L, obtain the length of the target object displayed on the monitor, and calculate the magnification factor Z of the current target object;

[0061] The length of the target object displayed on the monitor is calculated based on the distance L, that is, the length of the container displayed on the monitor at a distance L. The calculation formula is as follows:

[0062] ;

[0063] Based on the length of the target object displayed on the monitor, calculate the magnification factor Z of the current target object. The calculation formula is as follows:

[0064] .

[0065] S6. Based on the first focus value ZoomMax and the second focus value ZoomMin, and combined with the magnification factor Z of the target object displayed on the monitoring monitor, calculate the focus value Zoom that the camera needs to adjust.

[0066] Furthermore, by calling the camera's internal SDK functions, the required zoom level for the camera is calculated using the following formula:

[0067] Zoom=Fzoom(ZoomMax,ZoomMin, ZMax,Z).

[0068] S7, calculate the image distance value based on the camera focal length f and distance L, and obtain the camera's focus value based on the image distance value;

[0069] Based on the required focus value Zoom, call the camera's SDK function to obtain the camera's focal length f=FFocal(zoom) corresponding to the focus value Zoom;

[0070] Based on the camera focal length f and distance L, the image distance value v is calculated, and the camera's focus value focus = Focus(v) is obtained based on the image distance value v. The formula for calculating the image distance value v is:

[0071] .

[0072] S8 controls the camera based on the focus value and adjustment value to acquire images of the target object at the current distance.

[0073] The automatic focusing and autofocusing method for cameras of the present invention calculates the distance L using a laser rangefinder, and then calculates the magnification factor Z, focal length f, and image distance v of the current target object, thereby automatically controlling the camera's focusing and autofocusing values. The images captured by the camera are clear, avoiding the blurring caused by the autofocus correction process. In addition, since the camera's focusing and autofocusing values ​​can be adjusted automatically, containers do not need to be pulled up at a preset lifting speed. During peak port operations, it can flexibly handle containers of different weights and sizes, effectively improving work efficiency.

[0074] It effectively improved work efficiency.

[0075] Example 2

[0076] Based on the same inventive concept as the autofocus and focusing method for a camera in the foregoing embodiments, this application provides an autofocus and focusing system for a camera, the system comprising:

[0077] Camera 21 is configured to acquire images of the target object;

[0078] The industrial computer 22 is connected to the camera 21 to acquire images captured by the camera 21;

[0079] The laser rangefinder 23 is connected to the industrial control computer 22 and is configured to acquire the distance L between the camera and the target object;

[0080] The monitor 24 is connected to the industrial computer 21 and is configured to display images captured by the camera.

[0081] The industrial computer 22 is configured to implement the above-described autofocus and focusing methods for the camera.

[0082] The automatic focusing and autofocusing system for the camera in this embodiment has a simple structure, is easy to modify for different sites, has low modification costs, and is easy to maintain. In addition, by setting up a laser rangefinder and an industrial control computer, the laser rangefinder obtains the relative distance L between the container and the camera. Based on the camera focal length f and the distance L, the system automatically controls the camera's focusing and autofocusing values. The industrial control computer sends the focusing and autofocusing values ​​to the camera, realizing high-frequency (200 milliseconds) dynamic adjustment. This ensures that the camera can always capture the outline of the cleaned container, and the operator can always observe the image of the entire target object on the monitor.

[0083] The foregoing Figure 1The various variations and specific examples of the autofocus and focusing method for a camera in Embodiment 1 are also applicable to the autofocus and focusing system for a camera in this embodiment. Through the foregoing detailed description of the autofocus and focusing method for a camera, those skilled in the art can clearly understand the implementation method of the autofocus and focusing system for a camera in this embodiment. Therefore, for the sake of brevity, it will not be described in detail here.

[0084] Based on the above-described preferred embodiments of the present invention, and through the foregoing description, those skilled in the art can make various changes and modifications without departing from the inventive concept. The technical scope of this invention is not limited to the contents of the specification, but must be determined according to the scope of the claims.

Claims

1. A method for automatic focusing and autofocusing of a camera, characterized in that, The method includes the following steps: S1. Move the target object to a first distance L1, acquire an image of the target object, and obtain the first image and the corresponding first focus value ZoomMax; S2, move the target object to the second distance L2, perform image acquisition on the target object, and obtain the second image and the corresponding second focus value ZoomMin; S3, process the first image and the second image, and calculate the maximum magnification factor ZMax of the target object displayed on the display; S4. Control the movement of the target object and obtain the distance L between the camera and the target object through a laser rangefinder; S5, based on the distance L, obtain the length of the target object displayed on the display, and calculate the magnification factor Z of the current target object; S6. Based on the first focus value ZoomMax and the second focus value ZoomMin, and combined with the magnification factor Z of the target object displayed on the monitoring monitor, calculate the focus value Zoom that the camera needs to adjust. S7, calculate the image distance value based on the camera focal length f and distance L, and obtain the camera's focus value based on the image distance value; S8, control the camera according to the focus value and the adjustment value to realize image acquisition of the target object at the current distance.

2. The automatic focusing and autofocusing method for a camera as described in claim 1, characterized in that, The first distance L1 is less than the second distance L2.

3. The automatic focusing and autofocusing method for a camera as described in claim 2, characterized in that, Step S3 specifically includes: Based on the first image, obtain the first pixel value PLMax of the target object; The second pixel value PLMin of the target object is obtained based on the second image; The maximum magnification factor ZMax of the target object displayed on the monitor is calculated based on the first pixel value PLMax and the second pixel value PLMin. The calculation formula is as follows: ZMax = PLMax / PLMin.

4. The automatic focusing and autofocusing method for a camera as described in claim 3, characterized in that, Step S5 includes the following steps: The length of the target object displayed on the monitor is calculated based on the distance L, using the following formula: ; The formula for calculating the magnification factor Z of the target object, based on its length displayed on the monitor, is as follows: 。 5. The autofocusing and focusing method for a camera as described in claim 4, characterized in that, The zoom value that the camera needs to adjust in step S6 is calculated by calling the camera's internal SDK function. The calculation formula is as follows: Zoom=Fzoom(ZoomMax,ZoomMin,ZMax,Z).

6. The automatic focusing and autofocusing method for a camera as described in claim 5, characterized in that, Step S7 specifically includes the following steps: Based on the required focus value Zoom, call the camera's SDK function to obtain the camera's focal length f=FFocal(zoom) corresponding to the focus value Zoom; Based on the camera focal length f and distance L, the image distance value v is calculated, and the camera's focus value focus=Focus(v) is obtained based on the image distance value v.

7. An automatic focusing and autofocusing system for a camera, characterized in that, The system includes: Camera (21); An industrial computer (22) is connected to the camera (21); A laser rangefinder (23) is connected to the industrial control computer (22); The display (24) is connected to the camera (21); The industrial computer (22) is configured to implement the autofocus and focusing method for a camera as described in any one of claims 1 to 6.