Camera center alignment automatic detection and correction method and system

CN122813643APending Publication Date: 2026-09-25THE 44TH INST OF CHINA ELECTRONICS TECH GROUP CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611083316.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-21
Publication Date
2026-09-25

AI Technical Summary

Technical Problem

[0003]现有技术存在以下缺陷:无法量化图像传感器与机壳的中心偏差;PCB调整依赖手动操作,无法自动精准平移,有出现误差的风险;校正效率低、精度差

Benefits of technology

[0015]本发明的相机中心对位自动检测校正方法及系统,至少具有如下有益效果:本发明以装配平台中心的十字靶标作为机壳物理中心的统一基准,通过像素级坐标比对算法计算十字光标中心点与图像传感器光轴中心的像素偏差,并结合像元尺寸换算为物理位移,计算十字光标与图像坐标系坐标轴的角度偏移量,实现了中心位移偏差和角度偏差的完全量化检测,避免了人工目视校准的主观性和不确定性;集图像采集、偏移量计算、自动校正和校正后复检于一体,无需人工干预,耗时降低,大幅提升了生产效率和产品一致性;采用三维位移台带动PCB板平移和旋转,校正精度高;同时,位移台驱动平稳,无顶针挤压,配合PCB夹持具的硅橡胶夹持面,有效避免PCB形变和绿油磨损;定位销钉与三维位移台的位置可更换,能够适配不同尺寸和型号的工业相机,满足批量生产线多品种切换的需求。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122813643A_ABST
    Figure CN122813643A_ABST
Patent Text Reader

Abstract

The application discloses a camera center alignment automatic detection and correction method and system, and the method comprises the following steps: acquiring a target image generated by imaging a target fixedly arranged by an image sensor of a camera to be assembled; extracting a pixel coordinate value of a center point of the target image; calculating a displacement offset of an optical axis center of the image sensor relative to a physical center of the target according to the pixel coordinate value; judging whether the displacement offset meets a preset correction completion condition, if not, controlling the image sensor to move to correct the position; if yes, ending the correction. The application provides a camera center alignment automatic detection and correction method and system which can accurately and efficiently realize the alignment of the normal center of the image sensor and the normal center of the shell.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial camera assembly and inspection technology, and in particular to an automatic detection and correction method and system for camera center alignment. Background Technology

[0002] Against the backdrop of the rapid development of the industrial camera industry, various problems have been encountered in the research and development and production of industrial cameras. A key issue is how to align the exact center of the image sensor with the exact center of the camera housing. Even slight errors during assembly can cause significant misalignment of the camera's center, thus affecting its final use. Solving this problem requires an automatic detection and calibration system to align the exact center of the image sensor with the exact center of the camera housing within the technically required error range.

[0003] The existing technology has the following drawbacks: it cannot quantify the center deviation between the image sensor and the housing; PCB adjustment relies on manual operation and cannot be automatically and accurately translated, which poses a risk of error; and the calibration efficiency is low and the accuracy is poor. Summary of the Invention

[0004] In view of the shortcomings of the prior art, the technical problem to be solved by the present invention is to provide a camera center alignment automatic detection and correction method and system that can accurately and efficiently align the center of the image sensor with the center of the housing.

[0005] To solve the above-mentioned technical problems, one technical solution adopted by the present invention is to provide an automatic detection and correction method for camera center alignment, comprising the following steps: Acquire the target image generated by the image sensor of the camera to be assembled onto a fixed target; Extract the pixel coordinates of the center point of the target image; Calculate the displacement offset of the optical axis center of the image sensor relative to the physical center of the target based on the pixel coordinate values; Determine whether the displacement offset meets the preset correction completion conditions. If not, control the image sensor to move to correct the position; if it does, end the correction.

[0006] Furthermore, after the step of controlling the movement of the image sensor to correct the position, the method further includes: The process of returning to the image sensor of the camera to be assembled to image the target image generated by the fixed target is re-checked until the displacement offset meets the preset correction completion conditions.

[0007] Furthermore, the correction completion condition is that the absolute value of the displacement offset is less than or equal to a preset displacement threshold.

[0008] Furthermore, the target is a crosshair target, and the target image is a crosshair cursor image. Extracting the pixel coordinates of the center point of the target image is equivalent to extracting the pixel coordinates of the center point of the crosshair cursor in the crosshair cursor image; this includes the following sub-steps: Within the first target area defined in the crosshair image, a first feature point set and a second feature point set are extracted using multiple sets of edge detection calipers, and then fitted to obtain two horizontal edge lines of the crosshair respectively. Calculate the centerline of the two horizontal edge lines to obtain the horizontal centerline; Within the second target area defined in the crosshair image, the third and fourth feature point sets are extracted using multiple sets of edge detection calipers, and the two vertical edge lines of the crosshair are fitted to obtain them respectively. Calculate the centerline of the two perpendicular edge lines to obtain the perpendicular centerline; Calculate the coordinates of the intersection point of the horizontal center line and the vertical center line to obtain the pixel coordinates of the center point of the crosshair cursor.

