Method and device for determining three-dimensional direction offset of drawing and electronic equipment

By using image segmentation algorithm and mark mark in camera module detection, the three-dimensional direction offset of the drawing is calculated, which solves the problem that naked-eye adjustment cannot meet the high-precision needs, and achieves more accurate drawing fine adjustment and camera module testing.

CN119810188APending Publication Date: 2025-04-11TRULY OPTO ELECTRONICS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411916267.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

In camera module detection, with the improvement of camera accuracy, the requirements cannot be met by adjusting the drawing position by the naked eye. The offset of the drawing at the horizontal, vertical and rotation angles needs to be calculated through image processing for fine adjustment.

Method used

By adding four mark marks to the predetermined field of view position of the test drawing, taking images and processing using an image segmentation algorithm, determining the mark region and the center coordinates of the field of view of the camera module, and calculating the three-dimensional direction offset of the drawing.

Benefits of technology

The precise offset calculation of the drawing in the three-dimensional direction is realized, the subsequent drawing fine-tuning process is simplified, and the accuracy of camera module testing is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119810188A_ABST
    Figure CN119810188A_ABST
Patent Text Reader

Abstract

The invention provides a drawing three-dimensional direction deviation determination method and device and electronic equipment. Four mark marks are added to the position of a preset view field of a test drawing, and the intersection point of diagonal line connecting lines of the mark marks is located in the center of the test drawing; placing the test drawing at the central position of the field of view of the camera module, and shooting a first image; processing the first image according to an image segmentation algorithm, determining the mark region as an ROI region, and performing binarization processing to obtain a second image; determining center point coordinates of the four mark marks and center coordinates of a field of view of the camera module based on the second image; and determining the three-dimensional direction offset of the test drawing based on the center point coordinates of the four mark marks and the center coordinates of the field of view of the camera module. Compared with the prior art, the method has the advantages that the center point of the mark and the center view field coordinate of the camera are determined, the horizontal direction offset pixel, the vertical direction offset pixel and the rotation angle direction offset angle are accurately calculated, and then follow-up fine adjustment of a test drawing is facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of camera module detection technology, and in particular to a method, device and electronic equipment for determining a three-dimensional direction offset of a drawing. Background Art

[0002] When testing the camera module, the drawing needs to be placed in the center of the module's field of view. As the accuracy of the camera increases, adjusting the position of the drawing by eye can no longer meet the demand. It is necessary to calculate the horizontal, vertical, and rotational offsets of the drawing through image processing, and then fine-tune the drawing. Summary of the invention

[0003] The purpose of the embodiment of the present invention is to provide a method for accurately calculating the offset of a drawing in the horizontal, vertical and rotation angles through image processing, thereby facilitating subsequent fine-tuning of the drawing.

[0004] A first aspect of the present invention provides a method for determining a three-dimensional offset of a drawing, which is applied to a camera module test, and is characterized in that the method comprises:

[0005] Add four marks at the positions of the predetermined viewing field of the test drawing, and the intersection of the diagonal lines of the marks is located at the center of the test drawing;

[0006] Placing the test drawing at the center of the camera module's field of view and capturing a first image;

[0007] Processing the first image according to an image segmentation algorithm, determining the marked area as the ROI area, and performing binarization processing to obtain a second image;

[0008] Determine the center coordinates of the four markers and the center coordinates of the field of view of the camera module based on the second image;

[0009] Based on the center point coordinates of the four marks and the center coordinates of the field of view of the camera module, the three-dimensional direction offset of the test drawing is determined.

[0010] Further, the first image is processed according to an image segmentation algorithm, the marked area is determined as the ROI area, and binarization is performed to obtain a second image, including:

[0011] By presetting coordinate parameters in advance, the rectangular areas where the four marks of the first image are located are determined as ROI areas respectively;

[0012] Each ROI region is segmented according to the bimodal method, the mark is determined, and binarization is performed to obtain the second image.

