Focal length adjusting method for five-piece wide-angle lens
Through the data connection between the camera and the lens, the focal length is automatically adjusted using the zoom coefficient and center of mass coordinates, the problem of inconsistent field of view shooting of different cameras is solved, and efficient focal length adjustment and image comparison are achieved.
Patent Information
- Application Number
- CN202411776887.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-12-03
AI Technical Summary
In photography tests, the fields of view taken by different cameras at the same focal length are inconsistent, resulting in errors in manual focus and the position of the subject may move, affecting the intuitiveness of image comparison.
Through the data connection between the lens and the camera, the camera's focal length and sensor parameters are obtained, and the zoom coefficient is calculated to automatically adjust the focal length to ensure the consistent image field of view. At the same time, the center of mass coordinates and resolution comparison is used to determine whether the position of the object being photographed is consistent, and the adaptive coordinate calculation is performed to avoid errors caused by resolution differences.
Automatic adjustment of the focal length between cameras is realized, which improves the field of view of the captured image, reduces the error of manual focus, and improves the intuitiveness of image comparison.
Smart Images

Figure CN119653239A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of optical imaging, and in particular to a method for adjusting the focal length of a five-lens wide-angle lens. Background Art
[0002] With the development of the times and the maturity of production technology, digital cameras have more and more functions and better shooting performance. The lenses used with digital cameras have also developed into many types according to the functional positioning of various digital cameras. Among them, wide-angle zoom lenses, as one type of lens, have a smaller focal length range and are often used for digital cameras to take photos in long-range scenes. Among wide-angle zoom lenses, five-piece wide-angle zoom lenses are a common lens combination in some entry-level lenses. This lens has five optical lenses inside. Wide-angle lenses with this design are generally more compact and suitable for most standard wide-angle requirements.
[0003] At present, the lenses of many digital cameras have become intelligent. The lenses can exchange data with the cameras to realize various intelligent functions such as automatic focusing. The data interaction function is mainly realized by the electronic communication interface. This data interaction supports the information exchange between the lens and the body, thereby improving the shooting experience and operating efficiency. Generally speaking, as long as the protocol is interoperable and the docking size is suitable, a lens can be installed on a variety of cameras. Therefore, an adapter can be connected between the lens and the camera to make a lens applicable to multiple cameras. When testers in some photography industries compare the shooting effects of multiple cameras, such as testing competing cameras, they usually use the same test lens to cooperate with multiple cameras to shoot the same object at the same position, and compare the effects of each image after shooting. In this case, it is often required that the field of view of the images taken by each camera (the size of the scene area observed by the lens) be consistent, so that each image can be comparable. However, since the sensor size inside each camera may be different, this will lead to inconsistent field of view of images taken at the same focal length. Therefore, testers need to manually focus to try to keep the field of view of images taken by different cameras consistent. However, the manual focus method will have a certain degree of error, and even if the tester keeps the image field of view consistent, there may still be a problem of the position of the object in the image moving (the shooting aiming direction changes), which will make the comparison of the images less intuitive.
[0004] Therefore, it is necessary to provide a method for adjusting the focal length of a five-element wide-angle lens, which can automatically adjust the focal length according to camera parameters and keep the field of view and position of the captured image consistent. Summary of the invention
[0005] The object of the present invention is to provide a method for adjusting the focal length of a five-element wide-angle lens, which can automatically adjust the focal length according to camera parameters and keep the field of view and position of a captured image consistent.
[0006] According to one aspect of the present application, a method for adjusting the focal length of a five-element wide-angle lens is provided, which is used to test and compare images of an object captured by at least two cameras using the same lens at a fixed shooting position, and the method comprises the steps of:
[0007] The lens is connected to the first camera data and acquires a first image captured by the first camera;
[0008] The first image is recognized, and the lens obtains an area ratio A1 of the object in the first image, and records a current first focal length F1;
[0009] The lens is connected to the second camera data and a zoom factor I is obtained;
[0010] According to the zoom factor I, the lens calculates and obtains a second focal length F2, and at the second focal length F2, the second camera captures and obtains a second image;
[0011] Identify the second image, obtain the area ratio A2 of the photographed object in the second image, and if the relationship A2>A1 or A2<A1 is satisfied, calculate and obtain the fine-tuning coefficient M, and adjust the second focal length F2 according to the fine-tuning coefficient M to adjust the second area ratio A2 to satisfy the relationship A2=A1;
[0012] The first image and the second image are image-recognized in sequence to determine whether the second image needs to be re-photographed.
[0013] More preferably, in the step of "identifying the second image, obtaining the area ratio A2 of the photographed object in the second image, if the relationship A2>A1 is satisfied, or A2<A1, then calculating and obtaining the fine-tuning coefficient M, and adjusting the second focal length F2 according to the fine-tuning coefficient M, and satisfying the relationship F2=F1, the second area ratio A2 satisfies the relationship A2=A1", the formula for calculating and obtaining the fine-tuning coefficient by the lens is:
[0014]
[0015] Wherein, M is the focus coefficient, A1 is the area ratio of the first image, and A2 is the area ratio of the second image obtained according to the unadjusted second focal length F2.
[0016] More preferably, the step of "recognizing the first image and the second image in sequence to determine whether the second image needs to be re-photographed" includes the following steps:
[0017] A first coordinate system is established with the exact center of the first image as the origin, and a second coordinate system is established with the exact center of the second image as the origin;
[0018] Image recognition acquires pixel points located at the edge contour of the photographed object in the first image, and forms a first pixel set including N1 pixel point coordinates;
[0019] Image recognition acquires pixel points located at the edge contour of the photographed object in the second image, and forms a second pixel set including N2 pixel point coordinates;
[0020] According to the first pixel set, a first centroid coordinate C1 of the object in the first image is obtained by traversal calculation, and according to the second pixel set, a second centroid coordinate C2 of the object in the second image is obtained by traversal calculation;
[0021] A distance D1 between the first centroid coordinate C1 and an origin in the first image is obtained by calculation, and a distance D2 between the first centroid coordinate C2 and an origin in the second image is obtained by calculation.
[0022] More preferably, the step of "recognizing the first image and the second image in sequence to determine whether the second image needs to be re-photographed" further includes the following steps:
[0023] The lens is provided with a threshold S for determining a distance error, and the lens obtains a first resolution of the first camera and a second resolution of the second camera respectively;
[0024] Sequentially analyzing the first resolution and the second resolution to obtain a first horizontal pixel number X1 and a first vertical pixel number Y1 constituting the first resolution, and obtaining a second horizontal pixel number X2 and a second vertical pixel number Y2 constituting the second resolution;
[0025] Comparing the first resolution and the second resolution, if the relationship X1=X2 and Y1=Y2 is satisfied, then comparing the distance D1 and the distance D2 according to the threshold S;
[0026] Otherwise, the second centroid coordinate C1 is calculated and set as the adaptation coordinate C, and the distance D3 between the adaptation coordinate C and the origin in the second image is calculated and obtained according to the adaptation coordinate C, and the distance D1 and the distance D3 are compared.
[0027] More preferably, in the step of "otherwise calculating and setting the second centroid coordinate C1 as the adaptation coordinate C, calculating and obtaining the distance D3 between the adaptation coordinate C and the origin in the second image according to the adaptation coordinate C, and comparing the distance D1 and the distance D3", the formula for calculating and setting the adaptation coordinate C is as follows:
[0028]
[0029] Among them, C x To adapt to the horizontal coordinate of coordinate C, C1 x is the abscissa of the first centroid coordinate C1, X1 is the number of first horizontal pixels, and X2 is the number of second horizontal pixels;
[0030]
[0031] Among them, C y To adapt to the ordinate of coordinate C, C1 y is the ordinate of the first centroid coordinate C1, Y1 is the first vertical pixel number, and Y2 is the second vertical pixel number.
[0032] More preferably, in the step of "comparing the first resolution and the second resolution, if the relationship X1=X2 and Y1=Y2 is satisfied, then comparing the distance D1 and the distance D2 according to the threshold S",
[0033] If the relationship |D1-D2|>S is satisfied, it is determined that the position of the object in the second image is inaccurate and needs to be re-photographed to generate a new second image;
[0034] If the relationship |D1-D2|≤S is satisfied, the second image is saved.
[0035] More preferably, in the step of “otherwise calculating and setting the first centroid coordinate as the adaptation coordinate C, calculating and obtaining the distance D3 between the adaptation coordinate C and the origin in the second image according to the adaptation coordinate C, and comparing the distance D1 and the distance D3”,
[0036] If the relationship |D1-D3|>S is satisfied, it is determined that the position of the object in the second image is inaccurate, and it is necessary to re-shoot and generate a new second image;
[0037] If the relationship |D1-D3|≤S is satisfied, the second image is saved.
[0038] More preferably, according to the lens being respectively connected to the data of the first camera and the second camera, the lens sequentially obtains the diagonal length L1 of the sensor in the first camera and the diagonal length L2 of the sensor in the second camera, and according to the diagonal length L1 and the diagonal length L2, the lens obtains the zoom factor I, and the zoom factor I satisfies the relationship: I=L2 / L1.
[0039] More preferably, in the step of "according to the zoom factor I, the lens calculates and obtains the second focal length F2, and at the second focal length F2, the second camera captures and obtains the second image",
[0040] The formula for calculating the second focal length F2 is as follows:
[0041]
[0042] Wherein, F1 is the first focal length, I is the zoom factor, L1 is the diagonal length of the sensor in the first camera, and L2 is the diagonal length of the sensor in the second camera.
[0043] More preferably, in the first coordinate system, the horizontal axis extends along the horizontal direction of the first image and the vertical axis extends along the vertical direction of the first image, and in the second coordinate system, the horizontal axis extends along the horizontal direction of the second image and the vertical axis extends along the vertical direction of the second image;
[0044] The axis scale in the first coordinate system is composed of pixels at the first resolution, and the axis scale in the second coordinate system is composed of pixels at the second resolution.
[0045] The present invention has the following beneficial effects:
[0046] (1) The lens is connected to the data of the first camera and the second camera respectively, so that the lens can obtain the shooting focal length of the camera and the sensor parameters in the two cameras, and the second focal length of the second camera is calculated by the zoom factor, so that the lens can automatically adjust the focal length according to the parameters of the two cameras, thereby improving the field of view consistency of the two groups of images. In addition, the size of the objects in the images taken by the two cameras is compared and the second focal length is automatically fine-tuned, thereby further ensuring the consistency of the field of view of the two groups of images and avoiding the error caused by adjusting the focal length according to the parameters in the actual shooting.
[0047] (2) By using the centroid coordinates of the two objects to determine the distances between the two objects in the two images, the lens can determine whether the position of the objects in the image is inconvenient, thereby improving the intuitiveness of the two sets of images during the test comparison. By comparing the first resolution and the second resolution, the lens can avoid the inconsistency of the distance reference caused by the different resolutions of the two cameras. By comparing the first resolution and the second resolution, the lens can avoid the inconsistency of the distance reference caused by the different resolutions of the two cameras. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the implementation methods of the present application or the technical solutions in the prior art, the drawings required for use in the implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0049] Figure 1A flowchart of the steps of a method for adjusting the focal length of a five-element wide-angle lens according to one embodiment of the present application;
[0050] Figure 2 This is a connection block diagram of the lens described in one embodiment of the present application;
[0051] Figure 3 This is a schematic diagram of the principle of calculating the distance D1 in the first image in one embodiment of the present application;
[0052] Figure 4 This is a schematic diagram of the principle of calculating the distance D1 in the second image in one embodiment of the present application;
[0053] Description of reference numerals: 100, lens; 200, first camera; 300, second camera. DETAILED DESCRIPTION
[0054] In order to facilitate the understanding of the present application, the present application will be described more fully below with reference to the relevant drawings. The preferred embodiments of the present application are given in the drawings. However, the present application can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive.
[0055] It should be noted that when an element is referred to as being "fixed to" another element, it may be directly on the other element or there may be a central element. When an element is considered to be "connected to" another element, it may be directly connected to the other element or there may be a central element at the same time. The terms "vertical", "horizontal", "left", "right" and similar expressions used herein are for illustrative purposes only.
[0056] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.
[0057] Please refer to Figure 1 - Figure 4 In one embodiment of the present application, a method for adjusting the focal length of a five-element wide-angle lens 100 is provided, which is used to test and compare images of an object captured by at least two cameras using the same lens 100 at a fixed shooting position. The method comprises the steps of:
[0058] S10: The lens 100 is data-connected to the first camera 200, and a first image captured by the first camera 200 is acquired.
[0059] S20 identifies the first image, and the lens 100 obtains an area ratio A1 of the object in the first image, and records a current first focal length F1.
[0060] S30: The lens 100 is data-connected to the second camera 300, and a zoom factor I is obtained.
[0061] S40: According to the zoom factor I, the lens 100 calculates and obtains a second focal length F2, and at the second focal length F2, the second camera 300 captures and obtains a second image.
[0062] S50 identifies the second image, obtains the area ratio A2 of the photographed object in the second image, and if the relationship A2>A1 or A2<A1 is satisfied, calculates and obtains the fine-tuning coefficient M, and adjusts the second focal length F2 according to the fine-tuning coefficient M to adjust the second area ratio A2 to satisfy the relationship A2=A1.
[0063] S60 image recognition of the first image and the second image in sequence, and determining whether it is necessary to re-shoot the second image.
[0064] Among them, in step S10, the lens 100 is respectively connected to the data of the two cameras, and can obtain and record the size parameters of the sensor in the camera and the focal length when shooting the first image. The sensor is a key component in a digital camera that captures light and converts it into a digital signal. The diagonal length of the sensor refers to the diagonal of its physical size, and this size determines the quantity and quality of light information that the sensor can capture. The focal length is the distance from the optical center of the lens 100 to the imaging plane, which determines the magnification degree and the width of the viewing angle of the lens 100 to the distant object. The longer the focal length, the higher the magnification degree and the narrower the viewing angle; the shorter the focal length, the lower the magnification degree and the wider the viewing angle. The viewing angle determines the field of view size of the captured image. Therefore, if it is necessary to keep the field of view of two pictures taken by two cameras with different diagonal sizes of built-in sensors roughly consistent, it is necessary to adjust the focal length of the lens 100 according to the diagonal size. In step S20, an edge detection algorithm (such as a Canny edge detector built into the lens 100) is used to detect the edge of the object being photographed. The edge detection algorithm can identify pixels with drastic changes in brightness in the image, which usually correspond to the edges of the object. Based on the results of edge detection, the contour of the object is extracted by the contour tracking algorithm. After obtaining the contour, the pixel counting method is used to calculate the number of pixels inside the contour of the object, and finally the area ratio of the object in the image is obtained by calculating the number of pixels in the total image. In steps S30 and S40, the lens 100 can obtain the sensor size parameters of the two cameras and simply calculate the zoom factor for coarsely adjusting the focal length of the second camera 300 by the focal length of the first camera 200 when shooting. Through the second focal length, the second camera 300 captures the second image. In step S50, although the second pixel is obtained by the zoom factor, it cannot necessarily guarantee that the field of view of the two images is consistent. Therefore, it is also necessary to use the built-in image recognition module and edge computing module of the lens 100 to obtain the area ratio of the object in the two images, and compare the area ratio for verification. In step S60 , in addition to the consistent field of view, the position of the object in the images taken by the two cameras is also important. Therefore, the lens 100 needs to further determine whether the photo taken by the second image is comparable and whether it needs to be retaken.
[0065] Preferably, the step S60 includes the following steps:
[0066] S61: Establishing a first coordinate system with the exact center of the first image as the origin, and establishing a second coordinate system with the exact center of the second image as the origin.
[0067] S62 Image recognition acquires pixel points located at the edge contour of the photographed object in the first image, and forms a first pixel set including N1 pixel point coordinates.
[0068] S63 Image recognition acquires pixel points located at the edge contour of the photographed object in the second image, and forms a second pixel set including N2 pixel point coordinates.
[0069] S64: According to the first pixel set, traverse and calculate to obtain the first centroid coordinates C1 of the object in the first image; according to the second pixel set, traverse and calculate to obtain the second centroid coordinates C2 of the object in the second image.
[0070] S65 Calculate and obtain the distance D1 between the first centroid coordinate C1 and the origin in the first image, and calculate and obtain the distance D2 between the first centroid coordinate C2 and the origin in the second image.
[0071] Among them, in step S61, the creation of a coordinate system provides a standardized way to describe the relative position of the object in the image. By defining the horizontal axis and vertical axis of the coordinate system, it is possible to ensure a consistent reference benchmark when comparing different images. This setting facilitates providing a unified reference frame in images of different resolutions or sizes, and using the center of the image as the origin can reduce errors caused by differences in boundaries or pixel coordinate starting points. In steps S62 and S63, the lens 100 extracts the edges of the object in the image by combining image recognition technology and edge detection algorithms. And these edge points form a pixel set, which can be used to analyze the geometric properties of the object, such as the area and center of mass of the object. The edge contour is the basis for determining the spatial distribution of the object, and by extracting the edge points, its shape and position can be further determined. In step S64, through the coordinates of each edge pixel point in the pixel set, the lens 100 can traverse these coordinates to calculate the center of mass coordinates of the object. The formula for calculating the center of mass coordinates is:
[0072]
[0073] Among them, C x and C y are the horizontal and vertical coordinates of the centroid, N is the number of edge point pixels in the pixel set, i is the edge point pixel number, x i and i are the horizontal and vertical coordinates of the i-th pixel respectively.
[0074] In step S65, after calculating the first centroid coordinates and the second centroid coordinates, the distances from the two centroid coordinates to the image origin can be calculated according to the Euclidean distance calculation formula. At this time, there is a situation that the horizontal coordinate or vertical coordinate of the first centroid coordinate is opposite to the horizontal coordinate or vertical coordinate of the second centroid coordinate on the horizontal axis and the vertical axis (for example, the horizontal coordinate of the first centroid coordinate is a positive coordinate, but the horizontal coordinate of the second centroid coordinate is a negative coordinate).
[0075] Preferably, the step S60 further includes the following steps:
[0076] S66: A threshold S for determining a distance error is set in the lens 100, and the lens 100 obtains a first resolution of the first camera 200 and a second resolution of the second camera 300 respectively.
[0077] S67 parses the first resolution and the second resolution in sequence, obtains a first horizontal pixel number X1 and a first vertical pixel number Y1 constituting the first resolution, and obtains a second horizontal pixel number X2 and a second vertical pixel number Y2 constituting the second resolution.
[0078] S68 compares the first resolution and the second resolution, and if the relationship X1=X2 and Y1=Y2 is satisfied, then according to the threshold S, compares the distance D1 and the distance D2.
[0079] S69: Otherwise, the second centroid coordinate C1 is calculated and set as the adaptation coordinate C, and the distance D3 between the adaptation coordinate C and the origin in the second image is calculated according to the adaptation coordinate C, and the distance D1 is compared with the distance D3.
[0080] In step S66, by setting a threshold value S, the lens 100 can draw a conclusion on whether the position of the object is excessively shifted based on the distance comparison between the centroid of the object and the origin in the two images. Since the resolutions of the cameras connected to the lens 100 may be different, the threshold value S should be a dynamic value and set according to the parameters of the first camera 200. For example, the threshold value S can be set as: The lens 100 can obtain the resolution parameters of each camera respectively through data connection. In step S67, resolution is a basic attribute of an image, which is usually described by the number of horizontal pixels and the number of vertical pixels. Images with the same resolution represent the same pixel space division. If the resolution is consistent, the distance from the center of mass to the origin can be directly compared. If the resolution is inconsistent, an adaptation calculation is required. In step S68, at the same resolution, it means that the reference system of the center of mass coordinates in the two images is consistent. At this time, the geometric coordinates of the center of mass can be directly compared, which can save computing resources and simplify the process of determining the consistency of the center of mass position. In step S69, when the resolution is different, the pixel density and proportional relationship of the image are no longer consistent, and directly comparing the center of mass distance may lead to misjudgment. Therefore, it is necessary to calculate an adaptation coordinate that is the same as the second center of mass coordinate reference system in the second image, so that images of different resolutions can be mapped to the same benchmark for comparison.
[0081] More preferably, in the step of "otherwise calculating and setting the second centroid coordinate C1 as the adaptation coordinate C, calculating and obtaining the distance D3 between the adaptation coordinate C and the origin in the second image according to the adaptation coordinate C, and comparing the distance D1 and the distance D3", the formula for calculating and setting the adaptation coordinate C is as follows:
[0082]
[0083] Among them, C x To adapt to the horizontal coordinate of coordinate C, C2 x is the horizontal coordinate of the first centroid coordinate C1, X1 is the first horizontal pixel number, and X2 is the second horizontal pixel number.
[0084]
[0085] Among them, C y To adapt to the ordinate of coordinate C, C2 y is the ordinate of the first centroid coordinate C1, Y1 is the first vertical pixel number, and Y2 is the second vertical pixel number.
[0086] Among them, according to different resolutions, the calculation of the adaptive coordinates should require proportional reduction or increase in the total number of vertical pixels and the total number of horizontal pixels of the coordinate system, respectively, so the above calculation method is provided.
[0087] More preferably, in step S68,
[0088] S68A If the relationship |D1-D2|>S is satisfied, it is determined that the position of the object in the second picture is inaccurate and needs to be re-photographed to generate a new second image.
[0089] S68B If the relationship |D1-D2|≤S is satisfied, then the second image is saved.
[0090] Among them, the center of mass is a global geometric feature that can better reflect the overall position of the object than a single point position (such as an edge pixel). By comparing the center of mass deviation, misjudgment caused by local pixel changes or noise can be avoided. Even if some edge pixels are affected by noise or illumination, the center of mass deviation can still accurately reflect the overall displacement of the object. In step S68A, when the center of mass distance deviation exceeds the threshold value S, it means that the position of the object in the second image is too far offset (possibly due to a change in the shooting direction), and reshooting is to ensure that the image taken later is comparable to the image taken earlier. In step S68B, when the center of mass deviation in the two images is within the threshold value S, it can be considered that the position of the object is basically the same in the two shots. After saving the image, the user can compare the two images taken by himself to draw a comparative conclusion on the shooting effects of the two cameras.
[0091] More preferably, in step S69,
[0092] If S69A satisfies the relationship: |D1-D3|>S, it is determined that the position of the object in the second picture is inaccurate and needs to be re-photographed to generate a new second image.
[0093] S69B If the relationship |D1-D3|≤S is satisfied, then the second image is saved.
[0094] Among them, when the resolutions of the first image and the second image are different, directly comparing the deviations of D1 and D2 may be inaccurate, because the difference in resolution will cause the proportional relationship of the center of mass position to fail. The calculation of the adaptive coordinate C is to solve this problem of proportional imbalance, and adjust the center of mass coordinates of the second image to a state that adapts to the coordinate system of the first image. In step S69A, when the distance between the first center of mass coordinates and the adaptive coordinates exceeds the threshold value S, it means that the position error of the object being photographed exceeds the allowable range, which may affect the subsequent intuitive comparison of images, so it is necessary to re-shoot a more contrasting image. In step S69B, when the distance between the first center of mass coordinates and the adaptive coordinates is within the threshold value S, it means that the position deviation of the object being photographed in the second image and the first image is within an acceptable range, and the image can be saved directly.
[0095] More preferably, according to the data connection between the lens 100 and the first camera 200 and the second camera 300 respectively, the lens 100 sequentially obtains the diagonal length L1 of the sensor in the first camera 200 and the diagonal length L2 of the sensor in the second camera 300, and according to the diagonal length L1 and the diagonal length L2, the lens 100 obtains the zoom factor I, and the zoom factor I satisfies the relationship: I=L2 / L1.
[0096] Among them, the diagonal length of the camera sensor directly affects the imaging ratio (the number of pixels corresponding to a unit distance). When the sensor size is different, the imaging ratio will also be different. Through the zoom factor I, the imaging ratio of different sensor sizes can be calibrated to make the image coordinates taken by the two cameras consistent. At the same focal length, the larger the sensor size, the wider the field of view; the smaller the sensor size, the narrower the field of view. The zoom factor can be used to convert the difference in the imaging range of the two cameras. Different sensor sizes will lead to differences in pixel density (the number of pixels per unit distance). The calculation of the zoom factor can unify the image ratio under different pixel densities.
[0097] More preferably, in the first coordinate system, the horizontal axis extends along the horizontal direction of the first image and the vertical axis extends along the vertical direction of the first image, and in the second coordinate system, the horizontal axis extends along the horizontal direction of the second image and the vertical axis extends along the vertical direction of the second image. The axis scale in the first coordinate system is composed of pixels at the first resolution, and the axis scale in the second coordinate system is composed of pixels at the second resolution.
[0098] Among them, in a multi-camera system, image analysis requires data alignment and comparison between different coordinate systems. Therefore, separate coordinate systems are established in the first image and the second image, and the scales of their axes are composed of pixels at the corresponding resolution, in order to simplify the processing of image data and ensure the accuracy and computational efficiency of the comparison. An image is essentially a two-dimensional matrix composed of pixels. Using pixels as the scale can directly reference the index data of the image to avoid additional unit conversion. In image processing, edge detection, centroid calculation and other operations use pixels as the basic unit, and the pixel scale makes these calculations simple and intuitive. Resolution determines the pixel density of the image. Using pixels at each resolution as the unit, the size and position of objects in the image can be correctly described to avoid disproportion between different resolutions. Image data is usually stored in a two-dimensional matrix. The independence of the horizontal and vertical directions helps to separately calculate features such as edges and centroids in each direction, simplifying the complexity of the algorithm.
[0099] According to the steps S10 - S60 , this specific implementation provides a specific example to simulate a process in which a user uses the same test lens 100 to connect two cameras to capture images of an object at a fixed shooting position.
[0100] Example scenario:
[0101] The user takes photos of a building at the same distant location. The photos are taken using camera 1 with the test lens 100 and camera 2 with the test lens 100 respectively. The user compares the images taken by camera 1 and camera 2.
[0102] Instance parameter settings:
[0103] The sensor 1 of the camera 1 has a length of 36 mm and a width of 24 mm.
[0104] The sensor 2 of the camera 2 has a length of 22.3 mm and a width of 14.9 mm.
[0105] The focal length F1 of camera 1 when capturing image 1 is 200 mm.
[0106] The resolution of camera 1 is 1280×720.
[0107] The resolution of camera 2 is 1280×1024.
[0108] Example process:
[0109] 1. The lens 100 obtains the size data of the sensor 1 and the size data of the sensor 2 by connecting to the data of the camera 1 and the camera 2 respectively, and calculates the diagonal length L1 of the sensor 1 and the diagonal length L2 of the sensor 2 according to the size data of each sensor, and calculates the zoom factor I according to L1 and L2.
[0110] The calculation formula is as follows:
[0111]
[0112] 2. The lens 100 calculates the focal length F2 when the camera 2 captures the image 2 based on the zoom factor I.
[0113] The calculation formula is as follows:
[0114] F2=F1×I=200×0.62=124mm;
[0115] 3. The lens 100 uses the second camera 300 to capture image 2 according to the focal length F2. The image recognition module and the edge computing module in the lens 100 obtain the area ratio A1 of the object in image 1 and the area ratio A2 of the object in image 2. Assuming that the obtained A1 is 27% and A2 is 28%, it means that the focal length F2 adjusted according to the zoom factor I is not completely accurate and needs to be further roughly adjusted. Therefore, the lens 100 calculates the fine-tuning coefficient according to A1 and A2, and uses the fine-tuning coefficient to automatically fine-tune the focal length F2.
[0116] The calculation formula is as follows:
[0117]
[0118] F2=124×M=124×0.98=121.52mm;
[0119] 4. According to the new focal length F2, camera 2 re-captures image 2.
[0120] 5. The lens 100 uses the lower left corners of the images 1 and 2 as the origins to establish the first coordinate system and the second coordinate system, and obtains the first pixel set and the second pixel set in the first coordinate system by identifying the images 1 and 2. The first centroid coordinates of the object in the image 1 and the second centroid coordinates of the object in the image 2 are calculated by the pixel coordinates in the first pixel set and the second pixel set. Assuming that the first centroid coordinates are (600, 400) and the second centroid coordinates are (650, 500), the lens 100 compares the first resolution of the camera 1 and the second resolution of the camera 2. If the resolutions of the two cameras are different, the lens 100 calculates the adapted coordinates according to the resolutions (i.e., the number of pixels on the horizontal and vertical axes of the coordinate system).
[0121] The calculation formula is as follows:
[0122]
[0123] Among them, C x To adapt the horizontal axis of the coordinate, C y The ordinate of the adapted coordinate.
[0124] 6. The lens 100 calculates the distance D3 from the adaptation coordinates to the origin based on the adaptation coordinates, and calculates the distance D1 from the first centroid coordinates to the origin based on the first centroid coordinates. The absolute value of the difference between D1 and D3 is calculated and compared with the threshold S. If the absolute value is greater than the threshold S, it means that the position of the object in the two images is too far off and needs to be retaken. If the absolute value is less than or equal to the threshold S, it means that the position of the object in the two images is within an acceptable range and the second image can be saved and compared with the first image.
[0125] In this way, (1) the lens 100 is connected to the first camera 200 and the second camera 300 respectively by data, so that the lens 100 can obtain the shooting focal length of the camera and the sensor parameters in the two cameras, and calculate the second focal length of the second camera 300 by the zoom factor, so that the lens 100 can automatically adjust the focal length according to the parameters of the two cameras, thereby improving the consistency of the field of view of the two groups of images taken, and adopting a method of comparing the size of the objects in the images taken by the two cameras and automatically fine-tuning the second focal length, further ensuring the consistency of the field of view of the two groups of images taken, and avoiding the error caused by adjusting the focal length according to the parameters in the actual shooting.
[0126] (2) By using the centroid coordinates of the two objects to determine the distances between the two objects in the two images, the lens 100 can determine whether the positions of the objects in the images are inconvenient, thereby improving the intuitiveness of the two sets of images during the test comparison. By comparing the first resolution and the second resolution, the lens 100 can avoid the inconsistency of the distance reference caused by the different resolutions of the two cameras. By comparing the first resolution and the second resolution, the lens 100 can avoid the inconsistency of the distance reference caused by the different resolutions of the two cameras.
[0127] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application.
Claims
1. A method for adjusting the focal length of a five-element wide-angle lens, used for testing and comparing images of an object captured by at least two cameras using the same lens at a fixed shooting position, characterized in that: The method comprises the steps of: The lens is connected to the first camera data and acquires a first image captured by the first camera; The first image is recognized, and the lens obtains an area ratio A1 of the object in the first image, and records a current first focal length F1; The lens is connected to the second camera data and a zoom factor I is obtained; According to the zoom factor I, the lens calculates and obtains a second focal length F2, and at the second focal length F2, the second camera captures and obtains a second image; Identify the second image, obtain the area ratio A2 of the photographed object in the second image, and if the relationship A2>A1 or A2<A1 is satisfied, calculate and obtain the fine-tuning coefficient M, and adjust the second focal length F2 according to the fine-tuning coefficient M to adjust the second area ratio A2 to satisfy the relationship A2=A1; The first image and the second image are sequentially image-recognized to determine whether the second image needs to be re-photographed.
2. The method for adjusting the focal length of a five-element wide-angle lens according to claim 1, characterized in that: In the step of "identifying the second image, obtaining the area ratio A2 of the photographed object in the second image, if the relationship A2>A1 is satisfied, or A2<A1, then calculating and obtaining the fine-tuning coefficient M, and adjusting the second focal length F2 according to the fine-tuning coefficient M, and satisfying the relationship F2=F1. The second area ratio A2 satisfies the relationship A2=A1", the formula for calculating and obtaining the fine-tuning coefficient by the lens is: Wherein, M is the focus coefficient, A1 is the area ratio of the first image, and A2 is the area ratio of the second image obtained according to the unadjusted second focal length F2.
3. The method for adjusting the focal length of a five-element wide-angle lens according to claim 1, characterized in that: The step of "recognizing the first image and the second image in sequence and determining whether it is necessary to re-shoot the second image" includes the following steps: A first coordinate system is established with the lower left corner of the first image as the origin, and a second coordinate system is established with the lower left corner of the second image as the origin; Image recognition acquires pixel points located at the edge contour of the photographed object in the first image, and forms a first pixel set including N1 pixel point coordinates; Image recognition acquires pixel points located at the edge contour of the photographed object in the second image, and forms a second pixel set including N2 pixel point coordinates; According to the first pixel set, a first centroid coordinate C1 of the object in the first image is obtained by traversal calculation, and according to the second pixel set, a second centroid coordinate C2 of the object in the second image is obtained by traversal calculation; A distance D1 between the first centroid coordinate C1 and an origin in the first image is obtained by calculation, and a distance D2 between the second centroid coordinate C2 and an origin in the second image is obtained by calculation.
4. The method for adjusting the focal length of a five-element wide-angle lens according to claim 3, characterized in that: The step of "recognizing the first image and the second image in sequence and determining whether it is necessary to re-shoot the second image" further includes the steps of: The lens is provided with a threshold S for determining a distance error, and the lens obtains a first resolution of the first camera and a second resolution of the second camera respectively; Sequentially analyzing the first resolution and the second resolution to obtain a first horizontal pixel number X1 and a first vertical pixel number Y1 constituting the first resolution, and obtaining a second horizontal pixel number X2 and a second vertical pixel number Y2 constituting the second resolution; Comparing the first resolution and the second resolution, if the relationship X1=X2 and Y1=Y2 is satisfied, then comparing the distance D1 and the distance D2 according to the threshold S; Otherwise, the second centroid coordinate C1 is calculated and set as the adaptation coordinate C, and the distance D3 between the adaptation coordinate C and the origin in the second image is calculated and obtained according to the adaptation coordinate C, and the distance D1 and the distance D3 are compared.
5. The method for adjusting the focal length of a five-element wide-angle lens according to claim 4, characterized in that: In the step "otherwise, the second centroid coordinate C1 is calculated and set as the adaptation coordinate C, and the distance D3 between the adaptation coordinate C and the origin in the second image is calculated according to the adaptation coordinate C, and the distance D1 and the distance D3 are compared", the formula for calculating and setting the adaptation coordinate C is as follows: Among them, C x To adapt to the horizontal coordinate of coordinate C, C2 x is the horizontal coordinate of the second centroid coordinate C2, X1 is the first horizontal pixel number, and X2 is the second horizontal pixel number; Among them, C y To adapt to the ordinate of coordinate C, C2 y is the ordinate of the second centroid coordinate C2, Y1 is the first vertical pixel number, and Y2 is the second vertical pixel number.
6. The method for adjusting the focal length of a five-element wide-angle lens according to claim 5, characterized in that: In the step of "comparing the first resolution and the second resolution, if the relationship X1=X2 and Y1=Y2 is satisfied, then comparing the distance D1 and the distance D2 according to the threshold S", If the relationship |D1-D2|>S is satisfied, it is determined that the position of the object in the second image is inaccurate and needs to be re-photographed to generate a new second image; If the relationship |D1-D2|≤S is satisfied, the second image is saved.
7. The method for adjusting the focal length of a five-element wide-angle lens according to claim 6, characterized in that: In the step “otherwise, the first centroid coordinate is calculated and set as the adaptation coordinate C, and the distance D3 between the adaptation coordinate C and the origin in the second image is calculated according to the adaptation coordinate C, and the distance D1 is compared with the distance D3”, If the relationship |D1-D3|>S is satisfied, it is determined that the position of the object in the second image is inaccurate, and it is necessary to re-shoot and generate a new second image; If the relationship |D1-D3|≤S is satisfied, the second image is saved.
8. The method for adjusting the focal length of a five-element wide-angle lens according to claim 1, characterized in that: According to the lens being respectively connected to the data of the first camera and the second camera, the lens sequentially obtains the diagonal length L1 of the sensor in the first camera and the diagonal length L2 of the sensor in the second camera. According to the diagonal length L1 and the diagonal length L2, the lens obtains the zoom factor I, and the zoom factor I satisfies the relationship: I=L2 / L1.
9. The method for adjusting the focal length of a five-element wide-angle lens according to claim 8, characterized in that: In the step of "according to the zoom factor I, the lens calculates and obtains a second focal length F2, and at the second focal length F2, the second camera shoots and obtains a second image", The formula for calculating the second focal length F2 is as follows: Wherein, F1 is the first focal length, I is the zoom factor, L1 is the diagonal length of the sensor in the first camera, and L2 is the diagonal length of the sensor in the second camera.
10. The method for adjusting the focal length of a five-element wide-angle lens according to claim 4, characterized in that: In the first coordinate system, the horizontal axis extends along the horizontal direction of the first image and the vertical axis extends along the vertical direction of the first image, and in the second coordinate system, the horizontal axis extends along the horizontal direction of the second image and the vertical axis extends along the vertical direction of the second image; The axis scale in the first coordinate system is composed of pixels at the first resolution, and the axis scale in the second coordinate system is composed of pixels at the second resolution.
Citation Information
Patent Citations
Zoom magnification calibration method and device, electronic equipment and storage medium
CN113973200A
Focusing guidance method and system of zoom camera based on scene understanding
CN116723393A
Object recognition method and device, storage medium and electronic device
CN116894935A
Camera automatic zoom target capturing method, device and equipment and storage medium
CN117459829A
Photographing control method and apparatus, computer device and storage medium
US20240114246A1