[0009] Furthermore, after calculating the displacement offset of the optical axis center of the image sensor relative to the physical center of the target based on the pixel coordinate values, the method further includes the following steps: Extract the angle values ​​between the horizontal and / or vertical center lines of the crosshair cursor in the crosshair cursor image and the corresponding coordinate axes of the image coordinate system. The angle values ​​are the angle offsets. The correction is completed when the absolute value of the displacement offset is less than or equal to a preset displacement threshold and the absolute value of the angle offset is less than or equal to a preset angle threshold.

[0010] Furthermore, the step of obtaining the two horizontal edge lines of the crosshair cursor includes the following sub-steps: Multiple edge detection calipers are evenly arranged vertically within the first target area; Calculate the grayscale gradient for each pixel within each set of calipers, and retain pixels whose gradient values ​​are greater than a preset edge threshold. Based on the polarity of the grayscale change, edge points of the first type with increasing grayscale and edge points of the second type with decreasing grayscale are selected respectively. The edge points with the largest gradient values ​​are selected from the first type of edge points and the second type of edge points, respectively, and are designated as the first feature point and the second feature point. The first feature points of all calipers constitute the first feature point set, and the second feature points of all calipers constitute the second feature point set. Line fitting is performed on the first feature point set and the second feature point set respectively to generate two horizontal edge lines.

[0011] Furthermore, the step of obtaining the two vertical edge lines of the crosshair cursor includes the following sub-steps: Multiple edge detection calipers are evenly arranged horizontally within the second target area; Calculate the grayscale gradient for each pixel within each set of calipers, and retain pixels whose gradient values ​​are greater than a preset edge threshold. Based on the polarity of the grayscale change, third-class edge points with increasing grayscale and fourth-class edge points with decreasing grayscale are obtained respectively. The edge points with the largest gradient values ​​are selected from the third and fourth types of edge points, respectively, and are designated as the third feature point and the fourth feature point. The third feature points of all calipers constitute the third feature point set, and the fourth feature points of all calipers constitute the fourth feature point set. Line fitting is performed on the third and fourth feature point sets respectively to generate two vertical edge lines.

[0012] Furthermore, prior to the step of extracting the pixel coordinates of the center point of the target image, the following steps are also included: The target image is preprocessed, specifically including the following sub-steps: The target image is filtered to remove image noise; The filtered image is binarized to separate the target region from the background region.

[0013] To solve the above-mentioned technical problems, another technical solution adopted by the present invention is: to provide an automatic camera center alignment detection and correction system, comprising: An assembly platform, wherein a target is provided on the assembly platform; A light source, positioned below the assembly platform, is used to emit light that passes through the target and forms a target image on the image sensor of the camera to be assembled. The image acquisition module is used to acquire the target image; The image processing module is used to process the target image and extract the pixel coordinates of the center point of the target image; An actuator is used to carry the PCB board of the camera to be assembled and drive the PCB board to move. The PCB board is equipped with an image sensor. The control module is communicatively connected to the image processing module and the actuator, respectively. It is used to calculate the displacement offset of the optical axis center of the image sensor relative to the physical center of the target based on the pixel coordinate values, and to control the actuator to move to correct the position of the PCB board when the displacement offset does not meet the preset correction completion conditions.

[0014] Furthermore, the assembly platform is provided with positioning pins for positioning the camera housing on the assembly platform.

[0015] The automatic camera center alignment detection and correction method and system of the present invention has at least the following beneficial effects: The present invention uses the crosshair target at the center of the assembly platform as a unified reference for the physical center of the housing. It calculates the pixel deviation between the center point of the crosshair and the center of the optical axis of the image sensor through a pixel-level coordinate comparison algorithm, and converts the pixel size into physical displacement to calculate the angular offset between the crosshair and the coordinate axis of the image coordinate system. This achieves complete quantitative detection of center displacement deviation and angular deviation, avoiding the subjectivity and uncertainty of manual visual calibration. It integrates image acquisition, offset calculation, automatic correction, and post-correction inspection, eliminating the need for manual intervention, reducing time consumption, and significantly improving production efficiency and product consistency. It uses a three-dimensional displacement stage to drive the PCB board to translate and rotate, achieving high correction accuracy. At the same time, the displacement stage drive is stable, without pin squeezing, and the silicone rubber clamping surface of the PCB holder effectively avoids PCB deformation and solder mask wear. The positions of the positioning pins and the three-dimensional displacement stage are replaceable, which can adapt to industrial cameras of different sizes and models, meeting the needs of multi-variety switching in batch production lines. Attached Figure Description

[0016] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a flowchart of one embodiment of the automatic camera center alignment detection and correction method of the present invention.

[0017] Figure 2 This is the filtered image of the crosshair cursor.

[0018] Figure 3 This is the image of the crosshair cursor after filtering and binarization.

[0019] Figure 4 for Figure 1 Flowchart of step S200.

[0020] Figure 5 This is a schematic diagram of the edge detection caliper arrangement for the ROI region of the horizontal crosshair cursor.

[0021] Figure 6 A schematic diagram is generated for the horizontal center line G of the crosshair cursor.