[0013] Further, the step of segmenting each ROI region according to the bimodal method, determining a marker, and performing binarization processing to obtain a second image includes:

[0014] Set the marked area as the foreground and the rest of the area as the background for binarization.

[0015] Further, the method includes: calculating the center point coordinates of the four marks and the center coordinates of the field of view of the camera module according to the following formulas:

[0016]

[0017] Among them, x and y are column and row coordinates respectively, array(x,y) is the pixel grayscale value at (x,y) coordinates; m 10 Indicates; m 00 Indicates; m 01 Indicates; the center point coordinates of the four markers A(x1,y1), B(x2,y2), C(x3,y3), D(x4,y4) and the center field coordinates of the camera (x0,y0).

[0018] Further, based on the center point coordinates of the four marks and the center coordinates of the field of view of the camera module, the three-dimensional direction offset of the test drawing is determined, including: according to the following formulas, the horizontal direction offset pixel δx, the vertical direction offset pixel δy and the rotation angle direction offset angle δr are respectively calculated;

[0019] δx=(x1+x2+x3+x4) / 4-x0;

[0020] δy=(y1+y2+y3+y4) / 4-y0;

[0021] δr=arctan[((y2-y1) / (x2-x1)+(x2-x3) / (y3-y2)+(y3-y4) / (x3-x4)+(x1-x4) / (y4-y1)) / 4].

[0022] In order to solve the above technical problems, in a second aspect, an embodiment of the present application provides a device for determining a three-dimensional offset of a drawing, which is applied to a camera module test, and the device includes a marking module, a shooting module, a segmentation module, a center determination module, and an offset determination module; wherein:

[0023] A marking module, used to add four marks at the positions of the predetermined field of view of the test drawing, wherein the intersection of the diagonal lines of the marks is located at the center of the test drawing;

[0024] A shooting module, used for placing the test drawing at the center of the field of view of the camera module and shooting a first image;

[0025] A segmentation module, used to process the first image according to an image segmentation algorithm, determine the marked area as the ROI area, and perform binarization processing to obtain a second image;

[0026] A center determination module, used to determine the center point coordinates of the four markers and the center coordinates of the field of view of the camera module based on the second image;

[0027] The offset determination module determines the three-dimensional offset of the test drawing based on the center point coordinates of the four mark marks and the center coordinates of the field of view of the camera module.

[0028] Furthermore, the segmentation module is further used to determine the rectangular areas where the four markers of the first image are located as ROI areas respectively by presetting coordinate parameters in advance;

[0029] Each ROI region is segmented according to the bimodal method, a mark is determined, and a binarization process is performed to obtain a second image; wherein the binarization process is performed by setting the mark region as the foreground and the remaining regions as the background.

[0030] Furthermore, the center determination module is also used to calculate the center point coordinates of the four markers and the center coordinates of the field of view of the camera module according to the following formulas:

[0031]

[0032]

[0033] Among them, x and y are column and row coordinates respectively, array(x,y) is the pixel grayscale value at (x,y) coordinates; m 10 Indicates; m 00 Indicates; m 01 Indicates; the center point coordinates of the four markers A(x1,y1), B(x2,y2), C(x3,y3), D(x4,y4) and the center field coordinates of the camera (x0,y0).

[0034] In addition, the third aspect of the present invention provides an electronic device, the electronic device comprising: one or more processors, a memory, the memory being used to store one or more computer programs; characterized in that the computer program is configured to be executed by the one or more processors, the program comprising steps for executing the method for determining the three-dimensional direction offset of the drawing as described in the first aspect of claim