[0022] Figure 7 This is a schematic diagram of the edge detection caliper arrangement for the ROI region with the vertical line of the crosshair cursor.

[0023] Figure 8Generate a schematic diagram for the vertical center line H of the crosshair cursor.

[0024] Figure 9 This is a diagram showing the intersection of the horizontal center line G and the vertical center line H of the crosshair cursor.

[0025] Figure 10 This is a system block diagram of one embodiment of the automatic camera center alignment detection and correction system of the present invention.

[0026] Figure 11 This is a schematic diagram of one embodiment of the automatic camera center alignment detection and correction system of the present invention.

[0027] Figure 12 This is a schematic diagram showing the coaxial relationship between the motion axis system and the optical axis of a three-dimensional displacement stage. Detailed Implementation

[0028] The following disclosure provides various different embodiments or examples for implementing different features of the invention. Specific embodiments of components and arrangements will be described below to simplify the invention. Of course, these are merely embodiments and are not intended to limit the invention. For example, in the following description, forming a first component above or on a second component may include embodiments where the first and second components are in direct contact, or embodiments where other components may be formed between the first and second components such that the first and second components are not in direct contact. Furthermore, reference numerals and / or characters may be repeated in various instances of the invention. Such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or configurations.

[0029] Furthermore, spatial relation terms such as "below," "under," "below," "above," and "above" may be used herein to readily describe the relationship between one element or component and another element (or component) or component (or component) as shown in the figure. In addition to the orientations shown in the figure, spatial relation terms will encompass various different orientations of the device in use or operation. The device may be positioned in other ways (rotated 90 degrees or in other orientations) and will be interpreted accordingly through the spatial relation descriptors used herein.

[0030] Although the numerical ranges and parameter settings presented in this invention are approximations, the numerical settings in specific instances are reported as precisely as possible. Any numerical value, however, inherently contains certain inevitable errors arising from the standard deviation found in the respective test measurements. Similarly, as used herein, the term "about" generally refers to within 10%, 5%, 1%, or 0.5% of a given value or range. Alternatively, the term "about" means within an acceptable average standard error that can be conceived by one of ordinary skill in the art. Except in instances of operation / work, or unless expressly stated otherwise, all numerical ranges, totals, values, and percentages, such as those for material quantities, durations, temperatures, operating conditions, amounts, and other similarities disclosed herein, should be understood to be modified by the term "about" in all cases. Therefore, unless otherwise stated, the numerical parameter settings set forth in this invention and the appended claims are approximations that can be changed upon request. At a minimum, each numerical parameter should be interpreted based on the number of significant figures reported and the application of ordinary rounding techniques. A range herein may be expressed as from one endpoint to another or between two endpoints. All scopes disclosed herein include endpoints unless otherwise stated.

[0031] Furthermore, the technical parts described in this invention and the appended claims are primarily the improved technical parts of this invention, and do not limit the object protected by this invention to only having these technical parts. Other known essential components (structures and / or methods) and / or non-essential components of the object protected, besides the technical parts described in this invention and the appended claims, are not included in this invention and the appended claims because they do not fall within the scope of improvements of this invention; however, this does not mean that the object protected by this invention does not possess these known components.

[0032] Please see Figure 1 This is a flowchart of an embodiment of the automatic camera center alignment detection and correction method of the present invention. This embodiment includes the following steps: S100. Acquire target image. Acquire the target image generated by the image sensor of the camera to be assembled onto a fixed target.

[0033] Specifically, the camera housing to be assembled is fixed to the assembly platform using locating pins, ensuring no relative displacement between the housing and the platform. A crosshair target with a line width of 0.3mm is positioned at the center of the assembly platform. A light source is located below the assembly platform; the light emitted from the light source passes through the slit of the crosshair target from bottom to top, forming a crosshair cursor image on the camera's image sensor. The image sensor parameters of the camera under test are: monochrome, pixel size 5μm×5μm, resolution 2048×2048.

[0034] In this embodiment, the target is preferably a crosshair target, and the target image corresponds to a crosshair cursor image. In other embodiments, the target can also be other geometric shapes with a clear center point, such as dot targets, concentric circle targets, or grid targets, as long as the coordinates of its center point can be extracted through image processing.

[0035] In a preferred embodiment, after step S100, the target image acquired by the image sensor of the camera to be assembled is further preprocessed. This specifically includes the following sub-steps: First, the target image is filtered to remove image noise. In this embodiment, a Gaussian filter (3×3 kernel) is used to smooth the image, effectively suppressing noise interference introduced during image acquisition and transmission while preserving the edge information of the target image. In other embodiments, other filtering methods such as median filtering, mean filtering, or bilateral filtering may also be used. Please refer to [link to relevant documentation]. Figure 2 This is the filtered image of the crosshair cursor.

[0036] Then, the filtered image is binarized to separate the target region from the background region. In this embodiment, the target forms a relatively clear image on the image, with a grayscale value of approximately 200 DN for the target imaging region and approximately 30 DN for the remaining unimaged background region. Therefore, an automatic thresholding method is not required. In this embodiment, a hard thresholding binarization method is used, setting the low threshold to 80. Pixels with a grayscale value greater than or equal to 80 are set to 255 (white), and pixels with a grayscale value less than 80 are set to 0 (black), thereby highlighting the target region and facilitating subsequent edge detection and center extraction. In other embodiments, an adaptive thresholding method can also be used to adapt to images under different lighting conditions. Please refer to [link to relevant documentation]. Figure 3 , is the crosshair cursor image after filtering and binarization.

[0037] S200. Extract the pixel coordinates of the center point of the target image.

[0038] When the target is a crosshair, extracting the pixel coordinates of the center point of the target image is equivalent to extracting the pixel coordinates of the center point of the crosshair in the crosshair image.

[0039] Please see Figure 4 This step S200 includes the following sub-steps: S210. Extract the two horizontal edge lines of the crosshair cursor. Within the first target area defined in the crosshair cursor image, extract the first feature point set and the second feature point set using multiple sets of edge detection calipers, and fit them to obtain the two horizontal edge lines of the crosshair cursor.

[0040] Specifically, multiple edge detection calipers are uniformly arranged vertically within the first target area; grayscale gradients are calculated for pixels within each set of calipers, and pixels with gradient values ​​greater than a preset edge threshold are retained; based on the polarity of grayscale changes, first-type edge points with increasing grayscale and second-type edge points with decreasing grayscale are selected respectively; the edge points with the largest gradient values ​​are selected from the first-type and second-type edge points respectively, which are designated as the first feature point and the second feature point; the first feature points of all calipers constitute the first feature point set, and the second feature points of all calipers constitute the second feature point set; straight line fitting is performed on the first feature point set and the second feature point set respectively to generate two horizontal edge lines.

[0041] In practice, please refer to Figure 5 First, define the first target region (the ROI region along the horizontal line of the crosshair). The first target region is set to 0~2048 pixels in the X direction and 900~1100 pixels in the Y direction. Within the first target region, evenly distribute multiple edge detection calipers along the vertical direction (i.e., the Y-axis direction). The number of calipers is set to 20, ensuring that the calipers cover the entire length of the horizontal line of the crosshair. Then, perform the following operations on the pixels within each group of calipers: (1) Calculate the gray-level gradient of each pixel within the caliper and identify the locations of abrupt changes in pixel gray-level. In this embodiment, the Sobel operator is used to calculate the gray-level gradient to accurately reflect the intensity of gray-level changes.

[0042] (2) Only pixels with gradient values ​​greater than a preset edge threshold are retained, and invalid edges with low contrast are filtered out. In this embodiment, the preset edge threshold is 15.

[0043] (3) Filtering based on the polarity of grayscale changes. Filter edges by edge polarity "from white to black" (i.e., grayscale value from high to low), retaining the first type of edge points that conform to this grayscale change direction; filter edges by edge polarity "from black to white" (i.e., grayscale value from low to high), retaining the second type of edge points that conform to this grayscale change direction. The two edges of the crosshair cursor have opposite polarities; polarity matching can accurately distinguish the cursor edges.

[0044] (4) Select the edge point with the largest gradient value from the first type of edge point and the second type of edge point respectively, and use it as the first feature point and the second feature point of the caliper.

[0045] All the first feature points of the calipers constitute the first feature point set, and all the second feature points of the calipers constitute the second feature point set. A straight line is fitted to the first feature point set to generate the first horizontal edge line (as shown by line E in Figure 6); a straight line is fitted to the second feature point set to generate the second horizontal edge line (as shown by line E in Figure 6). Figure 6 As shown by the straight line F in the middle.

[0046] S220, Calculate the horizontal centerline.

[0047] Specifically, the center line of the two horizontal edge lines is calculated to obtain the horizontal center line. The horizontal line of the crosshair cursor (i.e., the first target area) has a certain width, approximately 50 pixels in this embodiment, corresponding to 250μm. Its two horizontal edge lines are line E and line F. The center line G of the two lines is calculated. Please refer to [link to relevant documentation]. Figure 6 The straight line G in the figure is the horizontal center line of the crosshair cursor.

[0048] S23O, Extract the two vertical edge lines of the crosshair cursor. Within the second target area defined in the crosshair cursor image, extract the third and fourth feature point sets using multiple sets of edge detection calipers, and fit them to obtain the two vertical edge lines of the crosshair cursor.

[0049] Specifically, multiple edge detection calipers are uniformly arranged horizontally within the second target area; grayscale gradients are calculated for pixels within each set of calipers, and pixels with gradient values ​​greater than a preset edge threshold are retained; based on the polarity of grayscale changes, third-type edge points with increasing grayscale and fourth-type edge points with decreasing grayscale are selected respectively; edge points with the largest gradient values ​​are selected from the third-type and fourth-type edge points respectively, which are designated as third feature points and fourth feature points; the third feature points of all calipers constitute the third feature point set, and the fourth feature points of all calipers constitute the fourth feature point set; straight line fitting is performed on the third feature point set and the fourth feature point set respectively to generate two vertical edge lines.