[0035] In the scheme of the present invention, four marks are added at the positions of the predetermined field of view of the test drawing, and the intersection of the diagonal lines of the marks is located at the center of the test drawing; the test drawing is placed at the center of the field of view of the camera module, and a first image is captured; the first image is processed according to the image segmentation algorithm, the mark area is determined to be the ROI area, and binarization is performed to obtain a second image; the center point coordinates of the four marks and the center coordinates of the field of view of the camera module are determined based on the second image; based on the center point coordinates of the four marks and the center coordinates of the field of view of the camera module, the three-dimensional directional offset of the test drawing is determined. Compared with the prior art, the embodiment of the present application has the following beneficial effects: by determining the center point of the mark and the center field of view coordinates of the camera, and accurately calculating the horizontal offset pixels, the vertical offset pixels, and the rotation angle offset angle, it is convenient for subsequent fine-tuning of the test drawing, thereby facilitating the camera module test. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0037] Figure 1 It is a schematic flow chart of a method for determining a three-dimensional direction offset of a drawing disclosed in an embodiment of the present invention;

[0038] Figure 2 is a schematic diagram of a cut ROI region disclosed in an embodiment of the present invention;

[0039] Figure 3 It is the second image obtained by binarizing the first image disclosed in the embodiment of the present invention. DETAILED DESCRIPTION

[0040] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of this application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of this application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.

[0041] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0042] It should be noted that the “plurality” mentioned in this article refers to two or more.

[0043] The implementation details of the technical solution of the embodiment of the present application are described in detail below:

[0044] In the prior art, the module test solution is to encapsulate different test algorithms into test items. Each test item requires a corresponding test environment (drawings in different positions, white or black fields with different color temperatures). The industrial control software controls the equipment to build the test environment and then executes the corresponding test item. This action is repeated until the test item is completed.

[0045] Until all test items are executed.

[0046] In a first aspect of this embodiment, a method for determining a three-dimensional offset of a drawing is provided, which is applied to a camera module test. The method flow chart is shown in Figure 1 The method comprises:

[0047] Step S101, adding four marks at positions of a predetermined field of view on a test drawing, wherein the intersection of the diagonal lines of the marks is located at the center of the test drawing;

[0048] Specifically, in this embodiment, four marks are added at the 0.9 degree viewing angle of the drawing, and the midpoint of the diagonal line connecting the marks is located at the center of the drawing. Among them, four marks are added at the 0.9 degree viewing angle of the drawing. The shape of the marks is circular.

[0049] Step S102, placing the test drawing at the center of the camera module's field of view, and capturing a first image.

[0050] Specifically, in this embodiment, the test drawing is placed at the center of the camera's field of view (visually), and a frame of image is captured.

[0051] Step S103, processing the first image according to an image segmentation algorithm, determining the marked area as the ROI area, and performing binarization processing to obtain a second image;

[0052] Further, the first image is processed according to an image segmentation algorithm, the marked area is determined as the ROI area, and binarization is performed to obtain a second image, including:

[0053] By presetting coordinate parameters in advance, the rectangular areas where the four marks of the first image are located are determined as ROI areas respectively;

[0054] Each ROI region is segmented according to the bimodal method, the mark is determined, and binarization is performed to obtain the second image.

[0055] Further, the step of segmenting each ROI region according to the bimodal method, determining a marker, and performing binarization processing to obtain a second image includes:

[0056] Set the marked area as the foreground and the rest of the area as the background for binarization.

[0057] Specifically, in this embodiment, Figure 2 The ROI region captured in this embodiment is shown as follows. The region where the mark is captured is the ROI region. Figure 2 The green box is the ROI area (region of interest), which is a parameter that needs to be preset in advance, such as setting the corresponding rectangular box coordinates in advance to determine the corresponding ROI area. The purpose is to extract this area and process it separately, to ensure the uniqueness of the mark in the ROI area and to reduce the amount of calculation.

[0058] Furthermore, after the ROI area is cut out, each ROI area image is subjected to image segmentation processing. There are many methods for image segmentation (segmenting an image into foreground and background with a certain threshold as the boundary). For the test drawing of this embodiment, the bimodal method (the histogram of pixel distribution has two obvious peaks) is selected as the segmentation algorithm.

[0059] The bimodal method is a threshold segmentation method based on the image histogram, which is particularly suitable for images with obvious bimodal phenomena. Principle: The bimodal method uses the grayscale histogram of the image to find the optimal threshold. When the image has an obvious bimodal phenomenon, two obvious peaks will appear on the histogram, corresponding to the foreground and background areas in the image. The valley between the two peaks is the optimal threshold 12. Steps: Calculate the grayscale histogram of the image: First, count the number of pixels at each gray level in the image and draw a grayscale histogram. Find the bimodal: Find two obvious peaks in the histogram, which usually represent the foreground and background. Determine the threshold: The valley between the two peaks is the optimal threshold. Pixels in the image with grayscale values ​​greater than or equal to the threshold are divided into foreground, and the rest are background.

[0060] Furthermore, the ROI area image is extracted and processed separately to obtain a binary image, such as Figure 3The second image is obtained by binarizing the first image in this embodiment. Figure 3 The center "cross point" of each circular mark is the center coordinate position of the mark.

[0061] Step S104, determining the center coordinates of the four markers and the center coordinates of the field of view of the camera module based on the second image;

[0062] Further, the method includes: calculating the center points of the four markers according to the following formulas:

[0063] Coordinates, and the coordinates of the center of the camera module's field of view:

[0064]

[0065] Wherein, x and y are column and row coordinates respectively, and array(x,y) is the grayscale value of the pixel at the (x,y) coordinates. In this embodiment, m 10 is the first-order moment of j=1, i=0, where j=1, i=0, m 10 =∑ x,y (arry(x,y)·x 1 ), after binarization, only 1 and 0 remain in the image data, so m 10 It is actually the integral of the x-coordinates of non-zero pixels in the binary image. Similarly, m01 is the integral of the y-coordinates of non-zero pixels in the binary image, and m00 is the number of non-zero pixels.

[0066] Furthermore, in this embodiment, the center point coordinates of the four markers are A (x1, y1), B (x2, y2), C (x3, y3), D (x4, y4) and the center field of view coordinates of the camera (x0, y0).

[0067] Step S105, determining the three-dimensional direction offset of the test drawing based on the center point coordinates of the four mark marks and the center coordinates of the field of view of the camera module.

[0068] Further, based on the center point coordinates of the four marks and the center coordinates of the field of view of the camera module, the three-dimensional direction offset of the test drawing is determined, including: according to the following formulas, the horizontal direction offset pixel δx, the vertical direction offset pixel δy and the rotation angle direction offset angle δr are respectively calculated;

[0069] δx=(x1+x2+x3+x4) / 4-x0;

[0070] δy=(y1+y2+y3+y4) / 4-y0;

[0071] δr=ractan[((y2-y1) / (x2-x1)+(x2-x3) / (y3-y2)+(y3-y4) / (x3-x4)+(x1-x4) / (y4-y1)) / 4].

[0072] Specifically, in this example, the units of δx and δy calculated above are pixels. The actual offset needs to be multiplied by the length of the side corresponding to the pixel (from the chip specification, most pixels are square) to get the specific offset corresponding to the offset pixel. The unit of δr is °, and no additional processing is required.

[0073] In summary, by adding four marks at the positions of the predetermined field of view of the test drawing, the intersection of the diagonal lines of the marks is located at the center of the test drawing; placing the test drawing at the center of the field of view of the camera module, and shooting the first image; processing the first image according to the image segmentation algorithm, determining the mark area as the ROI area, and performing binarization processing to obtain the second image; determining the center point coordinates of the four marks and the center coordinates of the field of view of the camera module based on the second image; determining the three-dimensional directional offset of the test drawing based on the center point coordinates of the four marks and the center coordinates of the field of view of the camera module. Compared with the prior art, the embodiment of the present application has the following beneficial effects: by determining the center point of the mark and the center field of view coordinates of the camera, and accurately calculating the horizontal offset pixels, vertical offset pixels, and rotation angle offset angle, it is convenient for subsequent fine-tuning of the test drawing, thereby facilitating the camera module test.