[0050] In practice, please refer to Figure 7 First, define the second target region (the ROI area along the vertical line of the crosshair). The second target region is set as follows: 900-1100 pixels in the X direction and 0-2048 pixels in the Y direction. Within the second target region, evenly distribute multiple edge detection calipers along the horizontal direction (i.e., the X-axis direction), with 20 calipers to ensure they cover the entire length of the vertical line of the crosshair. Then, perform the following operations on the pixels within each group of calipers: (1) Calculate the gray-level gradient of each pixel within the caliper and identify the locations of abrupt changes in pixel gray-level. In this embodiment, the Sobel operator is used to calculate the gray-level gradient to accurately reflect the intensity of gray-level changes.

[0051] (2) Only pixels with gradient values ​​greater than a preset edge threshold are retained, and invalid edges with low contrast are filtered out. In this embodiment, the preset edge threshold is 15.

[0052] (3) Filtering based on the polarity of grayscale changes. Filter edges by edge polarity "from white to black" (i.e., grayscale value from high to low), retaining the third type of edge points that conform to this grayscale change direction; filter edges by edge polarity "from black to white" (i.e., grayscale value from low to high), retaining the fourth type of edge points that conform to this grayscale change direction. The two edges of the crosshair cursor have opposite polarities; polarity matching can accurately distinguish the cursor edges.

[0053] (4) Select the edge points with the largest gradient values ​​from the third and fourth types of edge points respectively, and use them as the third and fourth feature points of the caliper.

[0054] The third feature points of all calipers constitute the third feature point set, and the fourth feature points of all calipers constitute the fourth feature point set. Line fitting is performed on the third feature point set to generate the first vertical edge line; line fitting is performed on the fourth feature point set to generate the second vertical edge line.

[0055] S240, Calculate the vertical centerline.

[0056] Specifically, the centerlines of the two perpendicular edge lines are calculated to obtain the perpendicular centerlines. Please refer to [link / reference needed]. Figure 8 The straight line H in the figure is the vertical center line of the crosshair cursor.

[0057] S250, Calculate the pixel coordinates of the center point of the crosshair cursor. (See also...) Figure 9 Calculate the coordinates of the intersection point of the horizontal center line G and the vertical center line H to obtain the pixel coordinates of the center point of the crosshair cursor.

[0058] Specifically, let the equation of the horizontal centerline G be:

[0059] Let the equation of the line perpendicular to the center line H be:

[0060] First, determine if the two lines are parallel:

[0061] If D is not 0, then it proves that the two lines are not parallel. Solving the system of equations, we can obtain the coordinates of the intersection point x0 and y0: , Determine whether (x0, y0) is within the image area (i.e., 0≤x0≤2048, 0≤y0≤2048). If it is within the image area, then (x0, y0) is the pixel coordinate value of the center point of the crosshair cursor.

[0062] S300. Calculate the displacement offset. Calculate the displacement offset of the optical axis center of the image sensor relative to the physical center of the target based on the pixel coordinate values.

[0063] In this embodiment, the resolution of the camera image sensor is 2048×2048, and the pixel coordinates corresponding to the center of its optical axis, i.e., the coordinates of the center point of the image coordinate system, are (xc, yc), where xc=1024 and yc=1024. According to step S200, the pixel coordinates of the center point of the crosshair are (x0, y0). Therefore, the pixel deviations in the X and Y directions are respectively: x = xc x0, y=yc y0 If the pixel size of the camera image sensor is 5μm × 5μm, then the displacement in the X direction is: xp= x×5 The displacement in the Y direction is: yp= y×5 Where xp represents the displacement in the X direction and yp represents the displacement in the Y direction, both in micrometers (μm). A positive value indicates that the optical axis center of the image sensor is offset in the positive direction relative to the physical center of the target, and a negative value indicates offset in the negative direction.

[0064] To improve the accuracy of camera center alignment correction, as a preferred implementation, this step S300 further includes the following steps: S400. Calculate the angle offset. Extract the angle between the horizontal and / or vertical center lines of the crosshair in the image and the corresponding coordinate axes of the image coordinate system. This angle is the angle offset. Specifically, extract the angle between the horizontal center line G of the crosshair and the X-axis of the image coordinate system, or extract the angle between the vertical center line H of the crosshair and the Y-axis of the image coordinate system, as the angle offset. Since the crosshair itself is a perfectly vertical horizontal and vertical line, only one angle needs to be calculated. For example, the angle between the horizontal center line of the crosshair and the X-axis of the image coordinate system is calculated using the following formula: in, This indicates the angular offset of the crosshair cursor relative to the image coordinate system.

[0065] In other implementations, the angular offset can be obtained by calculating the angle between the vertical centerline H and the Y-axis of the image coordinate system, or by simultaneously calculating the angle between the horizontal centerline G and the X-axis of the image coordinate system and the angle between the vertical centerline H and the Y-axis of the image coordinate system and then taking the average value to improve accuracy.

[0066] S500. Determine and correct. Determine whether the displacement offset meets the preset correction completion conditions. If not, control the image sensor to move to correct the position; if it meets the conditions, end the correction.

[0067] When only displacement offset is calculated, the correction completion condition is that the absolute value of the displacement offset is less than or equal to a preset displacement threshold. When angular offset is also calculated, the correction completion condition is that the absolute value of the displacement offset is less than or equal to a preset displacement threshold and the absolute value of the angular offset is less than or equal to a preset angle threshold. It should be understood that the absolute value of the displacement offset being less than or equal to the preset displacement threshold means that the absolute value of the displacement offset in the X direction is less than or equal to the preset displacement threshold and the absolute value of the displacement offset in the Y direction is also less than or equal to the preset displacement threshold. In this embodiment, the displacement threshold is 0.05 mm and the angle threshold is 0.17°.

[0068] When calibration is required, the host computer (control module) sends drive commands via RS422 serial port to control the movement of the 3D translation stage (actuator). The 3D translation stage includes an X-axis electric translation stage, a Y-axis electric translation stage, and a C-axis electric angular stage, with the C-axis rotation axis coinciding with the axis of the camera housing to be assembled. The PCB clamp of the 3D translation stage holds the camera's PCB board, on which an image sensor is mounted. Therefore, the movement of the 3D translation stage can precisely drive the image sensor to translate and rotate in the X, Y, and C axes. The travel range of the X and Y axes of the 3D translation stage is [missing information]. The C-axis travel range is ±10°, the X-axis and Y-axis positioning accuracy of the three-dimensional displacement stage is 0.005mm, and the C-axis positioning accuracy is 20″, which can meet the requirements of high-precision calibration.

[0069] In this embodiment, the three-dimensional displacement stage is driven by a stepper motor, and the control method is through RS422 serial port command transmission and reception. After receiving the drive command, the three-dimensional displacement stage moves at the set speed, and after reaching the commanded position, it sends a "displacement complete" command back to the computer via the serial port.

[0070] To further improve the accuracy of the correction, as a preferred embodiment, after controlling the movement of the image sensor to correct the position, the following steps are also included: Return to step S100 for re-inspection, re-acquire the target image generated by the image sensor of the camera to be assembled on the fixed target, and execute steps S200~S400 in sequence until the preset calibration completion conditions are met.

[0071] The aforementioned closed-loop re-inspection mechanism ensures that the center alignment accuracy of each camera meets technical requirements, effectively guaranteeing assembly consistency and product qualification rate. The integrated testing, calibration, and re-inspection process requires no manual intervention, offers high real-time processing, and significantly improves production efficiency.

[0072] This invention also discloses an automatic camera center alignment detection and correction system for implementing the automatic camera center alignment detection and correction method described in the above embodiments. For details, please refer to... Figures 10 to 12 The automatic camera center alignment detection and correction system of this embodiment includes an assembly platform 10, a light source 20, an image acquisition module 30, an image processing module 40, an actuator 50, and a control module 60.

[0073] The assembly platform 10 is equipped with a target. In this embodiment, the main body of the assembly platform 10 is made of aluminum alloy. A target hole with a diameter of 40.0 mm is opened in the center of the assembly platform 10, and a cross-shaped target is placed inside. The line width of the cross-shaped target is 0.3 mm. The assembly platform 10 is also equipped with positioning pins, which are located on the left and right sides of the target hole. The positioning pins are made of stainless steel and have a diameter of 3 mm. They are used to cooperate with the pin holes at both ends of the camera housing to accurately position the camera housing on the assembly platform 10, ensuring that there is no relative displacement between the housing and the assembly platform 10. This achieves a unified reference using the cross-shaped target on the assembly platform 10 as the physical center of the housing.

[0074] A light source 20 is positioned below the light source aperture of the assembly platform 10, emitting light that passes through the target and forms a target image on the image sensor of the camera to be assembled. In this embodiment, the light source 20 is a 24V coaxial light source with a wavelength of 550~700nm. The light path passes vertically upwards through the slit of the crosshair target, forming a crosshair cursor image on the camera image sensor. This vertical coaxial light path ensures that the crosshair cursor image is distortion-free and has clear edges, which is beneficial to improving the accuracy of subsequent image processing.

[0075] The image acquisition module 30 is used to acquire the target image. In this embodiment, the image acquisition module 30 is connected to the camera to be assembled through a dedicated camera interface, receives the crosshair image output by the camera's image sensor, and transmits it to the image processing module 40. The image acquisition module 30 can be a built-in image acquisition card of a computer or an external image acquisition device.

[0076] The image processing module 40 is used to process the target image and extract the pixel coordinates of the center point of the target image. In this embodiment, the image processing module 40 runs in a computer and includes a preprocessing unit, a center extraction unit, and an offset calculation unit. The preprocessing unit is used to perform filtering and binarization processing on the crosshair image; the center extraction unit is used to implement step S200, extracting the pixel coordinates of the center point of the crosshair in the crosshair image.