[0074] In order to solve the above technical problems, the second aspect of this embodiment provides a device for determining the three-dimensional offset of a drawing, which is applied to camera module testing. The device includes a marking module, a shooting module, a segmentation module, a center determination module and an offset determination module; wherein:

[0075] A marking module, used to add four marks at the positions of the predetermined field of view of the test drawing, wherein the intersection of the diagonal lines of the marks is located at the center of the test drawing;

[0076] A shooting module, used for placing the test drawing at the center of the field of view of the camera module and shooting a first image;

[0077] A segmentation module, used to process the first image according to an image segmentation algorithm, determine the marked area as the ROI area, and perform binarization processing to obtain a second image;

[0078] A center determination module, used to determine the center point coordinates of the four markers and the center coordinates of the field of view of the camera module based on the second image;

[0079] The offset determination module determines the three-dimensional offset of the test drawing based on the center point coordinates of the four mark marks and the center coordinates of the field of view of the camera module.

[0080] Furthermore, the segmentation module is further used to determine the rectangular areas where the four markers of the first image are located as ROI areas respectively by presetting coordinate parameters in advance;

[0081] Each ROI region is segmented according to the bimodal method, a mark is determined, and a binarization process is performed to obtain a second image; wherein the binarization process is performed by setting the mark region as the foreground and the remaining regions as the background.

[0082] Furthermore, the center determination module is also used to calculate the center point coordinates of the four markers and the center coordinates of the field of view of the camera module according to the following formulas:

[0083]

[0084] Among them, x and y are column and row coordinates respectively, array(x,y) is the pixel grayscale value under the (x,y) coordinates; the center point coordinates of the four mark are A(x1,y1), B(x2,y2), C(x3,y3), D(x4,y4) and the center field coordinates of the camera are (x0,y0).

[0085] Based on the center point coordinates of the four marks and the center coordinates of the field of view of the camera module, the three-dimensional direction offset of the test drawing is determined, including: calculating the horizontal direction offset pixel δx, the vertical direction offset pixel δy and the rotation angle direction offset angle δr according to the following formulas respectively;

[0086] δx=(x1+x2+x3+x4) / 4-x0;

[0087] δy=(y1+y2+y3+y4) / 4-y0;

[0088] δr=ractan[((y2-y1) / (x2-x1)+(x2-x3) / (y3-y2)+(y3-y4) / (x3-x4)+(x1-x4) / (y4-y1)) / 4].

[0089] In addition, an embodiment of the present application also discloses an electronic device, which includes: one or more processors, and a memory, wherein the memory is used to store one or more computer programs; characterized in that the computer program is configured to be executed by the one or more processors, and the program includes method steps for executing the three-dimensional directional offset of the drawing as described in the first aspect above.

[0090] In addition, an embodiment of the present application further provides a storage medium storing a computer program; the program is loaded and executed by a processor to implement the method steps for determining the three-dimensional direction offset of a drawing as described in the first aspect above.

[0091] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0092] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, or it can be an electrical, mechanical or other form of connection.

[0093] The units described as separate components may or may not be physically separated. As a unit, it can be appreciated by those skilled in the art that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0094] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0095] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a grid device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0096] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for determining the three-dimensional offset of a drawing, applied to camera module testing, characterized in that: The method comprises: Add four marks at the positions of the predetermined viewing field of the test drawing, and the intersection of the diagonal lines of the marks is located at the center of the test drawing; Placing the test drawing at the center of the camera module's field of view and capturing a first image; Processing the first image according to an image segmentation algorithm, determining the marked area as the ROI area, and performing binarization processing to obtain a second image; Determine the center coordinates of the four markers and the center coordinates of the field of view of the camera module based on the second image; Based on the center point coordinates of the four marks and the center coordinates of the field of view of the camera module, the three-dimensional direction offset of the test drawing is determined.