[0077] The actuator 50 is used to support the PCB board of the camera to be assembled and drive the PCB board to move. The PCB board is equipped with an image sensor. In this embodiment, the actuator 50 includes a three-dimensional displacement stage 51 and a PCB clamping fixture 52. The three-dimensional displacement stage 51 consists of an X-axis electric translation stage, a Y-axis electric translation stage, and a C-axis electric angular stage, wherein the rotation axis of the C-axis coincides with the axis of the camera housing to be assembled. The X-axis and Y-axis travel of the 3D translation stage 51 are both ±300mm, with a positioning accuracy of 0.005mm; the C-axis travel is ±10°, with a positioning accuracy of 20″. It is driven by a stepper motor and controlled via RS422 serial command transmission and reception. A PCB clamp 52 is mounted on the 3D translation stage 51 to fix the camera's PCB board, ensuring no relative displacement between the PCB board and the 3D translation stage 51. The PCB clamp 52 is a screw-driven double-jaw clamping mechanism, consisting of two aluminum alloy wedge-shaped jaws. The jaw tips are thin and slender to fit the camera housing structure. The jaws are designed with flexibility to provide moderate clamping force, preventing damage to the PCB. Silicone rubber is applied to the clamping surfaces where the jaws contact the PCB to increase friction and prevent wear on the PCB's solder mask surface.

[0078] The control module 60 is communicatively connected to the image processing module 40 and the actuator 50, respectively. It calculates the displacement offset of the optical axis center of the image sensor relative to the physical center of the target based on the pixel coordinate values, and controls the actuator 50 to move to correct the position of the PCB board when the displacement offset does not meet a preset correction completion condition. In this embodiment, the control module 60 runs in a computer and includes an offset calculation unit, a judgment unit, and a drive control unit. The offset calculation unit calculates the displacement offset in the X and Y directions and the angular offset based on the pixel coordinate values ​​of the crosshair center point; the judgment unit determines whether the displacement offset and angular offset meet the preset correction completion condition; and the drive control unit, when the correction completion condition is not met, sends a command via an RS422 serial port to control the movement of the three-dimensional displacement stage 51 to drive the image sensor on the PCB board to perform position correction.

[0079] The workflow of the automatic camera center alignment detection and correction system in this embodiment is as follows: First, the operator aligns the pin holes at both ends of the camera housing with the positioning pins on the assembly platform 10 and presses them in place. Simultaneously, the camera's PCB board is fixed to the three-dimensional displacement stage 51 using the PCB clamp 52, ensuring no relative displacement. Then, the light source 20 is turned on, and the light passes through the crosshair target from bottom to top, forming a crosshair image on the camera's image sensor. The image acquisition module 30 acquires this crosshair image and transmits it to the image processing module 40. The image processing module 40 performs Gaussian filtering and binarization preprocessing on the crosshair image, and then extracts the pixel coordinates of the crosshair's center point. The control module 60 calculates the displacement in the X and Y directions based on the pixel coordinates of the crosshair's center point, combined with the image sensor's resolution and pixel size, and obtains the angular offset. The judgment unit determines whether the displacement and angular offsets meet the correction completion conditions. If they do, the correction ends, and a qualified result is displayed; if not, the drive control unit sends a drive command to control the three-dimensional displacement stage 51 to move, causing the PCB board to translate and / or rotate to correct the image sensor's position. After the 3D displacement stage 51 reaches its designated position, it sends a "displacement complete" command back to the control module 60 via serial port. In a preferred implementation, upon receiving this command, the control module 60 triggers a re-check process: it re-acquires and processes the crosshair image, recalculates the displacement and angular offsets, and again determines whether the calibration completion conditions are met. This process is repeated until the calibration is successful. Once the calibration is successful, the control module 60 automatically saves the current image and records the final alignment result. The operator then removes the camera, completing the entire process.

[0080] This invention uses a crosshair target at the center of the assembly platform as a unified reference for the physical center of the casing. It calculates the pixel deviation between the center point of the crosshair and the optical axis of the image sensor using a pixel-level coordinate comparison algorithm, and converts this deviation into physical displacement based on pixel size. It then calculates the angular offset between the crosshair and the coordinate axes of the image coordinate system, achieving complete quantitative detection of center displacement and angular deviation, avoiding the subjectivity and uncertainty of manual visual calibration. This invention integrates image acquisition, offset calculation, automatic correction, and post-correction inspection, requiring no manual intervention, reducing time consumption, and significantly improving production efficiency and product consistency. This invention uses a three-dimensional displacement stage to drive the translation and rotation of the PCB board, achieving high correction accuracy. Simultaneously, the displacement stage drive is smooth, without pin compression, and the silicone rubber clamping surface of the PCB holder effectively avoids PCB deformation and solder mask wear. The positions of the positioning pins and the three-dimensional displacement stage are replaceable, adapting to industrial cameras of different sizes and models, meeting the needs of multi-product switching in mass production lines.

Claims

1. A method for automatic detection and correction of camera center alignment, characterized in that, Includes the following steps: Acquire the target image generated by the image sensor of the camera to be assembled onto a fixed target; Extract the pixel coordinates of the center point of the target image; Calculate the displacement offset of the optical axis center of the image sensor relative to the physical center of the target based on the pixel coordinate values; Determine whether the displacement offset meets the preset correction completion conditions. If not, control the image sensor to move to correct the position; if it does, end the correction.

2. The automatic camera center alignment detection and correction method as described in claim 1, characterized in that, After the step of controlling the movement of the image sensor to correct the position, the method further includes: The process of returning to the image sensor of the camera to be assembled to image the target image generated by the fixed target is re-checked until the displacement offset meets the preset correction completion conditions.

3. The automatic camera center alignment detection and correction method as described in claim 1, characterized in that: The correction is completed when the absolute value of the displacement offset is less than or equal to a preset displacement threshold.

4. The automatic camera center alignment detection and correction method as described in claim 1, characterized in that: The target is a cross-shaped target, and the target image is a cross-shaped cursor image. Extracting the pixel coordinates of the center point of the target image is equivalent to extracting the pixel coordinates of the center point of the cross-shaped cursor in the cross-shaped cursor image. Includes the following sub-steps: Within the first target area defined in the crosshair image, a first feature point set and a second feature point set are extracted using multiple sets of edge detection calipers, and then fitted to obtain two horizontal edge lines of the crosshair respectively. Calculate the centerline of the two horizontal edge lines to obtain the horizontal centerline; Within the second target area defined in the crosshair image, the third and fourth feature point sets are extracted using multiple sets of edge detection calipers, and the two vertical edge lines of the crosshair are fitted to obtain them respectively. Calculate the centerline of the two perpendicular edge lines to obtain the perpendicular centerline; Calculate the coordinates of the intersection point of the horizontal center line and the vertical center line to obtain the pixel coordinates of the center point of the crosshair cursor.

5. The automatic camera center alignment detection and correction method as described in claim 4, characterized in that, After calculating the displacement offset of the optical axis center of the image sensor relative to the physical center of the target based on the pixel coordinate values, the method further includes the following steps: Extract the angle values ​​between the horizontal and / or vertical center lines of the crosshair cursor in the crosshair cursor image and the corresponding coordinate axes of the image coordinate system. The angle values ​​are the angle offsets. The correction is completed when the absolute value of the displacement offset is less than or equal to a preset displacement threshold and the absolute value of the angle offset is less than or equal to a preset angle threshold.

6. The automatic camera center alignment detection and correction method as described in claim 4, characterized in that, The steps to obtain the two horizontal edge lines of the crosshair cursor include the following sub-steps: Multiple edge detection calipers are evenly arranged vertically within the first target area; Calculate the grayscale gradient for each pixel within each set of calipers, and retain pixels whose gradient values ​​are greater than a preset edge threshold. Based on the polarity of the grayscale change, edge points of the first type with increasing grayscale and edge points of the second type with decreasing grayscale are selected respectively. The edge points with the largest gradient values ​​are selected from the first type of edge points and the second type of edge points, respectively, and are designated as the first feature point and the second feature point. The first feature points of all calipers constitute the first feature point set, and the second feature points of all calipers constitute the second feature point set. Line fitting is performed on the first feature point set and the second feature point set respectively to generate two horizontal edge lines.

7. The automatic camera center alignment detection and correction method as described in claim 4, characterized in that, The step of obtaining the two vertical edge lines of the crosshair cursor includes the following sub-steps: Multiple edge detection calipers are evenly arranged horizontally within the second target area; Calculate the grayscale gradient for each pixel within each set of calipers, and retain pixels whose gradient values ​​are greater than a preset edge threshold. Based on the polarity of the grayscale change, third-class edge points with increasing grayscale and fourth-class edge points with decreasing grayscale are obtained respectively. The edge points with the largest gradient values ​​are selected from the third and fourth types of edge points, respectively, and are designated as the third feature point and the fourth feature point. The third feature points of all calipers constitute the third feature point set, and the fourth feature points of all calipers constitute the fourth feature point set. Line fitting is performed on the third and fourth feature point sets respectively to generate two vertical edge lines.

8. The automatic camera center alignment detection and correction method as described in claim 1, characterized in that, Before the step of extracting the pixel coordinates of the center point of the target image, the following steps are also included: The target image is preprocessed, specifically including the following sub-steps: The target image is filtered to remove image noise; The filtered image is binarized to separate the target region from the background region.

9. An automatic camera center alignment detection and correction system, characterized in that, include: An assembly platform, wherein a target is provided on the assembly platform; A light source, positioned below the assembly platform, is used to emit light that passes through the target and forms a target image on the image sensor of the camera to be assembled. The image acquisition module is used to acquire the target image; The image processing module is used to process the target image and extract the pixel coordinates of the center point of the target image; An actuator is used to carry the PCB board of the camera to be assembled and drive the PCB board to move. The PCB board is equipped with an image sensor. The control module is communicatively connected to the image processing module and the actuator, respectively. It is used to calculate the displacement offset of the optical axis center of the image sensor relative to the physical center of the target based on the pixel coordinate values, and to control the actuator to move to correct the position of the PCB board when the displacement offset does not meet the preset correction completion conditions.

10. The automatic camera center alignment detection and correction system as described in claim 9, characterized in that: The assembly platform is equipped with positioning pins for positioning the camera housing on the assembly platform.