2. The method for dynamically adjusting drawings according to claim 1, characterized in that: The first image is processed according to an image segmentation algorithm, a marked area is determined as a ROI area, and binarization is performed to obtain a second image, including: By presetting coordinate parameters in advance, the rectangular areas where the four marks of the first image are located are determined as ROI areas respectively; Each ROI region is segmented according to the bimodal method, the mark is determined, and binarization is performed to obtain the second image.

3. The method for dynamically adjusting drawings according to claim 2, characterized in that: The step of segmenting each ROI region according to the bimodal method, determining a marker, and performing binarization processing to obtain a second image includes: Set the marked area as the foreground and the rest of the area as the background for binarization.

4. The method for dynamically adjusting drawings according to claim 3, characterized in that: The method includes: calculating the center point coordinates of four marks and the center coordinates of the field of view of the camera module according to the following formulas: Among them, x and y are column and row coordinates respectively, array(x,y) is the pixel grayscale value under the (x,y) coordinates; j and i represent the order of the matrix; the center point coordinates of the four mark are represented as A(x1,y1), B(x2,y2), C(x3,y3), D(x4,y4) and the center field of view coordinates of the camera are represented as (x0,y0).

5. The method for dynamically adjusting drawings according to claim 4, characterized in that: Based on the center point coordinates of the four marks and the center coordinates of the field of view of the camera module, the three-dimensional direction offset of the test drawing is determined, including: calculating the horizontal direction offset pixel δx, the vertical direction offset pixel δy and the rotation angle direction offset angle δr according to the following formulas respectively; δx=(x1+x2+x3+x4) / 4-x0; δy=(y1+y2+y3+y4) / 4-y0; δr=arctan[((y2-y1) / (x2-x1)+(x2-x3) / (y3-y2)+(y3-y4) / (x3-x4)+(x1-x4) / (y4-y1)) / 4].

6. A device for determining the three-dimensional offset of a drawing, applied to camera module testing, characterized in that: The device includes a marking module, a shooting module, a segmentation module, a center determination module and an offset determination module; wherein: A marking module, used to add four marks at the positions of the predetermined field of view of the test drawing, wherein the intersection of the diagonal lines of the marks is located at the center of the test drawing; A shooting module, used for placing the test drawing at the center of the field of view of the camera module and shooting a first image; A segmentation module, used to process the first image according to an image segmentation algorithm, determine the marked area as the ROI area, and perform binarization processing to obtain a second image; A center determination module, used to determine the center point coordinates of the four markers and the center coordinates of the field of view of the camera module based on the second image; The offset determination module determines the three-dimensional offset of the test drawing based on the center point coordinates of the four mark marks and the center coordinates of the field of view of the camera module.

7. The device for determining the three-dimensional offset of a drawing according to claim 6, characterized in that: The segmentation module is further used to determine the rectangular areas where the four marks of the first image are located as ROI areas respectively by presetting coordinate parameters in advance; Each ROI region is segmented according to the bimodal method, a mark is determined, and a binarization process is performed to obtain a second image; wherein the binarization process is performed by setting the mark region as the foreground and the remaining regions as the background.

8. The device for determining the three-dimensional offset of a drawing according to claim 7, characterized in that: The center determination module is also used to calculate the center point coordinates of the four markers and the center coordinates of the field of view of the camera module according to the following formula: Among them, x and y are column and row coordinates respectively, array(x,y) is the pixel grayscale value at (x,y) coordinates; m 10 Indicates; m 00 Indicates; m 01 Indicates; the center point coordinates of the four markers A(x1,y1), B(x2,y2), C(x3,y3), D(x4,y4) and the center field coordinates of the camera (x0,y0).

9. An electronic device, comprising: One or more processors, a memory, wherein the memory is used to store one or more computer programs; characterized in that the computer program is configured to be executed by the one or more processors, and the program includes method steps for executing the three-dimensional direction offset determination of the drawing as described in any one of claims 1-5.

10. A storage medium storing a computer program; the program is loaded and executed by a processor to implement the method steps for determining the three-dimensional direction offset of a drawing as described in any one of claims 1 to 5.